许可协议: 其他
标签:
微件示例:
- 图片链接: https://cdn-media.huggingface.co/Inference-API/Sample-results-on-the-Cityscapes-dataset-The-above-images-show-how-our-method-can-handle.png
示例标题: 道路
基于CityScapes微调的SegFormer(b5尺寸)模型
本模型是在1024x1024分辨率下对CityScapes数据集进行微调的SegFormer模型。该模型由谢等人于论文《SegFormer:基于Transformer的语义分割简洁高效设计》(https://arxiv.org/abs/2105.15203)中提出,并首发于该代码库(https://github.com/NVlabs/SegFormer)。
免责声明:SegFormer发布团队未为此模型编写说明卡,本说明卡由Hugging Face团队撰写。
模型描述
SegFormer采用分层式Transformer编码器与轻量级全MLP解码头架构,在ADE20K和城市景观等语义分割基准测试中表现优异。分层Transformer首先在ImageNet-1k上进行预训练,随后添加解码头并在下游数据集上整体微调。
预期用途与限制
您可将该原始模型用于语义分割任务。访问模型中心(https://huggingface.co/models?other=segformer)可查找针对特定任务微调的版本。
使用方法
以下示例展示如何使用本模型对COCO 2017数据集的图像进行ImageNet千分类:
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
更多代码示例请参阅文档(https://huggingface.co/transformers/model_doc/segformer.html#)。
许可协议
本模型许可详见此处(https://github.com/NVlabs/SegFormer/blob/master/LICENSE)。
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}
}