Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
1. Dataset Overview
Dataset was taken from internet that were available publicly( opensource) for tranning and validating the detection model. The dataset contains total images set of 35,889 samples with seven different facial expressions with tranning dataset 80%, validation dataset 10% and testing dataset 10%. When the dataset was imported using pandas, it was reshaped, and its header values were shown. The tranning, validation and testing data sets were then divided. Target levels were created, and all facial emotions were then placed on emotion map array. The occurrence of each emotion on the dataset were extracted and plotted further on graph showing the class distribution, total number of data and emotions to get clear overview of dataset.
Figure 1 Dataset Overview
2. Import Libraries
All the libraries were imported like numpy, pandas etc. Numpy was used for mathematical operations that contains values stored in the form of array. Pandas is used for data analysis and importing datasets in the form of either CSV or JSON file.
Figure 2 Import Libraries.
3. Detection Model
The image was then passed through different preprocessing methods where the image was resized, converted into array, and emotions were converted into pixels for depth analysis and to remove extra distortion or noise present in image.
The data was then split into 3 parts as explained in dataset overview section and the strings were converted to list of intigers. Images were reshaped into a dimension of 48x48, and grayscale was normalized to 255.0 followed by encoding label.
Each emotion that was kept on emotion_labels array was set bar labels and number. Then graph was plotted for each train, validation, and test dataset. Then the detection CNN architecture was created. Workflow of model is displayed as below:
After that model was analyzed under tranning phase. The accuracy, epoch, model accuracy and model loss were then plotted as graph for easy visualization.
The test performance was then evaluated. And overall accuracy of system was 66%. This is because the tranning time of model was less. The accuracy is directly proportional to tranning time.
4. Flask Implimentation
The same process was then repeated with slight changes like class, object was created, and images were converted as form data so that it will be easy to send and receive the input data and detected output i.e., expression name. The model was loaded from JSON file as shown in below image.
All the routes were managed on main.py. Here the libraries were imported, and the location was set for each route. When the flask server (local server ip address: 127.0.0.1)opens, the system will check if the index page was opened on browser or not. If not, then they system will stop after some time. When the index page was opened, camera was detected. Then the frame was created around human face and motion was tracked. If the human face moves, then the frame also moves with that face.
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team