How to compile Deep learning Neural Network function?
조회 수: 6 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 12월 13일
편집: MathWorks Support Team
2023년 5월 26일
I am trying to create an executable with MATLAB compiler for neural network toolbox example here:
I get this error:
error: some functionality cannot be deployed
채택된 답변
MathWorks Support Team
2023년 5월 26일
편집: MathWorks Support Team
2023년 5월 26일
Starting R2016b MATLAB release:
You should be able to compile 'trainNetwork' and most command line functions (from both classical and deep learning networks) starting in R2016b.
Functions that cannot be compiled include the deep learning training "plot" function and all user interfaces.
Please refer the 'Neural Network Toolbox' product in this link for information on this:
Prior to R2016b release:
You can only compile a pre-trained network and use classify function to classify the test data.
So in order to compile the doc example below,
in releases prior to R2016b, please follow the steps below:
1. Run the example code in MATLAB
2. This will create the 'convnet' struct variable in your workspace. This is the pretrained network object. Save this to a mat file like below:
save 'model.mat' convnet
3. Also save the testImageData variable in the workspace to a mat file:
save 'testDigitData.mat' testDigitData
4. Then you can create a MATLAB function like below to be compiled into an executable that used the pretrained network to classify the test data.
function accuracy = runModelFromMATLAB()
load('model.mat');
load('testDigitData.mat')
YTest = classify(convnet,testDigitData);
TTest = testDigitData.Labels;
accuracy = sum(YTest == TTest)/numel(TTest)
end
5. Then create executable for this function with MATLAB compiler
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!