0

I am trying to build an Indian Currency Note Detector with the help of Cascade Classifier. I trained it on 200 positive images and 1000 negative images with 20 stages but it got terminated early because false alarm rate was achieved. I know that it is not an error. How ever the accuracy is pathetic, it fails to detect any note, sometimes it detects Mahatma Gandhi's photo on the note, but that is also very rare.

Also the platform that I used was Google Colab.

Any help would be appreciated.

Thank You in advance

Commands used-

For creating vector file - opencv_createsamples -info info.txt -num 200 -w 40 -h 20 -vec ./positives.vec

For training - opencv_traincascade -data data -vec positives.vec -bg bg.txt -numPos 200 -numNeg 1000 -numStages 20 -w 40 -h 20 -precalcValBufSize 5120 -precalcIdxBufSize 5120

Log file -

PARAMETERS:
cascadeDirName: data
vecFileName: positives.vec
bgFileName: bg.txt
numPos: 200
numNeg: 1000
numStages: 20
precalcValBufSize[Mb] : 5120
precalcIdxBufSize[Mb] : 5120
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: HAAR
sampleWidth: 40
sampleHeight: 20
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
Number of unique features given windowSize [40,20] : 312260

===== TRAINING 0-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 1
tcmalloc: large alloc 1498849280 bytes == 0x562833e04000 @  0x7f3d38e041e7 0x7f3d37fd7382 0x7f3d380d621b 0x562829915608 0x562829915d42 0x562829915e1a 0x56282991f1a9 0x56282990bfff 0x7f3d3729ab97 0x56282990cc1a
tcmalloc: large alloc 1498865664 bytes == 0x56288d36e000 @  0x7f3d38e041e7 0x7f3d37fd7382 0x7f3d37ff7e15 0x7f3d37ff7f21 0x5628299156fb 0x562829915d42 0x562829915e1a 0x56282991f1a9 0x56282990bfff 0x7f3d3729ab97 0x56282990cc1a
Precalculation time: 24
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|    0.132|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 1 minutes 3 seconds.

===== TRAINING 1-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.177022
tcmalloc: large alloc 1498849280 bytes == 0x562833e04000 @  0x7f3d38e041e7 0x7f3d37fd7382 0x7f3d380d621b 0x562829915608 0x562829915d42 0x562829915e1a 0x56282991f1a9 0x56282990bfff 0x7f3d3729ab97 0x56282990cc1a
Precalculation time: 22
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.359|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 2 minutes 9 seconds.

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

===== TRAINING 3-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.0292261
Precalculation time: 23
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.415|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 4 minutes 16 seconds.

===== TRAINING 4-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.0126773
Precalculation time: 22
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|    0.457|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 5 minutes 18 seconds.

===== TRAINING 5-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.00562578
Precalculation time: 22
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.567|
+----+---------+---------+
|   5|        1|    0.284|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 6 minutes 31 seconds.

===== TRAINING 6-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.00178874
Precalculation time: 22
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.561|
+----+---------+---------+
|   5|        1|    0.279|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 7 minutes 46 seconds.

===== TRAINING 7-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.000540067
Precalculation time: 23
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.615|
+----+---------+---------+
|   5|        1|     0.32|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 9 minutes 12 seconds.

===== TRAINING 8-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 0.00019292
Precalculation time: 22
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.621|
+----+---------+---------+
|   5|        1|    0.494|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 11 minutes 6 seconds.

===== TRAINING 9-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 9.82948e-05
Precalculation time: 23
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.629|
+----+---------+---------+
|   5|        1|    0.629|
+----+---------+---------+
|   6|        1|    0.481|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 13 minutes 42 seconds.

===== TRAINING 10-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 5.34855e-05
Precalculation time: 23
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.673|
+----+---------+---------+
|   5|        1|    0.819|
+----+---------+---------+
|   6|        1|    0.435|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 17 minutes 26 seconds.

===== TRAINING 11-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 2.3341e-05
Precalculation time: 22
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.591|
+----+---------+---------+
|   5|        1|    0.349|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 24 minutes 31 seconds.

===== TRAINING 12-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 9.21796e-06
Precalculation time: 24
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.791|
+----+---------+---------+
|   5|        1|    0.501|
+----+---------+---------+
|   6|        1|    0.369|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 40 minutes 22 seconds.

===== TRAINING 13-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    1000 : 3.34318e-06
Precalculation time: 24
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3|        1|        1|
+----+---------+---------+
|   4|        1|    0.742|
+----+---------+---------+
|   5|        1|    0.458|
+----+---------+---------+
END>
Training until now has taken 0 days 1 hours 22 minutes 10 seconds.

===== TRAINING 14-stage =====
<BEGIN
POS count : consumed   200 : 200
NEG count : acceptanceRatio    0 : 0
Required leaf false alarm rate achieved. Branch training terminated.
  • 1
    Haar Cascades is outdated technology and won't give good results. Why not try using CNN's instead or even a HOG based feature extractor with a linear SVM? – Vardan Agarwal Jul 03 '20 at 21:01
  • 1
    sounds like your training samples are too simple and not representative for real world images – Micka Jul 03 '20 at 21:35
  • NEG count : acceptanceRatio 0 : 0 sounds not like "false alarm rate reached" but like "no more negative training samples available" – Micka Jul 03 '20 at 21:40
  • @VardanAgarwal " *Haar Cascades is outdated technology and won't give good results* " not agree and not logical judgement – Yunus Temurlenk Jul 03 '20 at 23:11

0 Answers0