OpenCV Haar Results Table Explanation

I am trying to create a Haar classifier for recognizing objects, but I can’t understand what the result table created at each stage looks like.

eg. one

===== TRAINING 1-stage ===== <BEGIN POS count : consumed 700 : 700 NEG count : acceptanceRatio 2500 : 0.452161 Precalculation time: 9 +----+---------+---------+ | N | HR | FA | +----+---------+---------+ | 1| 1| 1| +----+---------+---------+ | 2| 1| 1| +----+---------+---------+ | 3| 1| 1| +----+---------+---------+ | 4| 1| 1| +----+---------+---------+ | 5| 1| 0.7432| +----+---------+---------+ | 6| 1| 0.6312| +----+---------+---------+ | 7| 1| 0.5112| +----+---------+---------+ | 8| 1| 0.6104| +----+---------+---------+ | 9| 1| 0.4488| +----+---------+---------+ END> 

eg. 2

 ===== TRAINING 2-stage ===== <BEGIN POS count : consumed 500 : 500 NEG count : acceptanceRatio 964 : 0.182992 Precalculation time: 49 +----+---------+---------+ | N | HR | FA | +----+---------+---------+ | 1| 1| 1| +----+---------+---------+ | 2| 1| 1| +----+---------+---------+ 

I am not sure what N , HR and FA refer to in each of these cases. Can someone explain what they mean and what they mean?

+7
opencv haar-classifier
source share
1 answer

Searching for "HR" in an OpenCV source leads us to this . Lines 1703-1707 inside CvCascadeBoost::isErrDesired print the table:

 cout << "|"; cout.width(4); cout << right << weak->total; cout << "|"; cout.width(9); cout << right << hitRate; cout << "|"; cout.width(9); cout << right << falseAlarm; cout << "|" << endl; cout << "+----+---------+---------+" << endl; 

So HR and FA stand for hit rate and false alarm. Conceptually: hitRate =% of positive samples that are classified as such. falseAlarm =% negative samples incorrectly classified as positive.

Reading the code for CvCascadeBoost::train , we can see the following in a loop

 cout << "+----+---------+---------+" << endl; cout << "| N | HR | FA |" << endl; cout << "+----+---------+---------+" << endl; do { [...] } while( !isErrDesired() && (weak->total < params.weak_count) ); 

Just looking at it and not knowing the specifics of the increase, we can make an educated assumption that the training works until the error is low enough, as measured by falseAlarm.

+11
source share

All Articles