Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PapaMadeleine2022 opened this issue Nov 17, 2017 · 7 comments

Comments

@PapaMadeleine2022
Copy link

hello, I begin to train the model. In your example, you use -numPos 68 -numNeg 140, so I use 25 for the number of pos and 55 for the number of neg. But it shows error:

---------------------------------------------------------------------------------
Training parameters are pre-loaded from the parameter file in data folder!
Please empty this folder if you want to use a NEW set of training parameters.
---------------------------------------------------------------------------------
PARAMETERS:
cascadeDirName: /home/ysju/cascade-trainer-master/classifier
vecFileName: /home/ysju/cascade-trainer-master/vec.bin
bgFileName: /home/ysju/cascade-trainer-master/negatives.txt
numPos: 25
numNeg: 55
numStages: 5
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
Number of unique features given windowSize [24,24] : 162336

Stages 0-3 are loaded

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

Aborted (core dumped)4

I google this error and find the common solution is about reducing the number of positive sample like link1 and link2 said. So now I am confused about the configuration of numPos and numNeg. how to solve my this error? can you give some advises?
look forward to your reply.
thank you very much~~

@ChrisTayl2018
Copy link

Hi IvyGongoogle, did you ever solve this training classifier problem? I am having the same error thrown. Thanks

@bharadwaj-vedula
Copy link

@ChrisTayl2018 have u solved the error and could you help me.

@CJSparrow
Copy link

i got same error did u solve it or not?

@SukruGokk
Copy link

I got the same error pls help

@shershunov
Copy link

To fix this, you need to increase the number of samples in the vec file, the num parameter is responsible for this.

opencv_createsamples -info positive/info.txt -vec vector/vector.vec -num 100000 -w 24 -h 24

@trezero
Copy link

trezero commented Oct 1, 2022

To fix this, you need to increase the number of samples in the vec file, the num parameter is responsible for this.

opencv_createsamples -info positive/info.txt -vec vector/vector.vec -num 100000 -w 24 -h 24

This worked for me. Thank you

@miguelinhou
Copy link

To fix this, you need to increase the number of samples in the vec file, the num parameter is responsible for this.
opencv_createsamples -info positive/info.txt -vec vector/vector.vec -num 100000 -w 24 -h 24

This worked for me. Thank you

ME PUEDES DECIR COMO LO HICISTE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants