Need help optimizing training setup to detect all german traffic signs

asked 2018-03-09 11:29:29 -0600

Hello dear OpenCV gurus,

I am a beginner with computer vision and need your help.

I need to detect all different types of german traffic signs (~600) and want to use OpenCV to do so.


In an Android and iOS App the user either takes a picture of a sign post or a single traffic sign where most of the picture is filled by that single sign (size of the longer side is 1536px).

Picture from mobile where vz151 should be detected

Picture from mobile where vz151 should be detected

I want to ease the process of selecting the type of the traffic sign by detecting which sign is on that picture.


I have the official SVG files of each traffic sign, so I created PNGs for each with a transparent background and from those samples using opencv_createsamples with several background images using -num and -max*angle parameters, but training using those did not work well - and apparently using real-world images is a better source.

SVGs of traffic signs SVGs of traffic signs


I also have a database (which is small yet, but will grow fast in the near future) where for each traffic sign I have a number of real-world pictures with the manually set annotations where exactly in the picture the sign is located (x y width height - like opencv_annotation).

I created samples (.vec) (via opencv_createsamples using the annotations from the database in sizes 102x90 and 102x102 according to their ratio) and trained using a list of negatives (.neg) for the five signs vz114, vz151, vz205, vz267, vz306 - the ones I currently have the most real-world pictures of.


Picture from mobile of a background for a sign

Picture from mobile of a background for a sign

First I tried using only backgrounds in which the signs might occur as negatives (in their original size 2448x3264px). As the identification did not work well I tried with those backgrounds downscaled to 816x216px and prepending downscaled versions (to 125px for the longer side) of the all the other signs to the negatives of each sign (so vz114 has the positives of vz151, vz205, vz267, vz306 and downscaled backgrounds as negatives, vz151 has the positives of vz114, vz205, vz267, vz306 and downscaled backgrounds as negatives and so on).

downscaled version of an annotated vz114 used as a negative when training vz151 downscaled version of an annotated vz114 used as a negative when training vz151

downscaled version of an annotated vz151 used as a negative when training vz114 downscaled version of an annotated vz151 used as a negative when training vz114


Log of training for vz114 (109 samples):

PARAMETERS:
cascadeDirName: classifier/vz114/
vecFileName: vz114_102x90.vec
bgFileName: vz114.neg
numPos: 102
numNeg: 1000
numStages: 20
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : 0.0001
stageType: BOOST
featureType: LBP
sampleWidth: 102
sampleHeight: 90
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
Number of unique features given windowSize [102,90] : 2292195

===== TRAINING 0-stage =====
<BEGIN
POS count : consumed   102 : 102
NEG count : acceptanceRatio    1000 : 1
Precalculation time: 10
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|    0.015|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 3 minutes 27 seconds.

===== TRAINING 1-stage =====
<BEGIN
POS count : consumed   102 : 102
NEG count : acceptanceRatio    1000 : 0.262055
Precalculation ...
(more)
edit retag flag offensive close merge delete

Comments

2

first, no you probably cannot use a cascade classifier for this. there are like 200 different traffic signs, you cannot train a single cascade for all of them, and one cascade foreach sign does not seem feasible, either.

read up a bit about deep learning, especially SSD networks (or YOLO) might be a much better option here, as they're able to give you probabilities, classid's and bboxes in one go. (you'd need the original frame work to train your classifier, but you can use opencv for the detections later)

also re-training existing classifiers there can be done with a surprisingly small amount of data (like 20 images for each sign)

berak gravatar imageberak ( 2018-03-09 11:37:57 -0600 )edit