Create Readme.md
Browse files
Readme.md
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
tags:
|
4 |
+
- vision
|
5 |
+
- image-segmentation
|
6 |
+
- generated_from_trainer
|
7 |
+
widget:
|
8 |
+
- src: >-
|
9 |
+
https://media.istockphoto.com/id/515788534/photo/cheerful-and-confidant.jpg?s=612x612&w=0&k=20&c=T0Z4DfameRpyGhzevPomrm-wjZp7wmGjpAyjGcTzpkA=
|
10 |
+
example_title: Person
|
11 |
+
- src: >-
|
12 |
+
https://storage.googleapis.com/pai-images/1484fd9ea9d746eb9f1de0d6778dbea2.jpeg
|
13 |
+
example_title: Person
|
14 |
+
datasets:
|
15 |
+
- sayeed99/fashion_segmentation
|
16 |
+
model-index:
|
17 |
+
- name: segformer-b3-fashion
|
18 |
+
results: []
|
19 |
+
pipeline_tag: image-segmentation
|
20 |
+
---
|
21 |
+
|
22 |
+
|
23 |
+
# segformer-b3-fashion
|
24 |
+
|
25 |
+
This model is a fine-tuned version of [nvidia/mit-b3](https://huggingface.co/nvidia/mit-b3) on the sayeed99/fashion_segmentation dataset using original image sizes without resizing.
|
26 |
+
|
27 |
+
|
28 |
+
```python
|
29 |
+
from transformers import SegformerImageProcessor, AutoModelForSemanticSegmentation
|
30 |
+
from PIL import Image
|
31 |
+
import requests
|
32 |
+
import matplotlib.pyplot as plt
|
33 |
+
import torch.nn as nn
|
34 |
+
|
35 |
+
processor = SegformerImageProcessor.from_pretrained("sayeed99/segformer-b3-fashion")
|
36 |
+
model = AutoModelForSemanticSegmentation.from_pretrained("sayeed99/segformer-b3-fashion")
|
37 |
+
|
38 |
+
url = "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80"
|
39 |
+
|
40 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
41 |
+
inputs = processor(images=image, return_tensors="pt")
|
42 |
+
|
43 |
+
outputs = model(**inputs)
|
44 |
+
logits = outputs.logits.cpu()
|
45 |
+
|
46 |
+
upsampled_logits = nn.functional.interpolate(
|
47 |
+
logits,
|
48 |
+
size=image.size[::-1],
|
49 |
+
mode="bilinear",
|
50 |
+
align_corners=False,
|
51 |
+
)
|
52 |
+
|
53 |
+
pred_seg = upsampled_logits.argmax(dim=1)[0]
|
54 |
+
plt.imshow(pred_seg)
|
55 |
+
```
|
56 |
+
|
57 |
+
Labels : {"0":"Unlabelled", "1": "shirt, blouse", "2": "top, t-shirt, sweatshirt", "3": "sweater", "4": "cardigan", "5": "jacket", "6": "vest", "7": "pants", "8": "shorts", "9": "skirt", "10": "coat", "11": "dress", "12": "jumpsuit", "13": "cape", "14": "glasses", "15": "hat", "16": "headband, head covering, hair accessory", "17": "tie", "18": "glove", "19": "watch", "20": "belt", "21": "leg warmer", "22": "tights, stockings", "23": "sock", "24": "shoe", "25": "bag, wallet", "26": "scarf", "27": "umbrella", "28": "hood", "29": "collar", "30": "lapel", "31": "epaulette", "32": "sleeve", "33": "pocket", "34": "neckline", "35": "buckle", "36": "zipper", "37": "applique", "38": "bead", "39": "bow", "40": "flower", "41": "fringe", "42": "ribbon", "43": "rivet", "44": "ruffle", "45": "sequin", "46": "tassel"}
|
58 |
+
|
59 |
+
### Framework versions
|
60 |
+
|
61 |
+
- Transformers 4.30.0
|
62 |
+
- Pytorch 2.2.2+cu121
|
63 |
+
- Datasets 2.18.0
|
64 |
+
- Tokenizers 0.13.3
|
65 |
+
|
66 |
+
|
67 |
+
### License
|
68 |
+
|
69 |
+
The license for this model can be found [here](https://github.com/NVlabs/SegFormer/blob/master/LICENSE).
|
70 |
+
|
71 |
+
### BibTeX entry and citation info
|
72 |
+
|
73 |
+
```bibtex
|
74 |
+
@article{DBLP:journals/corr/abs-2105-15203,
|
75 |
+
author = {Enze Xie and
|
76 |
+
Wenhai Wang and
|
77 |
+
Zhiding Yu and
|
78 |
+
Anima Anandkumar and
|
79 |
+
Jose M. Alvarez and
|
80 |
+
Ping Luo},
|
81 |
+
title = {SegFormer: Simple and Efficient Design for Semantic Segmentation with
|
82 |
+
Transformers},
|
83 |
+
journal = {CoRR},
|
84 |
+
volume = {abs/2105.15203},
|
85 |
+
year = {2021},
|
86 |
+
url = {https://arxiv.org/abs/2105.15203},
|
87 |
+
eprinttype = {arXiv},
|
88 |
+
eprint = {2105.15203},
|
89 |
+
timestamp = {Wed, 02 Jun 2021 11:46:42 +0200},
|
90 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2105-15203.bib},
|
91 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
92 |
+
}
|