I’m using OpenCV Haar Classifier to detect circle spheres or bubbles of different radiuses in images. To ensure identical colour ranges, we use thresholded black/white image, so circles are drawn in Black colours over White background. Then we train using synthetic images of circles of different radius sizes (black lines over white background of course).
From the observation, it correctly detected some of the circles, but there are too many false positives, where it draws non-existent circles. For the detection, we use the facedetect.cpp code available on OpenCV website, but slightly modified to removed the nested object. To validate, we have trained it again using concentric circles, and tested over circles without concentric/child circles, and it did not detect those. It was not meant to detect them.
So I’m lost as to why we are seeing non-existent circles? So it detect circles or even larger radius where there are non-existent circles. I’ve tried both the HAAR & LBP feature. We’ve trained it in multiples stages that took hours, but to see speedy results, we reduced training to 4 stages, and even tried to increase the MaxDepth (since it is using Boosted trees), but MaxDepth may not be working. So negative samples are just pictures that mostly doesn’t represent circles totalling 2638, while for this test, positives were around 3075, but it terminated early at the 2nd stage, since the FA may be less now.
I’m trying to understand what’s the best way to do this? I mean this is a single class problem, just to detect circles of different radiuses. From my observation, I doubt the classifier scales the input images, which is ok for us, since the synthetic contains circles of all radius sizes anyway.
Looking at the output:
NEG count : acceptanceRatio 2638 : 1 Precalculation time: 0 +----+---------+---------+ | N | HR | FA | +----+---------+---------+ | 1| 1|0.0015163| +----+---------+---------+ END> Training until now has taken 0 days 0 hours 0 minutes 0 seconds. -- POS count : consumed 3075 : 3075 NEG count : acceptanceRatio 0 : 0 Required leaf false alarm rate achieved. Branch training terminated. Input parameters: opencv_createsamples -info c0/d0/out2/o2.p -vec c0/d0/out2/o2.vec -bg c0/d0/neg.txt -num 3075 -bgcolor 255 Info file name: c0/d0/out2/o2.p Img file name: (NULL) Vec file name: c0/d0/out2/o2.vec BG file name: c0/d0/neg.txt Num: 3075 BG color: 255 BG threshold: 80 Invert: FALSE Max intensity deviation: 40 Max x angle: 1.1 Max y angle: 1.1 Max z angle: 0.5 Show samples: FALSE Width: 24 Height: 24 Max Scale: -1 RNG Seed: 12345 Create training samples from images collection... Done. Created 3075 samples opencv_traincascade -featureType LBP -data $HOME/vas/I/p/sub/group/cir5/c0/d0/out2 -vec $HOME/vas/I/p/sub/group/cir5/c0/d0/out2/o2.vec -bg $HOME/vas/I/p/sub/group/cir5/c0/d0/neg.txt -numPos 3075 -numNeg 2638 -numStages 4 -numThreads 20 -maxDepth 10 > $HOME/vas/I/p/sub/group/cir5/c0/d0/out2/r.out