Deep learning pipeline for synthesizing contrast-enhanced MRI from pre-contrast scans
- PSNR: 28.93 dB
- SSIM: 0.744
- Lesion Improvement: +15% over baseline
- Dataset: 3,960 paired MRI slices from I-SPY1
# Clone repo
# python version 3.10.0
git clone https://github.com/MansiDakhale/TSGAN_Project.git
cd TSGAN_Project
python -m venv venv
Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run inference
python scripts/tsgan/infer_tsgan.py --ckpt checkpoints/gen_best.pth
# Launch demo
streamlit run scripts/tsgan/app.pyGenerator: U-Net with tumor-attentive skip connections
- Input: Pre-contrast MRI + Segmentation mask (2-channel)
- Output: Synthetic contrast-enhanced MRI
- Attention modules: Channel-wise gating based on tumor regions
Discriminator: PatchGAN
- Input: Concatenated pre-contrast and CE (real or fake)
- Output: Patch-level real/fake predictions
Training:
- Loss: Adversarial (MSE) + L1 reconstruction + Tumor-weighted L1
- Optimizer: Adam (lr=2e-4)
- Mixed precision: torch.cuda.amp
- Epochs: 50
| Metric | Baseline (pix2pix) | TSGAN (Ours) | Improvement |
|---|---|---|---|
| L1 (global) | 0.0350 | 0.0230 | -34.3% |
| PSNR | 26.12 dB | 28.93 dB | +10.8% |
| SSIM | 0.698 | 0.744 | +6.6% |
| Tumor-L1 | 0.0562 | 0.0475 | -15.5% |
├── scripts/
│ ├── build_2d_dataset.py # DICOM→NPZ preprocessing
│ ├── pix2pix/ # Baseline implementation
│ └── tsgan/ # TSGAN implementation
│ ├── train_tsgan.py
│ ├── infer_tsgan.py
│ ├── evaluate_tsgan.py
│ └── app.py # Streamlit demo
├── checkpoints/ # Model weights
├── data/ # Processed dataset
└── TSGAN_PROJECT_REPORT.pdf # Complete technical report
Below is the link of TSGAN project report! https://drive.google.com/file/d/1u7ii3PQxmeSEAnuYhVT5YRgnAbCx2hma/view?usp=drive_link
See full report (Section 6) for detailed ablations on:
- Effect of segmentation guidance
- Attention module placement
- Loss weighting hyperparameters
@mastersthesis{dakhale2024tsgan,
title={Tumor-Attentive Segmentation-Guided GAN for Synthetic Contrast-Enhanced MRI Generation},
author={Dakhale, Mansi Girdhar},
year={2024},
school{IIIT Lucknow}
}Mansi Dakhale
- Email: mansidakhalee@gmail.com
- LinkedIn: linkedin.com/in/mansidakhale
- GitHub: @MansiDakhale
MIT License - see LICENSE file for details.
- I-SPY1 Dataset creators
- Dr. Deepshikha Agarwal (Supervisor, IIIT Lucknow)
- PyTorch, NiBabel, scikit-image communities
