๐Ÿง  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
ClassPrecisionRecallF1-scoreSupport
Apparel0.96020.91450.93681029
Electronics0.90520.92000.91261038
Home0.88970.91690.90311047
overall accuracyโ€”โ€”0.91713114
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
confusion matrix
Misclassified volume per pair
True โ†’ PredictedCountShare
Electronics โ†’ Home686.6% of true Electronics
Home โ†’ Electronics636.0% of true Home
Apparel โ†’ Home515.0% of true Apparel
Apparel โ†’ Electronics373.6% of true Apparel
Home โ†’ Apparel242.3% of true Home
Electronics โ†’ Apparel151.5% of true Electronics

๐Ÿ”Ž Which pairs fumble โ€” and why

Sub-category evidence
๐Ÿ”€ Electronics โ†’ Home 68 images
๐Ÿ”€ Home โ†’ Electronics 63 images
๐Ÿ”€ Apparel โ†’ Home 51 images
๐Ÿ”€ Apparel โ†’ Electronics 37 images
๐Ÿ”€ Home โ†’ Apparel 24 images
๐Ÿ”€ Electronics โ†’ Apparel 15 images
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
misclassified
Apparel โ†’ Electronics
misclassified
Apparel โ†’ Home
misclassified
Electronics โ†’ Apparel
misclassified
Electronics โ†’ Home
misclassified
Home โ†’ Apparel
misclassified
Home โ†’ Electronics

๐Ÿ“ˆ Training Curves

Loss & accuracy vs epoch
training curves
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