MATLAB: Is it possible to see which instances are classified incorrectly for the trainImage​CategoryCl​assifier example

image processing

I'm getting some good results going through the steps in the trainImageCategoryClassifier example (https://www.mathworks.com/help/vision/ref/trainimagecategoryclassifier.html?s_tid=doc_ta). However, all I can see at the moment is the confusion matrix. I'd like to know which of my testing samples are being misclassified so that I can evaluate them and see if there is anything that is obvious about them that might warrant further study.

Best Answer

I've answered my own question with a bit of searching, sorry!
%output classifications
for i = 1:length(testSet.Files)
[idx,score] = predict(categoryClassifier,readimage(testSet,i));
if (testSet.Labels(i) ~= categoryClassifier.Labels(idx))
i %just output the index, do interesting things with it later
end
end