metadata
title: Medgan
emoji: ⚡
colorFrom: blue
colorTo: gray
sdk: static
pinned: false
license: mit
short_description: The project focuses on brain tumor MRI scans and includes im
<<<<<<< HEAD Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
MedGAN: Advanced Medical Image Generation

Overview
MedGAN is a comprehensive framework for generating high-quality synthetic medical images using state-of-the-art Generative Adversarial Networks (GANs). The project focuses on brain tumor MRI scans and includes implementations of multiple cutting-edge GAN architectures optimized for medical imaging applications.
Features
Multiple GAN Implementations:
- DCGAN (Deep Convolutional GAN)
- ProGAN (Progressive Growing of GANs)
- StyleGAN2 (Style-based Generator with improvements)
- WGAN (Wasserstein GAN with gradient penalty)
Web Application Interface:
- Generate synthetic brain MRI scans
- Detect tumor types from uploaded MRI images
- Interactive and user-friendly interface
Pre-trained Models:
- Models for three tumor types: Glioma, Meningioma, and Pituitary
- ViT-based tumor detection model (92% accuracy)
Architecture Performance Comparison
Architecture | Image Quality | Training Stability | Generation Diversity | Training Speed |
---|---|---|---|---|
ProGAN | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ |
StyleGAN2 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
WGAN-GP | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
DCGAN | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ |
Getting Started
Prerequisites
- Python 3.9+
- PyTorch 1.9+
- Flask (for web application)
- CUDA-capable GPU (recommended)
Installation
- Clone the repository:
git clone https://github.com/mozaloom/medgan.git
cd medgan
- Install required packages:
pip install -r requirements.txt
- Run the web application:
python app.py
- Access the web interface at
http://localhost:5000
Usage
Web Application
The MedGAN web application offers two primary functionalities:
Generate synthetic brain MRI scans:
- Select tumor type (Glioma, Meningioma, Pituitary)
- Choose GAN architecture
- Generate high-quality synthetic MRI images
Detect tumor types:
- Upload brain MRI scans
- Receive AI-powered tumor classification
- View detection confidence scores
Check the individual model implementation files for specific training parameters.
Project Structure
medgan/
├── app.py # Flask web application
├── medgan/ # Core GAN implementations
│ ├── dcgan.py
│ ├── progan.py
│ ├── stylegan.py
│ ├── wgan.py
│ └── vit.py
├── models/ # Pre-trained model weights
├── notebooks/ # Training notebooks
│ ├── dcgan/
│ ├── progan/
│ ├── stylegan/
│ └── wgan/
├── static/ # Web assets
└── templates/ # HTML templates
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Brain Tumor MRI Dataset from Kaggle
- Research papers implementing the original GAN architectures: