C++ language conversion of the captured neural network

조회 수: 4 (최근 30일)
Kubota Junya
Kubota Junya 2021년 7월 26일
답변: Sayan Saha 2022년 6월 8일
After importing the trained model created by keras into MATLAB, I am trying to convert it to C++ and use it in Simulink.
I created the code to convert the keras model in .mat file into C++, but I get the following error.
Error: The library method'dltargets.mkldnn.mkldnnApi.updateBuildInfo' does not work. Cause: The number of outputs from the right-hand side of the equal sign is not enough to satisfy the substitution.
function out = myNet_predict(in) %#codegen
inputnet = 'netTransfer.mat';
persistent mynet;
if isempty(mynet)
mynet = coder.loadDeepLearningNetwork(inputnet);
end
out = predict(mynet,in);
end
in = imread('two.png');
in = imresize(in,[1,784]);
cfg = coder.config('mex');
cfg.TargetLang = 'C++';
cfg.DeepLearningConfig = coder.DeepLearningConfig('mkldnn');
codegen -args {ones(1,784,1,'uint8')} -config cfg myNet_predict -report;
Can this be dealt with by rewriting the program? Or is it better to try another method?
  댓글 수: 3
Kubota Junya
Kubota Junya 2021년 8월 18일
I'm using R2020b version.
The network MAT file is "netTransfer.mat" attached. It was created by learning MNIST of keras.
wang kai
wang kai 2021년 11월 9일
any updates. I had similar issues

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

답변 (1개)

Sayan Saha
Sayan Saha 2022년 6월 8일
This issue is likely because a supported C++ compiler is not set in MATLAB. You can invoke "mex -setup C++" to set the compiler from the list of supported ones as mentioned in https://www.mathworks.com/support/requirements/supported-compilers.html

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by