"FacialGender" (Built-in Classifier)
Classes
Details
- 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.
Examples
open all close allBasic Examples (2)
Determine the gender of a person:
Classify["FacialGender", [image]]Obtain the probabilities for the possible classes:
Classify["FacialGender", [image], "Probabilities"]Obtain a ClassifierFunction for this classifier:
c = Classify["FacialGender"]Use the classifier function to find the gender of an example:
c[[image]]Find the gender of many examples at once:
c[{[image], [image]}]Scope (2)
img = [image];
faces = ImageTrim[img, #]& /@ FindFaces[img]Use the classifier on each face:
Classify["FacialGender", faces]For images with many faces, the "FacialGender" classifier selects the largest face automatically:
Classify["FacialGender"][img]Load the ClassifierFunction corresponding to the built-in classifier:
c = Classify["FacialGender"]Obtain the possible classes using Information:
Information[c, "Classes"]Options (3)
ClassPriors (1)
Use a custom ClassPriors for the possible outputs:
Classify["FacialGender", [image], ClassPriors -> <|"Female" -> 0.5, "Male" -> 0.5|>]IndeterminateThreshold (1)
Use a custom IndeterminateThreshold:
Classify["FacialGender", [image], IndeterminateThreshold -> 0.999]UtilityFunction (1)
Obtain the utility function of the classifier:
utility = Information[Classify["FacialGender"], "UtilityFunction"]Modify this utility function to penalize "Male" being classified as "Female":
utility["Female", "Male"] = -100000;Classify an image using this new utility:
Classify["FacialGender", [image], UtilityFunction -> utility]Compare to the result with the default utility:
Classify["FacialGender", [image]]See Also
Classify FacialFeatures NetModel FindFaces
Classifiers: FacialAge FacialExpression NameGender NotablePerson NSFWImage
Related Guides
History
Introduced in 2018 (11.3)