Tobias Cornille
commited on
Commit
•
661d9c6
1
Parent(s):
6ddc926
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- vision
|
4 |
+
- image-segmentation
|
5 |
+
datasets:
|
6 |
+
- segments/sidewalk-semantic
|
7 |
+
widget:
|
8 |
+
- src: https://segmentsai-prod.s3.eu-west-2.amazonaws.com/assets/admin-tobias/439f6843-80c5-47ce-9b17-0b2a1d54dbeb.jpg
|
9 |
+
example_title: Brugge
|
10 |
+
---
|
11 |
+
# SegFormer (b0-sized) model fine-tuned on Segments.ai Sidewalk Semantic
|
12 |
+
SegFormer model fine-tuned on Segments.ai Sidewalk Semantic. 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).
|
13 |
+
## Model description
|
14 |
+
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.
|
15 |
+
## Intended uses & limitations
|
16 |
+
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.
|
17 |
+
### How to use
|
18 |
+
Here is how to use this model to classify an image of the sidewalk dataset:
|
19 |
+
```python
|
20 |
+
from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
|
21 |
+
from PIL import Image
|
22 |
+
import requests
|
23 |
+
feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")
|
24 |
+
model = SegformerForSemanticSegmentation.from_pretrained("segments-tobias/segformer-b0-finetuned-segments-sidewalk")
|
25 |
+
url = "https://segmentsai-prod.s3.eu-west-2.amazonaws.com/assets/admin-tobias/439f6843-80c5-47ce-9b17-0b2a1d54dbeb.jpg"
|
26 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
27 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
28 |
+
outputs = model(**inputs)
|
29 |
+
logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
|
30 |
+
```
|
31 |
+
For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/segformer.html#).
|
32 |
+
### BibTeX entry and citation info
|
33 |
+
```bibtex
|
34 |
+
@article{DBLP:journals/corr/abs-2105-15203,
|
35 |
+
author = {Enze Xie and
|
36 |
+
Wenhai Wang and
|
37 |
+
Zhiding Yu and
|
38 |
+
Anima Anandkumar and
|
39 |
+
Jose M. Alvarez and
|
40 |
+
Ping Luo},
|
41 |
+
title = {SegFormer: Simple and Efficient Design for Semantic Segmentation with
|
42 |
+
Transformers},
|
43 |
+
journal = {CoRR},
|
44 |
+
volume = {abs/2105.15203},
|
45 |
+
year = {2021},
|
46 |
+
url = {https://arxiv.org/abs/2105.15203},
|
47 |
+
eprinttype = {arXiv},
|
48 |
+
eprint = {2105.15203},
|
49 |
+
timestamp = {Wed, 02 Jun 2021 11:46:42 +0200},
|
50 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2105-15203.bib},
|
51 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
52 |
+
}
|
53 |
+
```
|