"FacialExpression" (Built-in Classifier)
Classes
Examples
open all close allBasic Examples (2)
Determine the facial expression of a person:
Classify["FacialExpression", [image] ]Obtain the probabilities for the 3 most likely classes:
Classify["FacialExpression"][[image], "TopProbabilities" -> 3]Obtain a ClassifierFunction for this classifier:
c = Classify["FacialExpression"]Use the classifier function to classify the facial expression of an example:
c[[image]]Classify many examples at once:
c[{[image], [image]}]Scope (2)
img = [image];faces = ImageTrim[img, #]& /@ FindFaces[img]Use the classifier on each face:
Classify["FacialExpression", faces]For images with many faces, the "FacialExpression" classifier selects the largest face automatically:
Classify["FacialExpression", img]Load the ClassifierFunction corresponding to the built-in classifier:
c = Classify["FacialExpression"]Information[c, "Classes"]Options (2)
ClassPriors (1)
Use a custom ClassPriors to restrict the possible outputs:
Classify["FacialExpression", [image], ClassPriors -> <|Entity["Word", "sadness"] -> 0.5, Entity["Word", "happiness"] -> 0.5|>]IndeterminateThreshold (1)
Use a custom IndeterminateThreshold:
Classify["FacialExpression", [image], IndeterminateThreshold -> 0.6]Interactive Examples (1)
Neat Examples (1)
Obtain different expressions with their corresponding probabilities:
expressions = Classify["FacialExpression", [image], "Probabilities"]Visualize the result using WordCloud:
WordCloud[expressions]See Also
Classify FacialFeatures NetModel FindFaces CurrentImage ImageIdentify
Classifiers: FacialAge FacialGender NotablePerson NSFWImage
Related Guides
History
Introduced in 2018 (11.3)