Let's now see a more complex problem—recognize facial expressions from pictures of human faces. For this we will use the Facial Expression Recognition (FER) 2013 dataset. This is a challenging task, as there are many mislabelled images, some are not centered well, and a few are not even human faces. Currently, in the literature, accuracy is below 75% for CNNs trained from scratch on only the FER 2013 dataset.
The FER 2013 dataset is provided on a comma-separated values (CSV) file, but as we want to demonstrate another way of reading the data we will transform it into a collection of images to make it easier to inspect the dataset:
#!/usr/bin/env python
# coding: utf-8
import os
import pandas as pd
from PIL import Image
# Pixel values range from 0 to 255 (0 is normally black and 255 is white)
basedir = os.path.join('..', 'data...