Skip to content

WalBouss/GANoloscopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GANoloscopy

                                                ▄▄                                                      
  ▄▄█▀▀▀█▄█      ██     ▀███▄   ▀███▀         ▀███                                                      
▄██▀     ▀█     ▄██▄      ███▄    █             ██                                                      
██▀       ▀    ▄█▀██▄     █ ███   █   ▄██▀██▄   ██   ▄██▀██▄ ▄██▀███▄██▀██  ▄██▀██▄▀████████▄▀██▀   ▀██▀
██            ▄█  ▀██     █  ▀██▄ █  ██▀   ▀██  ██  ██▀   ▀████   ▀▀█▀  ██ ██▀   ▀██ ██   ▀██  ██   ▄█  
██▄    ▀████  ████████    █   ▀██▄█  ██     ██  ██  ██     ██▀█████▄█      ██     ██ ██    ██   ██ ▄█   
▀██▄     ██  █▀      ██   █     ███  ██▄   ▄██  ██  ██▄   ▄███▄   ███▄    ▄██▄   ▄██ ██   ▄██    ███    
  ▀▀███████▄███▄   ▄████▄███▄    ██   ▀█████▀ ▄████▄ ▀█████▀ ██████▀█████▀  ▀█████▀  ██████▀     ▄█     
                                                                                     ██        ▄█       
                                                                                   ▄████▄    ██▀        

A simple GAN to generate synthetic colorectal images with the associated mask, based on pix2pix architecture

Some examples:

Example 0

Installation

  • Clone this repository and enter it:
    git clone https://github.com/WalBouss/GANoloscopy.git
    cd GANoloscopy
  • Set up the environment:
    • Use Anaconda to creat a python environment:
      • Run conda env create --name myenv
    • Install Pytorch:
      • Run conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
    • Install dependencies with pip
      • Install some other packages:
        # Cython needs to be installed before pycocotools
        pip install wandb
        pip install opencv-python pillow pycocotools matplotlib 
  • Download the pretrain weights from here and place the file in the ./weight folder.

Generate synthetic dataset

To generate a synthetic dataset edit and run the following command (don't forget to put the pretrained weight is already in ./weight dir):

# Specify the lenght and where to save the generated dataset.
python generate_synthetic_dataset.py --dataset_length=100 --path_to_save_img=path/dir/imgs --path_to_save_msk=path/dir/msks

# Use the help option to see a description of all available command line arguments
python generate_synthetic_dataset.py --help

Eval

To eval edit and run the following command

# Process a whole folder of masks.
python eval.py --path_to_masks=path/to/masks/ --path_to_save=path/to/save/data --batch_size=10 

# Use the help option to see a description of all available command line arguments
python eval.py --help

Training

To train edit and run the following command

# Trains 
python train.py --path_data_train=path_to_training_data --batch_size=10 --epochs=250

# Use the help option to see a description of all available command line arguments
python train.py --help

Logging

GANoloscopy uses Weights & Biases library to visualize training and validation information by default.

Custom Datasets

You can also train on your own dataset by following organizing your data as follow:

.
├── dir                    
│   ├── images          
│   └── masks                

Citation

If you use GANoloscopy or this code base in your work, please cite

@article{Bousselham-GANoloscopy-2021,
  author  = {Walid Bousselham},
  url     = {https://github.com/WalBouss/GANoloscopy/} 
  title   = {GANoloscopy: Generate colon images to enhance colonoscopies}, 
  year    = {2021},
}

Contact

For questions about the code, please contact Walid Bousselham.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages