Hello, it's my first post, so sorry if I set something not correctly.
I'm trying to write my own version of Image Recognition Using Machine Learning. I'm using code from this video: https://www.mathworks.com/videos/image-recognition-using-machine-learning-122900.html. What I change is image files (I use only two categories – drones and birds and I have only 200 examples from each group).
After running this section:
%%Test out accuracy on test set!
testSceneData = double(encode(bag, test_set));testSceneData = array2table(testSceneData,'VariableNames',trainedClassifier.RequiredVariables);actualSceneType = test_set.Labels;predictedOutcome = trainedClassifier.predictFcn(testSceneData);correctPredictions = (predictedOutcome == actualSceneType);validationAccuracy = sum(correctPredictions)/length(predictedOutcome) %#ok
I have error like this:
Error using detectSURFFeaturesExpected input number 1, I, to be one of these types:logical, uint8, int16, uint16, single, doubleInstead its type was matlab.io.datastore.ImageDatastore.Error in detectSURFFeatures>checkImage (line 124)validateattributes(I,{'logical', 'uint8', 'int16', 'uint16', ...Error in detectSURFFeatures (line 81)checkImage(I);Error in bagOfFeatures/determineExtractionPoints (line 591) points = detectSURFFeatures(grayImage, 'MetricThreshold', 800);Error in bagOfFeatures/extractDescriptorsFromImage (line 645) points = this.determineExtractionPoints(grayImage);Error in bagOfFeatures>@(img)extractDescriptorsFromImage(this,img)Error in bagOfFeatures/encodeSingleImage (line 487) descriptors = this.Extractor(img);Error in bagOfFeatures/encode (line 355) [featureVector, varargout{1:numVarargout}] = this.encodeSingleImage(in, params);
I create variable bag in this way:
bag = bagOfFeatures(imageSet(training_set.Files),'VocabularySize',250,'PointSelection','Detector');
Do you have any idea what can I change to fix this problem?
Best Answer