There's more...

Similarly, use the other pre-trained model to predict the emotion in a face in a given image (use the face detector function to detect the faces first). You should get an output like this if you draw the predicted emotions of Charlie Chaplin's face:

You may want to download the five celebrities' datasets from https://www.kaggle.com/dansbecker/5-celebrity-faces-dataset and try different face images for emotion, gender, and age recognition.

Get Python Image Processing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.