how to MAKE an image as a svm classifier input ?

2 ビュー (過去 30 日間)
syscon
syscon 2014 年 3 月 8 日
編集済み: Uttiya Ghosh 2020 年 7 月 15 日
i have matlab 2012 sample codes for svm (support vector machine) classifier. In these code "HOW CAN I ADD THE 2D IMAGE AS A INPUT FOR MALE & FEMALE DETECTION

回答 (1 件)

Uttiya Ghosh
Uttiya Ghosh 2020 年 7 月 15 日
編集済み: Uttiya Ghosh 2020 年 7 月 15 日
Hi Anto,
As per my understanding you would like to know the procedure to train a SVM classifier using grayscale images. I have used R2020a version of MATLAB to train trainImageCategoryClassifier function on a set of digits. This function trains a support vector machine (SVM) multiclass classifier using the input bag (bagOfFeatures object). PFB the code required to perform the desired task.
setDir = fullfile(matlabroot,'toolbox','nnet','nndemos', ...
'nndatasets','DigitDataset');
imds = imageDatastore(setDir,'IncludeSubfolders',true,'LabelSource',...
'foldernames');
[imdsTrain,imdsTest] = splitEachLabel(imds,0.9,'randomize');
bag = bagOfFeatures(imdsTrain,"VocabularySize",100);
mdl = trainImageCategoryClassifier(imdsTrain,bag);
confMatrix = evaluate(mdl,imdsTest);
For more information, refer to the following links.

Community Treasure Hunt

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

Start Hunting!

Translated by