So now that the limitation of the performance application has been identified what does that mean for the previous haar classifiers we have tested and analyzed this far? Well to put it bluntly they were wrong. The results did not truly reflect the classifiers accuracy. So I took the haarcascade15, since this classifier had the best overall results without taking into account the size and position differences.
Hit rate ≈ 57.1%



The coding excerpt that handles the size and position difference values and calculates whether the detected area is considered a true positive detection (HIT).
det is a pointer to an ObjectPos struct that contains the values for the detected rectangle.
ref is a pointer to an ObjectPos struct that contains the values for the referenced rectangle that was identified through the ObjectMarker.

                    found = 0;
                    for( j = 0; j < refcount; j++ )
                        distance = sqrtf( (det[i].x - ref[j].x) * (det[i].x - ref[j].x) + 
                                          (det[i].y - ref[j].y) * (det[i].y - ref[j].y) );
                        if( (distance < ref[j].width * maxPosDiff) &&
                            (det[i].width > ref[j].width / maxSizeDiff) &&
                            (det[i].width < ref[j].width * maxSizeDiff) )
                            ref[j].found = 1;
                            ref[j].neghbors = MAX( ref[j].neghbors, det[i].neghbors );
                            found = 1;

With specifying the values for a size and position difference it was pretty much trial and error to see which values gave the most desirable results. These values seemed to do well, and keep the detections within bounds of the real detections.

Performance.exe -data "F:\Thesis_Research\AutomatedDetector\HaarClassifier\haarcascade15\haarcascade15.xml" -info "F:\Thesis_Research\AutomatedDetector\Test_Sets\Positive_Solar_Cavities\positivesoutput.txt" -maxSizeDiff 5 -maxPosDiff 4

Below is the more accurate portrayal of the classifiers detection rates, this rate is about 89.5% which is definitely alot better than the 57.1% I was racking my brain over before.

Hit rate ≈ 89.4%



Tags: , , , ,

4 Comments on Performance ::: haarcascade15 :::

  1. love this site – it’s a great blog – may i suggest you get an rss feed.

    • Athena says:

      Thanks! I really appreciate it! There is an RSS feed icon on the homepage you should be able to click on that to get the feeds. Let me know if this is not working for you.

  2. yngjng says:

    hello…i have question here…
    inside opencv_performance….there is a struct called “ObjectPos”
    and a member variable width inside it.

    ObjectPos.width = sqrtf(0.5F * (width*width + height*height));

    What does this width means? any specific name for above equation?


    • Athena says:

      In the performance application it reads in your markup file to get the coordinates that you deemed was a positive ROI (region of interest), for example

      <name_of_image> <no_of_ROI> <x> <y> <width> <height>
      2001_06_27_AIA193.jpg 1 738 109 54 71

      But the performance application only marks images as a square as opposed to a rectangle, so it uses that above calculation to get an overall width value with taking into consideration the width and the height from your marked rectangle. In order to do this it uses the formula for getting the diagonal of a rectangle, and it uses that as the width of the square.

      Diagonal of rectangle
      sqrt ( length ^2 + width ^2)

      Hope this helps!

Leave a Reply