Closed Yrij-Zhavoronkov closed 4 years ago
Hi, Zhavoronkov,
There might be something wrong with your model itself.
The function test_format
from protobuf cannot Merge your model to net
.
Can you send your caffemodel to us so we can debug it for you?
Do you want this? robo-cars.txt
Are there custom layers in your caffe?
How about replace these files caffe_upsample.proto
and caffe_upsample_pb2.py
with the same named files in your caffe?
Yes, I have long taken proto from caffe SSD, but still can not understand how to write these layers in onnx
link to caffe ssd: https://github.com/weiliu89/caffe/tree/ssd
proto.zip new proto here)
I tried converting on official SSD caffemodel. The things you should do is as follows.
caffe.proto
with protoc
, then you will get caffe_pb2.py
. After that, replace the same files in proto
folder. Finally modify from proto import caffe_upsample_pb2
in src/load_save_model.py
and op_layer_info.py
.Normalize
, Flatten
, Permute
and PriorBox
, and now this repository do not support those OPs, you shall add those supports in src/OPs
.This is already done and I know that they should be added to the src. I don't know how to write Normalize, Flatten, Permute, PriorBox and other layers correctly to onnx. Is there a manual?
I try to convert MobileNet tet to onnx but its take me:
Traceback (most recent call last): File "D:\PyCharm_Community_Edition\helpers\pydev\pydevd.py", line 2060, in <module> main() File "D:\PyCharm_Community_Edition\helpers\pydev\pydevd.py", line 2054, in main globals = debugger.run(setup['file'], None, None, is_module) File "D:\PyCharm_Community_Edition\helpers\pydev\pydevd.py", line 1405, in run return self._exec(is_module, entry_point_fn, module_name, file, globals, locals) File "D:\PyCharm_Community_Edition\helpers\pydev\pydevd.py", line 1412, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "D:\PyCharm_Community_Edition\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:\nnetutils\ONNXConverter\utils\caffe2onnx\convert2onnx.py", line 34, in <module> main(args) File "D:\nnetutils\ONNXConverter\utils\caffe2onnx\convert2onnx.py", line 25, in main graph, params = loadcaffemodel(caffe_graph_path,caffe_params_path) File "D:\nnetutils\ONNXConverter\utils\caffe2onnx\src\load_save_model.py", line 8, in loadcaffemodel text_format.Merge(open(net_path).read(), net) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 690, in Merge allow_unknown_field=allow_unknown_field) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 757, in MergeLines return parser.MergeLines(lines, message) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 782, in MergeLines self._ParseOrMerge(lines, message) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 804, in _ParseOrMerge self._MergeField(tokenizer, message) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 929, in _MergeField merger(tokenizer, message, field) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 1003, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "C:\Users\Fuhrer\AppData\Local\Programs\Python\Python37\lib\site-packages\google\protobuf\text_format.py", line 896, in _MergeField (message_descriptor.full_name, name)) google.protobuf.text_format.ParseError: 4433:3 : Message type "caffe.LayerParameter" has no field named "permute_param".