Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,120 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
metrics:
|
| 6 |
+
- accuracy
|
| 7 |
+
tags:
|
| 8 |
+
- CNN
|
| 9 |
+
- NeuralNetwork
|
| 10 |
+
---
|
| 11 |
+
# CIFAR-10 CNN Image Classifier
|
| 12 |
+
|
| 13 |
+
A Convolutional Neural Network (CNN) built **from scratch** using **TensorFlow/Keras** to classify images from the CIFAR-10 dataset into 10 object categories.
|
| 14 |
+
|
| 15 |
+
This project focuses on **understanding CNN design, training stability, regularization, and evaluation**, without using pretrained models or transfer learning.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## 🚀 Project Overview
|
| 20 |
+
|
| 21 |
+
This project demonstrates:
|
| 22 |
+
|
| 23 |
+
- CNN architecture design from first principles
|
| 24 |
+
- Training and evaluation on the CIFAR-10 dataset
|
| 25 |
+
- Overfitting detection and mitigation
|
| 26 |
+
- Confusion matrix–based error analysis
|
| 27 |
+
- Clean, modular ML project structure
|
| 28 |
+
|
| 29 |
+
The goal is to gain **hands-on understanding of deep learning fundamentals**, rather than maximizing benchmark scores.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 🧠 Dataset
|
| 34 |
+
|
| 35 |
+
**CIFAR-10**
|
| 36 |
+
|
| 37 |
+
- 60,000 color images (32×32)
|
| 38 |
+
- 10 classes:
|
| 39 |
+
- airplane, automobile, bird, cat, deer
|
| 40 |
+
- dog, frog, horse, ship, truck
|
| 41 |
+
- 50,000 training images
|
| 42 |
+
- 10,000 test images
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
## 🏗️ Model Architecture
|
| 47 |
+
|
| 48 |
+
- **3 Convolutional blocks**
|
| 49 |
+
- Conv2D → Batch Normalization → ReLU → MaxPooling
|
| 50 |
+
- **Classifier**
|
| 51 |
+
- Dense(256) → Dropout(0.5)
|
| 52 |
+
- Dense(128) → Dropout(0.3)
|
| 53 |
+
- Dense(10 logits)
|
| 54 |
+
- Loss handled using `SparseCategoricalCrossentropy(from_logits=True)`
|
| 55 |
+
|
| 56 |
+
**Total parameters:** ~1.3M
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## ⚙️ Training Strategy
|
| 61 |
+
|
| 62 |
+
- Input normalization
|
| 63 |
+
- Data augmentation (horizontal flip, rotation, zoom)
|
| 64 |
+
- Batch Normalization for stable training
|
| 65 |
+
- Dropout for regularization
|
| 66 |
+
- Early stopping to prevent overfitting
|
| 67 |
+
|
| 68 |
+
Training was stopped automatically once validation performance stopped improving.
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## 📊 Evaluation & Results
|
| 73 |
+
|
| 74 |
+
- **Best validation accuracy:** ~67%
|
| 75 |
+
- Small train–validation gap → good generalization
|
| 76 |
+
- Performance analyzed using a **confusion matrix**
|
| 77 |
+
|
| 78 |
+
Key observations:
|
| 79 |
+
- Strong performance on classes like automobile, frog, ship, and truck
|
| 80 |
+
- Expected confusion between visually similar classes (cat ↔ dog, deer ↔ horse)
|
| 81 |
+
- Confusion matrix used as a diagnostic tool rather than accuracy alone
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## 🛠️ Installation
|
| 86 |
+
|
| 87 |
+
```bash
|
| 88 |
+
git clone https://github.com/revanthreddy0906/cifar10-cnn-image-classifier.git
|
| 89 |
+
cd cifar10-cnn-image-classifier
|
| 90 |
+
pip install -r requirements.txt
|
| 91 |
+
```
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
**📌 Key Learnings**
|
| 95 |
+
--------------------
|
| 96 |
+
|
| 97 |
+
- CNNs outperform dense networks for image data
|
| 98 |
+
|
| 99 |
+
- Correct data pipelines are critical for stable training
|
| 100 |
+
|
| 101 |
+
- Overfitting must be diagnosed using validation metrics
|
| 102 |
+
|
| 103 |
+
- Confusion matrices provide deeper insight than accuracy alone
|
| 104 |
+
|
| 105 |
+
- Regularization and early stopping are essential for generalization
|
| 106 |
+
|
| 107 |
+
* * * * *
|
| 108 |
+
|
| 109 |
+
**📈 Future Improvements**
|
| 110 |
+
--------------------------
|
| 111 |
+
|
| 112 |
+
- Stronger data augmentation (MixUp / CutOut)
|
| 113 |
+
|
| 114 |
+
- Learning rate scheduling
|
| 115 |
+
|
| 116 |
+
- Residual connections (ResNet-style blocks)
|
| 117 |
+
|
| 118 |
+
- Transfer learning with pretrained backbones
|
| 119 |
+
|
| 120 |
+
- Per-class precision and recall analysis
|