Segformer B0 fine-tuned for clothes segmentation

SegFormer model fine-tuned on ATR dataset for clothes segmentation. The dataset on hugging face is called "mattmdjaga/human_parsing_dataset".

from transformers import SegformerImageProcessor, AutoModelForSemanticSegmentation
from PIL import Image
import requests
import matplotlib.pyplot as plt
import torch.nn as nn

extractor = SegformerImageProcessor.from_pretrained("mattmdjaga/segformer_b0_clothes")
model = AutoModelForSemanticSegmentation.from_pretrained("mattmdjaga/segformer_b0_clothes")

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 = extractor(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
170
Safetensors
Model size
3.72M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for mattmdjaga/segformer_b0_clothes

Quantizations
1 model

Dataset used to train mattmdjaga/segformer_b0_clothes

Space using mattmdjaga/segformer_b0_clothes 1