Learn practical skills, build real-world projects, and advance your career

Happy, Sad, or Angry?

alt
#@title Importing the Lovelies
%%capture
! [ -e /content ] && pip install -Uqq fastbook
import fastbook
fastbook.setup_book()
!pip install nbdev
from fastbook import *
from fastai.vision.widgets import *
import nbdev
from fastai.vision import *
from pathlib import Path
import PIL

!pip install -q jmd_imagescraper
from jmd_imagescraper.core import * 
from jmd_imagescraper.imagecleaner import *

➢ Setting up the path where images will be saved

categories=['happy', 'sad', 'angry']
path = Path().cwd()/"faces"   # assigns path to current working directory

➢ Downloading 400 images of each facial expression

It took a lot of experimenting with the best search strings for getting the most images of actual human faces showing the three emotions rather than getting primarily emojis showing the emotions. I did happen to get a model 100% accurate on discerning emoji emotions. But that was not nearly as interesting to me as the challenge of classifying the emotions from human image data.