Compare commits

...

10 Commits

Author SHA1 Message Date
Niels Rogge 2c6f153e4c Update README.md 2022-08-09 11:29:37 +00:00
Niels Rogge 2591ce9057 Update README.md 2022-08-06 10:28:10 +00:00
Niels Rogge 6310f47d91 Update license 2022-08-06 10:07:36 +00:00
joaogante ff4c15ea95 Add TF weights (#2)
- Add TF weights (d474213c2b02d17db3fa814f371fe6fdb14d3929)
2022-07-20 09:53:14 +00:00
joaogante f900702eaf Update transformers architecture class (#1)
- Update transformers architecture class (5ee01c08e115cbd6737b9925745d900a37755fa9)
2022-07-19 10:40:37 +00:00
Niels Rogge 6f4aed64f4 Update README.md 2022-02-21 20:40:38 +00:00
Niels Rogge ba25a4f774 Create README.md 2022-02-21 20:27:52 +00:00
Niels Rogge ba402e7fc6 Fix size 2021-11-17 14:47:48 +00:00
Niels Rogge 19cc2e9fc5 Update preprocessor_config.json 2021-11-17 14:47:09 +00:00
Niels Rogge 12a2455fc5 Set do_pad to False 2021-11-09 14:24:59 +00:00
4 changed files with 81 additions and 17 deletions

75
README.md Normal file
View File

@ -0,0 +1,75 @@
---
license: other
tags:
- vision
- image-segmentation
datasets:
- cityscapes
widget:
- src: https://cdn-media.huggingface.co/Inference-API/Sample-results-on-the-Cityscapes-dataset-The-above-images-show-how-our-method-can-handle.png
example_title: Road
---
# SegFormer (b5-sized) model fine-tuned on CityScapes
SegFormer model fine-tuned on CityScapes at resolution 1024x1024. 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).
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.
## Model description
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.
## Intended uses & limitations
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.
### How to use
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
```python
from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
from PIL import Image
import requests
feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b5-finetuned-cityscapes-1024-1024")
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b5-finetuned-cityscapes-1024-1024")
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
```
For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/segformer.html#).
### License
The license for this model can be found [here](https://github.com/NVlabs/SegFormer/blob/master/LICENSE).
### BibTeX entry and citation info
```bibtex
@article{DBLP:journals/corr/abs-2105-15203,
author = {Enze Xie and
Wenhai Wang and
Zhiding Yu and
Anima Anandkumar and
Jose M. Alvarez and
Ping Luo},
title = {SegFormer: Simple and Efficient Design for Semantic Segmentation with
Transformers},
journal = {CoRR},
volume = {abs/2105.15203},
year = {2021},
url = {https://arxiv.org/abs/2105.15203},
eprinttype = {arXiv},
eprint = {2105.15203},
timestamp = {Wed, 02 Jun 2021 11:46:42 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-2105-15203.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
```

View File

@ -1,6 +1,6 @@
{
"architectures": [
"SegformerForImageSegmentation"
"SegformerForSemanticSegmentation"
],
"attention_probs_dropout_prob": 0.0,
"classifier_dropout_prob": 0.1,

View File

@ -1,12 +1,5 @@
{
"align": false,
"crop_size": [
512,
512
],
"do_normalize": true,
"do_pad": true,
"do_random_crop": false,
"do_resize": true,
"feature_extractor_type": "SegformerFeatureExtractor",
"image_mean": [
@ -14,19 +7,12 @@
0.456,
0.406
],
"image_scale": [
512,
512
],
"image_std": [
0.229,
0.224,
0.225
],
"keep_ratio": false,
"padding_value": 0,
"reduce_zero_label": false,
"reduce_labels": false,
"resample": 2,
"segmentation_padding_value": -100,
"size_divisor": 32
"size": 1024
}

BIN
tf_model.h5 (Stored with Git LFS) Normal file

Binary file not shown.