##Background For single-class detection, we apply LFD to WIDERFACE dataset which is large and diverse. We design 4 types of network structures with different sizes of weights and inference latency:
- LFD_L — Large
- LFD_M — Medium
- LFD_S — Small
- LFD_XS — Extreme Small
These structures can be adopted as templates for your own tasks, or inspire you to create new structures.
##Performance #####Accuracy on val under the SIO schema proposed in LFFD
Model Version | Easy Set | Medium Set | Hard Set |
---|---|---|---|
v2 | 0.875 | 0.863 | 0.754 |
WIDERFACE-L | 0.887 | 0.896 | 0.863 |
WIDERFACE-M | 0.874 | 0.888 | 0.855 |
WIDERFACE-S | 0.873 | 0.885 | 0.849 |
WIDERFACE-XS | 0.866 | 0.877 | 0.839 |
- for fairy comparison, WIDERFACE-L/M/S/XS have the similar detection range with v2, namely [4, 320] vs [10, 320], but WIDERFACE-L/M/S/XS have different network structures.
- great improvement on Hard Set
#####Inference latency
Platform: RTX 2080Ti, CUDA 10.2, CUDNN 8.0.4, TensorRT 7.2.2.3
- batchsize=1, weight precision mode=FP32
Model Version | 640×480 | 1280×720 | 1920×1080 | 3840×2160 |
---|---|---|---|---|
v2 | 2.12ms(472.04FPS) | 5.02ms(199.10FPS) | 10.80ms(92.63FPS) | 42.41ms(23.58FPS) |
WIDERFACE-L | 2.67ms(374.19FPS) | 6.31ms(158.38FPS) | 13.51ms(74.04FPS) | 94.61ms(10.57FPS) |
WIDERFACE-M | 2.47ms(404.23FPS) | 5.70ms(175.38FPS) | 12.28ms(81.43FPS) | 87.90ms(11.38FPS) |
WIDERFACE-S | 1.82ms(548.42FPS) | 3.57ms(280.00FPS) | 7.35ms(136.02FPS) | 27.93ms(35.81FPS) |
WIDERFACE-XS | 1.58ms(633.06FPS) | 3.03ms(330.36FPS) | 6.14ms(163.00FPS) | 23.26ms(43.00FPS) |
the results of v2 is directly get from LFFD, the Platform condition is slightly different from here.
- batchsize=1, weight precision mode=FP16
Model Version | 640×480 | 1280×720 | 1920×1080 | 3840×2160 |
---|---|---|---|---|
WIDERFACE-L | 1.68ms(594.12FPS) | 3.69ms(270.78FPS) | 7.66ms(130.51FPS) | 28.65ms(34.90FPS) |
WIDERFACE-M | 1.61ms(622.42FPS) | 3.51ms(285.13FPS) | 7.31ms(136.79FPS) | 27.32ms(36.60FPS) |
WIDERFACE-S | 1.26ms(793.97FPS) | 2.39ms(418.68FPS) | 4.88ms(205.09FPS) | 18.46ms(54.18FPS) |
WIDERFACE-XS | 1.23ms(813.01FPS) | 2.18ms(459.17FPS) | 4.57ms(218.62FPS) | 17.35ms(57.65FPS) |
It can be observed that FP16 mode is evidently faster than FP32 mode. So in deployment, FP16 is highly recommended if possible.
- batchsize=1, weight precision mode=INT8
Model Version | 640×480 | 1280×720 | 1920×1080 | 3840×2160 |
---|---|---|---|---|
WIDERFACE-L | 1.50ms(667.95FPS) | 3.24ms(308.43FPS) | 6.83ms(146.41FPS) | -ms(-FPS) |
WIDERFACE-M | 1.45ms(689.00FPS) | 3.15ms(317.60FPS) | 6.61ms(151.20FPS) | -ms(-FPS) |
WIDERFACE-S | 1.17ms(855.29FPS) | 2.14ms(466.86FPS) | 4.40ms(227.18FPS) | -ms(-FPS) |
WIDERFACE-XS | 1.09ms(920.91FPS) | 2.03ms(493.54FPS) | 4.11ms(243.15FPS) | -ms(-FPS) |
CAUTION:
-
means results are not available due to out of memory while calibrating
##Usage of Files
-
Generate pure neg images based on train set of WIDERFACE. The crop rule is simple, just read the code for details.
-
Pack all train data (pos & neg images) as a memory-based dataset.
-
Timing the inference latency of your designed structures without training. Once you finish the config file (like WIDERFACE_LFD_L.py here), you can immediately know how fast it can be.
-
WIDERFACE_LFD_L.py | WIDERFACE_LFD_M.py | WIDERFACE_LFD_S.py | WIDERFACE_LFD_XS.py
Configure all parameters and directly run the script for training.
-
Make a quick prediction of trained models and show qualitative results.
-
Make a quick prediction using tensorrt as inference engine.
-
Generate files of SIO results for WIDERFACE standard evaluation. You have to use matlab code to get final evaluation metrics.
##Get Started #####Quick Predict
- download the pre-trained models and put them in the current folder
- open the script
predict.py
, and make the following modifications:- select the model and import ----
from WIDERFACE_LFD_L_work_dir_xxxxxxxx_xxxxxx.WIDERFACE_LFD_L import config_dict, prepare_model
- set the path of model weight ----
param_file_path = './WIDERFACE_LFD_L_work_dir_xxxxxxxx_xxxxxx/epoch_1000.pth'
- set the image path ----
image_path = './test_images/image1.jpg'
(we provide some test images in./test_images
) - set the params of thresholds ----
classification_threshold=0.5, nms_threshold=0.3
- select the model and import ----
- run the script
#####Train with WIDERFACE dataset
- download the packed dataset or prepare by yourself. Here, we briefly describe the steps, for more information, please refer to the wiki:
- write your own annotation parser for providing samples
- pack data as memory-based or disk-based dataset according to your need
- select a off-the-shelf config script (currently, you have 4 choices----L/M/S/XS), and directly run the script for training. An other choice is to write your own config script, including designing new structures.
##Download ####pre-trained models We provide pre-trained weights of 4 models, as well as training logs for your reference, feel free to try.
- LFD_L pre-trained weight: Baidu YunPan Pwd: r1kx, MS OneDrive
- LFD_M pre-trained weight: Baidu YunPan Pwd: ayft, MS OneDrive
- LFD_S pre-trained weight: Baidu YunPan Pwd: jt7i, MS OneDrive
- LFD_XS pre-trained weight: Baidu YunPan Pwd: ru3e, MS OneDrive
When successfully download the folder, you just put them in the current fold, namely ./WIDERFACE_train
. It may look like this:
./WIDERFACE_train/WIDERFACE_LFD_L_work_dir_xxxxxxxx_xxxxxx
.
####packed WIDERFACE dataset Download here: Baidu YunPan Pwd: hnx5, MS OneDrive
After you download the packed dataset, you can put it to ./WIDERFACE_pack/widerface_train.pkl
.
##Qualitative Results We should some qualitative results produced by LFD_L with score threshold 0.5 and nms threshold 0.3.