Home

Awesome

English | 中文简体

Ultra-Light-Fast-Generic-Face-Detector-1MB

Ultra-lightweight face detection model

img1 This model is a lightweight facedetection model designed for edge computing devices.

Tested the environment that works

Accuracy, speed, model size comparison

The training set is the VOC format data set generated by using the cleaned widerface labels provided by Retinaface in conjunction with the widerface data set (PS: the following test results were obtained by myself, and the results may be partially inconsistent).

Widerface test

ModelEasy SetMedium SetHard Set
libfacedetection v1(caffe)0.650.50.233
libfacedetection v2(caffe)0.7140.5850.306
Retinaface-Mobilenet-0.25 (Mxnet)0.7450.5530.232
version-slim0.770.6710.395
version-RFB0.7870.6980.438
ModelEasy SetMedium SetHard Set
libfacedetection v1(caffe)0.7410.6830.421
libfacedetection v2(caffe)0.7730.7180.485
Retinaface-Mobilenet-0.25 (Mxnet)0.8790.8070.481
version-slim0.8530.8190.539
version-RFB0.8550.8220.579

Terminal device inference speed

Model1 core2 core3 core4 core
libfacedetection v12816129.7
Official Retinaface-Mobilenet-0.25 (Mxnet)462518.515
version-slim2916129.5
version-RFB3519.614.811
ModelInference Latency(ms)
slim-3206.33
RFB-3207.8
ModelInference Latency(ms)
slim-32065.6
RFB-320164.8

Model size comparison

Modelmodel file size(MB)
libfacedetection v1(caffe)2.58
libfacedetection v2(caffe)3.34
Official Retinaface-Mobilenet-0.25 (Mxnet)1.68
version-slim1.04
version-RFB1.11

Generate VOC format training data set and training process

  1. Download the wideface official website dataset or download the training set I provided and extract it into the ./data folder:

(1) The clean widerface data pack after filtering out the 10px*10px small face: Baidu cloud disk (extraction code: cbiu)Google Drive

(2) Complete widerface data compression package without filtering small faces: Baidu cloud disk (extraction code: ievk)Google Drive

  1. (PS: If you download the filtered packets in (1) above, you don't need to perform this step) Because the wideface has many small and unclear faces, which is not conducive to the convergence of efficient models, it needs to be filtered for training.By default,faces smaller than 10 pixels by 10 pixels will be filtered. run ./data/wider_face_2_voc_add_landmark.py
 python3 ./data/wider_face_2_voc_add_landmark.py

After the program is run and finished, the wider_face_add_lm_10_10 folder will be generated in the ./data directory. The folder data and data package (1) are the same after decompression. The complete directory structure is as follows:

  data/
    retinaface_labels/
      test/
      train/
      val/
    wider_face/
      WIDER_test/
      WIDER_train/
      WIDER_val/
    wider_face_add_lm_10_10/
      Annotations/
      ImageSets/
      JPEGImages/
    wider_face_2_voc_add_landmark.py
  1. At this point, the VOC training set is ready. There are two scripts: train-version-slim.sh and train-version-RFB.sh in the root directory of the project. The former is used to train the slim version model, and the latter is used. Training RFB version model, the default parameters have been set, if the parameters need to be changed, please refer to the description of each training parameter in ./train.py.

  2. Run train-version-slim.sh train-version-RFB.sh

sh train-version-slim.sh or sh train-version-RFB.sh

Detecting image effects (input resolution: 640x480)

img1 img1 img1

PS

(1) Optimal: input size input_size: 640 (640x480) resolution training, and use the same or larger input size for inference, such as using the provided pre-training model version-slim-640.pth or version-RFB-640.pth for inference, lower False positives.

 (2) Sub-optimal: input size input_size: 320 (320x240) resolution training, and use 480x360 or 640x480 size input for predictive reasoning, more sensitive to small faces, false positives will increase.  

TODO LIST

Completed list

Third-party related projects

Reference