GithubHelp home page GithubHelp logo

kawther-ch / knn-for-facial-emotion-recognition Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rrajj/knn-for-facial-emotion-recognition

0.0 0.0 0.0 428 KB

This repo contains the Implementation of k-Nearest Neighbor Classification for Facial Emotion Recognition

Python 20.16% Jupyter Notebook 79.84%

knn-for-facial-emotion-recognition's Introduction

Facial Emotion Recognition

This repo consists of a very basic model for Facial Emotion Recognition. The dataset for Facial Emotion Recognition can be downloaded from here.
Now coming to the dataset, the data consists of 48x48 pixel grayscale images of faces. The faces have been automatically registered so that the face is more or less centered and occupies about the same amount of space in each image. The task is to categorize each face based on the emotion shown in the facial expression in to one of seven categories:
(0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral).
train.csv contains two columns, "emotion" and "pixels". The "emotion" column contains a numeric code ranging from 0 to 6, inclusive, for the emotion that is present in the image. The "pixels" column contains a string surrounded in quotes for each image. The contents of this string a space-separated pixel values in row major order. test.csv contains only the "pixels" column and our task is to predict the emotion column.

Once downloaded, we need to split the dataset in feature columns and label columns. Over here I have splitted them to get 4 files:

  • X_train.csv -> Contains the training data pixel values. 28709 examples
  • y_train.csv -> Contains a single column which is a numeric code ranging from 0 to 6, for the training purpose.
  • X_test.csv -> Contains the testing data pixel values. 7178 examples
  • y_test.csv -> Contains a single column which is a numeric code ranging from 0 to 6 for the testing purpose.

k-NN Classifier

The idea is very simple: instead of finding the single closest image in the training set, we will find the top k closest images, and have them vote on the label of the test image. In particular, when k = 1, we recover the Nearest Neighbor classifier. Intuitively, higher values of k have a smoothing effect that makes the classifier more resistant to outliers:

knnimage

In the implementation of kNN, I have used L2 distance Norm which has the geometric interpretation of computing the euclidean distance between two vectors. The distance takes the form:

screenshot1

knn-for-facial-emotion-recognition's People

Contributors

rrajj avatar

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.