prithivMLmods commited on
Commit
a3679ee
·
verified ·
1 Parent(s): 9ad22ce

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +226 -1
README.md CHANGED
@@ -1,6 +1,20 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
4
 
5
  ```py
6
  Classification Report:
@@ -151,4 +165,215 @@ Face Scrub and Exfoliator 0.0000 0.0000 0.0000 4
151
  accuracy 0.8911 44072
152
  macro avg 0.7131 0.6174 0.6361 44072
153
  weighted avg 0.8877 0.8911 0.8846 44072
154
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model:
6
+ - google/siglip2-base-patch16-224
7
+ pipeline_tag: image-classification
8
+ library_name: transformers
9
+ tags:
10
+ - fashion
11
+ - articleType
12
+ - product
13
+ - siglip2
14
  ---
15
+ # **Fashion-Product-articleType**
16
+
17
+ > **Fashion-Product-articleType** is a vision model fine-tuned from **google/siglip2-base-patch16-224** using the **SiglipForImageClassification** architecture. It classifies fashion product images into one of 141 article types.
18
 
19
  ```py
20
  Classification Report:
 
165
  accuracy 0.8911 44072
166
  macro avg 0.7131 0.6174 0.6361 44072
167
  weighted avg 0.8877 0.8911 0.8846 44072
168
+ ```
169
+
170
+ The model predicts one of the following **article types** for fashion products, such as:
171
+
172
+ - **0:** Accessory Gift Set
173
+ - **1:** Baby Dolls
174
+ - **2:** Backpacks
175
+ - **3:** Bangle
176
+ - **...**
177
+ - **140:** Wristbands
178
+
179
+ ---
180
+
181
+ # **Run with Transformers 🤗**
182
+
183
+ ```bash
184
+ pip install -q transformers torch pillow gradio
185
+ ```
186
+
187
+ ```python
188
+ import gradio as gr
189
+ from transformers import AutoImageProcessor, SiglipForImageClassification
190
+ from PIL import Image
191
+ import torch
192
+
193
+ # Load model and processor
194
+ model_name = "prithivMLmods/Fashion-Product-articleType" # Replace with your actual model path
195
+ model = SiglipForImageClassification.from_pretrained(model_name)
196
+ processor = AutoImageProcessor.from_pretrained(model_name)
197
+
198
+ # Label mapping
199
+ id2label = {
200
+ 0: "Accessory Gift Set",
201
+ 1: "Baby Dolls",
202
+ 2: "Backpacks",
203
+ 3: "Bangle",
204
+ 4: "Basketballs",
205
+ 5: "Bath Robe",
206
+ 6: "Beauty Accessory",
207
+ 7: "Belts",
208
+ 8: "Blazers",
209
+ 9: "Body Lotion",
210
+ 10: "Body Wash and Scrub",
211
+ 11: "Booties",
212
+ 12: "Boxers",
213
+ 13: "Bra",
214
+ 14: "Bracelet",
215
+ 15: "Briefs",
216
+ 16: "Camisoles",
217
+ 17: "Capris",
218
+ 18: "Caps",
219
+ 19: "Casual Shoes",
220
+ 20: "Churidar",
221
+ 21: "Clothing Set",
222
+ 22: "Clutches",
223
+ 23: "Compact",
224
+ 24: "Concealer",
225
+ 25: "Cufflinks",
226
+ 26: "Cushion Covers",
227
+ 27: "Deodorant",
228
+ 28: "Dresses",
229
+ 29: "Duffel Bag",
230
+ 30: "Dupatta",
231
+ 31: "Earrings",
232
+ 32: "Eye Cream",
233
+ 33: "Eyeshadow",
234
+ 34: "Face Moisturisers",
235
+ 35: "Face Scrub and Exfoliator",
236
+ 36: "Face Serum and Gel",
237
+ 37: "Face Wash and Cleanser",
238
+ 38: "Flats",
239
+ 39: "Flip Flops",
240
+ 40: "Footballs",
241
+ 41: "Formal Shoes",
242
+ 42: "Foundation and Primer",
243
+ 43: "Fragrance Gift Set",
244
+ 44: "Free Gifts",
245
+ 45: "Gloves",
246
+ 46: "Hair Accessory",
247
+ 47: "Hair Colour",
248
+ 48: "Handbags",
249
+ 49: "Hat",
250
+ 50: "Headband",
251
+ 51: "Heels",
252
+ 52: "Highlighter and Blush",
253
+ 53: "Innerwear Vests",
254
+ 54: "Ipad",
255
+ 55: "Jackets",
256
+ 56: "Jeans",
257
+ 57: "Jeggings",
258
+ 58: "Jewellery Set",
259
+ 59: "Jumpsuit",
260
+ 60: "Kajal and Eyeliner",
261
+ 61: "Key chain",
262
+ 62: "Kurta Sets",
263
+ 63: "Kurtas",
264
+ 64: "Kurtis",
265
+ 65: "Laptop Bag",
266
+ 66: "Leggings",
267
+ 67: "Lehenga Choli",
268
+ 68: "Lip Care",
269
+ 69: "Lip Gloss",
270
+ 70: "Lip Liner",
271
+ 71: "Lip Plumper",
272
+ 72: "Lipstick",
273
+ 73: "Lounge Pants",
274
+ 74: "Lounge Shorts",
275
+ 75: "Lounge Tshirts",
276
+ 76: "Makeup Remover",
277
+ 77: "Mascara",
278
+ 78: "Mask and Peel",
279
+ 79: "Mens Grooming Kit",
280
+ 80: "Messenger Bag",
281
+ 81: "Mobile Pouch",
282
+ 82: "Mufflers",
283
+ 83: "Nail Essentials",
284
+ 84: "Nail Polish",
285
+ 85: "Necklace and Chains",
286
+ 86: "Nehru Jackets",
287
+ 87: "Night suits",
288
+ 88: "Nightdress",
289
+ 89: "Patiala",
290
+ 90: "Pendant",
291
+ 91: "Perfume and Body Mist",
292
+ 92: "Rain Jacket",
293
+ 93: "Ring",
294
+ 94: "Robe",
295
+ 95: "Rompers",
296
+ 96: "Rucksacks",
297
+ 97: "Salwar",
298
+ 98: "Salwar and Dupatta",
299
+ 99: "Sandals",
300
+ 100: "Sarees",
301
+ 101: "Scarves",
302
+ 102: "Shapewear",
303
+ 103: "Shirts",
304
+ 104: "Shoe Accessories",
305
+ 105: "Shoe Laces",
306
+ 106: "Shorts",
307
+ 107: "Shrug",
308
+ 108: "Skirts",
309
+ 109: "Socks",
310
+ 110: "Sports Sandals",
311
+ 111: "Sports Shoes",
312
+ 112: "Stockings",
313
+ 113: "Stoles",
314
+ 114: "Sunglasses",
315
+ 115: "Sunscreen",
316
+ 116: "Suspenders",
317
+ 117: "Sweaters",
318
+ 118: "Sweatshirts",
319
+ 119: "Swimwear",
320
+ 120: "Tablet Sleeve",
321
+ 121: "Ties",
322
+ 122: "Ties and Cufflinks",
323
+ 123: "Tights",
324
+ 124: "Toner",
325
+ 125: "Tops",
326
+ 126: "Track Pants",
327
+ 127: "Tracksuits",
328
+ 128: "Travel Accessory",
329
+ 129: "Trolley Bag",
330
+ 130: "Trousers",
331
+ 131: "Trunk",
332
+ 132: "Tshirts",
333
+ 133: "Tunics",
334
+ 134: "Umbrellas",
335
+ 135: "Waist Pouch",
336
+ 136: "Waistcoat",
337
+ 137: "Wallets",
338
+ 138: "Watches",
339
+ 139: "Water Bottle",
340
+ 140: "Wristbands"
341
+ }
342
+
343
+ def classify_article_type(image):
344
+ """Predicts the article type for a fashion product."""
345
+ image = Image.fromarray(image).convert("RGB")
346
+ inputs = processor(images=image, return_tensors="pt")
347
+
348
+ with torch.no_grad():
349
+ outputs = model(**inputs)
350
+ logits = outputs.logits
351
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
352
+
353
+ predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
354
+ return predictions
355
+
356
+ # Gradio interface
357
+ iface = gr.Interface(
358
+ fn=classify_article_type,
359
+ inputs=gr.Image(type="numpy"),
360
+ outputs=gr.Label(label="Article Type Prediction Scores"),
361
+ title="Fashion-Product-articleType",
362
+ description="Upload a fashion product image to predict its article type (e.g., T-shirt, Jeans, Handbag, etc)."
363
+ )
364
+
365
+ # Launch the app
366
+ if __name__ == "__main__":
367
+ iface.launch()
368
+ ```
369
+
370
+ ---
371
+
372
+ # **Intended Use**
373
+
374
+ This model is best suited for:
375
+
376
+ - **Fashion E-commerce Tagging & Categorization**
377
+ - **Automated Product Labeling for Catalogs**
378
+ - **Enhanced Product Search & Filtering**
379
+ - **Retail Analytics and Product Type Breakdown**