Upload New File
This commit is contained in:
12
image processing and models/arrest4ml.m
Normal file
12
image processing and models/arrest4ml.m
Normal file
@@ -0,0 +1,12 @@
|
||||
setDir = fullfile(toolboxdir('machine'),'machine data','imagesets');
|
||||
|
||||
imds = imageDatastore(setDir,'IncludeSubfolders',true,'LabelSource',...
|
||||
'foldernames');
|
||||
[trainingSet,testSet] = splitEachLabel(imds,0.3,'randomize');
|
||||
bag = bagOfFeatures(trainingSet);
|
||||
categoryClassifier = trainImageCategoryClassifier(trainingSet,bag);
|
||||
confMatrix = evaluate(categoryClassifier,testSet)
|
||||
mean(diag(confMatrix))
|
||||
img = imread(fullfile(setDir,'negative','e_images_3.jpg'));
|
||||
[labelIdx, score] = predict(categoryClassifier,img);
|
||||
categoryClassifier.Labels(labelIdx)
|
||||
Reference in New Issue
Block a user