FER-2013

The Facial Expression Recognition 2013 (FER-2013) Dataset

Originator: Pierre-Luc Carrier and Aaron Courville

Classify facial expressions from 35,685 examples of 48x48 pixel grayscale images of faces. Images are categorized based on the emotion shown in the facial expressions (happiness, neutral, sadness, anger, surprise, disgust, fear).

Examples

Basic Examples

Retrieve a sample of the data:

In[1]:=
RandomSample[ResourceData["FER-2013"], 25]
Out[2]=

Analysis

Select one image of each facial expression:

In[3]:=
sample = Cases[ResourceData["FER-2013"], HoldPattern[_ -> #]][[-1]] & /@ {Entity["Emotion", "Happiness::d8973"], Entity["Emotion", "Neutral::7468h"], Entity["Emotion", "Sadness::t2566"], Entity["Emotion", "Anger::bb6bt"], Entity["Emotion", "Surprise::dj3w9"], Entity["Emotion", "Disgust::s4t7h"], Entity["Emotion", "Fear::7k5tk"]}
Out[4]=

Use a built-in classifier:

In[5]:=
classifier = Classify["FacialExpression"]
Out[5]=

Test the built-in classifier on a set of images:

In[6]:=
classifier[Keys[sample]]
Out[6]=

Create a larger test set:

In[7]:=
test = RandomSample[ResourceData["FER-2013"], 300];

Measure the accuracy of the classifier on the test set:

In[8]:=
cm = ClassifierMeasurements[classifier, test]
Out[8]=

Visualize that accuracy of the classifier:

In[9]:=
cm["ConfusionMatrixPlot"]
Out[9]=

Wolfram Research, "FER-2013" from the Wolfram Data Repository (2018)  

Data Resource History

Source Metadata

Publisher Information