X-Ray GAN is a deep learning project aimed at generating synthetic chest X-ray images using various Generative Adversarial Network (GAN) architectures. The primary goal is to augment medical imaging datasets, facilitating improved training for diagnostic models, especially in scenarios with limited data availability.
- Project Structure
- Dataset
- Preprocessing
- Model Architectures
- Training
- Evaluation Metrics
- Generated Images
- Usage
- License
- ACGAN/: Contains implementation details for the Auxiliary Classifier GAN.
- DCGAN/: Contains implementation details for the Deep Convolutional GAN.
- ProGAN/: Contains implementation details for the Progressive Growing GAN.
- Generated-images/: Stores the synthetic images generated by the models.
- PSNR.py: Script to compute the Peak Signal-to-Noise Ratio between images.
- pre-processing.py: Script for preprocessing the dataset before training.
- ssim-progan.ipynb: Jupyter Notebook to compute the Structural Similarity Index Measure for ProGAN outputs.
The project utilizes chest X-ray images sourced from publicly available datasets. Ensure that the dataset is organized appropriately before initiating the training process.
Before training, images undergo preprocessing steps such as resizing, normalization, and, if necessary, augmentation. The pre-processing.py
script automates this process.
The Auxiliary Classifier GAN introduces a classifier in the discriminator to provide additional label information, enhancing the quality of generated images.
The Deep Convolutional GAN employs convolutional layers in both the generator and discriminator, suitable for generating high-quality images.
The Progressive Growing GAN starts with low-resolution images and progressively increases the resolution during training, leading to more stable training and better quality outputs.
Each GAN architecture has its dedicated training scripts and configurations within their respective directories. Training involves:
- Setting up the environment and dependencies.
- Running the training script specific to the chosen GAN architecture.
- Monitoring the training process and saving model checkpoints.
- PSNR (Peak Signal-to-Noise Ratio): Evaluates the quality of the generated images compared to real images.
- SSIM (Structural Similarity Index Measure): Measures the similarity between two images, focusing on structural information.
Use PSNR.py
and ssim-progan.ipynb
to compute these metrics for the generated images.
Synthetic images produced by the GAN models are stored in the Generated-images/
directory. These images can be used for further analysis, augmentation, or training of other models.
git clone https://github.com/fahadmujawar/X-Ray-GAN.git
cd X-Ray-GAN
python pre-processing.py
Navigate to the desired GAN directory and run the training script:
cd DCGAN # or ACGAN, ProGAN
python train.py
Use the provided scripts to compute PSNR and SSIM for the generated images:
python PSNR.py
# or open and run the Jupyter notebook:
jupyter notebook ssim-progan.ipynb