diff --git a/image processing and models/arrest4ml.m b/image processing and models/arrest4ml.m new file mode 100644 index 0000000..8c3b187 --- /dev/null +++ b/image processing and models/arrest4ml.m @@ -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)