"FacialGender" (Built-in Classifier)

Predict what gender a face appears to be.



  • The classifier is applied to the largest face found in the image.
  • The classifier is based on the MobileNet Model Trained on UTKFace Large-Scale Face Dataset.
  • The classifier may download resources that will be stored in your local object store at $LocalBase, and that can be listed using LocalObjects[] and removed using ResourceRemove.


open allclose all

Basic Examples  (2)

Determine the gender of a person:

Obtain the probabilities for the possible classes:

Obtain a ClassifierFunction for this classifier:

Use the classifier function to find the gender of an example:

Find the gender of many examples at once:

Scope  (2)

Find faces in an image:

Use the classifier on each face:

For images with many faces, the "FacialGender" classifier selects the largest face automatically:

Load the ClassifierFunction corresponding to the built-in classifier:

Obtain the possible classes using Information:

Options  (3)

ClassPriors  (1)

Use a custom ClassPriors for the possible outputs:

IndeterminateThreshold  (1)

Use a custom IndeterminateThreshold:

UtilityFunction  (1)

Obtain the utility function of the classifier:

Modify this utility function to penalize "Male" being classified as "Female":

Classify an image using this new utility:

Compare to the result with the default utility: