All projects

Face Detector with Landmarks

A sub-1 MB face detector with five-point landmarks, converted for ncnn, ONNX and PyTorch — and more accurate than the baselines it builds on.

PythonPyTorchONNXncnnOpenCVComputer Vision
Face detection with landmark keypoints

A lightweight face detector with keypoint detection built for mobile deployment. The model starts from RetinaFace-MobileNet-0.25 and is converted to ncnn, OpenCV ONNX and PyTorch — a slim detector that holds up on edge hardware.

What it does

  • Face-Detector-1MB slim with 5 facial keypoints.
  • RetinaFace-MobileNet-0.25 exported to ncnn, ONNX and PyTorch.
  • Parameter count and FLOP calculation built in, for optimising against a hardware budget.
  • Modified anchor sizes tuned for mobile and edge devices.
  • A reimplementation of Face-Detector-1MB that adds keypoint detection and ncnn C++ deployment.
  • Higher accuracy than the original models, fast enough for real-time use.

Stack

  • Ubuntu 18.04 · Python 3.7
  • PyTorch, OpenCV, NumPy
  • ncnn (C++ inference), ONNX Runtime

Accuracy on WIDER FACE

Single-scale input, 320×240

MethodEasyMediumHard
libfacedetection v1 (caffe)0.6500.5000.233
libfacedetection v2 (caffe)0.7140.5850.306
version-slim (original)0.7650.6620.385
version-RFB (original)0.7840.6880.418
version-slim (ours)0.7950.6830.345
version-RFB (ours)0.8140.7100.363
RetinaFace-MobileNet-0.25 (ours)0.8110.6970.376

Single-scale input, 640×480

MethodEasyMediumHard
libfacedetection v1 (caffe)0.7410.6830.421
libfacedetection v2 (caffe)0.7730.7180.485
version-slim (original)0.7570.7210.511
version-RFB (original)0.8510.8100.541
version-slim (ours)0.8500.8080.595
version-RFB (ours)0.8650.8280.622
RetinaFace-MobileNet-0.25 (ours)0.8730.8360.638

When testing, the long side is either 320 or 640 and the image is scaled in equal proportions.

References

Source code

View on GitHub