Looking at some previous examples where I was successfully able to export and import onnx models I noticed that the successful ones were all seriesNetworks while the ones I have trouble with are all DAGNetworks, and they were trained with R2021b vs R2022b. Maybe there's something going on there. What causes a network to be output as a seriesNetwork vs DAGNetwork?
exportONNXNetwork works but importONNXNetwork can't load input layer
조회 수: 10 (최근 30일)
이전 댓글 표시
I'm training a sequence classification network with lstms similar to the ClassifySequenceDataUsingLSTMNetworksExample and then exporting the trained model as an ONNX model for use in python. I have found that if I train the model with XTrain being cells of sequences, the network that is produced
1-will export without complaint with exportONNXNetwork
2-will NOT import to python
3-will NOT import back into Matlab via importONNXNetwork. matlab complaint is "Unable to create an ouput layer for ONNX network output #1 ... because its data format is unkown or not supported as a MATLAB output layer. If you know the output format, pass it using the 'outputDataFormats' parameter."
To get the complaint in 3- I added the following in the example live script after line 45:
exportONNXNetwork(net,onnxFilename)
importONNXNetwork(onnxFilename)
The python loading error is similar to the matlab error in that the layer input tensor rank (similar to data format) is incorrect
I have successfully exported and imported a lstm network to/from onnx format. But in that case, I trained with a datastore vs in this example the training inputs are cell arrays. Don't understand why that would change the onnx export/import outcome.
답변 (1개)
Tamir Suliman
2023년 2월 23일
All i can say based on your description, it seems like the issue may be related to the input data format or rank of the exported ONNX model, which is causing errors during the import process.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!