Failed conversion of MobileNet
Hi,
Has anyone have any luck converting MobileNet type architecture? We receive this error Pull #53 has been integrated.
Traceback (most recent call last):
File "convert.py", line 60, in
Thanks, Tim
@bonseyes-admin #161 hi, I have fixed the bugs. These bugs are triggered by the difference of Python2 and Python3. p.s., I am using Python3.
- In graph.py:
def __str__(self):
hdr = '{:<20} {:<30} {:>20} {:>20}'.format('Type', 'Name', 'Param', 'Output')
s = [hdr, '-' * 94]
for node in self.topologically_sorted():
# If the node has learned parameters, display the first one's shape.
# In case of convolutions, this corresponds to the weights.
if node.data:#ginger
node.data=list(node.data)#ginger
data_shape = str(node.data[0].shape) if node.data else '--'
out_shape = node.output_shape or '--'
s.append('{:<20} {:<30} {:>20} {:>20}'.format(node.kind, node.name,data_shape, str(tuple(out_shape))) )#ginger
return '\n'.join(s)
- In transformer.py and shapes.py, you should add list before map()
def format(self, arg):
'''Returns a string representation for the given value.'''
# return "'%s'" % arg if isinstance(arg, basestring) else str(arg)#ginger
return "'%s'" % arg if isinstance(arg, str) else str(arg)
def pair(self, key, value):
'''Returns key=formatted(value).'''
return '%s=%s' % (key, self.format(value))
def emit(self):
'''Emits the Python source for this node.'''
# Format positional arguments
args = list(map(self.format, self.args))#ginger
# Format any keyword arguments
if self.kwargs:
args += [self.pair(k, v) for k, v in self.kwargs]
# Set the node name
args.append(self.pair('name', self.node.name))
args = ', '.join(args)
return '%s(%s)' % (self.op, args)
3.change all the basestring into str
- In transformer.py:
def transform_source(self):
if self.source is None:
mapper = TensorFlowMapper(self.graph)
chains = mapper.map()
emitter = TensorFlowEmitter()
self.source = emitter.emit(self.graph.name, chains)
return self.source.encode(encoding="utf-8")#ginger
@ginger0106 Hi, I have finished converting caffe to tensorflow. But I am a little confused about conv function:
conv(3,3,32,1,1,biased=False,group=32,relu=False,name='conv2_1_dw')
Can you tell me how to write the conv function in network.py?
Please! Thank you very much!