Dario
Dario

Reputation: 331

OPENCV training cascade "out of range"

I'm trying to train my own detector by using OpenCV 3.0 traincascade. I have 82 positive and 188 negative sample and with the following

 opencv_traincascade -data data -vec signals.vec -bg negative.txt -numPos 82 -numNeg 188 -numStages 20 -w 50 -h 50 -featureType LBP

I'm able to reach stage 8. At the stage 9 I have the following error

    ===== TRAINING 9-stage =====
<BEGIN
POS count : consumed   82 : 82
NEG cterminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr
Aborted (core dumped)149

Someone knows why? Thank you in advance.

Upvotes: 1

Views: 385

Answers (1)

cyriel
cyriel

Reputation: 3522

The short answer is - you don't have enough negative samples for selected maxFalseAlarm and numStages parameters. So you have 3 options (starting from the best):

  • provide more negative samples (imho it's the best option - it's not hard and will give you the best results)
  • decrease value of maxFalseAlarm parameter (you can find it here)
  • decrease number of stages

If i remember correct (better check it..) you should have at least (1-maxFalseAlarm)^(numStages-1) (where '^' is power, not xor) negative samples to complete training.

Upvotes: 1

Related Questions