# Revision history [back]

Hi,

I'm trying to train new detectors, with previous OpenCV version 2.3.1, my parameters had worked nice. I have discarded the previous detectors, so I needed to train again in the new version OpenCV 2.4.2. But with the same parameters, it had the following error:

===== TRAINING 2-stage =====
<BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is
insufficient count of samples in given vec-file.
) in get, file /home/giseli/opencv/apps/traincascade/imagestorage.cpp, line 159
terminate called after throwing an instance of 'cv::Exception'
what():  /home/giseli/opencv/apps/traincascade/imagestorage.cpp:159: error: (-5) Can not
get new positive sample. The most possible reason is insufficient count of samples in given
vec-file.
in function get


The parameters that I used:

    ./opencv_traincascade -data mix25x15 -vec mix.vec -bg negativos.txt -numStages 15
-minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 3600 -numNeg 3045 -w 25 -h 15
-precalcValBufSize 2048 -precalcIdxBufSize 2048 -mode ALL


But I have put the exact number of positive samples, I have looked on the vec file to be sure. I also put the correct number of negatives images. I've tried to put the same number of pos and neg, for example 1200 (of course I've created the corresponding vec file) for each, but it is not working. I have tried also with 1200 pos and 3045 neg.

I'm not sure if is something in the code or in my parameters. Any idea? Thanks!

Hi,

I'm trying to train new detectors, with previous OpenCV version 2.3.1, my parameters had worked nice. I have discarded the previous detectors, so I needed to train again in the new version OpenCV 2.4.2. But with the same parameters, it had the following error:

===== TRAINING 2-stage =====
<BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is
insufficient count of samples in given vec-file.
terminate called after throwing an instance of 'cv::Exception'
get new positive sample. The most possible reason is insufficient count of samples in given
vec-file.
in function get


The parameters that I used:

    ./opencv_traincascade -data mix25x15 -vec mix.vec -bg negativos.txt negatives.txt -numStages 15
-minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 3600 -numNeg 3045 -w 25 -h 15
-precalcValBufSize 2048 -precalcIdxBufSize 2048 -mode ALL


But I have put the exact number of positive samples, I have looked on the vec file to be sure. I also put the correct number of negatives images. I've tried to put the same number of pos and neg, for example 1200 (of course I've created the corresponding vec file) for each, but it is not working. I have tried also with 1200 pos and 3045 neg.

I'm not sure if is something in the code or in my parameters. Any idea? Thanks!

Hi,

I'm trying to train new detectors, with previous OpenCV version 2.3.1, my parameters had worked nice. I have discarded the previous detectors, so I needed to train again in the new version OpenCV 2.4.2. But with the same parameters, it had the following error:

===== TRAINING 2-stage =====
<BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is
insufficient count of samples in given vec-file.
) in get, file /home/user/opencv/apps/traincascade/imagestorage.cpp, line 159
terminate called after throwing an instance of 'cv::Exception'
what():  /home/user/opencv/apps/traincascade/imagestorage.cpp:159: error: (-5) Can not
get new positive sample. The most possible reason is insufficient count of samples in given
vec-file.
in function get


The parameters that I used:

    ./opencv_traincascade -data mix25x15 -vec mix.vec -bg negatives.txt -numStages 15
-minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 3600 -numNeg 3045 -w 25 -h 15
-precalcValBufSize 2048 -precalcIdxBufSize 2048 -mode ALL


But I have put the exact number of positive samples, I have looked on the vec file to be sure. I also put the correct number of negatives images. I've tried to put the same number of pos and neg, for example 1200 (of course I've created the corresponding vec file) for each, but it is not working. I have tried also with 1200 pos and 3045 neg.

I'm not sure if is something in the code or in my parameters. Any idea? Thanks!

 4 retagged Kirill Kornyakov 2792 ●13 ●25 ●52

### Error in parameter of traincascade?

Hi,

I'm trying to train new detectors, with previous OpenCV version 2.3.1, my parameters had worked nice. I have discarded the previous detectors, so I needed to train again in the new version OpenCV 2.4.2. But with the same parameters, it had the following error:

===== TRAINING 2-stage =====
<BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is
insufficient count of samples in given vec-file.
) in get, file /home/user/opencv/apps/traincascade/imagestorage.cpp, line 159
terminate called after throwing an instance of 'cv::Exception'
what():  /home/user/opencv/apps/traincascade/imagestorage.cpp:159: error: (-5) Can not
get new positive sample. The most possible reason is insufficient count of samples in given
vec-file.
in function get


The parameters that I used:

    ./opencv_traincascade -data mix25x15 -vec mix.vec -bg negatives.txt -numStages 15
-minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 3600 -numNeg 3045 -w 25 -h 15
-precalcValBufSize 2048 -precalcIdxBufSize 2048 -mode ALL


But I have put the exact number of positive samples, I have looked on the vec file to be sure. I also put the correct number of negatives images. I've tried to put the same number of pos and neg, for example 1200 (of course I've created the corresponding vec file) for each, but it is not working. I have tried also with 1200 pos and 3045 neg.

I'm not sure if is something in the code or in my parameters. Any idea? Thanks!