Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

POOpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.

I am tying to train my own classifier with the following: positives: 256 Negatives: 493 I created the .vec file from the postives with the following annotation. All of my images are in png formate are 50x50

opencv_createsamples -info annotations.txt -vec /home/coffeecam/Documents/training/samples5.vec -w 50 -h 50

Output of createsamples: image description

I trained with following command

opencv_traincascade -data /home/coffeecam/Documents/training/hc8 -vec /home/coffeecam/Documents/training/samples5.vec -bg /home/coffeecam/Documents/training/nag.txt -precalcValBufSize 2500 -precalcIdxBufSize 2500 -numPos 256 -numNeg 493 -numStages 15 -minhitrate 0.999 -maxfalsealarm 0.5 -w 50 -h 50

After my training starts it errors out after first stage with the following error

image description I might be doing something wrong. Please if you can take a look and assist me with this. I am using Java build on Ubuntu. Thanks

POOpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.

I am tying to train my own classifier with the following: positives: 256 Negatives: 493 I created the .vec file from the postives with the following annotation. All of my images are in png formate are 50x50

opencv_createsamples -info annotations.txt -vec /home/coffeecam/Documents/training/samples5.vec -w 50 -h 50

Output of createsamples: image descriptionInfo file name: annotations.txt Img file name: (NULL) Vec file name: /home/coffeecam/Documents/training/samples5.vec BG file name: (NULL) Num: 1000 BG color: 0 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 Original image will be scaled to: Width: $backgroundWidth / 50 Height: $backgroundHeight / 50 Create training samples from images collection... annotations.txt(257) : parse errorDone. Created 256 samples

I trained with following command

opencv_traincascade -data /home/coffeecam/Documents/training/hc8 -vec /home/coffeecam/Documents/training/samples5.vec -bg /home/coffeecam/Documents/training/nag.txt -precalcValBufSize 2500 -precalcIdxBufSize 2500 -numPos 256 -numNeg 493 -numStages 15 -minhitrate 0.999 -maxfalsealarm 0.5 -w 50 -h 50

After my training starts it errors out after first stage with the following error

image description POOpenCV 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/coffeecam/Documents/finalBuild/opencv-2.4.13/apps/traincascade/imagestorage.cpp, line 154 terminate called after throwing an instance of 'cv::Exception' what(): /home/coffeecam/Documents/finalBuild/opencv-2.4.13/apps/traincascade/imagestorage.cpp:154: error: (-5) Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file. in function get

I might be doing something wrong. Please if you can take a look and assist me with this. I am using Java build on Ubuntu. Thanks Thanks

click to hide/show revision 3
None

updated 2017-11-29 13:22:12 -0600

berak gravatar image

POOpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.

I am tying to train my own classifier with the following: positives: 256 Negatives: 493 I created the .vec file from the postives with the following annotation. All of my images are in png formate are 50x50

opencv_createsamples -info annotations.txt -vec /home/coffeecam/Documents/training/samples5.vec -w 50 -h 50

Output of createsamples: **Output of createsamples:** Info file name: annotations.txt Img file name: (NULL) Vec file name: /home/coffeecam/Documents/training/samples5.vec BG file name: (NULL) Num: 1000 BG color: 0 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 Original image will be scaled to: Width: $backgroundWidth / 50 Height: $backgroundHeight / 50 Create training samples from images collection... annotations.txt(257) : parse errorDone. Created 256 samples

samples

I trained with following command

opencv_traincascade -data /home/coffeecam/Documents/training/hc8 -vec /home/coffeecam/Documents/training/samples5.vec -bg /home/coffeecam/Documents/training/nag.txt -precalcValBufSize 2500 -precalcIdxBufSize 2500 -numPos 256 -numNeg 493 -numStages 15 -minhitrate 0.999 -maxfalsealarm 0.5 -w 50 -h 50

After my training starts it errors out after first stage with the following error error:

POOpenCV 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/coffeecam/Documents/finalBuild/opencv-2.4.13/apps/traincascade/imagestorage.cpp, line 154
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/coffeecam/Documents/finalBuild/opencv-2.4.13/apps/traincascade/imagestorage.cpp:154: error: (-5) Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.
 in function get

get

I might be doing something wrong. Please if you can take a look and assist me with this. I am using Java build on Ubuntu. Thanks