Code Monkey home page Code Monkey logo

facial-expression-recognition's Introduction

A Pytorch Implementation of FER(Facial-Expression-Recognition)

Introduction

This project aims to classify facial expression. Here I provide seven types of expression, including Angry Disgusted Fearful Happy Sad Surprised Neutral. With 250 epochs, this accuracy of baseline achieves 70.382%

Here is the trained model link: ———— Trained Model Link password:5nfw

  • Backbone ——VGG16
  • Dataset ——FER2013:

Dataset Link 240×240 Data(Train、Val、Test) password:5j3x Backbone

Highlight

  • In this project, face detection part is applied, which can definitely improve the test accuracy. More over, it can support the robust of the model, especially no face input image.
  • GPU and CPU all support. If no GPU, it's OK.
  • Dependencies fewer.
  • When testing, batch images input is supported in the demo.

Results Show

Result1 Result2

Requirement

Recommend to use Anaconda

  • Ubuntu16.04 (Windows also avaliable)
  • Python 3.6
  • Pytorch (latest version or old version are all fine)
  • torchvision
  • numpy
  • matplotlib
  • opencv(cv2)
  • pillow

Dataset Process

FER2013 includes 35887 pictures: 48 × 48 pixels, here using bilinear interpolation to resize the expression pictures to 240 × 240 pixels. The input of the net is 224 × 224, same as original VGG16.

Train

First, put the processed dataset in the folder "data", the data folder like following:

-- data
------- train
------------------ 0
---------------------------00000.jpg
---------------------------00005.jpg
...
------------------ 1
---------------------------00023.jpg
...
...
------------------ 6
---------------------------00061.jpg
...

------- val
------------------ 0
---------------------------00006.jpg
...
------------------ 1
---------------------------00043.jpg
...
...
------------------ 6
---------------------------00021.jpg
...

------- test
------------------ 0
---------------------------00008.jpg
...
------------------ 1
---------------------------00011.jpg
...
...
------------------ 6
---------------------------00022.jpg
...

0-6 represent 7 different expression: Angry Disgusted Fearful Happy Sad Surprised Neutral

Demo

Image Input

python demo_image.py

Running the demo, first need to type the image name, such as 1.jpg.

Put input images in input folder

Camera Detection

python demo_camera.py

Batch Image Input

python demo_image_batch.py

TODO

Find image process methods to improve the accuracy.

Apply RPN face detection to improve accuracy.

Issue and Suggestion

Any questions, open a new issue.

If helpful, please give me a star

Reference

facial-expression-recognition's People

Contributors

leonard-niu 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.