Purpose: This project aims to classify facial images into one of the following seven emotions - anger, contempt, disgust, fear, happiness, neutral, sadness, surprise.
Working Summary: The dataset used is CK+ (Extended Cohn Kanade), which is useful for emotion classification applications. It comprises of images labelled with their corresponding facial emotions. Facial landmark detection (detection of 68 coordinates on the face) is applied on all images present in the dataset. For each image, 18 triangles are constructed by taking groups of 3 coordinates, and the cosines of the 3 angles of each triangle are computed. A modified dataset is derived from the CK+ dataset, which only comprises of the 54 cosine values, and the corresponding emotion label. This modified dataset is used to train the classifier. The classifier used is based on the Fuzzy Unordered Rule Induction Algorithm (FURIA), which generates fuzzy rules to perform rule-based classification. Live image feed is captured from webcam, and facial landmarks are detected in each image. The triangles and their corresponding cosines are computed for each image, and passed to the classifier. The classifier outputs its prediction, which is then displayed along with the webcam feed to the user.
Software Stack:
- dlib - detection of facial landmarks, and their corresponding coordinates
- opencv - image manipulation, webcam capture, display, etc.
- weka - generating the dataset and the classifier, and classifying new instances
- python3.8 - the development environment used
- default-jdk - javabridge for python
Python Dependencies:
- numpy
- opencv-contrib-python
- imutils
- dlib
- python-javabridge
- python-weka-wrapper3
- pillow
- matplotlib
- pygraphviz
Additional Package Requirements (for Ubuntu):
- build-essential
- python3-dev
- python3-pip
- python3-venv
- default-jdk
File-by-File Explanation: (sorted by importance and/or order of occurence in workflow)
- cosine_dataset_generator.py - responsible for generating the cosine dataset in .arff format for weka
- emotion_cosine_dataset.arff - the generated dataset comprising of 54 cosine attributes, one emotion attribute, and around 920 data points
- fuzzyUnorderedRuleInduction1.0.2.zip - FURIA package for weka
- furia_package_installer.py - installs FURIA package in weka
- fuzzy_model_generator.py - uses the .arff file generated to train the FURIA classifier, outputs the .model file, and performs cross-validation
- emotion_recog_fuzzy_model.model - the outputted .model file
- fuzzy_training_logs.txt -
- demo.py - a demonstration of the emotion classification, by taking a live image feed from the webcam and displaying its corresponding emotion
- face_landmark_indices.txt - comprises of the indices of facial landmarks that comprise each triangle
- shape_predictor_68_face_landmarks.dat - the model file used by dlib to predict facial landmarks
- cosine_attribute_string_generator.py - a convenience program to print out the list of cosine attributes
- requirements.txt - list of python libraries to be installed