Based on a discussion on the forum, opencv_traincascade often fails because you have to guess the number of samples and pass numPos about 90% of the sample for it to work.
The error is pretty cryptic like "Can not get new positive sample. The most possible
reason is insufficient count of samples in given vec-file."
Command didn't work at last step train.
./prep.py train
TRAIN
Traceback (most recent call last):
File "./prep.py", line 170, in
num_neg_samples = file_len(NEGATIVE_INFO_FILE)
File "./prep.py", line 54, in file_len
return i + 1
UnboundLocalError: local variable 'i' referenced before assignment
Hello,
Based on a discussion on the forum,
opencv_traincascade
often fails because you have to guess the number of samples and passnumPos
about 90% of the sample for it to work.The error is pretty cryptic like "Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file."
Here are links about how to tackle this:
http://stackoverflow.com/questions/10863560/haar-training-opencv-assertion-failed http://code.opencv.org/issues/1834
Just creating this issue for others and maybe a PR will eventually come.