MTCNN_Train Scripts with PyTorch 0.4.0
The source code in this repository is mainly from kuaikuaikim/DFace. I reimplemented the part of MTCNN with PyTorch 0.4.0 and made some optimizations but most remains unchanged. If you want to know more details, please go to kuaikuaikim/DFace
This project is still in progess, I will finish it in my spare time as soon as possible !
This project is a reimplementation version of mtcnn face detection, most of the source code is from kuaikuaikim/DFace, I restructed the source code with Pytorch 0.4.0 and made some modifications and optimizations. All the contributions I have made is listed below.
- restruct the source code with PyTorch 0.4.0.
- avoid some unnecessary image data copy operation in training data preparation, for example, ./prepare_data/gen_Pnet_data.py and so on.
- remove some meaningless operation in traing process, and format the output information during training.
- fix the bug that data_loader can't load the last mini_batch when the last minibatch'size is less than the batch_size in ./tools/image_reader.py.
- to be continue.
For training PNet and RNet, I only use the Widerface for face classification and face bounding box regression. For training ONet, I use Widerface for face classification and face bounding box regression and use Training Dataset for face landmark regression.
- Train PNet
cd MTCNN_TRAIN
python prepare_data/gen_Pnet_train_data.py
python prepare_data/assemble_pnet_imglist.py
python train_net/train_p_net.py
- Train RNet
cd MTCNN_TRAIN
python prepare_data/gen_Rnet_train_data.py
python prepare_data/assemble_rnet_imglist.py
python train_net/train_r_net.py
- Train ONet
cd MTCNN_TRAIN
python prepare_data/gen_landmark_48.py
python prepare_data/gen_Onet_train_data.py
python prepare_data/assemble_onet_imglist.py
python train_net/train_o_net.py
- Test Image
cd MTCNN_TRAIN
python test_image.py
Because I didn't use much data to train, the detection results is not at the best.
There still remains a problem to solve: When starting to train each stage network, the first batch will last for a long time about 30 minutes and I don't know why.