The CGAN model was based on Kugelman et al. paper "Data augmentation for patch-based oct chorio-retinal segmentation using generative adversarial networks". Our code was based on their implementation that you can find on their github repository.
- Python
- tensorflow
- matplotlib
The file tensorflow-env.yml is a working environment for training the CGAN.
cgan_NxN_patchbased.pytrains a conditional CGAN on NxN patches.evalfid_NxN_patchbased.pyevaluate trained generators of a GAN, using the Frechet Inception Distance.cgan_NxN_patchbased_genfid.pyconstructs synthetic patches and save the images as required.- patches.ipynb is the notebook generating original patches of a given shape.
- script_evalfid.sh and script.sh are shells to launch the jobs on the clusters.
- fid.py, Minibatch.py and training_patchbased.py are helpers for the CGAN training and the synthetic patches generation. They were given by Kugelman's et al. implementations.
Follow the following steps to train and generate synthetic patches:
- Train a conditional GAN on 70x70 patches using cgan_70x70_patchbased.py. Load data using the load_data function.
- Evaluate trained generators of a GAN, using the Frechet Inception Distance (FID), using evalfid_70x70_patchbased.py and by specifying the folder containing the generators as load_path
- Construct synthetic patches using cgan_70x70_patchbased_genfid.py. Save the generated images as required.