 
![18.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/B0YuDqYBhhE310ZHAFDFE.png)

# **Fashion-Product-baseColour**

> **Fashion-Product-baseColour** is a visual classification model fine-tuned from **google/siglip2-base-patch16-224** using the **SiglipForImageClassification** architecture. It predicts the **base color** of fashion products from images — enabling accurate tagging, search, and recommendation in fashion-related applications.

```py
Classification Report:
                   precision    recall  f1-score   support

            Beige     0.4338    0.5409    0.4815       745
            Black     0.8051    0.8656    0.8342      9699
             Blue     0.7513    0.7858    0.7682      4906
           Bronze     0.0000    0.0000    0.0000        89
            Brown     0.6812    0.7596    0.7183      3440
         Burgundy     0.0000    0.0000    0.0000        44
         Charcoal     0.4941    0.1842    0.2684       228
     Coffee Brown     0.0000    0.0000    0.0000        29
           Copper     0.5000    0.0120    0.0235        83
            Cream     0.3940    0.3446    0.3677       383
Fluorescent Green     0.0000    0.0000    0.0000         5
             Gold     0.4935    0.6747    0.5701       621
            Green     0.7286    0.7760    0.7516      2103
             Grey     0.6313    0.5002    0.5581      2735
     Grey Melange     0.5728    0.4041    0.4739       146
            Khaki     0.3540    0.2878    0.3175       139
         Lavender     0.5049    0.3250    0.3954       160
       Lime Green     0.0000    0.0000    0.0000         5
          Magenta     0.5909    0.1016    0.1733       128
           Maroon     0.5121    0.2929    0.3727       577
            Mauve     0.0000    0.0000    0.0000        28
         Metallic     0.0000    0.0000    0.0000        41
            Multi     0.4005    0.3832    0.3917       394
   Mushroom Brown     0.0000    0.0000    0.0000        16
          Mustard     0.4912    0.2887    0.3636        97
        Navy Blue     0.6290    0.4905    0.5512      1784
             Nude     0.0000    0.0000    0.0000        21
        Off White     0.5789    0.2418    0.3411       182
            Olive     0.5259    0.5208    0.5233       409
           Orange     0.6838    0.6119    0.6458       523
            Peach     0.4727    0.4216    0.4457       185
             Pink     0.6912    0.7423    0.7158      1824
           Purple     0.6846    0.7568    0.7189      1612
              Red     0.6916    0.8273    0.7534      2432
             Rose     0.0000    0.0000    0.0000        21
             Rust     0.5000    0.1692    0.2529        65
        Sea Green     0.0000    0.0000    0.0000        22
           Silver     0.6088    0.4830    0.5387      1089
             Skin     0.5479    0.6319    0.5869       163
            Steel     0.2857    0.0381    0.0672       315
              Tan     0.6667    0.0357    0.0678       112
            Taupe     0.0000    0.0000    0.0000        11
             Teal     0.4857    0.2857    0.3598       119
   Turquoise Blue     0.0000    0.0000    0.0000        69
            White     0.7518    0.7950    0.7728      5497
           Yellow     0.7714    0.8003    0.7856       776

         accuracy                         0.7072     44072
        macro avg     0.4112    0.3343    0.3469     44072
     weighted avg     0.6919    0.7072    0.6935     44072
```

The model categorizes fashion product images into the following **46 base color classes**:

- Beige, Black, Blue, Bronze, Brown, Burgundy, Charcoal, Coffee Brown, Copper, Cream  
- Fluorescent Green, Gold, Green, Grey, Grey Melange, Khaki, Lavender, Lime Green  
- Magenta, Maroon, Mauve, Metallic, Multi, Mushroom Brown, Mustard, Navy Blue  
- Nude, Off White, Olive, Orange, Peach, Pink, Purple, Red, Rose, Rust  
- Sea Green, Silver, Skin, Steel, Tan, Taupe, Teal, Turquoise Blue, White, Yellow  

---

# **Run with Transformers 🤗**

```python
!pip install -q transformers torch pillow gradio
```

```python
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch

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

# Label mapping
id2label = {
    0: "Beige", 1: "Black", 2: "Blue", 3: "Bronze", 4: "Brown", 5: "Burgundy",
    6: "Charcoal", 7: "Coffee Brown", 8: "Copper", 9: "Cream", 10: "Fluorescent Green",
    11: "Gold", 12: "Green", 13: "Grey", 14: "Grey Melange", 15: "Khaki", 16: "Lavender",
    17: "Lime Green", 18: "Magenta", 19: "Maroon", 20: "Mauve", 21: "Metallic",
    22: "Multi", 23: "Mushroom Brown", 24: "Mustard", 25: "Navy Blue", 26: "Nude",
    27: "Off White", 28: "Olive", 29: "Orange", 30: "Peach", 31: "Pink", 32: "Purple",
    33: "Red", 34: "Rose", 35: "Rust", 36: "Sea Green", 37: "Silver", 38: "Skin",
    39: "Steel", 40: "Tan", 41: "Taupe", 42: "Teal", 43: "Turquoise Blue", 44: "White", 45: "Yellow"
}

def classify_base_color(image):
    """Predicts the base color of a fashion product from an image."""
    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_base_color,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Label(label="Base Colour Prediction Scores"),
    title="Fashion-Product-baseColour",
    description="Upload a fashion product image to detect its primary color (e.g., Red, Black, Cream, Navy Blue, etc.)."
)

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

---

# **Intended Use**

This model is ideal for:

- **E-commerce platforms** for accurate product color labeling  
- **Fashion search engines** and recommendation systems  
- **Inventory and catalog automation**  
- **Fashion analytics and trends tracking**  
- **Design tools** for color-based sorting and filters
beige black blue bronze brown burgundy charcoal coffee brown copper cream fluorescent green gold green grey grey melange khaki lavender lime green magenta maroon mauve metallic multi mushroom brown mustard navy blue nude off white olive orange peach pink purple red rose rust sea green silver skin steel tan taupe teal turquoise blue white yellow