This project uses 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 code is able to look at any image, detect faces, and predict the locations of facial keypoints on each face; examples of these keypoints are displayed below.
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 trained CNN
Notebook 4 : Fun Filters and Keypoint Uses
models.py : Define the neural network architectures
data_load.py : Load and transform data
data/ : Where the training and test data are download
saved_model/ : Where you save the trained PyTorch model
Use Notebook 1: Loading and Visualizing Data to download and explore the data for the project. In the folder data
are training and tests set of image/keypoint data, and their respective csv files.
All of the starting code and resources you'll need to compete this project are in this Github repository. Before you can get started coding, you'll have to make sure that you have all the libraries and dependencies required to support this project. If you have already created a cv-nd
environment for exercise code, then you can use that environment! If not, instructions for creation and activation are below.
Note that this project does not require the use of GPU, so this repo does not include instructions for GPU setup.
- 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/margaretmz/CVND-Facial-Keypoint-Detection.git
cd CVND-Facial-Keypoint-Detection
-
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