/Selfie_Filters_OpenCV

This deep learning application can detect Facial Keypoints (15 unique points). They mark important areas of the face - the eyes, corners of the mouth, the nose, etc.

Primary LanguagePythonMIT LicenseMIT

[UPDATE]: I will not be responding to issues or emails related to this repo anymore as I am currently occupied with other research commitments. Also, the libraries used are pretty old and outdated. Thank you.

Selfie Filters Using Facial Landmarks

This deep learning application in python can put various sunglasses on a detected face (I am calling them 'Selfie Filters') by finding the Facial Keypoints (15 unique points). These keypoints mark important areas of the face - the eyes, corners of the mouth, the nose, etc.

Working Example

Data Description

OpenCV is often used in practice with other machine learning and deep learning libraries to produce interesting results. Employing Convolutional Neural Networks (CNN) in Keras along with OpenCV - I built a couple of selfie filters (very boring ones).

Facial keypoints can be used in a variety of machine learning applications from face and emotion recognition to commercial applications like the image filters popularized by Snapchat.

Facial keypoints (also called facial landmarks) are the small blue-green dots shown on each of the faces in the image above - there are 15 keypoints marked in each image.

I used this dataset from Kaggle to train a decent CNN model to predict the facial keypoints given a face and used the keypoints to place the desired filters on the face (as shown below).

Code Requirements

The code is in Python (version 3.6 or higher). You also need to install OpenCV and Keras libraries.

Execution

Order of Execution is as follows:

Step 0 - Download the 'training.zip' file from here and extract it into the 'data' folder.

Step 1 - Execute python model_builder.py

Step 2 - This could take a while, so feel free to take a break.

Step 3 - Execute python shades.py

Step 4 - Choose filters of your choice.

Step 5 - And don't forget to SMILE !