openalpr / train-detector

Input files and scripts necessary to train the license plate detector.
GNU Affero General Public License v3.0
125 stars 166 forks source link

opencv_traincascade "Can not get new positive sample" -> figure num samples automagically #2

Open Silex opened 10 years ago

Silex commented 10 years ago

Hello,

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."

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.

lastessa commented 10 years ago

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