Views
No views yet

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.
1Classification Report:
2 precision recall f1-score support
3
4 Beige 0.4338 0.5409 0.4815 745
5 Black 0.8051 0.8656 0.8342 9699
6 Blue 0.7513 0.7858 0.7682 4906
7 Bronze 0.0000 0.0000 0.0000 89
8 Brown 0.6812 0.7596 0.7183 3440
9 Burgundy 0.0000 0.0000 0.0000 44
10 Charcoal 0.4941 0.1842 0.2684 228
11 Coffee Brown 0.0000 0.0000 0.0000 29
12 Copper 0.5000 0.0120 0.0235 83
13 Cream 0.3940 0.3446 0.3677 383
14Fluorescent Green 0.0000 0.0000 0.0000 5
15 Gold 0.4935 0.6747 0.5701 621
16 Green 0.7286 0.7760 0.7516 2103
17 Grey 0.6313 0.5002 0.5581 2735
18 Grey Melange 0.5728 0.4041 0.4739 146
19 Khaki 0.3540 0.2878 0.3175 139
20 Lavender 0.5049 0.3250 0.3954 160
21 Lime Green 0.0000 0.0000 0.0000 5
22 Magenta 0.5909 0.1016 0.1733 128
23 Maroon 0.5121 0.2929 0.3727 577
24 Mauve 0.0000 0.0000 0.0000 28
25 Metallic 0.0000 0.0000 0.0000 41
26 Multi 0.4005 0.3832 0.3917 394
27 Mushroom Brown 0.0000 0.0000 0.0000 16
28 Mustard 0.4912 0.2887 0.3636 97
29 Navy Blue 0.6290 0.4905 0.5512 1784
30 Nude 0.0000 0.0000 0.0000 21
31 Off White 0.5789 0.2418 0.3411 182
32 Olive 0.5259 0.5208 0.5233 409
33 Orange 0.6838 0.6119 0.6458 523
34 Peach 0.4727 0.4216 0.4457 185
35 Pink 0.6912 0.7423 0.7158 1824
36 Purple 0.6846 0.7568 0.7189 1612
37 Red 0.6916 0.8273 0.7534 2432
38 Rose 0.0000 0.0000 0.0000 21
39 Rust 0.5000 0.1692 0.2529 65
40 Sea Green 0.0000 0.0000 0.0000 22
41 Silver 0.6088 0.4830 0.5387 1089
42 Skin 0.5479 0.6319 0.5869 163
43 Steel 0.2857 0.0381 0.0672 315
44 Tan 0.6667 0.0357 0.0678 112
45 Taupe 0.0000 0.0000 0.0000 11
46 Teal 0.4857 0.2857 0.3598 119
47 Turquoise Blue 0.0000 0.0000 0.0000 69
48 White 0.7518 0.7950 0.7728 5497
49 Yellow 0.7714 0.8003 0.7856 776
50
51 accuracy 0.7072 44072
52 macro avg 0.4112 0.3343 0.3469 44072
53 weighted avg 0.6919 0.7072 0.6935 44072!pip install -q transformers torch pillow gradio1import gradio as gr
2from transformers import AutoImageProcessor, SiglipForImageClassification
3from PIL import Image
4import torch
5
6# Load model and processor
7model_name = "prithivMLmods/Fashion-Product-baseColour" # Replace with actual model path
8model = SiglipForImageClassification.from_pretrained(model_name)
9processor = AutoImageProcessor.from_pretrained(model_name)
10
11# Label mapping
12id2label = {
13 0: "Beige", 1: "Black", 2: "Blue", 3: "Bronze", 4: "Brown", 5: "Burgundy",
14 6: "Charcoal", 7: "Coffee Brown", 8: "Copper", 9: "Cream", 10: "Fluorescent Green",
15 11: "Gold", 12: "Green", 13: "Grey", 14: "Grey Melange", 15: "Khaki", 16: "Lavender",
16 17: "Lime Green", 18: "Magenta", 19: "Maroon", 20: "Mauve", 21: "Metallic",
17 22: "Multi", 23: "Mushroom Brown", 24: "Mustard", 25: "Navy Blue", 26: "Nude",
18 27: "Off White", 28: "Olive", 29: "Orange", 30: "Peach", 31: "Pink", 32: "Purple",
19 33: "Red", 34: "Rose", 35: "Rust", 36: "Sea Green", 37: "Silver", 38: "Skin",
20 39: "Steel", 40: "Tan", 41: "Taupe", 42: "Teal", 43: "Turquoise Blue", 44: "White", 45: "Yellow"
21}
22
23def classify_base_color(image):
24 """Predicts the base color of a fashion product from an image."""
25 image = Image.fromarray(image).convert("RGB")
26 inputs = processor(images=image, return_tensors="pt")
27
28 with torch.no_grad():
29 outputs = model(**inputs)
30 logits = outputs.logits
31 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
32
33 predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
34 return predictions
35
36# Gradio interface
37iface = gr.Interface(
38 fn=classify_base_color,
39 inputs=gr.Image(type="numpy"),
40 outputs=gr.Label(label="Base Colour Prediction Scores"),
41 title="Fashion-Product-baseColour",
42 description="Upload a fashion product image to detect its primary color (e.g., Red, Black, Cream, Navy Blue, etc.)."
43)
44
45# Launch the app
46if __name__ == "__main__":
47 iface.launch()