🚀 segformer-b2-fashion
segformer-b2-fashion 是一個用於圖像分割的模型,它在時尚領域有著出色的表現,能夠精準地對時尚元素進行分割識別。該模型基於預訓練模型微調而來,可有效處理各種時尚相關的圖像。
🚀 快速開始
本模型是 nvidia/mit-b2 在 sayeed99/fashion_segmentation 數據集上的微調版本。
💻 使用示例
基礎用法
from transformers import SegformerImageProcessor, AutoModelForSemanticSegmentation
from PIL import Image
import requests
import matplotlib.pyplot as plt
import torch.nn as nn
processor = SegformerImageProcessor.from_pretrained("sayeed99/segformer-b2-fashion")
model = AutoModelForSemanticSegmentation.from_pretrained("sayeed99/segformer-b2-fashion")
url = "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits.cpu()
upsampled_logits = nn.functional.interpolate(
logits,
size=image.size[::-1],
mode="bilinear",
align_corners=False,
)
pred_seg = upsampled_logits.argmax(dim=1)[0]
plt.imshow(pred_seg)
標籤說明
Labels : {"0":"其他所有內容", "1": "襯衫", "2": "上衣、T恤、運動衫", "3": "毛衣", "4": "開襟羊毛衫", "5": "夾克", "6": "背心", "7": "褲子", "8": "短褲", "9": "裙子", "10": "外套", "11": "連衣裙", "12": "連身褲", "13": "披肩", "14": "眼鏡", "15": "帽子", "16": "頭帶、頭巾、髮飾", "17": "領帶", "18": "手套", "19": "手錶", "20": "腰帶", "21": "腿套", "22": "緊身褲、長襪", "23": "襪子", "24": "鞋子", "25": "包、錢包", "26": "圍巾", "27": "雨傘", "28": "兜帽", "29": "衣領", "30": "翻領", "31": "肩章", "32": "袖子", "33": "口袋", "34": "領口", "35": "搭扣", "36": "拉鍊", "37": "貼花", "38": "珠子", "39": "蝴蝶結", "40": "花朵", "41": "流蘇", "42": "絲帶", "43": "鉚釘", "44": "褶邊", "45": "亮片", "46": "纓穗"}
📚 詳細文檔
框架版本
- Transformers 4.30.0
- Pytorch 2.2.2+cu121
- Datasets 2.18.0
- Tokenizers 0.13.3
📄 許可證
該模型的許可證信息可在 此處 查看。
📖 引用信息
@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}
}