Coder Social home page Coder Social logo

jahin07 / emotion-recognition Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 10.0 831 KB

A classification model in Machine Learning capable of recognizing human facial emotions

Python 100.00%
classification emotion-recognition face-detection machine-learning

emotion-recognition's Issues

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?

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'

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.