Clear Filters
Clear Filters

Classify Image using SVM after PCA analysis

5 views (last 30 days)
Hello,
I need some help to classify a test image to belong to the correct person.
I am using PCA with a SVM classifier to classify the image.
I have 40 subjects, each with 5 features (= total of 200 images).
I therefore have the "train_label" matrix as [1;1;1;1;1;2;2;2;2;2;3;3;3;3;3;4;4;4;4;4;5...40;40;40;40;40]
  1. I got the projected images down to a 200 x 200 matrix using the PCA analysis - "projectimg".
  2. I then used the following command to "Train" the SVM classifier:
SVMModel = fitrsvm(projectimg', train_label,'Standardize',true,'KernelFunction','RBF',... 'KernelScale','auto');
I then generated the projected test image, - "projtestimg".
I now wanted to classify this test image, so I use the following command:
[label] = predict(SVMModel,projtestimg');
I always get the wrong value for the label, meaning that the label value never correlates to the proper subject. I think that I might be implementing the classify part incorrectly.
Can you please tell me how to correctly predict the class of the test image after the PCA analysis using the SVM method in Matlab? Thanks!

Answers (0)

Categories

Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!