This implementation of the P1_Facial_Keypoints is built for Udacity's Computer Vision Nanodegree.
This project, combines computer vision techniques and deep learning architectures to build a facial keypoint detection system. Facial keypoints include points around the eyes, nose, and mouth on a face and are used in many applications. These applications include: facial tracking, facial pose recognition, facial filters, and emotion recognition. The can look at any image, detect faces, and predict the locations of facial keypoints on each face; examples of these keypoints are displayed below.
The project is broken up into 4 main parts Python notebooks, only Notebooks 2 and 3 (and the models.py
file) contain my code:
Notebook 1 : Loading and Visualizing the Facial Keypoint Data
Notebook 2 : Defining and Training a Convolutional Neural Network (CNN) to Predict Facial Keypoints
Notebook 3 : Facial Keypoint Detection Using Haar Cascades and your Trained CNN
Notebook 4 : Fun Filters and Keypoint Uses
- Clone the repository, and navigate to the downloaded folder.
git clone https://github.com/udacity/P1_Facial_Keypoints.git
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.- 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-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.
- 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
All of the data needed to train a neural network is in the P1_Facial_Keypoints 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.
- Navigate back to the repo. (Also, your source environment should still be activated at this point.)
cd
cd P1_Facial_Keypoints
- Open the directory of notebooks, using the below command. You'll see all of the project files appear in your local environment; open the first notebook and follow the instructions.
jupyter notebook
- Once you open any of the project notebooks, make sure you are in the correct
cv-nd
environment by clickingKernel > Change Kernel > cv-nd
.