Hi,
I am trying to convert a Caffe model to mxnet, but I get a error as below:
Traceback (most recent call last):
File "convert_model.py", line 232, in <module>
main()
File "convert_model.py", line 228, in main
convert_model(args.prototxt, args.caffemodel, args.save_model_name)
File "convert_model.py", line 65, in convert_model
sym, input_dim = convert_symbol(prototxt_fname)
File "incubator-mxnet/tools/caffe_converter/convert_symbol.py", line 316, in convert_symbol
sym, output_name, input_dim = _parse_proto(prototxt_fname)
File "incubator-mxnet/tools/caffe_converter/convert_symbol.py", line 254, in _parse_proto
param_string = "shape=(%s)" % (','.join(param.shape.dim),)
TypeError: sequence item 0: expected str instance, int found
Related code snippet in the script is:
if layer.type == 'Reshape':
type_string = 'mx.symbol.Reshape'
need_flatten[name] = False
param = layer.reshape_param
param_string = "shape=(%s)" % (','.join(param.shape.dim),)
And the reshape_param
in the prototxt is:
reshape_param {
shape {
dim: 0
dim: 2
dim: 1
dim: -1
}
}
Then I modify the code from
param_string = "shape=(%s)" % (','.join(param.shape.dim),)
to
param_string = "shape=(%s)" % (','.join(str(v) for v in param.shape.dim),)
The symbol file is created successfully but I get another error:
[1] 141655 abort (core dumped) python convert_model.py SD.prototxt SD.caffemodel
The error is caused by
arg_shapes, _, aux_shapes = sym.infer_shape(data=tuple(input_dim))
What should I do?