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 = "fj11/fashion"
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)
Downloads last month
21
Safetensors
Model size
47.3M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for fj11/fashion

Base model

nvidia/mit-b3
Finetuned
(19)
this model

Dataset used to train fj11/fashion

Space using fj11/fashion 1