Skip to content
Back to Projects
ML / AI 2025-10

SliceWise — MRI Brain Tumor Detection & Segmentation

Multimodal MRI classification and segmentation model trained on BraTS dataset with shared encoder, achieving 91.3% accuracy and 97.1% sensitivity.

Accuracy 91.3%
PyTorchEfficientNetU-NetComputer VisionMedical ImagingFastAPIStreamlitBraTS

What this project proves

End-to-end model design, evaluation, and automation

Shared-encoder multimodal MRI system with 91.3% accuracy, 97.1% sensitivity, and a productized training-to-demo pipeline.

Core challenge

Unify classification and segmentation without paying the cost of separate models.

Evaluation lens

Model architecture, training pipeline, and applied evaluation discipline.

A faster multimodal system with strong clinical metrics and automated reproducibility.

Shared encoder architecture diagram Architecture
Shared encoder architecture — single backbone for classification and segmentation

Overview

Built a production-ready multimodal MRI classification and segmentation pipeline trained on the BraTS dataset. The model uses a shared encoder architecture for both tumor classification and pixel-level segmentation, achieving strong performance across both tasks simultaneously.

This project is strongest as an example of end-to-end applied ML system design: model architecture, preprocessing, inference optimization, explainability, quality control, and productized delivery all had to work together.

Results

MetricScore
Classification Accuracy91.3%
Sensitivity97.1%
Dice Score (Segmentation)76.5%
Model Parameters31.7M
Inference Speedup~40% faster vs separate models

What I Owned

  • Designed the shared-encoder multitask architecture
  • Built the training and evaluation pipeline around the BraTS dataset
  • Added conditional inference so segmentation only runs when classification indicates tumor presence
  • Productized the work into a demo/application workflow with testing and explainability tooling
Multi-task training progression — P2.3 (joint classification + segmentation) achieves the best classification accuracy while maintaining competitive Dice score.

Live App — Detection & Segmentation

SliceWise Streamlit app — real-time tumor detection with binary mask, probability map, and overlay outputs from a single MRI slice.
Comprehensive visualization mode — Binary Mask, Probability Map, Overlay, Grad-CAM attention heatmap, and pixel-level Segmentation mask rendered simultaneously.

Inference Pipeline

flowchart LR
A[MRI Input] --> B[Preprocessing]
B --> C[Shared Encoder]
C --> D{Tumor?}
D -->|Yes| E[Segmentation Head]
D -->|No| F[No Tumor]
E --> G[Pixel Mask]
C --> H[Classification Head]
H --> D

Conditional segmentation activates only when tumor is detected, avoiding unnecessary compute on negative cases.

Hard Problems Solved

  • Unify two tasks without doubling system cost: the architecture needed to support both classification and segmentation without separate full models
  • Keep explanations clinically interpretable: Grad-CAM attention and masking quality controls were necessary to make model behavior more inspectable
  • Turn research output into a usable tool: the work had to move beyond offline metrics into a reproducible, demoable inference workflow

Grad-CAM Explainability

Grad-CAM visualization — the heatmap shows which regions drove the classification decision. Red/Yellow = high importance, Blue = low importance.
Effect of brain masking on Grad-CAM focus — masking removes skull/background signal and tightens attention to the tumor region. Top: without masking. Bottom: with masking.
Cross-dataset inaccuracy — when a model trained on BraTS is evaluated on Kaggle slices without re-masking, Grad-CAM attention leaks outside the brain boundary, highlighting the importance of dataset-aligned preprocessing.

Brain Masking Quality Control

Automated masking QC pipeline — each slice is evaluated on brain area coverage and border-touch thresholds. Cases failing the quality gate (area too large, border intrusion) are flagged and excluded from model input.

Key Features

  • Shared Encoder Architecture: Single backbone for both classification and segmentation reduces parameter count and inference time
  • Conditional Segmentation: Segmentation head activates only when tumor is detected, optimizing inference
  • Grad-CAM Explainability: Per-prediction attention heatmaps with brain-mask-aware focus, rendered live in the Streamlit app
  • Robust Brain Masking: Automated QC pipeline filters slices on area coverage and border-touch thresholds before model input
  • One-Command Pipeline: Productized training-to-demo pipeline with automation across 6 stages, 4 smart prompts, and 25/25 passing tests
  • API Endpoints: 11 FastAPI endpoints for model inference, health checks, and data management

Why It Matters

This project shows I can bridge research-grade model development and product-minded delivery: architecture design, evaluation rigor, inference behavior, and user-facing tooling all reinforce each other.

Tech Stack

  • ML: PyTorch, EfficientNet, U-Net, BraTS dataset
  • Explainability: Grad-CAM with brain-mask-aware preprocessing
  • App: Streamlit frontend, FastAPI backend, Uvicorn, Pydantic
  • Testing: pytest with 25/25 test coverage
  • Optimization: Conditional inference, shared encoder, mixed precision