The easiest way to get started is to use our trained SCHP models on your own images to extract human parsing representations. Here we provided state-of-the-art trained models on three popular datasets. Theses three datasets have different label system, you can choose the best one to fit on your own task.
LIP is the largest single person human parsing dataset with 50000+ images. This dataset focus more on the complicated real scenarios. LIP has 20 labels, including 'Background', 'Hat', 'Hair', 'Glove', 'Sunglasses', 'Upper-clothes', 'Dress', 'Coat', 'Socks', 'Pants', 'Jumpsuits', 'Scarf', 'Skirt', 'Face', 'Left-arm', 'Right-arm', 'Left-leg', 'Right-leg', 'Left-shoe', 'Right-shoe'.
ATR is a large single person human parsing dataset with 17000+ images. This dataset focus more on fashion AI. ATR has 18 labels, including 'Background', 'Hat', 'Hair', 'Sunglasses', 'Upper-clothes', 'Skirt', 'Pants', 'Dress', 'Belt', 'Left-shoe', 'Right-shoe', 'Face', 'Left-leg', 'Right-leg', 'Left-arm', 'Right-arm', 'Bag', 'Scarf'.
Pascal Person Part is a tiny single person human parsing dataset with 3000+ images. This dataset focus more on body parts segmentation. Pascal Person Part has 7 labels, including 'Background', 'Head', 'Torso', 'Upper Arms', 'Lower Arms', 'Upper Legs', 'Lower Legs'.
Choose one and have fun on your own task!
To extract the human parsing representation, simply put your own image in the INPUT_PATH folder, then download a pretrained model and run the following command. The output images with the same file name will be saved in OUTPUT_PATH
The DATASET command has three options, including 'lip', 'atr' and 'pascal'. Note each pixel in the output images denotes the predicted label number. The output images have the same size as the input ones. To better visualization, we put a palette with the output images. We suggest you to read the image with PIL.
If you need not only the final parsing images, but also the feature map representations. Add --logits command to save the output feature maps. These feature maps are the logits before softmax layer.
Dataset Preparation
Please download the LIP dataset following the below structure.
commandline
1data/LIP
2|--- train_imgaes # 30462 training single person images
3|--- val_images # 10000 validation single person images
4|--- train_segmentations # 30462 training annotations
5|--- val_segmentations # 10000 training annotations
6|--- train_id.txt # training image list
7|--- val_id.txt # validation image list
Training
python train.py
By default, the trained model will be saved in ./log directory. Please read the arguments for more details.
Please cite our work if you find this repo useful in your research.
latex
1@article{li2020self,
2 title={Self-Correction for Human Parsing},
3 author={Li, Peike and Xu, Yunqiu and Wei, Yunchao and Yang, Yi},
4 journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
5 year={2020},
6 doi={10.1109/TPAMI.2020.3048039}}
Visualization
Source Image.
demo
LIP Parsing Result.
demo-lip
ATR Parsing Result.
demo-atr
Pascal-Person-Part Parsing Result.
demo-pascal
Source Image.
demo
Instance Human Mask.
demo-lip
Global Human Parsing Result.
demo-lip
Multiple Human Parsing Result.
demo-lip
Related
Our code adopts the InplaceSyncBN to save gpu memory cost.
There is also a PaddlePaddle Implementation of this project.