Skip to content

Generative Adversarial Networks implemented in PyTorch

Notifications You must be signed in to change notification settings

AissamDjahnine/gans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gans v1.0

forthebadge made-with-python ForTheBadge built-with-love

Deep Convolutional Generative Adversarial Network (DCGAN*) implemented in PyTorch.

Applied on different medical datasets for different medical-based approaches (later we will be discussing Segmentation).

Unlike the original paper "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks" we generate 128 x 128 Images that looks quite plausible.Check the results above and try it yourself.

gans

Motivation

The main objective of this work is twofold :

  • Generate synthetic medical images that model the distribution of the input data
  • [SOON] Use both of the synthetic and real images for training a context-aware CNN that can accurately segment the given images

Install

In your terminal, run:

git clone https://github.com/AissamDjahnine/gans
cd gans

Then, install all dependencies with PIP using:

pip install -r requirements.txt

Datasets

Medical datasets :

Since the main task behind this project is to generate synthetic medical images , we used these two datasets described below ( links are available as well )

gans

* Absorbance microscopy images of human Retinal Pigment Epithelium (RPE) cells

You can use this Dataset consisted of 1032 ( 256 x 256 ) RPE cells images images.You can browse and donwload the data using this link : RpeCells

* Osteosarcoma data from UT Southwestern/UT Dallas for Viable and Necrotic Tumor Assessment

The dataset consists of 1144 images of size 1024 X 1024 at 10X resolution with the following distribution: 536 (47%) non-tumor images, 263 (23%) necrotic tumor images and 345 (30%) viable tumor tiles.

You can browse the data using this link : Osteosarcoma data from UT Southwestern/UT Dallas, to download the data that you can use directly: Osteosarcoma data

Usage

useful notes :

  • You can train the model on big datasets.The script saves your current model state (weights , bias ..) so that you can resume training from this point.the state is saved after 25 epochs (you can adjust the value depending on how big is your dataset) --Available only for the API.

  • Please respect this structure while feeding the model with your images directory :

./IMAGESFOLDER/Images/.. Examlpe : RPEDATA/Images/.. , Osteosarcoma_data/Images/..

Jupyter Notebook

Run a jupyter process :

Jupyter notebook

You find a Jupyter notebook version of the project , you can interactively run cells and check outputs for different sections

gans

In your terminal, run:

mkdir Generated_Images_numpy_notebook

To create a directory for the generated imges ( numpy arrays ) version.

API

In your terminal, run:

python GAN_F_128.py --path IMAGEFOLDER --epochs 500 --batch-size 128 --lr 0.0002

Note : You may use default values ( see the file : GAN_F_128.py )

Example :

python GAN_F_128.py --path ./RPEDATA --epochs 500 

Visualization

Jupyter notebook

  • You can see generated images changing with time ( every 10 batches ), feel free to change the display time.

Tensorboard

If you're familiar with Tensorboard , skip this section

In your terminal, run:

tensorboard --logdir ./runs
  • You should be looking to : gans

References

  • "Generative Adversarial Networks." Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, Yoshua Bengio. ArXiv 2014.

  • "Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks" Alec Radford, Luke Metz, Soumith Chintala

Questions :

Generic badge Ask Me Anything ! GitHub followers

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please feel free to contact if case of issues.

About

Generative Adversarial Networks implemented in PyTorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published