Error generating code for network net0_0. Index exceeds the number of array elements. Index must not exceed 0.
조회 수: 2 (최근 30일)
이전 댓글 표시
Trying to generate code for trained mobilenetV2 for arm target.
But its failing with error. Could not find more description what can cause this error. Need pointers to debug.
cfg = coder.config('lib');
cfg.TargetLang = 'C++';
cfg.GenCodeOnly=true;
dlcfg = coder.DeepLearningConfig('arm-compute');
dlcfg.ArmArchitecture = 'armv7';
dlcfg.ArmComputeVersion = '19.05';
cfg.DeepLearningConfig = dlcfg;
codegen -config cfg Mobilenet_predict -args {ones(320,592,3,'single')} -report

function out = Mobilenet_predict(in)
persistent mynet;
opencv_linkflags = '`pkg-config --cflags --libs opencv`';
coder.updateBuildInfo('addLinkFlags',opencv_linkflags);
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('Mobilenet.mat','net');
end
out = predict(mynet,in);
end
댓글 수: 3
Sayan Saha
2022년 2월 28일
Were you able to resolve this issue? If not, can you attach the trained mobilenetv2 model in this post? You should be able to edit the question and attach the model.
If you do not feel comfortable attaching the model MATFile, please contact MathWorks technical support for furhter assistance.
Thanks,
Sayan
답변 (1개)
Walter Roberson
2022년 2월 10일
You might need to use a %#function directive to bring in the class that predict is a method of; https://www.mathworks.com/matlabcentral/answers/568818-predict-function-doesn-t-work-in-standalone-matlab-application
mobilenetV2 appears to be an instance of the class https://www.mathworks.com/help/deeplearning/ref/dagnetwork.html
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

