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!

