Nausad commited on
Commit
0faddb0
·
verified ·
1 Parent(s): d56b5b8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +117 -2
README.md CHANGED
@@ -1,10 +1,125 @@
1
  ---
2
- title: Vision Transformer Based Image Classification Model
3
  emoji: 👀
4
  colorFrom: purple
5
  colorTo: pink
6
  sdk: docker
 
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: CIFAR-10 Vision Transformer Classifier
3
  emoji: 👀
4
  colorFrom: purple
5
  colorTo: pink
6
  sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
+ license: mit
10
+ short_description: Classify images into 10 CIFAR-10 .
11
  ---
12
 
13
+ # 🔍 CIFAR-10 Vision Transformer Classifier
14
+
15
+ A web-based image classification application powered by a **custom Vision Transformer (ViT)** trained from scratch on the **CIFAR-10** dataset. Upload any image and get real-time predictions across 10 categories.
16
+
17
+ ---
18
+
19
+ ## 🚀 Demo
20
+
21
+ Upload any image via drag-and-drop or file browser. The model resizes it to **32×32 pixels** (the native CIFAR-10 resolution) and predicts one of 10 classes with confidence scores.
22
+
23
+ **Supported Classes:**
24
+ `airplane` · `automobile` · `bird` · `cat` · `deer` · `dog` · `frog` · `horse` · `ship` · `truck`
25
+
26
+ ---
27
+
28
+ ## 🧠 Model Architecture
29
+
30
+ | Component | Details |
31
+ |-----------|---------|
32
+ | Architecture | Vision Transformer (ViT) — built from scratch |
33
+ | Patch Size | 4 × 4 pixels |
34
+ | Embedding Dim | 256 |
35
+ | Transformer Depth | 20 layers |
36
+ | Attention Heads | 8 |
37
+ | MLP Dim | 512 |
38
+ | Total Parameters | ~10.57 Million |
39
+ | Input Size | 32 × 32 × 3 |
40
+ | Output Classes | 10 |
41
+
42
+ ### Training Details
43
+
44
+ | Metric | Value |
45
+ |--------|-------|
46
+ | Dataset | CIFAR-10 (50K train / 10K test) |
47
+ | Epochs | 25 |
48
+ | Training Accuracy | 72.59% |
49
+ | Test Accuracy | **70.51%** |
50
+
51
+ ---
52
+
53
+ ## 🛠️ Tech Stack
54
+
55
+ - **Backend:** Flask (Python)
56
+ - **ML Framework:** PyTorch
57
+ - **Frontend:** HTML5 · Vanilla CSS · JavaScript
58
+ - **Model:** Custom Vision Transformer (no pretrained weights)
59
+ - **Containerization:** Docker
60
+
61
+ ---
62
+
63
+ ## 📁 Project Structure
64
+
65
+ ```
66
+ ├── flask_app.py # Flask server (routes: /, /predict, /model-info)
67
+ ├── cifar10_model.pth # Trained model weights
68
+ ├── requirements.txt # Python dependencies
69
+ ├── Dockerfile # Container configuration
70
+ └── templates/
71
+ └── index.html # Full-featured web UI
72
+ ```
73
+
74
+ ---
75
+
76
+ ## ⚙️ Run Locally
77
+
78
+ ```bash
79
+ # 1. Install dependencies
80
+ pip install -r requirements.txt
81
+
82
+ # 2. Start the Flask server
83
+ python flask_app.py
84
+
85
+ # 3. Open in browser
86
+ # → http://127.0.0.1:5000
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 🐳 Run with Docker
92
+
93
+ ```bash
94
+ # Build the image
95
+ docker build -t cifar10-vit .
96
+
97
+ # Run the container
98
+ docker run -p 7860:7860 cifar10-vit
99
+
100
+ # Open in browser
101
+ # → http://localhost:7860
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 📊 Features
107
+
108
+ - 🖼️ **Drag & Drop upload** — supports JPEG, PNG, WEBP, BMP
109
+ - 🔲 **32×32 pixel simulator** — see exactly what the model processes
110
+ - 📊 **Animated probability bars** for all 10 classes
111
+ - ⚡ **Real-time inference** with latency display (milliseconds)
112
+ - 🎨 **Warm beige premium UI** with glassmorphism cards
113
+
114
+ ---
115
+
116
+ ## 👤 Author
117
+
118
+ **Nausad Ali**
119
+ Built with ❤️ and a Cup of Coffee
120
+
121
+ ---
122
+
123
+ ## 📄 License
124
+
125
+ This project is licensed under the **MIT License**.