๐ง Product-Image Classifier (CNN)
Flipkart-style catalogue auto-categorisation into Apparel / Electronics / Home โ MobileNetV3-Small (1.52M params) fine-tuned on 20,754 real product images from the public Amazon Reviews 2023 corpus (Hou et al., 2024). Fully reproducible: stream-sampled metadata โ image fetch โ stratified split โ train โ confusion-matrix & sub-category error analysis. One-click Google Colab notebook included.
Test Accuracy
91.71%
n=3,114 held-out ยท flip-TTA
Best Val Accuracy
92.10%
peak epoch 5/8 (warm-started)
Dataset Size
20,754
real product images ยท 3 classes
Model Size
1.52M
params ยท MobileNetV3-Small @224px
From-Scratch Baseline
84.1%
ProductCNN 0.63M params โ transfer wins
Split
70/15/15
14,527 / 3,113 / 3,114 ยท stratified, seed 42
๐ Per-Class Metrics
Test set n=3114
| Class | Precision | Recall | F1-score | Support |
|---|
| Apparel | 0.9602 | 0.9145 | 0.9368 | 1029 |
| Electronics | 0.9052 | 0.9200 | 0.9126 | 1038 |
| Home | 0.8897 | 0.9169 | 0.9031 | 1047 |
| overall accuracy | โ | โ | 0.9171 | 3114 |
Horizontal-flip test-time augmentation (disclosed in README; disable with --no-tta). All numbers from the fixed seed-42 split โ nothing re-split after training.
๐ข Confusion Matrix
Counts + row-normalised
Misclassified volume per pair
| True โ Predicted | Count | Share |
|---|
| Electronics โ Home | 68 | 6.6% of true Electronics |
| Home โ Electronics | 63 | 6.0% of true Home |
| Apparel โ Home | 51 | 5.0% of true Apparel |
| Apparel โ Electronics | 37 | 3.6% of true Apparel |
| Home โ Apparel | 24 | 2.3% of true Home |
| Electronics โ Apparel | 15 | 1.5% of true Electronics |
๐ Which pairs fumble โ and why
Sub-category evidence
๐ Electronics โ Home 68 images
- **Computers & Accessories** - 17 images, e.g. *"1080P Webcam with Microphone, Computer USB Web Camera Full HD for Windows 10 8 7 XP Mac OS"*
- **Unknown** - 13 images, e.g. *"EOS Meraki MX60 Enterprise License and Support, 3 Years, Electronic Delivery"*
- **Camera & Photo** - 11 images, e.g. *"MyRingLight - Fluorescent Ring Light, 5400K, 65watts, Photo and Video"*
๐ Home โ Electronics 63 images
- **Kitchen & Dining** - 22 images, e.g. *"De'Longhi Stilosa Manual Espresso Machine, Latte & Cappuccino Maker & Stainless Steel Milk"*
- **Home Dรฉcor Products** - 11 images, e.g. *"Karlsson Wall Clock Platinum Record Aluminum, Silver"*
- **Unknown** - 9 images, e.g. *"Grocery plastic Bag Dispenser,Brushed Stainless Steel Organizer,Wall Mount Trash Holder,Re"*
๐ Apparel โ Home 51 images
- **Other apparel (title-derived)** - 17 images, e.g. *"Pierced Owl - Organic Coconut Wood Saddle Fit Solid Plugs, Sold as a Pair"*
- **Jewelry & Watches (title-derived)** - 7 images, e.g. *"10K Yellow Gold Cherub Angel Pendant Praying Angel 1 inch"*
- **Bags & Wallets (title-derived)** - 5 images, e.g. *"S.CHU Women's A Mom And A Nurse Tote Handbag Stripes Weave Shoulder Bag Black"*
๐ Apparel โ Electronics 37 images
- **Jewelry & Watches (title-derived)** - 14 images, e.g. *"SUPERDAVES SUPERSTORE Kurdistan Red Country Flag C' Bracelet Wristband. for Adults & Teens"*
- **Other apparel (title-derived)** - 9 images, e.g. *"Magnetic Backgammon Board Game"*
- **Shoes (title-derived)** - 3 images, e.g. *"Paw Patrol Skye & Everest Toddler Girls Slippers, Medium (7/8)"*
๐ Home โ Apparel 24 images
- **Home Dรฉcor Products** - 9 images, e.g. *"Juvale Blue Nautical Poop Deck Hanging Wall Sign Beach Ocean Theme (12 x 7.5 In)"*
- **Kitchen & Dining** - 6 images, e.g. *"YUTRO Fashion Women's Winter Slouchy Fleece Lined Wool Beanie Hat One Size OCEAN BLUE"*
- **Vacuums & Floor Care** - 2 images, e.g. *"Oreck Belt, Corded U7000 Series"*
๐ Electronics โ Apparel 15 images
- **Wearable Technology** - 3 images, e.g. *"VANLUCK Strap Compatible with Mi Band 5/XiaoMi Band 6, Replacement Leather Strap Wristband"*
- **Computers & Accessories** - 3 images, e.g. *"hBARSCI Violin Player Vinyl Decal - 5 Inches - for Cars, Trucks, Windows, Laptops, Tablets"*
- **Television & Video** - 2 images, e.g. *"Power Acoustik PMD-103CM BG 10.4-Inch Overhead Monitor with Built-in DVD Player"*
Sub-category names marked (title-derived): the corpus's Amazon-Fashion slice ships without a category tree upstream, so Apparel sub-categories are derived from product titles with a transparent keyword rule. Examples include genuine upstream label noise (e.g. a board game filed under Apparel) โ reported as-is.
๐ธ Real misclassified test images
Hardest examples
Apparel โ Electronics
Apparel โ Home
Electronics โ Apparel
Electronics โ Home
Home โ Apparel
Home โ Electronics
๐ Training Curves
Loss & accuracy vs epoch
Two stages: (1) 160px warm-up, AdamW head 7e-4 / trunk 1.4e-4; (2) 224px fine-tune, AdamW 2.5e-4 cosine, label smoothing 0.05, batch 24, early stop. Full provenance: reports/TRAINING_LOG_NOTE.md in the repo.
๐งช Pipeline
100% reproducible
๐ฅ Data
- Stream-samples public JSONL via HTTP range requests (no multi-GB download)
- Parallel fetch + Pillow validation + EXIF fix + SHA-1 content dedup
- 165 dead URLs & 81 duplicate images dropped automatically
๐๏ธ Training
- torchvision transforms: RandomResizedCrop, flip, rotation, colour jitter
- AdamW + cosine annealing + label smoothing 0.05
- Early stopping on val accuracy; best checkpoint tracked automatically
๐ Reproduce in Colab
- notebooks/product_image_classifier_colab.ipynb โ Runtime โ T4 GPU โ Run all
- Downloads dataset.zip from the v1.0.0 release (images + splits + metadata)
- Trains both models; prints the same tables & confusion matrix
๐ฎ Single-image inference
- python -m src.predict path/to/product.jpg โ ranked class probabilities
- Checkpoint stores arch, classes, img size & normalisation stats