Facial keypoint detection system takes in any image with faces, and predicts the location of 68 distinguishing keypoints on the face - Udacity project
Here we're defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working with.
Let's take a look at some examples of images and corresponding facial keypoints.
Facial keypoints (also called facial landmarks) are the small magenta dots shown on each of the faces in the image above. In each training and test image, there is a single face and 68 keypoints, with coordinates (x, y), for that face. These keypoints mark important areas of the face: the eyes, corners of the mouth, the nose, etc. These keypoints are relevant for a variety of tasks, such as face filters, emotion recognition, pose recognition, and so on. Here they are, numbered, and you can see that specific ranges of points match different portions of the face.
git clone https://github.com/soheillll/Facial-Keypoint-Detection
cd P1_Facial_Keypoints
Create (and activate) a new environment, named cv-nd
with Python 3.6. If prompted to proceed with the install (Proceed [y]/n)
type y.
conda create -n cv-nd python=3.6
source activate cv-nd
conda create --name cv-nd python=3.6
activate cv-nd
At this point your command line should look something like: (cv-nd) <User>:P1_Facial_Keypoints <user>$
. The (cv-nd)
indicates that your environment has been activated, and you can proceed with further package installations.
Install PyTorch and torchvision; this should install the latest version of PyTorch.
conda install pytorch torchvision -c pytorch
conda install pytorch-cpu -c pytorch
pip install torchvision
Install a few required pip packages, which are specified in the requirements text file (including OpenCV).
pip install -r requirements.txt
All of the data you'll need to train a neural network is in the Facial-Keypoint-Detection repo, in the subdirectory data
. In this folder are training and tests set of image/keypoint data, and their respective csv files. This will be further explored in Notebook 1: Loading and Visualizing Data, and you're encouraged to look trough these folders on your own, too.
cd
cd Facial-Keypoint-Detection
jupyter notebook
cv-nd
environment by clicking Kernel > Change Kernel > cv-nd
.