/PIPNet

The Facial Landmark Preprocessing Toolkit.

Primary LanguagePython

PIPNet Facial Landmark Detection

This repository contains the implementation of PIPNet, a robust approach for facial landmark detection using a deep learning model based on ResNet architectures.

Vizualization

Click here to watch the video

Key Achievements

Exceptional Model Performance on the 300W Dataset

Features

  • Utilizes ResNet as the backbone for the PIPNet model.

  • Supports training, testing, and real-time demo modes.

  • Includes a 300W dataset loader and loss computation.

  • Implements a face detector for real-time landmark detection in videos.

  • Designed for easy customization and scalability to accommodate research and development needs.

Requirements

conda create -n PyTorch python=3.8
conda activate PyTorch
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch-lts
pip install opencv-python==4.5.5.64
pip install PyYAML
pip install tqdm

Usage

Datasets: 300W

  • Download the datasets from official sources. The folder structure should look like this:
  • afw

  • helen

  • ibug

  • lfpw

Run the below command for dataset preparation

$ python -c 'from utils.util import DataGenerator; gen = DataGenerator("../Datasets_path/"); gen.run()'

Training

To train the model, run:

  • Configure your dataset path in main.py for training
$ python main.py --train

Testing

For testing the model, use:

  • Configure your dataset path in main.py for testing
$ python main.py --test

Real-Time Demo

To run the real-time facial landmark detection:

$ python main.py --demo

Results

Backbone Epochs Test NME Pretrained weights
ResNet18 120 3.37 model
ResNet50 120 3.23 model
ResNet101 120 3.17 model
Reference