From 9b8f264ac6d7ad8e4ccd8f6a25f1cfde53da59b0 Mon Sep 17 00:00:00 2001 From: "Ragini.N" Date: Thu, 22 Oct 2020 09:41:16 +0000 Subject: [PATCH] Upload New File --- image processing and models/arrest4ml.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 image processing and models/arrest4ml.m 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)