An out-of-box human parsing representation extractor.
Our solution ranks 1st for all human parsing tracks (including single, multiple and video) in the third LIP challenge!
Features:
- Out-of-box human parsing extractor for other downstream applications.
- Pretrained model on three popular single person human parsing datasets.
- Training and inferecne code.
- Simple yet effective extension on multi-person and video human parsing tasks.
Python >= 3.6, PyTorch >= 1.0
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 (exp-schp-201908261155-lip.pth)
-
mIoU on LIP validation: 59.36 %.
-
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 (exp-schp-201908301523-atr.pth)
-
mIoU on ATR test: 82.29%.
-
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 (exp-schp-201908270938-pascal-person-part.pth)
-
mIoU on Pascal-Person-Part validation: 71.46 %.
-
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
python simple_extractor.py --dataset [DATASET] --model-restore [CHECKPOINT_PATH] --input-dir [INPUT_PATH] --output-dir [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.
Please download the LIP dataset following the below structure.
data/LIP
|--- train_imgaes # 30462 training single person images
|--- val_images # 10000 validation single person images
|--- train_segmentations # 30462 training annotations
|--- val_segmentations # 10000 training annotations
|--- train_id.txt # training image list
|--- val_id.txt # validation image list
python trian.py
By default, the trained model will be saved in ./log
directory. Please read the arguments for more details.
python evaluate.py --model-restore [CHECKPOINT_PATH]
CHECKPOINT_PATH should be the path of trained model.
Please read MultipleHumanParsing.md for more details.
Please cite our work if you find this repo useful in your research.
@article{li2019self,
title={Self-Correction for Human Parsing},
author={Li, Peike and Xu, Yunqiu and Wei, Yunchao and Yang, Yi},
journal={arXiv preprint arXiv:1910.09777},
year={2019}
}
- Source Image.
- LIP Parsing Result.
- ATR Parsing Result.
- Pascal-Person-Part Parsing Result.
- Source Image.
- Instance Human Mask.
- Global Human Parsing Result.
- Multiple Human Parsing Result.
Our code adopts the InplaceSyncBN to save gpu memory cost.
There is also a PaddlePaddle Implementation of this project.