AnthonyF333 / PFLD_GhostOne

Apache License 2.0
76 stars 15 forks source link

PFLD_GhostOne: PFLD+GhostNet+MobileOne

An ultralight face landmark detector based on PFLD, GhostNet and MobileOne

This project supplies a better face landmark detector that is suitable for embedding devices: PFLD_GhostOne which is more suitable for edge computing. In most cases, its accuracy is better than the original PFLD model, and its speed is around 55% faster than the original PFLD model.

The proposed GhostOne module is show below: image More details about GhostOne can be found on this blog

 

Implementation

image image

 

Dependencies

 

WFLW Test Result

Model input size is 112x112

Model NME OpenVino Latency(ms) NCNN Latency(ms) ONNX Model Size(MB)
PFLD 0.05438 1.65(CPU) 2.78(GPU) 5.4(CPU) 5.1(GPU) 4.66
PFLD-GhostNet 0.05347 1.79(CPU) 2.55(GPU) 2.9(CPU) 5.3(GPU) 3.09
PFLD-GhostNet-Slim 0.05410 2.11(CPU) 2.54(GPU) 2.7(CPU) 5.2(GPU) 2.83
PFLD-GhostOne 0.05207 1.79(CPU) 2.18(GPU) 2.4(CPU) 5.0(GPU) 2.71

The latency is the average time of running 1000 times on 11th Gen Intel(R) Core(TM) i5-11500

Model Zoo

Model Pretrained Model
PFLD pfld_best.pth
PFLD-GhostNet pfld_ghostnet_best.pth
PFLD-GhostNet-Slim pfld_ghostnet_slim_best.pth
PFLD-GhostOne pfld_ghostone_best.pth

 

Installation

Clone and install:

Data:

 

Training

Before training, check or modify network configuration (e.g. batch_size, epoch and steps etc..) in config.py.

After modify the configuration, run train.py to start training.

 

Export to ONNX

Modify the model_type and model_path in pytorch2onnx.py, and then run pytorch2onnx.py to generate the xxx.onnx file. It will optimize and simplify the ONNX file.

 

ONNX inference

Before test the model, modify the configuration in onnx_inference.py, include the pfld_onnx_model, test_folder, save_result_folder etc. Then run onnx_inference.py to detect and align the images in the test_folder, and save results in save_result_folder directory.

  

References