Lung Disease Detection Using Chest X-ray Images

This project is an AI-powered backend system designed to detect and classify lung diseases such as Pneumonia, Pneumothorax, and Normal conditions using deep learning techniques applied to chest X-ray images. The system focuses on automated medical image classification with enhanced preprocessing to improve accuracy.


Overview

The project utilizes a Convolutional Neural Network (CNN) trained on chest X-ray datasets to diagnose different lung conditions. It employs advanced preprocessing methods like histogram equalization and fuzzy logic-based contrast enhancement to improve the visibility of important features in the images, which helps achieve better classification performance.


Key Features

Classifies X-ray images into four categories: Pneumonia, Pneumothorax, Normal, and COVID-19.

Uses a custom CNN model built with PyTorch.

Incorporates a preprocessing pipeline that includes histogram equalization and fuzzy logic-based contrast enhancement.

Supports GPU acceleration for faster training and testing.

Provides visualization of training and testing accuracy.

Saves the trained model for future inference in a file named lung_disease_cnn_model.pth.


Tech Stack

Programming Language: Python

Deep Learning Framework: PyTorch

Image Processing Libraries: OpenCV, NumPy

Visualization Tools: Matplotlib, tqdm

Dataset: Chest X-ray images categorized into Pneumonia, Pneumothorax, and Normal classes


How It Works

  1. X-ray images are preprocessed using histogram equalization and fuzzy logic-based contrast enhancement.

  2. The dataset is loaded and divided into training and testing subsets.

  3. The CNN model is trained on the preprocessed images.

  4. Model performance is evaluated using metrics like accuracy and loss.

  5. The trained model is saved and can be used later for predictions.


Model Performance

Accuracy: (Insert your actual accuracy value, e.g., around 94%) Loss: (Insert your actual test loss, e.g., 0.16) Evaluation was performed using a separate test dataset and analyzed using a confusion matrix.

Built With

Share this project:

Updates