Training cascade for detecting arrow signs

asked 2017-12-14 16:59:33 -0600

d-e-t gravatar image

updated 2017-12-15 11:36:55 -0600

I'm working on a simple navigation problem, for which I need to detect arrow signs and follow the arrow right or left. I can define the arrow shape, and am using this black arrow on white background.

left_arrow

Using a cascade with detectMultiscale seems to be the most promising:

  • I need to something that works at a range of scales (to detect arrows close and further away).
  • It doesn't need to be very fast: the speed of detectMultiscale is not a problem.

I've trained a cascade that does detect some arrows, but there are lots of false positives and I miss many arrows. I am also trying to train cascades to recognize just left or just right arrows, and have not achieved a reliable result. It seems like this should be a relatively easy object recognition problem, so I'm puzzled by my poor results.

For the details, I am using the LableMe dataset (from http://www.ais.uni-bonn.de/download/d...) for negative samples. I'm creating positive samples from this dataset with the command below and a 26x20 pixel version of the arrow.

opencv_createsamples -img arrow_26x20R.jpg -bg bg_0-20.txt -num 20000 -info ./pos_5R/annotations.lst -pngoutput ./pos_5R -bgcolor 1 -bgthresh 0 -maxxangle 0.2 -maxyangle 0.5 -maxzangle 0.2 -w 26 -h 20

Then, to create the vector file:

opencv_createsamples -num 20000 -info ./pos_5L/annotations.lst -vec pos_5L.vec -w 26 -h 20

Then, to train the cascade:

opencv_traincascade -data cascade_arrow_5L -vec pos_5L.vec -bg bg_5R_0-20.txt -numPos 17000 -numNeg 40000 -numStages 10 -w 26 -h 20

I've tried it with 2000 positive:4000 negative images, and with 20,000 positive:40,000 negative images, but see no improvement in effectiveness. The training finishes with 'Required leaf false alarm rate achieved. Branch training terminated.' after just 2 stages (stage 0 & 1).

I've read a lot of helpful advice and tutorials, including this forum, but can't figure out any mistake. I'd be very grateful for any suggestions.

edit retag flag offensive close merge delete