Classification code R2016a, will not compile
Ältere Kommentare anzeigen
I am trying to compile a simple example using bag of features with SVM. The compiler runs but the resulting executable gives the following error:
Undefined function 'predict' for input arguments of type 'single'.
Error in imageCategoryClassifier/predictImage (line 541)
Error in imageCategoryClassifier/predict (line 177)
Sample Code :
function test()
disp('This script takes a user defined image and runs it through a classifier. The output of the function is printed to screen')
x = load('model.mat');
[labelIdx,scores] = classifyListbox(x.img, x.categoryClassifier);
disp([labelIdx,scores])
function [labelIdx,scores] = classifyListbox(image,categoryClassifier)
[labelIdx, scores] = predict(categoryClassifier, image);
return
3 Kommentare
Swarooph
am 2 Aug. 2016
How do you generate the input to the predict function?
Swarooph
am 2 Aug. 2016
Looks like predict wants categoryClassifier to be of type imageCategoryClassifier . You can type the following command to see if it returns imageCategoryClassifier or single.
class(categoryClassifier)
Antworten (2)
Image Analyst
am 2 Aug. 2016
0 Stimmen
image is a built in function. You should not name your variables or dummy variables that.
Also, I fixed your formatting, but here is how you can do it yourself next time: http://www.mathworks.com/matlabcentral/answers/13205#answer_18099
Check your mccExcluded.log file to see if predict is allowed to be compiled.
2 Kommentare
Michael
am 3 Aug. 2016
Bearbeitet: Walter Roberson
am 3 Aug. 2016
Image Analyst
am 3 Aug. 2016
Well it looks like it's excluding things. I don't know why. It would be worth asking the Mathworks.
Steven Lord
am 4 Aug. 2016
0 Stimmen
There's nothing in your code that MATLAB Compiler can statically analyze and determine it needs to include the imageCategoryClassifier class (in particular its constructor and its predict method) from Computer Vision System Toolbox in your application.
I believe "helping" MATLAB Compiler by telling it that it needs to include imageCategoryClassifier will work. Try using the technique described in this Answer to do that.
1 Kommentar
Michael
am 4 Aug. 2016
Kategorien
Mehr zu Image Category Classification finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!