Skip to content

Commit 4f60cf7

Browse files
committed
README:s from sample preparation in Training* directories
register-plate recognition with haar-cascade seems to work well enought, using cascade.xml as rekkari.xml from TrainingWithITO40_positivesfromscaled
1 parent 38c2c35 commit 4f60cf7

File tree

2 files changed

+134
-0
lines changed
  • TrainingWithITO40
  • TrainingWithITO40_positivesfromscaled

2 files changed

+134
-0
lines changed

TrainingWithITO40/README

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Rekkari
2+
Recognition of a numberplate of a car
3+
4+
1) Positive samples are in
5+
~/PycharmProjects/Rekkari/TrainingWithITO40/PositivePicturesFromPhone
6+
python3 ../../picture2rectangle.py 10
7+
Various resolutions are in directories Rectangle*
8+
unscaled samples with original resolution of the rectangle
9+
box are in dir 'NotScaled'
10+
Negative samples are in dir 'NegativeSamples'
11+
(they have white ball on top of plates)
12+
clipped images go to dir 'Rectangle*'
13+
14+
accepted full images go to dir 'NotScaled'
15+
images with rectangle replaced by ball go to dir 'NegativeSamples'
16+
17+
copy positive samples to positive_samples directory
18+
mkdir ../positive_samples; cp NotScaled/* ../positive_samples
19+
20+
2) copy negative samples to negative_samples directory
21+
you can generate more negatives by google picture search by
22+
python3 ../../get_google_images.py "stad bil gata"
23+
(remember to manually remove positive figures here)
24+
You can process files by
25+
python3 ../../../add_balls.py
26+
# if the 'r' key is pressed, reset the cropping region
27+
# if the 'c' key is pressed, accept rectanglecp
28+
# if the 'k' key is pressed, keep the original
29+
# if the 'd' key is pressed, do not write image (it is virtually deleted)
30+
31+
which writes to 'HumanProcessed' directory
32+
Also copy files in cp HumanProcessed/* ../negative_samples/
33+
34+
3) find ./negative_samples -iname "*.jpg" > negatives.txt
35+
cp PositivePicturesFromPhone/NotScaled/* positive_images/
36+
find ./positive_samples -iname "*.jpg" > positives.txt
37+
4)
38+
create distorted positive samples:
39+
perl ../opencv-haar-classifier-training/bin/createsamples.pl positives.txt negatives.txt samples 1000 "opencv_createsamples -maxxangle 1 -maxyangle 0.1 -maxzangle 0.1 -maxidev 30 -w 37 -h 10"
40+
41+
check: opencv_createsamples -w 37 -h 10 -vec ./samples/*vec
42+
43+
5)
44+
merge positive *.vec files to one vec file
45+
python2 ~/Dropbox/Apu/mergevec.py -v samples -o positives.vec
46+
#python2 ../opencv-haar-classifier-training/tools/mergevec.py -v samples -o positives.vec
47+
check: opencv_createsamples -w 37 -h 10 -vec positives.vec
48+
49+
4) generate vec file of positive samples
50+
NOT USED
51+
cp positives.txt info.txt
52+
edit info.txt to contain pixel info
53+
> ./positive_images/sample_IMG_20170307_102910.jpg 1 0 0 80 20
54+
> ...
55+
opencv_createsamples -num 36 -info info.txt -w 80 -h 20 -vec positives.vec
56+
57+
6) train:
58+
check: opencv_createsamples -w 37 -h 10 -vec positives.vec
59+
rm -f classifier/*
60+
mkdir classifier
61+
opencv_traincascade -data classifier -vec positives.vec -bg negatives.txt\
62+
-numStages 50 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 \
63+
-numNeg 529 -w 37 -h 10 -mode ALL -precalcValBufSize 512\
64+
-precalcIdxBufSize 512
65+
66+
7) in rekkariDetection.py play with parameters
67+
rekkari_cascade.detectMultiScale(img, 1.1, scale)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Rekkari
2+
Recognition of a numberplate of a car
3+
4+
1) Positive samples are in
5+
~/PycharmProjects/Rekkari/TrainingWithITO40/PositivePicturesFromPhone
6+
python3 ../../picture2rectangle.py 10
7+
Various resolutions are in directories Rectangle*
8+
unscaled samples with original resolution of the rectangle
9+
box are in dir 'NotScaled'
10+
Negative samples are in dir 'NegativeSamples'
11+
(they have white ball on top of plates)
12+
clipped images go to dir 'Rectangle*'
13+
14+
accepted full images go to dir 'NotScaled'
15+
images with rectangle replaced by ball go to dir 'NegativeSamples'
16+
17+
copy positive samples to positive_samples directory
18+
mkdir ../positive_samples; cp NotScaled/* ../positive_samples
19+
20+
2) copy negative samples to negative_samples directory
21+
you can generate more negatives by google picture search by
22+
python3 ../../get_google_images.py "stad bil gata"
23+
(remember to manually remove positive figures here)
24+
You can process files by
25+
python3 ../../../add_balls.py
26+
# if the 'r' key is pressed, reset the cropping region
27+
# if the 'c' key is pressed, accept rectanglecp
28+
# if the 'k' key is pressed, keep the original
29+
# if the 'd' key is pressed, do not write image (it is virtually deleted)
30+
31+
which writes to 'HumanProcessed' directory
32+
Also copy files in cp HumanProcessed/* ../negative_samples/
33+
34+
3) find ./negative_samples -iname "*.jpg" > negatives.txt
35+
cp PositivePicturesFromPhone/Rectangle-37-10/* positive_images/
36+
find ./positive_samples -iname "*.jpg" > positives.txt
37+
4)
38+
create distorted positive samples:
39+
perl ../opencv-haar-classifier-training/bin/createsamples.pl positives.txt negatives.txt samples 1000 "opencv_createsamples -maxxangle 1 -maxyangle 0.1 -maxzangle 0.1 -maxidev 100 -w 37 -h 10"
40+
41+
check: opencv_createsamples -w 37 -h 10 -vec ./samples/*vec
42+
43+
5)
44+
merge positive *.vec files to one vec file
45+
python2 ~/Dropbox/Apu/mergevec.py -v samples -o positives.vec
46+
#python2 ../opencv-haar-classifier-training/tools/mergevec.py -v samples -o positives.vec
47+
check: opencv_createsamples -w 37 -h 10 -vec positives.vec
48+
49+
4) generate vec file of positive samples
50+
NOT USED
51+
cp positives.txt info.txt
52+
edit info.txt to contain pixel info
53+
> ./positive_images/sample_IMG_20170307_102910.jpg 1 0 0 80 20
54+
> ...
55+
opencv_createsamples -num 36 -info info.txt -w 80 -h 20 -vec positives.vec
56+
57+
6) train:
58+
check: opencv_createsamples -w 37 -h 10 -vec positives.vec
59+
rm -f classifier/*
60+
mkdir classifier
61+
opencv_traincascade -data classifier -vec positives.vec -bg negatives.txt\
62+
-numStages 50 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 \
63+
-numNeg 529 -w 37 -h 10 -mode ALL -precalcValBufSize 512\
64+
-precalcIdxBufSize 512
65+
66+
7) in rekkariDetection.py play with parameters
67+
rekkari_cascade.detectMultiScale(img, 1.1, scale)

0 commit comments

Comments
 (0)