Giter Club home page Giter Club logo

fer2013's Introduction

FER2013

forthebadge made-with-python

Open Source Love svg1 GitHub release Maintenance Ask Me Anything ! PyPI pyversions

Kaggle Challenge - https://www.kaggle.com/c/challenges-in-representation-learning-facial-expression-recognition-challenge/data

Facial Emotion Recognition on FER2013 Dataset Using a Convolutional Neural Network.

80-10-10 ratio for training-validation-test sets.

Winner - 71.161% accuracy

This Model - 66.369% accuracy

emotions

Getting Started

These instructions will get this model up and running. Follow them to make use of the fertestcusstom.py file to recognize facial emotions using custom images. This model can also be used as facial emotion recognition part of projects with broader applications

Prerequisites

Install these prerequisites before proceeding-

 pip3 install tensorflow
 pip3 install keras
 pip3 install numpy
 pip3 install sklearn
 pip3 install pandas
 pip3 install opencv-python

Method 1 : Using the built model

If you don't want to train the classifier from scratch, you can make the use of fertestcustom.py directly as the the repository already has fer.json (trained model) and fer.h5 (parameters) which can be used to predict emotion on any test image present in the folder. You can modify fertestcustom.py according to your requirements and use it to predict fatial emotion in any use case.

Method 2 : Build from scratch

Clone this repository using-

git clone https://github.com/gitshanks/fer2013.git

Download and extract the dataset from Kaggle link above.

Run the preprocessing.py file, which would generate fadataX.npy and flabels.npy files for you.

Run the fertrain.py file, this would take sometime depending on your processor and gpu. Took around 1 hour for with an Intel Core i7-7700K 4.20GHz processor and an Nvidia GeForce GTX 1060 6GB gpu, with tensorflow running on gpu support. This would create modXtest.npy, modytest,npy, fer.json and fer.h5 file for you.

Running the tests (Optional)

You can test the accuracy of trained classifier using modXtest.npy and modytest.npy by running fertest.py file. This would give youy the accuracy in % of the recently trained classifier.

Getting the Confusion Matrix (Optional)

You can get the confusion matrix for this model by running confmatrix.py file. This would evaluate the most confused expressions and generate a confusionmatrix.png file for your trained model, which would look something like this.

confusionmatrix

Model Summary

The layers in the Convolution Neural Network used in implementing this classifier can be summarized as follows. You can git a similar summary by decommenting the model.summar() function before executing fertrain.py file.

layers

fer2013's People

Contributors

gitshanks avatar

Watchers

 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.