Invalid .MAT file error while code generation for Raspberry Pi

조회 수: 9 (최근 30일)
Paras Dhekale
Paras Dhekale 2021년 7월 27일
댓글: Paras Dhekale 2021년 10월 7일
Error - Invalid MAT file. MAT file should contain a single instance of either a SeriesNetwork, DAGNetwork, yolov2ObjectDetector or ssdObjectDetector object.
I want to deploy a customised deep learning model on Raspberry Pi 4. I have made my own deep learning model and saved it in .MAT format. When I deploy the code I am getting this error but when I load saved model in workspace it shows it is a 1*1 SeriesNetwork. I have loaded model in program as "coder.loadDeepLearningNetwork('smart.mat')". Also in the given webinar of Deep Learning with Raspberry Pi and MATLAB ( https://www.youtube.com/watch?v=i5XfCIdVStY ), they have used a pretrained available model (resnet50) in MATLAB but I want use a customised model. My ARM Compute library version is 20.02.1.
  댓글 수: 2
Hariprasad Ravishankar
Hariprasad Ravishankar 2021년 8월 2일
Hi Paras,
Do you have more than one network saved into the same MAT file? Could you try saving only one SeriesNetwork object into the MAT file?
Paras Dhekale
Paras Dhekale 2021년 8월 2일
편집: Paras Dhekale 2021년 8월 2일
Sir, could you elaborate on how to save only one SeriesNetwork object into the MAT file?
Here is my snippet of saving network after training:-
net = trainNetwork(Images,layers,opt);
customnet = net;
save ('customnet.mat');
When I load this custom network in workspace, its value is 1*1 SeriesNetwork and the variables along with values of this network are Layers(27*1 layer), InputNames(1*1 cell) & OutputNames(1*1 cell).

댓글을 달려면 로그인하십시오.

답변 (1개)

Sehairi K.
Sehairi K. 2021년 10월 6일
Hello
Usually it happens when Matlab detects two different deep neural networks for example DAGNetwork and yolov2ObjectDetector in the same saved mat file, this happens when use a backend network trying to construct an object detetor network. Try to delete the DAGNetwork and save your 'detetctor' again (save the detector not the mat file)
  댓글 수: 3
Sehairi K.
Sehairi K. 2021년 10월 7일
Hello
Make sure that the current folder in Matlab is where the mat file is
Follow these steps line by line in Matlab command Window
clear all % clear the workspace
% load your saved network again
load ('customnet.mat');
In the Workspace Window, in the right, check if you have two different DNN network for example DAGNetwork and SeriesNetwork, right click on the DAGNetwork and delete it after that save your detector with the name of the SeriesNetwork
If the SeriesNetwork has the name customnet save it as
save customnet
check again that you have just one DNN by clearing the workspace and loading the saved network
check the image below I have two DNNs, a DAGNetwork and yolov2ObjectDetector, I select network with right click and delete it than I save the network using the name of yolov2ObjectDetector
save detector
Hope this will resolve your issue

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by