MTCNN-Pytorch icon indicating copy to clipboard operation
MTCNN-Pytorch copied to clipboard

Face detection model

Instructions

MTCNN is a face detection model

The Chinese introduction can be found here

paper

Referring to kuaikuaikim/DFace and Sierkinhane/mtcnn-pytorch, I fixed some bugs that would appear in the training, added the table of learning rate, and optimized the training parameters.Testing on the WiderFace validation set, I found it performance better than the model weight they had originally provided.

Test image

测试图

WiderFace Val Performance in MTCNN

MTCNN-original is the test result of the original weight parameter MTCNN-trained is the test result of my training

Style easy medium hard
MTCNN-original 65.3% 65.1% 40.3%
MTCNN-trained 71.4% 70.4% 43.2%

Easy

medium

hard

Installation

1.pytorch 2.opencv

test

a single picture

Modify the image path in the program

python detect.py

Train the model

download widerface Organise the dataset directory as follows:

  ./data_set/face_detection/
    WIDER_train/
      images/
    WIDER_val/
      images/

I have made the label file

./anno_store/anno_train.txt

If you want to make your own labels The reference program ./anno_store/tool/change.py

train pnet

prepare pnet data

python mtcnn/data_preprocessing/gen_Pnet_train_data.py
python mtcnn/data_preprocessing/assemble_pnet_imglist.py

train pnet

python mtcnn/train_net/train_p_net.py

prepare rnet data

python mtcnn/data_preprocessing/gen_Rnet_train_data.py
python mtcnn/data_preprocessing/assemble_rnet_imglist.py

train rnet

python mtcnn/train_net/train_r_net.py

prepare onet data

python mtcnn/data_preprocessing/gen_Onet_train_data.py
python mtcnn/data_preprocessing/assemble_onet_imglist.py

prepare onet

python mtcnn/train_net/train_o_net.py

Evaluation widerface val

python wildface_test.py

References

kuaikuaikim/DFace

Sierkinhane/mtcnn-pytorch