Giter Club home page Giter Club logo

smile_detection_hromada's Introduction

Smile Detection

Project Objectives

Implement a convolutional neural network capable of detecting a person smiling or not:

  • Constructed LeNet architecture from scratch.
  • Trained a model on a dataset of images that contain faces of people who are smiling or not smiling.
  • Developed a script to detect smile in real-time.

Language / Packages Used

Approaches

The dataset, named SMILES, comes from Daniel Hromada (check reference). There are 13,165 images in the dataset, where each image has a dimension of 64x64x1 (grayscale). And the images in the dataset are tightly cropped around the face.

The Figure 1 shows some examples of smiling image, and Figure 2 shows some example of not smiling image.

alt text alt text alt text alt text alt text

Figure 1: Positive example of the dataset (smiling).

alt text alt text alt text alt text alt text

Figure 2: Negative example of the dataset (not smiling).

Results

Build the LeNet architecture from scratch

The LeNet architecture can be found in lenet.py inside pipeline/nn/conv/ directory. The input to the model includes dimensions of the image (height, width, the depth), and number of classes. In this project, the input would be (width = 28, height = 28, depth = 1, classes = 2).

Table 1 demonstrates the architecture of LeNet. The activation layer is not shown in the table, which should be one after each CONV layer. The ReLU activation function is used in the project.

Layer Type Output Size Filter Size / Stride
Input Image 28 x 28 x 1
CONV 28 x 28 x 20 5 x 5, K = 20
POOL 14 x 14 x 20 2 x 2
CONV 14 x 14 x 50 3 x 3, K = 50
POOL 7 x 7 x 50 2 x 2
FC 500
softmax 2

Table 1: Summary of the LeNet architecture.

Train the Smile CNN

The train_model.py is used for the training process. The weighted model will be saved after training (chere here).The saved model can be used for detecting smile in real-time later.

Figure 3 shows the plot of loss and accuracy for the training and validation set. As we can see from the figure, validation loss past 6th epoch starts to stagnate. Further training past 15th epoch may result in overfitting. Implement data augmentation on training set would be a good future "next-step" plan.

alt text

Figure 3: Plot of loss and accuracy for the training and validation set.

Figure 4 illustrates the evaluation of the network, which obtains about 92% classification accuracy on validation set.

alt text

Figure 4: Evaluation of the network.

Run the Smile CNN in real-time

smile_detection_hromada's People

Contributors

meng1994412 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.