19.png

Fashion-Product-subCategory

Fashion-Product-subCategory is a vision model fine-tuned from google/siglip2-base-patch16-224 using the SiglipForImageClassification architecture. It classifies fashion product images into 45 fine-grained subcategories for retail and e-commerce applications.

Classification Report:
                          precision    recall  f1-score   support

             Accessories     0.9700    0.7519    0.8472       129
             Apparel Set     0.9011    0.7736    0.8325       106
                    Bags     0.9275    0.9767    0.9515      3053
           Bath and Body     1.0000    0.1111    0.2000         9
      Beauty Accessories     0.0000    0.0000    0.0000         3
                   Belts     0.9684    0.9840    0.9761       811
              Bottomwear     0.9445    0.9754    0.9597      2685
               Cufflinks     0.8870    0.9444    0.9148       108
                   Dress     0.7857    0.7364    0.7603       478
                    Eyes     0.7500    0.0882    0.1579        34
                 Eyewear     0.9898    0.9991    0.9944      1073
              Flip Flops     0.8558    0.9102    0.8822       913
               Fragrance     0.9280    0.9530    0.9404      1001
              Free Gifts     0.0000    0.0000    0.0000       104
                  Gloves     0.7000    0.3500    0.4667        20
                    Hair     0.8824    0.7895    0.8333        19
                Headwear     0.9403    0.8601    0.8984       293
         Home Furnishing     0.0000    0.0000    0.0000         1
               Innerwear     0.9763    0.9347    0.9550      1806
               Jewellery     0.9689    0.9527    0.9607      1079
                    Lips     0.9292    0.9271    0.9282       425
Loungewear and Nightwear     0.7604    0.6703    0.7125       464
                  Makeup     0.7904    0.8745    0.8303       263
                Mufflers     1.0000    0.0526    0.1000        38
                   Nails     0.9450    0.9892    0.9666       278
                Perfumes     0.0000    0.0000    0.0000         6
                  Sandal     0.8720    0.7940    0.8312       961
                   Saree     0.9320    0.9953    0.9626       427
                 Scarves     0.6316    0.7119    0.6693       118
        Shoe Accessories     0.0000    0.0000    0.0000         4
                   Shoes     0.9759    0.9799    0.9779      7323
                    Skin     0.5455    0.4528    0.4948        53
               Skin Care     0.7333    0.4490    0.5570        49
                   Socks     0.9417    0.9728    0.9570       698
      Sports Accessories     0.0000    0.0000    0.0000         3
        Sports Equipment     0.7083    0.8095    0.7556        21
                  Stoles     0.8871    0.6111    0.7237        90
                    Ties     0.9808    0.9884    0.9846       258
                 Topwear     0.9822    0.9914    0.9867     15383
               Umbrellas     1.0000    1.0000    1.0000         6
                Vouchers     0.0000    0.0000    0.0000         1
                 Wallets     0.9376    0.8605    0.8974       925
                 Watches     0.9790    0.9921    0.9855      2542
            Water Bottle     0.0000    0.0000    0.0000         7
              Wristbands     0.0000    0.0000    0.0000         4

                accuracy                         0.9568     44072
               macro avg     0.7091    0.6270    0.6412     44072
            weighted avg     0.9535    0.9568    0.9540     44072

The model predicts one of the following product subcategories:

"id2label": {
  "0": "Accessories",
  "1": "Apparel Set",
  "2": "Bags",
  "3": "Bath and Body",
  "4": "Beauty Accessories",
  "5": "Belts",
  "6": "Bottomwear",
  "7": "Cufflinks",
  "8": "Dress",
  "9": "Eyes",
  "10": "Eyewear",
  "11": "Flip Flops",
  "12": "Fragrance",
  "13": "Free Gifts",
  "14": "Gloves",
  "15": "Hair",
  "16": "Headwear",
  "17": "Home Furnishing",
  "18": "Innerwear",
  "19": "Jewellery",
  "20": "Lips",
  "21": "Loungewear and Nightwear",
  "22": "Makeup",
  "23": "Mufflers",
  "24": "Nails",
  "25": "Perfumes",
  "26": "Sandal",
  "27": "Saree",
  "28": "Scarves",
  "29": "Shoe Accessories",
  "30": "Shoes",
  "31": "Skin",
  "32": "Skin Care",
  "33": "Socks",
  "34": "Sports Accessories",
  "35": "Sports Equipment",
  "36": "Stoles",
  "37": "Ties",
  "38": "Topwear",
  "39": "Umbrellas",
  "40": "Vouchers",
  "41": "Wallets",
  "42": "Watches",
  "43": "Water Bottle",
  "44": "Wristbands"
}

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-subCategory"  # 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 Set", 2: "Bags", 3: "Bath and Body", 4: "Beauty Accessories",
    5: "Belts", 6: "Bottomwear", 7: "Cufflinks", 8: "Dress", 9: "Eyes", 10: "Eyewear",
    11: "Flip Flops", 12: "Fragrance", 13: "Free Gifts", 14: "Gloves", 15: "Hair", 16: "Headwear",
    17: "Home Furnishing", 18: "Innerwear", 19: "Jewellery", 20: "Lips", 21: "Loungewear and Nightwear",
    22: "Makeup", 23: "Mufflers", 24: "Nails", 25: "Perfumes", 26: "Sandal", 27: "Saree",
    28: "Scarves", 29: "Shoe Accessories", 30: "Shoes", 31: "Skin", 32: "Skin Care", 33: "Socks",
    34: "Sports Accessories", 35: "Sports Equipment", 36: "Stoles", 37: "Ties", 38: "Topwear",
    39: "Umbrellas", 40: "Vouchers", 41: "Wallets", 42: "Watches", 43: "Water Bottle", 44: "Wristbands"
}

def classify_subcategory(image):
    """Predicts the subcategory 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_subcategory,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Label(label="Subcategory Prediction Scores"),
    title="Fashion-Product-subCategory",
    description="Upload a fashion product image to predict its subcategory (e.g., Dress, Shoes, Accessories, etc.)."
)

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

Intended Use

This model is best suited for:

  • Product Subcategory Tagging: Automatically assign fine-grained subcategories to fashion product listings.
  • Improved Search & Filters: Enhance customer experience by enabling better filtering and browsing.
  • Catalog Structuring: Streamline fashion catalog organization at scale for large e-commerce platforms.
  • Automated Inventory Insights: Identify trends in product categories for sales, inventory, and marketing analysis.
Downloads last month
4
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-subCategory

Finetuned
(51)
this model

Collection including prithivMLmods/Fashion-Product-subCategory