This repository contains my code and associated files of face keypoints detection project included in the Udacity "Computer Vision" Nanodegree program.
https://eu.udacity.com/course/computer-vision-nanodegree--nd891
This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces.
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.
Per the Anaconda docs:
Conda is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.
Using Anaconda consists of the following:
- Install
minicondaon your computer, by selecting the latest Python version for your operating system. If you already havecondaorminicondainstalled, you should be able to skip this step and move on to step 2. - Create and activate * a new
condaenvironment.
* Each time you wish to work on any exercises, activate your conda environment!
Download the latest version of miniconda that matches your system.
NOTE: There have been reports of issues creating an environment using miniconda v4.3.13. If it gives you issues try versions 4.3.11 or 4.2.12 from here.
| Linux | Mac | Windows | |
|---|---|---|---|
| 64-bit | 64-bit (bash installer) | 64-bit (bash installer) | 64-bit (exe installer) |
| 32-bit | 32-bit (bash installer) | 32-bit (exe installer) |
Install miniconda on your machine. Detailed instructions:
- Linux: http://conda.pydata.org/docs/install/quick.html#linux-miniconda-install
- Mac: http://conda.pydata.org/docs/install/quick.html#os-x-miniconda-install
- Windows: http://conda.pydata.org/docs/install/quick.html#windows-miniconda-install
For Windows users, these following commands need to be executed from the Anaconda prompt as opposed to a Windows terminal window. For Mac, a normal terminal window will work.
These instructions also assume you have git installed for working with Github from a terminal window, but if you do not, you can download that first with the command:
conda install git
If you'd like to learn more about version control and using git from the command line, take a look at our free course: Version Control with Git.
Now, we're ready to create our local environment!
- Clone the repository, and navigate to the downloaded folder. This may take a minute or two to clone due to the included image data.
git clone https://github.com/vittorio-nardone/Facial-Keypont-Detection.git
cd Facial-Keypont-Detection
-
Create (and activate) a new environment, named
cv-ndwith Python 3.6. If prompted to proceed with the install(Proceed [y]/n)type y.- Linux or Mac:
conda create -n cv-nd python=3.6 source activate cv-nd- Windows:
conda create --name cv-nd python=3.6 activate cv-ndAt this point your command line should look something like:
(cv-nd) <User>:CVND_Exercises <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.
- Linux or Mac:
conda install pytorch torchvision -c pytorch- Windows:
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
- That's it!
Now all of the cv-nd libraries are available to you. Assuming you're environment is still activated, you can navigate to the repo and start looking at the notebooks:
cd
cd Facial-Keypont-Detection
jupyter notebook
To exit the environment when you have completed your work session, simply close the terminal window.
Verify that the cv-nd environment was created in your environments:
conda info --envs
Cleanup downloaded libraries (remove tarballs, zip files, etc):
conda clean -tp
Uninstall the environment (if you want); you can remove it by name:
conda env remove -n cv-nd