VOOZH about

URL: https://huggingface.co/prithivMLmods/Fashion-Product-masterCategory

⇱ prithivMLmods/Fashion-Product-masterCategory · Hugging Face


👁 13.png

Fashion-Product-masterCategory

Fashion-Product-masterCategory is a vision model fine-tuned from google/siglip2-base-patch16-224 using the SiglipForImageClassification architecture. It classifies fashion product images into high-level master categories.

Classification Report:
 precision recall f1-score support

 Accessories 0.9611 0.9698 0.9654 11244
 Apparel 0.9855 0.9919 0.9887 21361
 Footwear 0.9952 0.9936 0.9944 9197
 Free Items 0.0000 0.0000 0.0000 105
 Home 0.0000 0.0000 0.0000 1
 Personal Care 0.9638 0.9219 0.9424 2139
Sporting Goods 1.0000 0.0400 0.0769 25

 accuracy 0.9803 44072
 macro avg 0.7008 0.5596 0.5668 44072
 weighted avg 0.9779 0.9803 0.9788 44072

The model predicts one of the following master categories:

  • 0: Accessories
  • 1: Apparel
  • 2: Footwear
  • 3: Free Items
  • 4: Home
  • 5: Personal Care
  • 6: Sporting Goods

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-masterCategory" # Replace with your actual model path
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)

# Label mapping
id2label = {
 0: "Accessories",
 1: "Apparel",
 2: "Footwear",
 3: "Free Items",
 4: "Home",
 5: "Personal Care",
 6: "Sporting Goods"
}

def classify_master_category(image):
 """Predicts the master category of 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_master_category,
 inputs=gr.Image(type="numpy"),
 outputs=gr.Label(label="Master Category Prediction Scores"),
 title="Fashion-Product-masterCategory",
 description="Upload a fashion product image to predict its master category (Accessories, Apparel, Footwear, etc.)."
)

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

Intended Use

This model can be applied to:

  • E-commerce product categorization
  • Automated tagging of product catalogs
  • Enhancing search and filtering options
  • Data annotation pipelines for fashion datasets
Downloads last month
8
Safetensors
Model size
92.9M params
Tensor type
F32
·

Model tree for prithivMLmods/Fashion-Product-masterCategory

Finetuned
(119)
this model

Collection including prithivMLmods/Fashion-Product-masterCategory