What is the meaning of values in stage.xml and cascade.xml for opencv cascade classifier

前端 未结 1 1588
旧时难觅i
旧时难觅i 2021-01-03 05:02

I have tried to detect something from a tutorial. When training have finished, stage files and cascade file is created. I have knowledge about the algorithm but I don\'t kno

相关标签:
1条回答
  • 2021-01-03 05:34

    Let's start with first block:

    <internalNodes>
            0 -1 13569 2.8149113059043884e-003</internalNodes>
    <leafValues>
            9.8837211728096008e-002 -8.5897433757781982e-001</leafValues></_> 
    

    It describes one of the weak classifier. In such case it's stump based, i.e. it's tree with max depth is equal to 1. 0 and -1 it's indexes of left and right child of root node. If indexes less or equal to zero it indicates that it's leaf nodes. Note that to calculate leaf index you need to negate it. Next number (13569) is index of feature in <features> section. And next number (2.8149113059043884e-003) is node threshold. In leafValues section presented weights of leafs in cascade tree.

    For example, in this weak classifier we need to calculate value of 13569 feature. Next, compare this value with threshold (2.8149113059043884e-003) and if it less that threshold than you need to add the first leaf value (9.8837211728096008e-002) else you need to add the second leaf value (-8.5897433757781982e-001).

    Next section describes one of the Haar feature:

    <rects>
            <_>
              0 0 3 1 -1.</_>
            <_>
              1 0 1 1 3.</_></rects>
    <tilted>0</tilted></_>
    

    It obviously describes parameters of rectangle (x, y, width, height) and the weight of rectangle. It also may be tilted, that indicates by <tilted>0</tilted> flag.

    I hope it will help.

    0 讨论(0)
提交回复
热议问题