|
1 | 1 | # Self Correction for Human Parsing
|
2 | 2 |
|
3 |
| -An out-of-box human parsing representation extractor. Also the 3rd LIP challenge winner solution! |
| 3 | + |
| 4 | +[](https://opensource.org/licenses/MIT) |
4 | 5 |
|
5 |
| - |
| 6 | +An out-of-box human parsing representation extractor. |
6 | 7 |
|
7 |
| -At this time, we provide the trained models on three popular human parsing datasets that achieve the state-of-the-art performance. We hope our work could serve as a basic human parsing representation extractor and facilitate your own tasks, e.g. Fashion AI, Person Re-Identification, Virtual Reality, Virtual Try-on, Human Analysis and so on. |
| 8 | +Our solution ranks 1st for all human parsing tracks (including single, multiple and video) in the third LIP challenge! |
8 | 9 |
|
9 |
| -## Citation |
10 |
| - |
11 |
| -Please cite our work if you find this repo useful in your research. |
| 10 | + |
12 | 11 |
|
13 |
| -```latex |
14 |
| -@article{li2019self, |
15 |
| - title={Self-Correction for Human Parsing}, |
16 |
| - author={Li, Peike and Xu, Yunqiu and Wei, Yunchao and Yang, Yi}, |
17 |
| - journal={arXiv preprint arXiv:1910.09777}, |
18 |
| - year={2019} |
19 |
| -} |
20 |
| -``` |
21 |
| - |
22 |
| -## TODO List |
23 |
| - |
24 |
| -- [x] Inference code on three popular single person human parsing datasets. |
25 |
| -- [ ] Training code |
26 |
| -- [ ] Extension on multi-person and video human parsing tasks. |
27 |
| - |
28 |
| -Coming Soon! Stay tuned! |
| 12 | +Features: |
| 13 | +- [x] Out-of-box human parsing extractor for other downstream applications. |
| 14 | +- [x] Pretrained model on three popular single person human parsing datasets. |
| 15 | +- [x] Training and inferecne code. |
| 16 | +- [x] Simple yet effective extension on multi-person and video human parsing tasks. |
29 | 17 |
|
30 | 18 | ## Requirements
|
31 | 19 |
|
32 | 20 | ```
|
33 |
| -Python >= 3.5, PyTorch >= 0.4 |
| 21 | +Python >= 3.6, PyTorch >= 1.0 |
34 | 22 | ```
|
35 | 23 |
|
36 |
| -## Trained models |
| 24 | +## Simple Out-of-Box Extractor |
37 | 25 |
|
38 |
| -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 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. |
| 26 | +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](https://drive.google.com/drive/folders/1uOaQCpNtosIjEL2phQKEdiYd0Td18jNo?usp=sharing) on three popular datasets. Theses three datasets have different label system, you can choose the best one to fit on your own task. |
39 | 27 |
|
40 |
| -**LIP** ([exp-schp-201908261155-lip.pth](https://drive.google.com/file/d/1ZrTiadzAOM332d896fw7JZQ2lWALedDB/view?usp=sharing)) |
| 28 | +**LIP** ([exp-schp-201908261155-lip.pth](https://drive.google.com/file/d/1k4dllHpu0bdx38J7H28rVVLpU-kOHmnH/view?usp=sharing)) |
41 | 29 |
|
42 | 30 | * mIoU on LIP validation: **59.36 %**.
|
43 | 31 |
|
44 | 32 | * 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'.
|
45 | 33 |
|
46 |
| -**ATR** ([exp-schp-201908301523-atr.pth](https://drive.google.com/file/d/1klCtqx51orBkFKdkvYwM4qao_vEFbJ_z/view?usp=sharing)) |
| 34 | +**ATR** ([exp-schp-201908301523-atr.pth](https://drive.google.com/file/d/1ruJg4lqR_jgQPj-9K0PP-L2vJERYOxLP/view?usp=sharing)) |
47 | 35 |
|
48 | 36 | * mIoU on ATR test: **82.29%**.
|
49 | 37 |
|
50 | 38 | * 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'.
|
51 | 39 |
|
52 |
| -**Pascal-Person-Part** ([exp-schp-201908270938-pascal-person-part.pth](https://drive.google.com/file/d/13ph1AloYNiC4DIGOyCLZdmA08tP9OeGu/view?usp=sharing)) |
| 40 | +**Pascal-Person-Part** ([exp-schp-201908270938-pascal-person-part.pth](https://drive.google.com/file/d/1E5YwNKW2VOEayK9mWCS3Kpsxf-3z04ZE/view?usp=sharing)) |
53 | 41 |
|
54 | 42 | * mIoU on Pascal-Person-Part validation: **71.46** %.
|
55 | 43 |
|
56 | 44 | * 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'.
|
57 | 45 |
|
58 | 46 | Choose one and have fun on your own task!
|
59 | 47 |
|
60 |
| -## Inference |
| 48 | +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` |
| 49 | + |
| 50 | +``` |
| 51 | +python simple_extractor.py --dataset [DATASET] --model-restore [CHECKPOINT_PATH] --input-dir [INPUT_PATH] --output-dir [OUTPUT_PATH] |
| 52 | +``` |
| 53 | + |
| 54 | +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`. |
| 55 | + |
| 56 | +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. |
| 57 | + |
| 58 | +## Dataset Preparation |
| 59 | + |
| 60 | +Please download the [LIP](http://sysu-hcp.net/lip/) dataset following the below structure. |
61 | 61 |
|
62 |
| -To extract the human parsing representation, simply put your own image in the `Input_Directory`, download a pretrained model and run the following command. The output images with the same file name will be saved in `Output_Directory` |
| 62 | +```commandline |
| 63 | +data/LIP |
| 64 | +|--- train_imgaes # 30462 training single person images |
| 65 | +|--- val_images # 10000 validation single person images |
| 66 | +|--- train_segmentations # 30462 training annotations |
| 67 | +|--- val_segmentations # 10000 training annotations |
| 68 | +|--- train_id.txt # training image list |
| 69 | +|--- val_id.txt # validation image list |
| 70 | +``` |
| 71 | + |
| 72 | +## Training |
| 73 | + |
| 74 | +``` |
| 75 | +python trian.py |
| 76 | +``` |
63 | 77 |
|
| 78 | +## Evaluation |
64 | 79 | ```
|
65 |
| -python evaluate.py --dataset Dataset --restore-weight Checkpoint_Path --input Input_Directory --output Output_Directory |
| 80 | +python evaluate.py --model-restore [CHECKPOINT_PATH] |
66 | 81 | ```
|
67 | 82 |
|
68 |
| -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`. |
| 83 | +## Extension on Multiple Human Parsing |
69 | 84 |
|
70 |
| -If you need not only the final parsing image, but also a feature map representation. Add `--logits` command to save the output feature map. This feature map is the logits before softmax layer with the dimension of HxWxC. |
| 85 | +Please read [MultipleHumanParsing.md](./mhp_extension/README.md) for more details. |
71 | 86 |
|
| 87 | +## Citation |
| 88 | + |
| 89 | +Please cite our work if you find this repo useful in your research. |
| 90 | + |
| 91 | +```latex |
| 92 | +@article{li2019self, |
| 93 | + title={Self-Correction for Human Parsing}, |
| 94 | + author={Li, Peike and Xu, Yunqiu and Wei, Yunchao and Yang, Yi}, |
| 95 | + journal={arXiv preprint arXiv:1910.09777}, |
| 96 | + year={2019} |
| 97 | +} |
| 98 | +``` |
72 | 99 |
|
73 | 100 | ## Visualization
|
74 | 101 |
|
75 | 102 | * Source Image.
|
76 |
| - |
77 |
| - |
| 103 | + |
78 | 104 | * LIP Parsing Result.
|
79 |
| - |
80 |
| - |
| 105 | + |
81 | 106 | * ATR Parsing Result.
|
82 |
| - |
83 |
| - |
| 107 | + |
84 | 108 | * Pascal-Person-Part Parsing Result.
|
85 |
| - |
| 109 | + |
| 110 | +* Source Image. |
| 111 | + |
| 112 | +* Instance Human Mask. |
| 113 | + |
| 114 | +* Global Human Parsing Result. |
| 115 | + |
| 116 | +* Multiple Human Parsing Result. |
| 117 | + |
86 | 118 |
|
87 | 119 |
|
88 | 120 | ## Related
|
| 121 | +Our code adopts the [InplaceSyncBN](https://github.com/mapillary/inplace_abn) to save gpu memory cost. |
89 | 122 |
|
90 |
| -There is also a [PaddlePaddle](https://github.com/PaddlePaddle/PaddleSeg/tree/master/contrib/ACE2P) Implementation. |
91 |
| -This implementation is the version that we submitted to the 3rd LIP Challenge. |
| 123 | +There is also a [PaddlePaddle](https://github.com/PaddlePaddle/PaddleSeg/tree/develop/contrib/ACE2P) Implementation of this project. |
0 commit comments