How to export trained Faster RCNN to another hardware platform

1 次查看(过去 30 天)
Hello all,
I have used MATLAB with the deep learning toolbox to train my own Faster RCNN object detector.
Either if I use a predefined CNN (squeezenet for example) or my designed CNN, I want to export the trained Faster RCNN to use it on other embedded platforms.
exportONNXNetwork gives errors with Faster RCNN architectures no matter the CNN used.
How can I export my work to use it in another HW? I have worked many hours and now I can not deploy my design !!
Thank you all in advance,
Alberto
  3 个评论
Alberto Tellaeche
Alberto Tellaeche 2019-10-24
Hi,
I can provide an example. Ihave a fasterRCNNObjectDetector trained using the squeezenet network model.
Here is the output of MATLAB 2019b when trying to export. It only happens with the faster RCNN models. It seems to work with FastRCNN or RCNN.
Thank you all in advance,
Alberto
>> load('ResultsFasterRCNN_squeezenet.mat')
>> exportONNXNetwork(detector.Network,'test.onnx')
Warning: ONNX does not support layer 'nnet.cnn.layer.RPNSoftmaxLayer'. Exporting to ONNX operator
'com.MathWorks.Placeholder'.
> In nnet.internal.cnn.onnx/NNTLayerConverter/makeLayerConverter (line 212)
In nnet.internal.cnn.onnx/ConverterForNetwork/networkToGraphProto (line 100)
In nnet.internal.cnn.onnx/ConverterForNetwork/toOnnx (line 44)
In nnet.internal.cnn.onnx.exportONNXNetwork (line 35)
In exportONNXNetwork (line 40)
Warning: ONNX does not support layer 'nnet.cnn.layer.RPNClassificationLayer'. Exporting to ONNX operator
'com.MathWorks.Placeholder'.
> In nnet.internal.cnn.onnx/NNTLayerConverter/makeLayerConverter (line 212)
In nnet.internal.cnn.onnx/ConverterForNetwork/networkToGraphProto (line 100)
In nnet.internal.cnn.onnx/ConverterForNetwork/toOnnx (line 44)
In nnet.internal.cnn.onnx.exportONNXNetwork (line 35)
In exportONNXNetwork (line 40)
Warning: ONNX does not support layer 'nnet.cnn.layer.RegionProposalLayer'. Exporting to ONNX operator
'com.MathWorks.Placeholder'.
> In nnet.internal.cnn.onnx/NNTLayerConverter/makeLayerConverter (line 212)
In nnet.internal.cnn.onnx/ConverterForNetwork/networkToGraphProto (line 100)
In nnet.internal.cnn.onnx/ConverterForNetwork/toOnnx (line 44)
In nnet.internal.cnn.onnx.exportONNXNetwork (line 35)
In exportONNXNetwork (line 40)
Error using nnet.internal.cnn.onnx.ConverterForClassificationOutputLayer/toOnnx (line 28)
Assertion failed.
Error in nnet.internal.cnn.onnx.ConverterForNetwork/networkToGraphProto (line 102)
= toOnnx(layerConverter, nodeProtos, TensorNameMap, TensorLayoutMap);
Error in nnet.internal.cnn.onnx.ConverterForNetwork/toOnnx (line 44)
modelProto.graph = networkToGraphProto(this);
Error in nnet.internal.cnn.onnx.exportONNXNetwork (line 35)
modelProto = toOnnx(converter);
Error in exportONNXNetwork (line 40)
nnet.internal.cnn.onnx.exportONNXNetwork(Network, filename, varargin{:});
>>
Ganesh Regoti
Ganesh Regoti 2019-10-25
Hi Alberto,
It seemed to work fine for me for the following network. I am able to export the network to ONNX format.
Could you send your network (ResultsFasterRCNN_squeezenet.mat) ?

请先登录,再进行评论。

回答(3 个)

Alberto Tellaeche
Alberto Tellaeche 2019-10-25
Hi Ganesh,
Please find attached my .mat file.
I would like to export the detector.Network network.
Best,
Alberto

Alberto Tellaeche
Alberto Tellaeche 2019-10-25
Sorry for the inconveniences,
I have just done now drag and drop of the .mat containing the netwrok.
Let`s see if now it is correct...
Sorry again,
Alberto

Ganesh Regoti
Ganesh Regoti 2019-11-4
Hi Alberto,
I have tried it on the latest version of MATLAB R2019b and it worked fine for me.
1. Try updating / re-installing to the latest version of MATLAB R2019b.
2. Try re-installing the Deep Learning Toolbox.
Hope this helps!

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by