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 个评论

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

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by