by polarisZhao

polarisZhao / PFLD-pytorch

PFLD pytorch Implementation

257 Stars 78 Forks Last release: Not found 48 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Implementation of PFLD A Practical Facial Landmark Detector by pytorch.

install requirements

pip3 install -r requirements.txt


  • WFLW Dataset Download

Wider Facial Landmarks in-the-wild (WFLW) is a new proposed face dataset. It contains 10000 faces (7500 for training and 2500 for testing) with 98 fully manual annotated landmarks.

  1. WFLW Training and Testing images [Google Drive] [Baidu Drive]
  2. WFLW Face Annotations
  3. Unzip above two packages and put them on
  4. move
$ cd data 
$ python3

training & testing

training :

$ python3

use tensorboard, open a new terminal ~~~ $ tensorboard --logdir=./checkpoint/tensorboard/ ~~~ testing:

$ python3


pytorch -> onnx -> ncnn

Pytorch -> onnx


onnx -> ncnn

how to build :

cd ncnn/build/tools/onnx
./onnx2ncnn pfld-sim.onnx pfld-sim.param pfld-sim.bin

Now you can use pfld-sim.param and pfld-sim.bin in ncnn:

ncnn::Net pfld;

cv::Mat img = cv::imread(imagepath, 1); ncnn::Mat in = ncnn::Mat::from_pixels_resize(, ncnn::Mat::PIXEL_BGR, img.cols, img.rows, 112, 112); const float norm_vals[3] = {1/255.f, 1/255.f, 1/255.f}; in.substract_mean_normalize(0, norm_vals);

ncnn::Extractor ex = pfld.create_extractor(); ex.input("input_1", in); ncnn::Mat out; ex.extract("415", out);


PFLD: A Practical Facial Landmark Detector

Tensorflow Implementation:


  • [x] Train on CPU and GPU

  • [x] ncnn inference

  • [ ] retrain on datasets AFLW and 300W

  • [ ] fix bugs

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.