Skip to content

madrazaldi/tuberculosis

Repository files navigation

Tuberculosis Detection Web App

This project is a web application for detecting Tuberculosis from chest X-ray images using machine learning.

Project Structure

  • backend/: FastAPI backend for image processing and prediction.
  • frontend/: React/Vite frontend for user interaction.
  • data/: Dataset directory (downloaded from Kaggle).

Prerequisites

  • Python 3.8+
  • Node.js 16+
  • Kaggle API credentials (for downloading data)

Setup and Running

1. Backend

The backend handles image segmentation, feature extraction, and model inference.

cd backend
pip install -r requirements.txt
python download_data.py  # Download dataset if not already present
python train_model.py    # Train the model (saves to model.joblib)
uvicorn app:app --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000. Swagger documentation is available at http://localhost:8000/docs.

2. Frontend

The frontend provides a modern UI for uploading images and viewing results.

cd frontend
npm install
npm run dev

The web app will be available at http://localhost:5173.

Features

  • Lung Segmentation: Automatically segments lungs from chest X-rays using image processing techniques (Otsu's thresholding, morphological operations).
  • Feature Extraction: Calculates area, perimeter, intensity, and entropy features.
  • Machine Learning: Uses a Random Forest classifier to predict TB status.
  • Interactive UI: Drag-and-drop file upload, real-time analysis, and visual result display.

Notes

  • The model achieves ~90% accuracy on the test set.
  • Ensure model.joblib exists in the backend/ directory before starting the API.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published