Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Pneumonia Detection from Chest X-Ray Images

person367_virus_747

Problem Description

This project implements a deep learning model to detect pneumonia from chest X-ray images. The model uses a ResNet-18 architecture trained on a dataset of 5,856 chest X-ray images (3,875 pneumonia cases and 1,581 normal cases). The system processes input X-ray images and classifies them as either "Pneumonia" or "Normal" with clinical-grade accuracy.

Dataset Source:
Chest X-Ray Images (Pneumonia) on Kaggle

Model Training

The ResNet-18 model was trained with the following key parameters:

  • Input Size: 224x224 pixels (3-channel RGB)
  • Data Augmentation: Random rotations, flips, and normalization
  • Loss Function: Cross-Entropy Loss
  • Optimizer: Adam (Learning Rate = 0.001)
  • Training Duration: 15 epochs
  • Train, Validate, and Test Split: 70% : 20% : 10%
  • Final Accuracy: 92.3% on test set

The trained model (pneumonia_model.pth) is included in the model/ directory.

Installation

Prerequisites

  • Python 3.12+
  • Pipenv
  • Docker (optional)

Setup

  1. Clone the repository:
git clone https://github.com/garlicdoggoe/pneumonia-detection.git 
cd pneumonia-detector
  1. Install dependencies using Pipenv:
  pip install pipenv 
  pipenv install
  1. Activate virtual environment:
pipenv shell

Docker Setup

  1. Build the Docker image:
docker build -t pneumonia-detector .
  1. Run the container:
docker run -d -p 5000:5000 --name pneumonia-container pneumonia-detector
  1. Access the web interface at:
http://localhost:5000

Run directly from app.py

  1. Start the Flask application:
python app/app.py

Usage

image

  1. Open web browser and navigate to:
http://localhost:5000
  1. Upload a chest X-ray image (JPEG/PNG format)

  2. Get instant prediction result (Pneumonia/Normal)

Key Dependencies

  • Flask (Web framework)
  • PyTorch (Deep learning)
  • TorchVision (Image transformations)
  • Pillow (Image processing)
  • Gunicorn (Production server)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages