|
Download README.md from Nausad/Vision_Transformer_Based_Image_Classification_Model: direct link, hf CLI and curl.
- Browser
- Download file 2.85 kB
-
https://huggingface.co/spaces/Nausad/Vision_Transformer_Based_Image_Classification_Model/resolve/cb91c228e10d02172fba0eadfc2016080b1f7f12/README.md
- Command line
-
hf download hf://spaces/Nausad/Vision_Transformer_Based_Image_Classification_Model@cb91c228e10d02172fba0eadfc2016080b1f7f12/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Nausad/Vision_Transformer_Based_Image_Classification_Model/resolve/cb91c228e10d02172fba0eadfc2016080b1f7f12/README.md
2.85 kB
| title: CIFAR-10 Vision Transformer Classifier | |
| emoji: 👀 | |
| colorFrom: purple | |
| colorTo: pink | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| license: mit | |
| short_description: Classify images into 10 CIFAR-10 . | |
| # 🔍 CIFAR-10 Vision Transformer Classifier | |
| 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. | |
| --- | |
| ## 🚀 Demo | |
| 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. | |
| **Supported Classes:** | |
| `airplane` · `automobile` · `bird` · `cat` · `deer` · `dog` · `frog` · `horse` · `ship` · `truck` | |
| --- | |
| ## 🧠 Model Architecture | |
| | Component | Details | | |
| |-----------|---------| | |
| | Architecture | Vision Transformer (ViT) — built from scratch | | |
| | Patch Size | 4 × 4 pixels | | |
| | Embedding Dim | 256 | | |
| | Transformer Depth | 20 layers | | |
| | Attention Heads | 8 | | |
| | MLP Dim | 512 | | |
| | Total Parameters | ~10.57 Million | | |
| | Input Size | 32 × 32 × 3 | | |
| | Output Classes | 10 | | |
| ### Training Details | |
| | Metric | Value | | |
| |--------|-------| | |
| | Dataset | CIFAR-10 (50K train / 10K test) | | |
| | Epochs | 25 | | |
| | Training Accuracy | 72.59% | | |
| | Test Accuracy | **70.51%** | | |
| --- | |
| ## 🛠️ Tech Stack | |
| - **Backend:** Flask (Python) | |
| - **ML Framework:** PyTorch | |
| - **Frontend:** HTML5 · Vanilla CSS · JavaScript | |
| - **Model:** Custom Vision Transformer (no pretrained weights) | |
| - **Containerization:** Docker | |
| --- | |
| ## 📁 Project Structure | |
| ``` | |
| ├── flask_app.py # Flask server (routes: /, /predict, /model-info) | |
| ├── cifar10_model.pth # Trained model weights | |
| ├── requirements.txt # Python dependencies | |
| ├── Dockerfile # Container configuration | |
| └── templates/ | |
| └── index.html # Full-featured web UI | |
| ``` | |
| --- | |
| ## ⚙️ Run Locally | |
| ```bash | |
| # 1. Install dependencies | |
| pip install -r requirements.txt | |
| # 2. Start the Flask server | |
| python flask_app.py | |
| # 3. Open in browser | |
| # → http://127.0.0.1:5000 | |
| ``` | |
| --- | |
| ## 🐳 Run with Docker | |
| ```bash | |
| # Build the image | |
| docker build -t cifar10-vit . | |
| # Run the container | |
| docker run -p 7860:7860 cifar10-vit | |
| # Open in browser | |
| # → http://localhost:7860 | |
| ``` | |
| --- | |
| ## 📊 Features | |
| - 🖼️ **Drag & Drop upload** — supports JPEG, PNG, WEBP, BMP | |
| - 🔲 **32×32 pixel simulator** — see exactly what the model processes | |
| - 📊 **Animated probability bars** for all 10 classes | |
| - ⚡ **Real-time inference** with latency display (milliseconds) | |
| - 🎨 **Warm beige premium UI** with glassmorphism cards | |
| --- | |
| ## 👤 Author | |
| **Nausad Ali** | |
| Built with ❤️ and a Cup of Coffee | |
| --- | |
| ## 📄 License | |
| This project is licensed under the **MIT License**. | |