kevinkyi commited on
Commit
71cc2a7
·
verified ·
1 Parent(s): 697843e

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +73 -0
README.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ pipeline_tag: image-classification
4
+ license: mit
5
+ tags:
6
+ - automl
7
+ - pytorch
8
+ - torchvision
9
+ - optuna
10
+ - early-stopping
11
+ model_name: Tomato vs Not-Tomato — AutoML (Compact CNN / Transfer Learning)
12
+ language:
13
+ - en
14
+ ---
15
+
16
+ # Tomato vs Not-Tomato — AutoML (Compact NN)
17
+
18
+ ## Purpose
19
+ Course assignment to practice AutoML for neural networks on a small, real dataset.
20
+ We train a compact image classifier to predict whether an image **is a tomato (1) or not (0).**
21
+
22
+ ## Dataset
23
+ - **Source:** classmate dataset on Hugging Face → `Iris314/Food_tomatoes_dataset`
24
+ - **Task:** Binary classification (`0 = not_tomato`, `1 = tomato`)
25
+ - **Splits:** Stratified **60/20/20** (train/val/test) created in the notebook
26
+ - **Size:** ~30 images total (very small)
27
+ - **Input resolution:** 224×224
28
+
29
+ ## Preprocessing & Augmentation
30
+ - **Normalization:** mean = [0.485, 0.456, 0.406], std = [0.229, 0.224, 0.225]
31
+ - **Train augmentations:** RandomResizedCrop, HorizontalFlip(0.5), ColorJitter
32
+ - **Eval transforms:** Resize → CenterCrop → Normalize
33
+
34
+ ## AutoML Setup
35
+ - **Search framework:** Optuna (budgeted search with pruning)
36
+ - **Architectures:** `smallcnn` (from scratch), `resnet18`, `mobilenet_v3_small`
37
+ - **Hyperparams:** optimizer ∈ {adamw, sgd}, lr ∈ [1e-5, 5e-3] (log), weight_decay ∈ [1e-6, 1e-2] (log),
38
+ dropout ∈ [0, 0.6], batch_size ∈ {8, 12, 16}, `freeze_backbone` ∈ {True, False} (for pretrained)
39
+ - **Early stopping:** patience = 6 epochs on validation F1
40
+ - **Budget:** 10 trials, max 20 epochs per trial, ~5 min wall-clock
41
+ - **Seed:** 42
42
+ - **Compute:** Google Colab GPU runtime
43
+
44
+ ## Best Model & Hyperparameters
45
+ ```json
46
+ {
47
+ "arch": "mobilenet_v3_small",
48
+ "freeze_backbone": false,
49
+ "dropout": 0.4761270681732692,
50
+ "optimizer": "adamw",
51
+ "lr": 1.1860369117967872e-05,
52
+ "weight_decay": 0.00043282443346186894,
53
+ "batch_size": 16
54
+ }
55
+ ```
56
+ ## Limitations & Known Failure Modes
57
+ - Extremely small dataset → risk of overfitting and unstable metrics.
58
+ - Backgrounds and lighting variations can bias predictions.
59
+ - Out-of-distribution images (e.g., tomato cartoons, extreme angles) may fail.
60
+
61
+ ## Ethics
62
+ - This model is for coursework demonstration only; not for production or consequential decisions.
63
+
64
+ ## License
65
+ - Code & weights: MIT (adjust per course requirements)
66
+ - Dataset: follow the original dataset’s license/terms
67
+
68
+ ## Acknowledgments
69
+ - Dataset: Iris314/Food_tomatoes_dataset
70
+ - AutoML: Optuna
71
+ - Backbones: torchvision models
72
+ - Trained in Google Colab
73
+ - GenAI tools assisted with boilerplate organization and documentation