sayeed99 commited on
Commit
6c12f0e
1 Parent(s): 8044458

Dump Readme. Need to update properly.

Browse files
Files changed (1) hide show
  1. README.md +112 -0
README.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - vision
5
+ - image-segmentation
6
+ widget:
7
+ - src: >-
8
+ https://images.unsplash.com/photo-1643310325061-2beef64926a5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Nnx8cmFjb29uc3xlbnwwfHwwfHw%3D&w=1000&q=80
9
+ example_title: Person
10
+ - src: >-
11
+ https://freerangestock.com/sample/139043/young-man-standing-and-leaning-on-car.jpg
12
+ example_title: Person
13
+ datasets:
14
+ - mattmdjaga/human_parsing_dataset
15
+ pipeline_tag: image-segmentation
16
+ ---
17
+ # Segformer B3 fine-tuned for clothes segmentation
18
+
19
+ SegFormer model fine-tuned on [ATR dataset](https://github.com/lemondan/HumanParsing-Dataset) for clothes segmentation but can also be used for human segmentation.
20
+ The dataset on hugging face is called "mattmdjaga/human_parsing_dataset".
21
+
22
+
23
+ **NEW** -
24
+ **[Training code](https://github.com/mattmdjaga/segformer_b2_clothes)**. Right now it only contains the pure code with some comments, but soon I'll add a colab notebook version
25
+ and a blog post with it to make it more friendly.
26
+
27
+ ```python
28
+ from transformers import SegformerImageProcessor, AutoModelForSemanticSegmentation
29
+ from PIL import Image
30
+ import requests
31
+ import matplotlib.pyplot as plt
32
+ import torch.nn as nn
33
+
34
+ processor = SegformerImageProcessor.from_pretrained("sayeed99/segformer_b3_clothes")
35
+ model = AutoModelForSemanticSegmentation.from_pretrained("sayeed99/segformer_b3_clothes")
36
+
37
+ url = "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80"
38
+
39
+ image = Image.open(requests.get(url, stream=True).raw)
40
+ inputs = processor(images=image, return_tensors="pt")
41
+
42
+ outputs = model(**inputs)
43
+ logits = outputs.logits.cpu()
44
+
45
+ upsampled_logits = nn.functional.interpolate(
46
+ logits,
47
+ size=image.size[::-1],
48
+ mode="bilinear",
49
+ align_corners=False,
50
+ )
51
+
52
+ pred_seg = upsampled_logits.argmax(dim=1)[0]
53
+ plt.imshow(pred_seg)
54
+ ```
55
+
56
+ Labels: 0: "Background", 1: "Hat", 2: "Hair", 3: "Sunglasses", 4: "Upper-clothes", 5: "Skirt", 6: "Pants", 7: "Dress", 8: "Belt", 9: "Left-shoe", 10: "Right-shoe", 11: "Face", 12: "Left-leg", 13: "Right-leg", 14: "Left-arm", 15: "Right-arm", 16: "Bag", 17: "Scarf"
57
+
58
+ ### Evaluation
59
+
60
+ | Label Index | Label Name | Category Accuracy | Category IoU |
61
+ |:-------------:|:----------------:|:-----------------:|:------------:|
62
+ | 0 | Background | 0.99 | 0.99 |
63
+ | 1 | Hat | 0.73 | 0.68 |
64
+ | 2 | Hair | 0.91 | 0.82 |
65
+ | 3 | Sunglasses | 0.73 | 0.63 |
66
+ | 4 | Upper-clothes | 0.87 | 0.78 |
67
+ | 5 | Skirt | 0.76 | 0.65 |
68
+ | 6 | Pants | 0.90 | 0.84 |
69
+ | 7 | Dress | 0.74 | 0.55 |
70
+ | 8 | Belt | 0.35 | 0.30 |
71
+ | 9 | Left-shoe | 0.74 | 0.58 |
72
+ | 10 | Right-shoe | 0.75 | 0.60 |
73
+ | 11 | Face | 0.92 | 0.85 |
74
+ | 12 | Left-leg | 0.90 | 0.82 |
75
+ | 13 | Right-leg | 0.90 | 0.81 |
76
+ | 14 | Left-arm | 0.86 | 0.74 |
77
+ | 15 | Right-arm | 0.82 | 0.73 |
78
+ | 16 | Bag | 0.91 | 0.84 |
79
+ | 17 | Scarf | 0.63 | 0.29 |
80
+
81
+ Overall Evaluation Metrics:
82
+ - Evaluation Loss: 0.15
83
+ - Mean Accuracy: 0.80
84
+ - Mean IoU: 0.69
85
+
86
+ ### License
87
+
88
+ The license for this model can be found [here](https://github.com/NVlabs/SegFormer/blob/master/LICENSE).
89
+
90
+ ### BibTeX entry and citation info
91
+
92
+ ```bibtex
93
+ @article{DBLP:journals/corr/abs-2105-15203,
94
+ author = {Enze Xie and
95
+ Wenhai Wang and
96
+ Zhiding Yu and
97
+ Anima Anandkumar and
98
+ Jose M. Alvarez and
99
+ Ping Luo},
100
+ title = {SegFormer: Simple and Efficient Design for Semantic Segmentation with
101
+ Transformers},
102
+ journal = {CoRR},
103
+ volume = {abs/2105.15203},
104
+ year = {2021},
105
+ url = {https://arxiv.org/abs/2105.15203},
106
+ eprinttype = {arXiv},
107
+ eprint = {2105.15203},
108
+ timestamp = {Wed, 02 Jun 2021 11:46:42 +0200},
109
+ biburl = {https://dblp.org/rec/journals/corr/abs-2105-15203.bib},
110
+ bibsource = {dblp computer science bibliography, https://dblp.org}
111
+ }
112
+ ```