MATLAB Coder Arm-Compute Library

조회 수: 2 (최근 30일)
Ignacio Acevedo
Ignacio Acevedo 2021년 3월 29일
댓글: Sergio Matiz Romero 2021년 4월 1일
So I have the following function and test script for function, respectively shown:
function out = NNet_Predict(in) %#codegen
persistent NNet;
if isempty(NNet)
NNet = coder.loadDeepLearningNetwork('C:\Users\iacev\Desktop\ImgClass\NNet.mat');
end
out = classify(NNet,in);
end
and
clc;
newImage = imread(fullfile('C:\Users\iacev\Desktop\ImgClass\Prueba\106.jpg'));
imageSize = [256 256];
in = imresize(newImage,imageSize);
y = NNet_Predict(in);
disp(y)
sprintf('The subjects mask is %s', y)
figure
imshow(newImage)
When I run these in the MATLAB Coder tool, i get the following error:
library method MKL-DNN is not even the target library i have in settings, its ARM Compute.
What could be causing this error and how do i fix it?
  댓글 수: 2
Sergio Matiz Romero
Sergio Matiz Romero 2021년 3월 31일
편집: Sergio Matiz Romero 2021년 3월 31일
Hi Ignacio,
Thank you for reporting this issue, we are investigating the behavior you described above internally. My understanding is that this occurred when you clicked on "check for issues" after selecting the ARM compute library. A potential workaround would be to skip the "check for issues" step by clicking on "next" in the bottom right hand corner to move forward and generate code directly (if the "check for issues" window pops up you can close it by clicking on the little arrow next to it)
When you continue to generate code, you will see the following tab:
Please select "More Settings" and make sure ARM compute library is selected, then click on Generate.
If generating the code throws error, you may want to check that the script that uses the network works fine in simulation. I was able generated code sucesfully for ARM using the workflow above for the following code (which is based on the one you shared):
imageSize = [24 24 3];
layers = [
imageInputLayer(imageSize, 'name', 'input', 'normalization', 'none')
reluLayer('Name', 'relu1')
fullyConnectedLayer(3, 'Name', 'fc1')
softmaxLayer('Name','softmax')
classificationLayer('Name','classoutput)')];
% input/output
X = randn([imageSize 1]);
Y = discretize(rand(size(X,4),1,'single'),[0 .25 .75 1],'categorical',{'small','medium','large'});
% training
opts = trainingOptions('adam', 'Plots', 'none', 'MaxEpochs', 2);
lgraph = layerGraph(layers);
net = trainNetwork(X, Y, lgraph, opts);
save('trainedNet.mat','net');
y = NNet_Predict(X);
disp(y)
function out = NNet_Predict(in)
%#codegen
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('trainedNet.mat');
end
out = classify(mynet,in);
end
Sergio Matiz Romero
Sergio Matiz Romero 2021년 4월 1일
As an update to my previous comment, the workflow described above is documented in the MathWorks doc page:
The reason "check for issues" is not done directly for ARM-compute library is the fact that it cannot be run as MEX. I have contacted the appropriate team internally so that they are aware that the ARM-compute option is still being displayed in the check for issues step so that they might consider improving this behavior in a future release.
Thanks again for reporting this behavior.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by