C/C++ Code generation for Alexnet without GPU

Hello,
I am a hardware guy with little knowlwdge on machine learning thing. I need pure C/C++ code for Alexnet , I am trying to generate the C/C++ code for the alexnet using MATLAB C Coder, but fail to do so.
*my pc does does not have GPU or NVIDIA drivers or libraries etc.
here is my entry function:
function out = alexnet_classify(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('alexnet', 'myalexnet');
out = mynet.predict(in);
end
I am getting the following error:
coder.loadDeepLearningNetwork is only supported for GPU code generation.
please help me

1 Kommentar

Hi Haroon,
Just a quick note, your if statement actually includes the assignment to out, since it requires the end statement. So it really looks like this.
function out = alexnet_classify(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('alexnet', 'myalexnet');
out = mynet.predict(in);
end
Which means if you've already called this code once (and therefore mynet is now initalized) you won't get out assigned. I suspect you want
function out = alexnet_classify(in)
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork('alexnet', 'myalexnet');
end
out = mynet.predict(in);
end
This doesn't address your question (which is why I'm only marking it as a Comment).
Raymond

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Gefragt:

am 19 Okt. 2020

Kommentiert:

am 19 Okt. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by