16.png

Fashion-Product-Gender

Fashion-Product-Gender is a vision model fine-tuned from google/siglip2-base-patch16-224 using the SiglipForImageClassification architecture. It classifies fashion product images into one of five gender categories.

Classification Report:
              precision    recall  f1-score   support

        Boys     0.4127    0.0940    0.1531       830
       Girls     0.5000    0.0061    0.0121       655
         Men     0.7506    0.8393    0.7925     22104
      Unisex     0.5714    0.0188    0.0364      2126
       Women     0.7317    0.7609    0.7460     18357

    accuracy                         0.7407     44072
   macro avg     0.5933    0.3438    0.3480     44072
weighted avg     0.7240    0.7407    0.7130     44072

The model predicts one of the following gender categories for fashion products:

  • 0: Boys
  • 1: Girls
  • 2: Men
  • 3: Unisex
  • 4: Women

Run with Transformers πŸ€—

!pip install -q transformers torch pillow gradio
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch

# Load model and processor
model_name = "prithivMLmods/Fashion-Product-Gender"  # Replace with your actual model path
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)

# Label mapping
id2label = {
    0: "Boys",
    1: "Girls",
    2: "Men",
    3: "Unisex",
    4: "Women"
}

def classify_gender(image):
    """Predicts the gender category for a fashion product."""
    image = Image.fromarray(image).convert("RGB")
    inputs = processor(images=image, return_tensors="pt")

    with torch.no_grad():
        outputs = model(**inputs)
        logits = outputs.logits
        probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()

    predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
    return predictions

# Gradio interface
iface = gr.Interface(
    fn=classify_gender,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Label(label="Gender Prediction Scores"),
    title="Fashion-Product-Gender",
    description="Upload a fashion product image to predict the target gender category (Boys, Girls, Men, Unisex, Women)."
)

# Launch the app
if __name__ == "__main__":
    iface.launch()

Intended Use

This model is best suited for:

  • Fashion E-commerce tagging and search
  • Personalized recommendations based on gender
  • Catalog organization and gender-based filters
  • Retail analytics and demographic insights
Downloads last month
2
Safetensors
Model size
92.9M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for prithivMLmods/Fashion-Product-Gender

Finetuned
(51)
this model

Collection including prithivMLmods/Fashion-Product-Gender