Andy Johnson
Andy Johnson

Reputation: 693

OpenCV Training Custom Haar Cascade

I am trying to train a haar cascade on my face. I have everything setup including the positive, negetive, the vec file, etc. but when I run the opencv_traincascade, it gave me a terminate called after throwing an instance of 'std::bad_alloc' error. Then I added this line to my arguments -nonsym -mem 512 and it gave me this error: terminate called after throwing an instance of 'std::logic_error'.

Here is the command I am running:

opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\
>    -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\
>    -numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024\
>    -precalcIdxBufSize 1024\
>    -nonsym\
>    -mem 512\

Any help would be greatly appreciated!

Upvotes: 0

Views: 133

Answers (1)

Andy Johnson
Andy Johnson

Reputation: 693

You have to get rid of the -nonsym -mem 512 and instead put -mode ALL. So new the command looks like this:

opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt\
>    -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\
>    -numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024\
>    -precalcIdxBufSize 1024\
>    -mode ALL

The -nonsym -mem512 commands don't actually exist.

Upvotes: 0

Related Questions