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에 대해 자세히 알아보기

질문:

2020년 10월 19일

댓글:

2020년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by