Error generating samples for cascade classifier training
Show older comments
While trying to run trainCascadeObjectDetector with MATLAB R2013a on Windows, I keep getting an error that won't allow me to get past the very first stage.
I have been following MATLAB's tutorial on how to "Train a Cascade Object Detector", as well as this blog post .
I am using 4,372 .pgm positive images and 14,440 .pgm negative images.
The positive images are given to the function as a structure variable which contains path+filename and object bounding box of the images. Both positive and negative images are located in their respective subfolders.
Calling of the function:
negativeFolder = ('./negativeFolder');
trainCascadeObjectDetector('trainedCrater1.xml',positiveData,negativeFolder);
The following is printed when the training starts:
Automatically setting ObjectTrainingSize to [ 32, 32 ]
Using at most 3992 of 4372 positive samples per stage
Using at most 7984 negative samples per stage
Training stage 1 of 20
The error that I am getting is this:
Training stage 1 of 20
[....................................................Error using ocvTrainCascade
Error in generating samples for training. No samples could be generated for training the first cascade stage.
Error in trainCascadeObjectDetector (line 265)
ocvTrainCascade(filenameParams, trainerParams, cascadeParams, boostParams, ...
Error in training (line 24)
trainCascadeObjectDetector('trainedCrater1.xml',positiveData,negativeFolder);
Does anyone have any kind of suggestion on how to fix this issue? Thank you very much!
Accepted Answer
More Answers (1)
Zhenglin Wang
on 8 Jun 2017
0 votes
Might be because training images are smaller than 32x32. Try to specify such as " 'ObjectTrainingSize', [28 28]"
1 Comment
Hossam Alzomor
on 30 Jul 2019
Edited: Hossam Alzomor
on 30 Jul 2019
what is the problem with small images?
I am facing the same problem, my images are 32*32
I have 106 ROI images and 96 NROI images
but the false -ve detection is 90%
Categories
Find more on Object Detection in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!