Upload README.txt
Browse files- README.txt +75 -0
README.txt
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
tags:
|
4 |
+
- vision
|
5 |
+
- image-segmentation
|
6 |
+
datasets:
|
7 |
+
- cityscapes
|
8 |
+
widget:
|
9 |
+
- src: https://cdn-media.huggingface.co/Inference-API/Sample-results-on-the-Cityscapes-dataset-The-above-images-show-how-our-method-can-handle.png
|
10 |
+
example_title: Road
|
11 |
+
---
|
12 |
+
|
13 |
+
# SegFormer (b0-sized) model fine-tuned on CityScapes
|
14 |
+
|
15 |
+
SegFormer model fine-tuned on CityScapes at resolution 768x768. It was introduced in the paper [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) by Xie et al. and first released in [this repository](https://github.com/NVlabs/SegFormer).
|
16 |
+
|
17 |
+
Disclaimer: The team releasing SegFormer did not write a model card for this model so this model card has been written by the Hugging Face team.
|
18 |
+
|
19 |
+
## Model description
|
20 |
+
|
21 |
+
SegFormer consists of a hierarchical Transformer encoder and a lightweight all-MLP decode head to achieve great results on semantic segmentation benchmarks such as ADE20K and Cityscapes. The hierarchical Transformer is first pre-trained on ImageNet-1k, after which a decode head is added and fine-tuned altogether on a downstream dataset.
|
22 |
+
|
23 |
+
## Intended uses & limitations
|
24 |
+
|
25 |
+
You can use the raw model for semantic segmentation. See the [model hub](https://huggingface.co/models?other=segformer) to look for fine-tuned versions on a task that interests you.
|
26 |
+
|
27 |
+
### How to use
|
28 |
+
|
29 |
+
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
30 |
+
|
31 |
+
```python
|
32 |
+
from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
|
33 |
+
from PIL import Image
|
34 |
+
import requests
|
35 |
+
|
36 |
+
feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b0-finetuned-cityscapes-768-768")
|
37 |
+
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-cityscapes-768-768")
|
38 |
+
|
39 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
40 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
41 |
+
|
42 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
43 |
+
outputs = model(**inputs)
|
44 |
+
logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
|
45 |
+
```
|
46 |
+
|
47 |
+
For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/segformer.html#).
|
48 |
+
|
49 |
+
### License
|
50 |
+
|
51 |
+
The license for this model can be found [here](https://github.com/NVlabs/SegFormer/blob/master/LICENSE).
|
52 |
+
|
53 |
+
### BibTeX entry and citation info
|
54 |
+
|
55 |
+
```bibtex
|
56 |
+
@article{DBLP:journals/corr/abs-2105-15203,
|
57 |
+
author = {Enze Xie and
|
58 |
+
Wenhai Wang and
|
59 |
+
Zhiding Yu and
|
60 |
+
Anima Anandkumar and
|
61 |
+
Jose M. Alvarez and
|
62 |
+
Ping Luo},
|
63 |
+
title = {SegFormer: Simple and Efficient Design for Semantic Segmentation with
|
64 |
+
Transformers},
|
65 |
+
journal = {CoRR},
|
66 |
+
volume = {abs/2105.15203},
|
67 |
+
year = {2021},
|
68 |
+
url = {https://arxiv.org/abs/2105.15203},
|
69 |
+
eprinttype = {arXiv},
|
70 |
+
eprint = {2105.15203},
|
71 |
+
timestamp = {Wed, 02 Jun 2021 11:46:42 +0200},
|
72 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2105-15203.bib},
|
73 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
74 |
+
}
|
75 |
+
```
|