chainyo commited on
Commit
5298838
1 Parent(s): 17609e7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -0
README.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - vision
5
+ - image-segmentation
6
+ datasets:
7
+ - segments/sidewalk-semantic
8
+ ---
9
+
10
+ # SegFormer (b1-sized) model fine-tuned on sidewalk-semantic dataset
11
+
12
+ SegFormer model fine-tuned on segments/sidewalk-semantic at resolution 512x512. 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
+
14
+ ## Model description
15
+
16
+ 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.
17
+
18
+ ## Intended uses & limitations
19
+
20
+ 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.
21
+
22
+ ### How to use
23
+
24
+ Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
25
+
26
+ ```python
27
+ from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
28
+ from PIL import Image
29
+ import requests
30
+
31
+ feature_extractor = SegformerFeatureExtractor(reduce_labels=True)
32
+ model = SegformerForSemanticSegmentation.from_pretrained("ChainYo/segformer-sidewalk")
33
+
34
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
35
+ image = Image.open(requests.get(url, stream=True).raw)
36
+
37
+ inputs = feature_extractor(images=image, return_tensors="pt")
38
+ outputs = model(**inputs)
39
+ logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
40
+ ```
41
+
42
+ For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/segformer.html#).