Skip to content

Repository files navigation

🧠 Brain Tumor Classification — Medical Imaging MLOps Pipeline

An end-to-end MLOps pipeline that classifies brain MRI scans into diagnostic categories using Deep Learning (PyTorch), packaged as decoupled microservices in Docker containers, and deployed live on AWS cloud infrastructure.


📸 Demo

Diagnosis Output Live deployment on AWS EC2 — MRI scan input → real-time diagnostic classification


🏗️ System Architecture

+---------------------------------+
|         Streamlit Web GUI       |
|    (Port 8501 - User Interface) |
+---------------------------------+
                |
                | HTTP POST /predict (Image Payload)
                v
+---------------------------------+
|          FastAPI Backend        |
|     (Port 8000 - Model API)     |
+---------------------------------+
                |
                | Inference Tensor Processing
                v
+---------------------------------+
|        PyTorch CNN Model        |
|  (brain_tumor_model.pth Weights)|
+---------------------------------+
  1. Frontend (Streamlit): Web interface for uploading MRI scans and triggering real-time diagnostic inference.
  2. Backend (FastAPI): Asynchronous API that preprocesses input images, runs tensor inference via PyTorch, and returns structured JSON predictions.
  3. Containerization & Deployment: Multi-container setup managed via Docker Compose, deployed on AWS EC2 (Ubuntu, eu-north-1).

📊 Model Performance

  • Task: Multi-class brain MRI classification — Glioma / Meningioma / Pituitary Tumor / No Tumor
  • Framework: PyTorch CNN
  • Deployment: Live REST API inference — image upload → JSON prediction → UI render

🛠️ Tech Stack

Layer Technology
Machine Learning PyTorch, Torchvision, Pillow, NumPy
API FastAPI, Uvicorn
Frontend Streamlit
Containerization Docker, Docker Compose V2
Cloud AWS EC2 (Ubuntu Linux, eu-north-1)
Version Control Git, GitHub

📁 Repository Structure

medical-imaging-mlops/
│
├── models/                      # Model weights (excluded via .gitignore)
│   └── brain_tumor_model.pth    # Download link — see below
├── src/
│   ├── api.py                   # FastAPI inference endpoints
│   └── app.py                   # Streamlit web application
├── Dockerfile.backend           # Docker image — FastAPI backend
├── Dockerfile.frontend          # Docker image — Streamlit frontend
├── docker-compose.yml           # Container orchestration
├── requirements.txt             # Python dependencies
└── README.md

Model weights: Available on request or via (Google Drive Link) — place in models/ before running.


🚀 How to Run

Local (Docker required)

git clone https://github.com/Sachinsara14/medical-imaging-mlops
cd medical-imaging-mlops
# Add brain_tumor_model.pth to models/ folder
docker compose up --build

Open http://localhost:8501 in your browser.

AWS Deployment

Deployed on EC2 using Docker Compose V2. Access the live instance at: [your EC2 public IP]:8501


🔬 Part of a Larger Medical Imaging Portfolio

This project is one component of an ongoing medical imaging ML portfolio:

  • Brain Tumor Classification (this repo) — MLOps deployment
  • Cardiac Histopathology Segmentation — Attention UNet, active learning, WSI analysis (6,627 images, Dice 0.8956)

👤 Author

Sachinkumar P — M.Tech., IIT Roorkee
github.com/sachinkumarp-code | LinkedIn

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages