@wujiaju
2021-10-15T08:35:04.000000Z
字数 2981
阅读 479
2020
PostGraduate
You can click here to get the Chinese version.
anaconda3
pytorch >= 1.0.0
torchvision
opencv-python
tensorflow (optional)
1. get the codes
The complete codes for this experiment is given in MTCNN_pytorch, you can download it directly or using git clone command.
2. install the environment
1. download anaconda3 for your computer;
2. use pip or conda to install pytorch 1.0.0 and torchvision;
3. use pip or conda to install opencv-python;
conda install pytorch=1.0
conda install torchvision
pip install opencv-python
3. test the given models
Use the model we have trained before to run on the test dataset, which is under mtcnn_pytorch/data/test_images/ and contains 64 pictures, input the command below and then go to mtcnn_pytorch/data/test_images/ to examine the result.
cd mtcnn_pytorch/
python test_image.py
4. training (optional)
NOTE: You should check whether the path of the training dataset is consistent with the path in the code. If not, you must modify the path in the code before you start training.
train PNet (optional)
cd mtcnn_experiment
python preprocessing/gen_pnet_data.py
python preprocessing/assemble_pnet_imglist.py
python training/pnet/train.py
train RNet (optional)
cd mtcnn_experiment
python preprocessing/gen_rnet_data.py
python preprocessing/assemble_rnet_imglist.py
python training/rnet/train.py
train ONet (optional)
cd mtcnn_experiment
python preprocessing/gen_landmark_48.py
python preprocessing/gen_onet_data.py
python preprocessing/assemble_onet_imglist.py
python training/onet/train.py
After finishing training, you can find three trained models in mtcnn_pytorch/results/.
test your model (optional)
Use the given test dataset, which is in mtcnn_pytorch/data/test_images/ and contains 64 pictures, to test your model. Run the commands below and then get the results in mtcnn_pytorch/data/you_result/.
cd mtcnn_experiment/
python test_youModel_images.py
NOTE: You should check whether the path of the training dataset is consistent with the path in the code. If not, you must modify the path in the code before you start training.
Finishing experiment report according to experiment result. The template of report can be found in here.