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

OpenAlpr Training indian number plates #25

Open rawat123 opened 6 years ago

rawat123 commented 6 years ago

Hi, OS: windows 10 I am trying to train for Indian number plates, and I have some image in positive directory. indian license plate standard is 500 120 mm, so I created a 500 120 mm image and in pixels it converts to 1417*340 px.

I run the 'prep.py neg' and it counts all files as it creates a negative.txt in negative directory and there are all negative files are listed.

I tried running 'prep.py pos' and there was 40 images in my folder 'in'(country code) and positive directory was empty before running the command and after executing the 'prep.py pos' command all files got copied from 'in' folder to 'positive' folder and output of the command is below.

C:\Users\LaserTrac\Downloads\alpr\train-detector-master>python prep.py pos
Pos
Exception reading image file: positive.txt
C:/Users/LaserTrac/Downloads/opencv1/opencv/build/x64/vc14/bin/opencv_createsamples -vec C:/Users/LaserTrac/Downloads/alpr/train-detector-master/positive/vecfile.vec -w 1417 -h 340 -info C:/Users/LaserTrac/Downloads/alpr/train-detector-master/positive/positive.txt -num 0
Info file name: C:/Users/LaserTrac/Downloads/alpr/train-detector-master/positive/positive.txt
Img file name: (NULL)
Vec file name: C:/Users/LaserTrac/Downloads/alpr/train-detector-master/positive/vecfile.vec
BG  file name: (NULL)
Num: 0
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
Width: 1417
Height: 340
Max Scale: -1
RNG Seed: 12345
Create training samples from images collection...
Done. Created 0 samples

and positive.txt file was empty. please help.

debihiga commented 6 years ago

Hi, it's throwing you an exception: Exception reading image file: positive.txt Line 145 (aprox) from prep.py. Maybe because you deleted all the content inside "positive" folder. Try to restore original positive.txt and vecfile.vec.

rawat123 commented 6 years ago

I think it creates those file. like 'prep.py neg' it creates negative.txt in "negative" folder and after executing 'prep.py pos' it creates a positive.txt in positive folder but files was empty

debihiga commented 6 years ago

Yep, I've just tested it and created those files and worked for me. Also, it should not reach that exception as in line 134 continues with the next iteration of the loop if extension is .txt. Check correct indentation. Try/except (line 136) must be inside for loop (line 130).