Clear Filters
Clear Filters

How to put a bounding box for image detection using SVM model exported from Classification Learner?

4 views (last 30 days)
Hello, I have a classifier trained with Classification Learner APP, 200-word-bagOfFeature per image was used as trained data.
PoseScrewClassifier =
struct with fields:
predictFcn: @(x)exportableClassifier.predictFcn(predictorExtractionFcn(x))
RequiredVariables: {1×200 cell}
ClassificationSVM: [1×1 ClassificationSVM]
About: 'This struct is a trained classifier exported from Classifi…'
HowToPredict: 'To make predictions on a new table, T, use: …'
I have used it to predict new data, T. T is a table summarize new testing images with 200-word-bagOfFeature per image.
if true
[label, score] = predict(PoseScrewClassifier.ClassificationSVM,T);
I want to put a bounding box around the object which the classifier thinks it belongs to certain category. I want to do this because I have a lot of testing images not only have category 1, but also have category 2 in the same image. This is what I did...
if true
[bboxes, score] = predict(PoseScrewClassifier.ClassificationSVM,T);
box = insertObjectAnnotation(imageT,'rectangle',bboxes,score);
figure, imshow(box);
And this is the Error I got:
if true
Error using insertObjectAnnotation
Expected input number 3, POSITION, to be one of these types:
Instead its type was categorical.
Error in insertObjectAnnotation
Error in insertObjectAnnotation
I do not quite understand. Is it because of the nature of bagoffeature which is looking at the entire image, so there will not be a bounding box at all? Or some other reasons?
And what are the possible solutions to get a bounding box? A sliding window?
Someone please point me a direction. Greatly appreciate!

Answers (0)


Find more on Recognition, Object Detection, and Semantic Segmentation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!