Instructions to use Itbanque/fashion_segformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Itbanque/fashion_segformer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="Itbanque/fashion_segformer")# Load model directly from transformers import AutoImageProcessor, SegformerForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("Itbanque/fashion_segformer") model = SegformerForSemanticSegmentation.from_pretrained("Itbanque/fashion_segformer") - Notebooks
- Google Colab
- Kaggle
metadata
license: apache-2.0
datasets:
- fj11/fashion
base_model:
- nvidia/mit-b3
pipeline_tag: image-segmentation
library_name: transformers
SegFormer‑B3 for Fashion Semantic Segmentation (48 classes)
Base model: nvidia/mit-b3 Task: multi-class semantic segmentation for fashion images Classes: 0–47
⸻
🚀 Inference
from transformers import AutoModelForSemanticSegmentation, SegformerImageProcessor
from PIL import Image
import numpy as np
import requests
import matplotlib.pyplot as plt
import torch.nn as nn
model_id = "Itbanque/fashion_segformer"
processor = SegformerImageProcessor(
size={"height": 512, "width": 512},
do_resize=True,
do_normalize=True
)
model = AutoModelForSemanticSegmentation.from_pretrained(model_id).eval()
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)