Custom classifier for gender prediction with masks

Hello,

I have a few questions on how to train a custom openCV classifier. I hope the right people can answer this.

  1. I am thinking of training one classifier with masked male images as positive images and masked female images as negative images. Will this work? or do I need to create two custom classifiers one for detecting male gender with masked male images as positive and everything else as negative images and vice versa for the case females.

  2. How many positive and negative images should I use for training the custom classifier?

  3. What model does OpenCV use for object detection?

  4. Finally, can you explain the content of an example cascade XML file is. An example shown below

<opencv_storage>
<cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>
 <featureType>HAAR</featureType>
 <height>24</height>
 <width>24</width>
 <stageParams>
  <maxWeakCount>211</maxWeakCount>
 </stageParams>
 <featureParams>
  <maxCatCount>0</maxCatCount></featureParams>
 <stageNum>25</stageNum>
 <stages>
    <_> 
      <maxWeakCount>9</maxWeakCount>
      <stageThreshold>-5.0425500869750977e+00</stageThreshold>
      <weakClassifiers>

cascades are for detecting a single object class, you cannot use them for a 2 class classification problem.

nope, since buses, stop signs and dogs are also “not male human”

again, no it won’t work.

in the end, you will need 2 things:

  • a human face detection (with masks) (maybe this could be a cascade)
  • a male/female classifier (not a cascade, but a cnn or such)

Thank you so much for the quick response Berak. I will look further into it to understand how this can help me.

Can you also explain the content of the XML or redirect me to a link where I can understand this?

Thanks
Anish Paul

have a look at the docs (and read the paper !)

Thanks, berak for all the help, sorry for asking dumb questions.