Predict image category
The imageCategoryClassifier
object contains a linear support
vector machine (SVM) classifier trained to recognize an image category.
You must have a Statistics and Machine Learning Toolbox™ license to use this classifier. This classifier supports parallel computing using multiple MATLAB® workers. Enable parallel computing using the Computer Vision Toolbox Preferences dialog. To open the Computer Vision Toolbox™ preferences, on the Home tab, in the Environment section, click Preferences. Select Computer Vision System Toolbox.
Use the trainImageCategoryClassifier
function to create
the imageCategoryClassifier
object.
bag = bagOfFeatures(trainingSet); categoryClassifier = trainImageCategoryClassifier(trainingSet,bag);
[1] Csurka, G., C. R. Dance, L. Fan, J. Willamowski, and C. Bray Visual Categorization with Bag of Keypoints, Workshop on Statistical Learning in Computer Vision, ECCV 1 (1-22), 1-2.
bagOfFeatures
| imageDatastore
| trainImageCategoryClassifier
| fitcecoc
(Statistics and Machine Learning Toolbox)