we have trained our model to determine the emotions in the same pattern using a technique called Machine Learning. ML as its name denotes, is the process making an otherwise oblivious, computer learn something to predict in a real time solution. It is almost alike teaching a student how to solve a particular problem and the learned student is then able to solve test problems he is given.
This program can be run on both Linux and Windows, installation of above packages however differ on both. It is coded in Computer Programming Language, Python version 3.6.
Same have we done in this model. This program does real time emotion recognition using Machine Learning algorithm called Linear SVM. There are three aspects to this:
We use a part of CK dataset which is labelled on 7 emotions: Anger, disgust, joy, neutral, sadness, fear and surprise. A human face has 68 landmark points of movement which can help us determine the emotion. This done through change in positions of these landmarks and they are fed as features to our training model.
Fig: Facial Landamrks Source:https://www.researchgate.net/figure/Example-face-image-annotated-with-68-landmarks_fig1_37434867To determine change in these landmarks, we use a center point on face and we determine changes in contrast to that point.
Then we train our Machine learning model based on this processed dataset. We extract the labels of each image and feed image landmarks as features and train them against the labels. This, in a nutshell means our system learning what positions of facial landmarks corresponds to which emotion.
Use a chunk of the same dataset, we test our model and record scores of each. Our system does 7 epochs and uses a linear SVM to train a dataset of approximately 500 images.
The program takes input from a webcam and displays on console the predicted emotion as it detects in real time. Some example snippets are attached in res1.png and res2.png.