How to export trained Faster RCNN to another hardware platform

3 views (last 30 days)
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 Comments
Alberto Tellaeche
Alberto Tellaeche on 24 Oct 2019
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 on 25 Oct 2019
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) ?

Sign in to comment.

Answers (3)

Alberto Tellaeche
Alberto Tellaeche on 25 Oct 2019
Hi Ganesh,
Please find attached my .mat file.
I would like to export the detector.Network network.
Best,
Alberto
  1 Comment
Ganesh Regoti
Ganesh Regoti on 25 Oct 2019
Hi,
The attached .mat file is empty. Can you please cross-verify and attach the correct file.

Sign in to comment.


Alberto Tellaeche
Alberto Tellaeche on 25 Oct 2019
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 on 4 Nov 2019
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!

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!