Skip to content

advafaeian/cyclegan-fitzpatrick

Repository files navigation

CycleGAN-Fitzpatrick

Overview

A CycleGAN model trained on Diverse Dermatology Images (DDI) from Daneshjou et al. (https://doi.org/10.1126/sciadv.abq6147), to transform dermatological images between Fitzpatrick I-II and V-VI categories, aimed at generalizing dermatological image analysis. The cGAN implementation was adapted from Aitor Ruano.

This tool demonstrates data augmentation techniques for improving dataset diversity and model generalization across different demographic populations. While not intended for production use, this proof-of-concept implementation explores the potential benefits and limitations of this approach to data augmentation.

Table of Contents

Installation

  1. Clone the repository:
    git clone https://github.com/advafaeian/cyclegan-fitzpatrick.git
    cd cyclegan-fitzpatrick
  2. Install the required packages:
    pip install -r requirements.txt
  3. Download the DDI dataset from here.
  4. Extract the content in a folder named ddi_dataset.
  5. Generate training dataset consisting of Fitzpatrick I-II and V-VI images:
    python prepare_dataset.py

Training

To train the CycleGAN model, use the following commands:

# Initialize the Visdom server for monitoring
python -m visdom.server

# To start training from scratch
python train.py --dataroot ./ddi_dataset/train --cuda

# To resume training from the current weights
python train.py --dataroot ./ddi_dataset/train --resume --epoch 400 --n_epochs 600 --cuda

The following data are from the second 200 epochs. The data from the first 200 epochs can be found here.

loss_d loss_g loss_g_cycle loss_g_gan loss_g_identity

Testing

After training or using the current weights, you can generate transformed result images by running:

python generate.py --dataroot './test_images'

Results

Here are some example results from the model using images from the ISIC dataset: Transformed images from Fitzpatrick I-II to V-VI

Acknowledgments

  • CycleGAN for the original implementation.
  • CycleGAN Clean Version for the refined implementation.
  • Diverse Dermatology Images for the datasets used for training.
  • Roxana Daneshjou et al. ,Disparities in dermatology AI performance on a diverse, curated clinical image set.Sci. Adv.8,eabq6147(2022).DOI:10.1126/sciadv.abq6147
  • Test images from the ISIC dataset, attributed to Hospital Italiano de Buenos Aires, used under the CC-BY license.

About

A CycleGAN model to transform dermatological images between Fitzpatrick I-II and V-VI, aimed at generalizing dermatological image analysis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages