Custom classifier for gender prediction with masks


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

<cascade type_id="opencv-cascade-classifier"><stageType>BOOST</stageType>

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?

Anish Paul

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

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