A Pytorch implementation face parsing model trained by CelebAMask-HQ, based on EHANet.
CelebA-HQ-to-CelebA-mapping.txt
under ./Data_preprocessing
python g_mask.py
to merge separate labels. Support multiprocess, use python g_mask.py --num_process 4
for 4 processes.python g_partition.py
to split train set and test set.bash run_train.sh #GPU_USE_INDEX
, for example, bash run_train.sh 0
. --parallel True
in bash script if you want to use multi-GPU for training.#num.pth
) should be put under ./models/FaceParseNet50/
- | Label list (19 classes) | - |
---|---|---|
0: 'background' | 1: 'skin' | 2: 'nose' |
3: 'eye_g' | 4: 'l_eye' | 5: 'r_eye' |
6: 'l_brow' | 7: 'r_brow' | 8: 'l_ear' |
9: 'r_ear' | 10: 'mouth' | 11: 'u_lip' |
12: 'l_lip' | 13: 'hair' | 14: 'hat' |
15: 'ear_r' | 16: 'neck_l' | 17: 'neck' |
18: 'cloth' | - | - |
bash run_test.sh #GPU_num #Model_num
, for example, bash run_test.sh 0 32
, which uses epoch 32 model file (32_G.pth
). ./test_pred_results
./test_color_visualize
python ./Data_preprocessing/g_color.py
@article{CelebAMask-HQ,
title={MaskGAN: Towards Diverse and Interactive Facial Image Manipulation},
author={Lee, Cheng-Han and Liu, Ziwei and Wu, Lingyun and Luo, Ping},
journal={arXiv preprint arXiv:1907.11922},
year={2019},
website={https://github.com/switchablenorms/CelebAMask-HQ}
}
@article{luo2020ehanet,
title={EHANet: An Effective Hierarchical Aggregation Network for Face Parsing},
author={Luo, Ling and Xue, Dingyu and Feng, Xinglong},
journal={Applied Sciences},
volume={10},
number={9},
pages={3135},
year={2020},
publisher={Multidisciplinary Digital Publishing Institute},
website={https://github.com/JACKYLUO1991/FaceParsing}
}
@code{face-parsing.PyTorch,
author={zllrunning},
year={2019},
website={https://github.com/zllrunning/face-parsing.PyTorch}
}