模型:

nvidia/segformer-b0-finetuned-cityscapes-768-768

英文

SegFormer(b0大小)模型在CityScapes上进行了微调

SegFormer模型在分辨率为768x768的CityScapes数据集上进行了微调。该模型由Xie等人在论文 SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers 中提出,并于 this repository 首次发布。

免责声明:发布SegFormer模型的团队并未为此模型编写模型卡片,因此本模型卡片由Hugging Face团队编写。

模型描述

SegFormer包含一个分层Transformer编码器和一个轻量级的全MLP解码头,以在ADE20K和Cityscapes等语义分割基准上取得出色的结果。首先在ImageNet-1k上对分层Transformer进行预训练,然后添加解码头并在下游数据集上进行整体微调。

拟合使用和限制

您可以使用原始模型进行语义分割任务。查看 model hub 以寻找您感兴趣的任务的微调版本。

如何使用

使用此模型将COCO 2017数据集中的图像分类为1,000个ImageNet类别的步骤如下:

from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
from PIL import Image
import requests

feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b0-finetuned-cityscapes-768-768")
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-cityscapes-768-768")

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)

有关更多代码示例,请参阅 documentation

许可证

有关此模型的许可证信息可以在 here 中找到。

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}
}