license: other
tags:
- 视觉
- 图像分割
datasets:
- 城市景观数据集
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: 道路
基于CityScapes微调的SegFormer(b0尺寸)模型
该SegFormer模型在768x768分辨率下针对CityScapes数据集进行了微调。该模型由谢等人于论文《SegFormer:基于Transformer的语义分割简洁高效设计》(https://arxiv.org/abs/2105.15203)中提出,并首次发布于此代码库。
免责声明:发布SegFormer的团队未为此模型编写模型卡,本模型卡由Hugging Face团队撰写。
模型描述
SegFormer包含一个分层Transformer编码器和一个轻量级全MLP解码头,在ADE20K和Cityscapes等语义分割基准测试中表现出色。分层Transformer首先在ImageNet-1k上进行预训练,随后添加解码头并在下游数据集上共同微调。
预期用途与限制
您可以将该原始模型用于语义分割任务。请访问模型中心查找您感兴趣任务的微调版本。
使用方法
以下示例展示如何使用该模型对COCO 2017数据集的图像进行分类(分为1000个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
更多代码示例请参阅文档。
许可证
该模型的许可证可在此处查看。
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}
}