CoolFace
Modelpublic

zyuzuguldu/garment-segmentation-unet-resnet50

sourceHugging Faceapache-2.0updated 9mo agoView on Hugging Face
0likes
Model Card

Fashion Segmentation Model (Unet / resnet50)

This model performs binary segmentation to extract upper-body garments and clothing items from images. It was trained on the DeepFashion2 dataset using the Unet architecture with a resnet50 encoder.

Model Details

  • —Task: Binary Segmentation (Cloth vs Background)
  • —Architecture: Unet
  • —Encoder: resnet50 (Weights: imagenet)
  • —Decoder Channels: (256, 128, 64, 32, 16)
  • —Input Resolution: 768x768
  • —Classes: 1 (Binary segmentation)
  • —Activation Function: None (None = logits output)
  • —Performance:
  • —Validation IoU: 0.8964 at epoch 45

Usage

python
import torch
import segmentation_models_pytorch as smp
from safetensors.torch import load_file

# Load the model
model = smp.Unet(
    encoder_name="resnet50",
    classes=1,
    activation=None,
    decoder_channels=(256, 128, 64, 32, 16)
)

# Load weights from safetensors
state_dict = load_file("model.safetensors")
model.load_state_dict(state_dict)
model.eval()

# Use for inference
with torch.no_grad():
    prediction = model(input_image)  # Input: (B, 3, 768, 768)
    mask = torch.sigmoid(prediction) > 0.5  # Binary mask

Training Details

  • —Dataset: DeepFashion2
  • —Framework: PyTorch Lightning
  • —Run ID: p2avrl3r

Intended Use

This model is designed for virtual try-on applications, fashion image editing, and garment extraction tasks.