shwethd commited on
Commit
92a5bd1
·
verified ·
1 Parent(s): 4ec2306

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -14
README.md CHANGED
@@ -1,28 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # ResNet on CIFAR-100
2
 
3
- This project trains a ResNet model from scratch on the CIFAR-100 dataset.
4
 
5
  ## Target
6
 
7
- - Achieve 73% top-1 accuracy on CIFAR-100.
8
- - No pre-trained models are used.
9
 
10
  ## Project Structure
11
 
12
- - `main.py`: Main script to train the model.
13
- - `model.py`: ResNet model implementation.
14
- - `utils.py`: Data loading, augmentations, and other utilities.
15
- - `logs.md`: Training logs.
 
 
 
 
 
 
 
 
 
 
16
 
17
- ## How to run
 
 
 
 
 
18
 
19
- 1. Install dependencies: `pip install -r requirements.txt`
20
- 2. Run training: `python main.py`
 
21
 
22
- ## Hugging Face Spaces
 
 
 
23
 
24
- [Link to be added]
 
 
 
 
 
25
 
26
- ## GitHub
 
 
 
 
27
 
28
- [Link to be added]
 
 
 
 
1
+ ---
2
+ title: CIFAR-100 ResNet18 Classifier
3
+ emoji: 🚀
4
+ colorFrom: indigo
5
+ colorTo: purple
6
+ sdk: gradio
7
+ app_file: app.py
8
+ pinned: false
9
+ license: apache-2.0
10
+ ---
11
+
12
  # ResNet on CIFAR-100
13
 
14
+ Train a ResNet18 from scratch on CIFAR-100 and deploy a Gradio demo on Hugging Face Spaces.
15
 
16
  ## Target
17
 
18
+ - Achieve 73% top-1 accuracy on CIFAR-100
19
+ - Train from scratch (no pretrained weights)
20
 
21
  ## Project Structure
22
 
23
+ - `main.py`: Training entrypoint (OneCycleLR + label smoothing)
24
+ - `model.py`: ResNet18 architecture (with dropout)
25
+ - `utils.py`: CIFAR-100 dataloaders and augmentations (RandAugment + RandomErasing)
26
+ - `app.py`: Gradio Space app (CPU inference, loads `ckpt.pth` if present)
27
+ - `logs.md`: Training logs (epoch-by-epoch)
28
+ - `.gitattributes`: Git LFS rules for weight files (`.pth`, `.pt`)
29
+ - `requirements.txt`: Dependencies
30
+
31
+ ## Train
32
+
33
+ 1) Install deps
34
+ ```bash
35
+ pip install -r requirements.txt
36
+ ```
37
 
38
+ 2) Run training
39
+ ```bash
40
+ python main.py --lr 0.2 --epoch 70
41
+ ```
42
+ - Best checkpoint auto-saves as `ckpt.pth`
43
+ - Logs are written to `logs.md`
44
 
45
+ Tips:
46
+ - You can stop early once test accuracy ≥ 73% (best weights already saved)
47
+ - For Apple Silicon: code auto-uses `mps` if available
48
 
49
+ ## Export / Weights
50
+ - Keep the best weights at repo root as `ckpt.pth` (tracked via LFS)
51
+ - `app.py` will attempt to load one of: `ckpt.pth`, `checkpoint/resnet18_cifar100.pth`, `resnet18_cifar100.pth`
52
+ - If your checkpoint is a dict with `net` (current default), no change needed
53
 
54
+ ## Deploy to Hugging Face Spaces
55
+ 1) Create a new Space (SDK: Gradio)
56
+ 2) Push these files at minimum:
57
+ - `app.py`, `model.py`, `utils.py`, `requirements.txt`, `.gitattributes`
58
+ - `ckpt.pth` (LFS)
59
+ 3) The app runs CPU-only and resizes inputs to 32×32. It returns top-5 predictions.
60
 
61
+ ## Local Demo
62
+ ```bash
63
+ python app.py
64
+ ```
65
+ Open the printed local Gradio URL in your browser, upload an image, and view predictions.
66
 
67
+ ## Links
68
+ - Space: [link to be added]
69
+ - GitHub: [link to be added]
70
+ - Logs: `logs.md`