An open API service indexing awesome lists of open source software.

https://github.com/parth147op/intel-image-classification

Intel Image Classification using CNN & Transfer Learning (VGG16) with Streamlit demo.
https://github.com/parth147op/intel-image-classification

cnn computer-vision deep-learning image-classification keras streamlit tensorflow transfer-learning

Last synced: about 2 months ago
JSON representation

Intel Image Classification using CNN & Transfer Learning (VGG16) with Streamlit demo.

Awesome Lists containing this project

README

          

# ๐Ÿ–ผ๏ธ Intel Image Classification with CNNs & Transfer Learning

![Python](https://img.shields.io/badge/Python-3.10-blue?logo=python&logoColor=white)
![TensorFlow](https://img.shields.io/badge/TensorFlow-2.14-orange?logo=tensorflow&logoColor=white)
![Keras](https://img.shields.io/badge/Keras-3.3.3-red?logo=keras&logoColor=white)
![Streamlit](https://img.shields.io/badge/Streamlit-App-FF4B4B?logo=streamlit&logoColor=white)
![Status](https://img.shields.io/badge/Project%20Status-Completed-brightgreen)
![License](https://img.shields.io/badge/License-MIT-yellow)

> ๐Ÿง  A complete end-to-end deep-learning pipeline โ€” from data preprocessing and CNN training to a deployment-ready Streamlit app.

---

## ๐Ÿ“Œ Project Overview

This project focuses on **scene image classification** using Convolutional Neural Networks (CNNs) and Transfer Learning.
The dataset consists of natural scenes categorized into six classes, and the goal was to develop a high-accuracy model deployable via Streamlit.

**Highlights**
- ๐Ÿงฉ Baseline CNN from scratch (80 % accuracy)
- โš™๏ธ Transfer learning with **VGG16** (88 %)
- ๐ŸŽฏ Fine-tuned model reaching **90 %+ validation accuracy**
- ๐Ÿ“ˆ Visualizations: confusion matrix and Grad-CAM interpretability
- ๐Ÿ–ฅ๏ธ Frontend built in **Streamlit**

---

## ๐Ÿ“‚ Dataset

- **Source:** [Intel Image Classification Dataset โ€“ Kaggle](https://www.kaggle.com/puneet6060/intel-image-classification)
- **Classes:** `buildings`, `forest`, `glacier`, `mountain`, `sea`, `street`
- **Split:**
- Train โ‰ˆ 14 000
- Validation โ‰ˆ 3 000
- Test โ‰ˆ 3 000

---

## ๐Ÿงฑ Architecture & Approach

### Data preparation
- Verified and removed corrupted images
- Applied extensive augmentation (`rotation`, `shift`, `zoom`, `brightness`, `flip`)
- Normalized pixels to [0, 1]

### Baseline CNN
- 3 convolutional + pooling layers
- Dense layer (256 neurons + dropout)
- Accuracy โ‰ˆ 80 % @ 10 epochs

### Transfer Learning โ€“ VGG16
- Pre-trained ImageNet base
- Custom head: `Flatten โ†’ Dense(512 ReLU) โ†’ Dropout โ†’ Softmax(6)`
- Validation โ‰ˆ 88 %

### Fine-tuned Model
- Unfrozen last block (`block5_conv1โ€“3`)
- LR = 1e-5, early stopping
- Validation โ‰ˆ 90.4 %, Test โ‰ˆ 90.2 %

### Hyperparameter Optimization
- Tuned with **Keras Tuner**: conv blocks, filters, dense units, dropout, optimizer, LR

---

## ๐Ÿ“Š Results

| Model | Validation Acc | Test Acc |
|:------|:---------------:|:--------:|
| Baseline CNN | 80 % | 78.5 % |
| VGG16 (frozen) | 88.4 % | 87.5 % |
| **VGG16 (fine-tuned)** | **90.4 %** | **90.2 %** |

**Classification Report**

```
precision recall f1-score support
buildings 0.91 0.87 0.89 437
forest 0.97 0.99 0.98 474
glacier 0.87 0.85 0.86 553
mountain 0.86 0.84 0.85 525
sea 0.92 0.92 0.92 510
street 0.89 0.94 0.92 501
accuracy 0.90 3000
```

---

## ๐Ÿ“ธ Visualizations

| Confusion Matrix |
|:-----------------|
| ![Confusion Matrix](results/Confusion_Matrix.png) |

**Streamlit App Demo**

![Streamlit Demo](results/streamlit_demo.png)

---

## ๐Ÿงฉ Tech Stack
- **Languages:** Python (Numpy, Pandas)
- **Frameworks:** TensorFlow 2.14 ยท Keras 3.3.3 ยท Streamlit
- **Visualization:** Matplotlib ยท Seaborn ยท OpenCV
- **Tools:** Jupyter Notebook ยท Keras Tuner ยท Git

---

## ๐Ÿš€ Deployment & MLOps

![Docker](https://img.shields.io/badge/Docker-Ready-blue?logo=docker)
![AWS](https://img.shields.io/badge/AWS-Deployable-232F3E?logo=amazonaws)
![CI/CD](https://img.shields.io/badge/MLOps-GitHub%20Actions-lightgrey?logo=githubactions)

### Deployment Options
- Dockerized App
```bash
docker build -t intel-cnn-api .
docker run -p 8501:8501 intel-cnn-api
```
- Deploy on AWS ยท GCP ยท Render ยท Streamlit Cloud
- Production server โ†’ NGINX + Gunicorn

### MLOps Extensions
- CI/CD pipeline (GitHub Actions)
- Model registry (MLflow / Weights & Biases)
- Drift monitoring & auto-rollback

---

## ๐ŸŽจ Streamlit App

**Run locally**

```bash
streamlit run app/app.py
```

**Features**
- Upload JPG/PNG image
- Displays prediction + confidence chart
- Clean and responsive UI

---

## โš™๏ธ Setup Guide

```bash
# 1๏ธโƒฃ Clone repo
git clone https://github.com/parthhpatel/intel-image-classification.git
cd intel-image-classification

# 2๏ธโƒฃ Create virtual environment
python -m venv venv
.env\Scriptsctivate

# 3๏ธโƒฃ Install requirements
pip install -r requirements.txt

# 4๏ธโƒฃ Run app or notebook
streamlit run app/app.py
# or
jupyter notebook notebooks/Intel_Image_Classification.ipynb
```

---

## ๐Ÿ—‚๏ธ Folder Structure

```
intel-image-classification/
โ”œโ”€โ”€ notebooks/
โ”‚ โ””โ”€โ”€ Intel_Image_Classification.ipynb
โ”œโ”€โ”€ app/
โ”‚ โ”œโ”€โ”€ app.py
โ”‚ โ””โ”€โ”€ intel_cnn_best.h5
โ”œโ”€โ”€ results/
โ”‚ โ”œโ”€โ”€ confusion_matrix.png
โ”‚ โ””โ”€โ”€ streamlit_demo.png
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ LICENSE
```

---

## ๐Ÿง  Key Learnings
- Built CNN & transfer-learning pipelines
- Fine-tuned pre-trained architectures
- Hyperparameter tuning with Keras Tuner
- Grad-CAM model interpretability
- Streamlit deployment and MLOps readiness

---

## ๐Ÿงพ License
Released under the **MIT License**.
See the [LICENSE](LICENSE) file for details.

---

## ๐Ÿ‘ค Author

**Parth Patel**
๐Ÿ“ง [parthhpatel2504@gmail.com](mailto:parthhpatel2504@gmail.com)
๐Ÿ”— [LinkedIn](https://www.linkedin.com/in/parth-patel-8990a9281/) ยท [GitHub](https://github.com/parth147op)

---

> ๐Ÿš€ From data to deployment โ€” making deep learning models interpretable, performant and production-ready.