MATLAB Coder Arm-Compute Library

1 Ansicht (letzte 30 Tage)
Ignacio Acevedo
Ignacio Acevedo am 29 Mär. 2021
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 Kommentare
Sergio Matiz Romero
Sergio Matiz Romero am 31 Mär. 2021
Bearbeitet: Sergio Matiz Romero am 31 Mär. 2021
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 am 1 Apr. 2021
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by