Coder Social home page Coder Social logo

emotion-recognition's Introduction

Emotion-Recognition

This project creates a classification model in Machine Learning capable of recognizing human facial emotions.

Getting Started

This project uses the CK+ dataset containing 8 classes of facial expressions encoded as {0=neutral, 1=anger, 2=contempt, 3=disgust, 4=fear, 5=happy, 6=sadness, 7=surprise}.

Prerequisites

  1. CK+ dataset - The dataset used
  2. Python 2.7
  3. OpenCV 3

Installing

Clone the repository

git clone 'https://github.com/jahin07/Emotion-Recognition.git'

Download the CK+ dataset

Install OpenCV 3

conda install -c menpo opencv3=3.2.0

Running the code

To run the code

python dataset_org.py
python extract_faces.py
python classi.py

Authors

Reference

  1. van Gent, P. (2016). Emotion Recognition With Python, OpenCV and a Face Dataset. A tech blog about fun things with Python and embedded electronics. Retrieved from: here
  2. Kanade, T., Cohn, J. F., & Tian, Y. (2000). Comprehensive database for facial expression analysis. Proceedings of the Fourth IEEE International Conference on Automatic Face and Gesture Recognition (FG'00), Grenoble, France, 46-53.
  3. Lucey, P., Cohn, J. F., Kanade, T., Saragih, J., Ambadar, Z., & Matthews, I. (2010). The Extended Cohn-Kanade Dataset (CK+): A complete expression dataset for action unit and emotion-specified expression. Proceedings of the Third International Workshop on CVPR for Human Communicative Behavior Analysis (CVPR4HB 2010), San Francisco, USA, 94-101.

emotion-recognition's People

Contributors

jahin07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

emotion-recognition's Issues

Unable to convert from string to float

error: Traceback (most recent call last):
File "C:\Python27\ck_org.py", line 25, in
emotion = int(float(file.readline())) #emotions are encoded as a float, readline as float, then convert to integer.
ValueError: could not convert string to float: Þ4ðà­õ5

Error Line : emotion = int(float(file.readline())) #emotions are encoded as a float, readline as float, then convert to integer.

IsADirectoryError: [Errno 21] Is a directory:

`

import glob as gb
from shutil import copyfile

emotions_list = ["neutral", "anger", "contempt", "disgust", "fear", "happy", "sadness","surprise"]
emotions_folders = gb.glob("emotions//*") #Returns a list of all folders with participant numbers

def imageWithEmotionEtraction():
for x in emotions_folders:
participant = "%s" %x[-4:] #store current participant number
for sessions in gb.glob("%s//" %x):
for files in gb.glob("%s//
" %sessions):
current_session = files[20:-30]
file = open(files, 'r')

            emotion = int(float(file.readline())) 
           
            #get path for last image in sequence, which contains the emotion
            sourcefile_emotion = gb.glob("images/%s/%s/*" %(participant, current_session))[-1] 
           
            #do same for neutral image
            sourcefile_neutral = gb.glob("images/%s/%s/*" %(participant, current_session))[0] 
           
            #Generate path to put neutral image
            dest_neut = "selected_set/neutral/%s/" %sourcefile_neutral[25:] 
            #Do same for emotion containing image
            dest_emot = "selected_set/%s/%s/" %(emotions_list[emotion], sourcefile_emotion[25:]) 
            
           
            copyfile(sourcefile_neutral, dest_neut) #Copy file
            copyfile(sourcefile_emotion, dest_emot) #Copy file

if name == 'main':
imageWithEmotionEtraction() `

and the error im getting is shown below plz help me

Traceback (most recent call last):
File "img_seq1.py", line 36, in
imageWithEmotionEtraction()
File "img_seq1.py", line 31, in imageWithEmotionEtraction
copyfile(sourcefile_emotion, dest_emot) #Copy file
File "/usr/lib/python3.6/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
IsADirectoryError: [Errno 21] Is a directory: 'images/S156/002'

How to get the dataset?

I'm a noob! how do you get those datasets? I got the email but not sure which to download?

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.