Smile detection based on OpenCV and deep learning - with free source code

A free source code download link is provided at the end of the article

We will use the SMILES dataset to train our convolutional neural network. Once our model is trained, we will follow the same steps as in the previous tutorial to detect smiles in images and videos:

  • We will use Haar cascade to detect faces in images.
  • Extract face regions from images.
  • Pass the face regions to our network for classification.
  • Finally, we will annotate the image with the text "smiling" or "not smiling" based on the output of the network.

The SMILES dataset contains 13,165 grayscale images of 64x64 pixels, divided into 2 categories: smiling and not smiling. There are exactly 9,475  images of "non-smiling"  faces and 3,690 images of "smiling" faces. The dataset is unbalanced, which means that the images are not evenly distributed.

A common technique for dealing with imbalanced datasets is to apply class weights - we'll see how to do this when building a model.

Guess you like

Origin blog.csdn.net/tianqiquan/article/details/131525522