简体   繁体   中英

What are the meanings of various parameters in OpenCV LBP cascade classifier model XML file?

I am trying to implement LBP face detector on FPGA. For that I want to train the detector in OpenCV and use the model in the RTL code. I tried to dig into already existing LBP frontal face model . I also studied about the cascade classifier which is a cascade of weak classifiers with each weak classifier having its own weight. However, I am not able to clearly correlate the theory I studied with the model in the XML file. Considering a sample stage form this model:

<!-- stage 0 -->
<_>
  <maxWeakCount>3</maxWeakCount>
  <stageThreshold>-0.7520892024040222</stageThreshold>
  <weakClassifiers>
    <!-- tree 0 -->
    <_>
      <internalNodes>
        0 -1 46 -67130709 -21569 -1426120013 -1275125205 -21585
        -16385 587145899 -24005</internalNodes>
      <leafValues>
        -0.6543210148811340 0.8888888955116272</leafValues></_>
    <!-- tree 1 -->
    <_>
      <internalNodes>
        0 -1 13 -163512766 -769593758 -10027009 -262145 -514457854
        -193593353 -524289 -1</internalNodes>
      <leafValues>
        -0.7739216089248657 0.7278633713722229</leafValues></_>
    <!-- tree 2 -->
    <_>
      <internalNodes>
        0 -1 2 -363936790 -893203669 -1337948010 -136907894
        1088782736 -134217726 -741544961 -1590337</internalNodes>
      <leafValues>
        -0.7068563103675842 0.6761534214019775</leafValues></_></weakClassifiers></_>
<!-- stage 1 -->

My specific questions are:

  1. What are the numbers in ? I think the numbers 0 and -1 correspond to left and right nodes of the stump (correct me if I am wrong) and 46 refers to the feature number. I am not clear about other 7 integers here.
  2. After computing all 3 LBP features (46, 13 and 2 in here), how do I decide whether the stage is pass or fail?
  3. I studied that LBP features are 8 bit unsigned numbers (0 to 255). But I don't understand why those large +ve and -ve integers are present in the model. Ex: -67130709 -21569 -1426120013 -1275125205 -21585 -16385 587145899 -24005

I appreciate any suggestions. Thanks.

  1. You are right. First two numbers refer to indexes of nodes in tree. If index is <= 0 it indicates that it's leaf node. So, in your example it's definately stump-based tree. 46 is index of LBP feature. Another 8 values is subset masks. To understand how it works please see this line of code ( c is value of LBP feature):

     tmp += (subset[c>>5] & (1 << (c & 31))) ? stump.left : stump.right; 
  2. When you compute LBP feature for each tree, you should calculate leaf index (see link to line of code above). Then you need to sum leaf values among all trees on this stage. If this sum is less than <stageThreshold> the stage is failed.

  3. See the first point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM