Skip to content

This project implements a Convolutional Neural Network (CNN) to classify chest X-ray images. The pipeline covers data preparation, augmentation, model training, and evaluation, delivering accurate predictions to support healthcare AI solutions.

Notifications You must be signed in to change notification settings

Vedag812/Image_Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🩺 CNN for Medical X-Ray Classification

Python
TensorFlow
Keras
PyTorch
Kaggle Dataset
License: MIT


📌 Project Overview

This repository implements a Convolutional Neural Network (CNN) to classify chest X-ray images into NORMAL or PNEUMONIA.
The project follows a structured deep learning workflow, including dataset preparation, preprocessing, training, evaluation, and visualization of results.


🗂️ Dataset

We use the Chest X-Ray Images (Pneumonia) dataset from Kaggle.

📥 Dataset link: Chest X-Ray Dataset (Kaggle)

Folder Structure:

data/chest_xray/
├── train/
│   ├── NORMAL/
│   └── PNEUMONIA/
├── val/
│   ├── NORMAL/
│   └── PNEUMONIA/
└── test/
    ├── NORMAL/
    └── PNEUMONIA/
  • Train: used for training the CNN
  • Validation: used for tuning hyperparameters
  • Test: used for final evaluation

⚙️ Preprocessing

Before training, the dataset undergoes image preprocessing and augmentation to improve generalization:

  • ✅ Resizing images to 150×150 pixels
  • ✅ Normalizing pixel values to range [0, 1]
  • ✅ Data augmentation:
    • Random rotations
    • Width/height shifts
    • Zoom operations
    • Horizontal flips

This ensures the model is robust and reduces overfitting.


🔄 Workflow

The end-to-end workflow of the project:

  1. Dataset Loading → Load train/val/test splits
  2. Preprocessing & Augmentation → Resize, normalize, and augment images
  3. Training → Early stopping and checkpointing for best model
  4. Evaluation → Classification metrics & confusion matrix
  5. Visualization → Training curves and prediction samples

🛠 Tech Stack

  • Python 3.8+
  • TensorFlow / Keras (Deep Learning Framework)
  • NumPy, scikit-learn (Data Handling & Metrics)

📊 Results

  • ✅ Model achieves high accuracy in distinguishing NORMAL vs PNEUMONIA X-rays
  • Confusion matrix & classification report included
  • ✅ Visualization of training curves and sample predictions

📈 Training Curves

  • Accuracy and loss plots for training & validation

🖼 Sample Predictions

  • Example predictions with true vs predicted labels

🌐 Live Demo

🚀 Try the model here: Live Demo Link


📂 Repository Structure

xray_classification/
├── data/                  # Chest X-ray dataset
├── models/                # Saved trained models
├── results/               # Training history, plots, evaluation
├── src/                   # Source code
│   ├── data_loader.py     # Data loading & augmentation
│   ├── xray_classifier.py # CNN model architecture
│   ├── evaluate.py        # Evaluation metrics
├── train.py               # Training script
├── run.py                 # Run evaluation & predictions
├── requirements.txt       # Dependencies
├── README.md              # Project documentation
└── LICENSE                # MIT License

📥 Installation & Usage

# Clone the repository
git clone https://github.com/Vedag812/Image_Classification
cd xray_classification

# Install dependencies
pip install -r requirements.txt

# Train the model
python train.py

# Run evaluation & predictions
python run.py

📜 License

This project is licensed under the MIT License.


🔬 Built with Deep Learning to advance healthcare AI solutions.

About

This project implements a Convolutional Neural Network (CNN) to classify chest X-ray images. The pipeline covers data preparation, augmentation, model training, and evaluation, delivering accurate predictions to support healthcare AI solutions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages