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

Problem in stage-2 #16

Closed ChillyGuy closed 8 years ago

ChillyGuy commented 8 years ago

Hello,

I have been messing around with openalpr project for somedays now and been reading about it as much as i could however theres a problem which remains unanswered.

Im trying to train openalpr plate detector for certain angles, i gathered around 1000 plates as positive image changed the prep script regarding to my needs and executed the script, for some reason i ran into the problem which is written below :

TRAIN
Traceback (most recent call last):
  File "./prep.py", line 184, in <module>
    execStr = '%s/opencv_traincascade %s %s %s %s -numPos %d -numNeg %d -maxFalseAlarmRate 0.45 -featureType LBP -numStages 13' % (OPENCV_DIR, data_arg, vector_arg, bg_arg, width_height_arg, num_pos_samples, num_neg_samples )
NameError: name 'num_neg_samples' is not defined

somehow after executing /prep.py train command variable "num_neg_samples" can not be located in python, after a quick look i added num_neg_samples = file_len(NEGATIVE_INFO_FILE) below " num_pos_samples = file_len(POSITIVE_INFO_FILE)" to the line 173 this took care of my variable problem but after executing train command process stops in stage 2

===== TRAINING 2-stage =====
<BEGIN
POS count : consumed   1 : 1
Train dataset for temp stage can not be filled. Branch training terminated.

thanks in advance :)

ChillyGuy commented 8 years ago

Ok if anyone else banging hes head against the wall with the similar problem. 1st as readme instructs gather 3000+ plate images. in my case problem was after every stage opencv adds to the positive number which is provided from ./prep.py train to resolve this issue i prepared 3198 plates and reduced the number after train command to 3000 and it worked like a charm.

merimem commented 7 years ago

Hello, Can you tell me please where I can find the prep.py script? I installed openalpr and it works fine but when i try to do the training I couldn't find this script. Thank you in advance

ChillyGuy commented 7 years ago

Hi, Try these two links you can find everything needed to train ocr or detector. http://doc.openalpr.com/opensource.html#training-ocr http://doc.openalpr.com/opensource.html#training-the-detector