2022-04-02 Update: If you could not download the weights with LFS, check out issue hhj1897/face_parsing#7 (comment) for alternative downloading links.
2022-03-04 Update: We have released the FP-Age model which can perform face parsing and age estimation simultaneously, please visit https://github.com/ibug-group/fpage for details.
Official repo for our paper RoI Tanh-polar transformer network for face parsing in the wild.
Note: If you use this repository in your research, we kindly rquest you to cite the following paper:
@article{lin2021roi,
title = {RoI Tanh-polar transformer network for face parsing in the wild},
journal = {Image and Vision Computing},
volume = {112},
pages = {104190},
year = {2021},
issn = {0262-8856},
doi = {https://doi.org/10.1016/j.imavis.2021.104190},
url = {https://www.sciencedirect.com/science/article/pii/S0262885621000950},
author = {Yiming Lin and Jie Shen and Yujiang Wang and Maja Pantic},
keywords = {Face parsing, In-the-wild dataset, Head pose augmentation, Tanh-polar representation},
}
- git-lfs
- MacOS:
brew install git-lfs
- Linux:
sudo apt-get install git-lfs
- MacOS:
- Numpy:
$pip3 install numpy
- OpenCV:
$pip3 install opencv-python
- PyTorch:
$pip3 install torch torchvision
git clone https://github.com/KudoKhang/face_parsing
cd face_parsing
git lfs install
git lfs pull
pip install -e .
python inference.py
Change mode here:
if __name__ == '__main__':
image('image_test/g2.jpg')
# video('dathao1.mp4')
# webcam()
# process_with_folder(input_dir=image_test, output_dir=image_out)
The training and testing images, bounding boxes, landmarks, and parsing maps can be found in the following:
Label map for 11 classes:
0 : background
1 : skin (including face and scalp)
2 : left_eyebrow
3 : right_eyebrow
4 : left_eye
5 : right_eye
6 : nose
7 : upper_lip
8 : inner_mouth
9 : lower_lip
10 : hair
Label map for 14 classes:
0 : background
1 : skin (including face and scalp)
2 : left_eyebrow
3 : right_eyebrow
4 : left_eye
5 : right_eye
6 : nose
7 : upper_lip
8 : inner_mouth
9 : lower_lip
10 : hair
11 : left_ear
12 : right_ear
13 : glasses