Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# macOS
.DS_Store

# Python cache
__pycache__/
*.py[cod]
.ipynb_checkpoints/

# Local environments
.venv/
venv/
env/

# Large/generated model files
*.h5
*.keras
*.pkl
*.joblib
*.ckpt
checkpoints/
models/

# Logs and temporary outputs
logs/
*.log
tmp/
temp/
184 changes: 122 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,130 @@
# Image Classification with CNN

Build a Convolutional Neural Network (CNN) model to classify images from the CIFAR-10 dataset into 10 predefined categories through iterative architectural improvements and advanced training techniques.

[Repository link](https://github.com/pavithraaiengineer/CNN-DL-ImageClassification)

## Project Results
In this project, we processed the CIFAR-10 dataset and explored the results of 10 different classifier iterations:
* Models #1 - #4: Building sequential CNN models from scratch.
* Models #5 - #8: Deepening architecture and implementing Global Average Pooling.
* Model #9: Transfer learning and fine-tuning using EfficientNetB0.
* Model #10: Ensemble,
* Deployment for final prediction.

## Repository Folders and Files

### Documents
* **Presentation Slides**
* **Read me file**
* **10 notebooks with diferent models**

---

## Technical Evolution & Performance

```diff
# Training Progress Log
- Model #1: Baseline (2 Conv layers) -> Test Acc: 55.70%
- Model #2: Added BN and Dropout -> Test Acc: 62.63%
+ Model #3: Optimized 32x32 + BN -> Test Acc: 82.15%
+ Model #4: 6 Conv layers + L2 Reg -> Test Acc: 81.00%
+ Model #6: 13 Conv layers + GAP -> Test Acc: 93.03%
+ Model #7: Contrast Aug + AdamW -> Test Acc: 93.12%
+ Model #8: Brightnes augmentation. + AdamW -> Test Acc: 93.12%
+ Model #9: Transfer Learning (EfficientNetB0) -> Test Acc: 91.35%
+ Model #10: Final Ensemble for Maximum Stability 93.21%

---
## PROBLEMS & CHALLENGES

```diff
- Overfitting: High training accuracy but failed to generalize to the test set.
- Class Weakness: "Cat" and "Dog" categories had the lowest performance.
- Recall Drop: Cat/Dog recall declined continuously during training iterations.
- Feature Extraction: Baseline model was too shallow to capture complex image patterns.
- Data Quality: 32x32 resolution was too low and blurry for distinct classification.

---
# CIFAR-10 Image Classification with CNNs

This project builds and compares deep learning models for image classification on the CIFAR-10 dataset. The goal was to improve model performance step by step, starting from a simple Convolutional Neural Network and ending with stronger CNN, transfer learning, and ensemble experiments.

## Dataset

The project uses the CIFAR-10 image dataset:

- 60,000 color images
- 10 image classes
- 32x32 pixel image size
- 50,000 training images
- 10,000 test images

Classes:

```text
airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck
```

The dataset is small and low-resolution, which makes classification harder for visually similar classes such as cats and dogs.

## Project Goal

The main goal was to train a CNN model that can classify CIFAR-10 images accurately while reducing overfitting. We tested multiple model versions to understand how architecture changes and training strategies affect performance.

## Repository Structure

```text
.
├── README.md
├── notebooks/
│ ├── Model1.ipynb
│ ├── Model1_v2.ipynb
│ ├── Model2.ipynb
│ ├── Model2_4.ipynb
│ ├── Model2_6.ipynb
│ ├── Model3.ipynb
│ ├── Model4.ipynb
│ ├── Model5.ipynb
│ ├── Model6.ipynb
│ ├── Model7.ipynb
│ ├── Model8.ipynb
│ ├── Model9.ipynb
│ └── model10.ipynb
└── presentations/
└── CIFAR-10 CNN Classification Project (1).key
```

All model notebooks are stored in the `notebooks/` folder so the repository is easier to navigate.

## Methods Tested

We compared several CNN and deep learning strategies:

- Baseline CNN built from scratch
- Deeper CNN architectures
- Batch Normalization
- Dropout regularization
- L2 regularization
- Data augmentation
- Global Average Pooling
- AdamW optimizer
- Transfer learning with EfficientNetB0
- Ensemble prediction for final stability

## Model Evolution

| Model | Main Change | Test Accuracy |
|---|---|---:|
| Model 1 | Baseline CNN with 2 convolution layers | 55.70% |
| Model 2 | Added Batch Normalization and Dropout | 62.63% |
| Model 3 | Optimized CNN for 32x32 images with BatchNorm | 82.15% |
| Model 4 | 6 convolution layers with L2 regularization | 81.00% |
| Model 6 | Deeper CNN with 13 convolution layers and GAP | 93.03% |
| Model 7 | Contrast augmentation and AdamW | 93.12% |
| Model 8 | Brightness augmentation and AdamW | 93.12% |
| Model 9 | Transfer learning with EfficientNetB0 | 91.35% |
| Model 10 | Final ensemble model | 93.21% |

## Best Result

The best final result came from the ensemble model:

```text
Best test accuracy: 93.21%
```

Model 7 was the strongest single model, while Model 10 gave the most stable final prediction through ensembling.

## Main Challenges

- Overfitting appeared when training accuracy improved faster than test accuracy.
- Cat and dog images were often confused because CIFAR-10 images are very small.
- The 32x32 resolution limits how much visual detail the model can learn.
- Deeper models helped, but regularization and augmentation were needed to improve generalization.

## Recommended Notebooks
To see the best performing results and the final architecture, we recommend starting with these notebooks:

```diff
+ Recommended: model_7_training (Best Single Model)
+ Recommended: model_10_ensemble (Final Ensemble Strategy & Deployment)
! Note: Model 7 provides the highest individual accuracy, while Model 10
! offers the most stable predictions on unseen data and highest accuracy.
Start with these notebooks if you want to understand the strongest results:

- `notebooks/Model7.ipynb`: best single-model strategy
- `notebooks/model10.ipynb`: final ensemble strategy

## Installation & Setup
## How to Run

To replicate the environment and run the notebooks, follow these steps:
Create and activate a Python environment:

```bash
# 1. Create a virtual environment
python -m venv .venv

# 2. Activate the environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
```

Install the main libraries:

```bash
pip install tensorflow keras numpy pandas matplotlib seaborn scikit-learn jupyter
```

Open Jupyter:

```bash
jupyter notebook
```

Then run the notebooks from the `notebooks/` folder.

## Notes

This project was completed as a deep learning image classification project. This repository version is organized to make the model experiments, results, and presentation easier to review.
File renamed without changes.
File renamed without changes.
379 changes: 379 additions & 0 deletions notebooks/Model1_v2.ipynb

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.