This repository contains code to train denoising GANs with TensorFlow 2.
dcnn_0.05
: Simple DnCNNdrcnn_0.02
drcnn_0.05
: Simple DnCNN with internal residualsdrcnn_0.10
drcnn_0.20
drcnn-deep_0.05
dunet_0.05
: U-Netdunet+_0.05
: U-Net trained on multiple datasetsdunet+_0.0-0.2
: U-Net trained on multiple datasets and noise levelsdrunet+_0.05
drunet+_0.0-0.2
: DRUNet trained on multiple datasets and noise levelsdrugan+_0.0-0.2
: DRUGANdrugan+-lambda-zero_0.0-0.2
: DRUGAN without adverserial lossdrugan+-nora2_0.0-0.2
: DRUGAN without relativistic discriminatordrugan+-nora1_0.0-0.2
Pretrained models can be downloaded from Google Drive.
The easiest way to get started is to use VSCode and open the folder in a Remote-Container.
Otherwise, install the dependencies
tensorflow==2.4.1
tensorflow-datasets
tensorflow-probability
image-similarity-measures==0.3.5
git+https://github.com/HedgehogCode/[email protected]
Use the following environment variables to control the scripts.
DNGAN_DEBUG
: Debug mode, only train for a few stepsDNGAN_LOGS_PREFIX
: Folder for the Tensorboard logsDNGAN_CHECKPOINTS_PREFIX
: Folder for the checkpointsDNGAN_CONFIG
: Path to the config json file (See configs/)
Training the generator with MSE loss:
$ python train_dae.py
Training the denoising GAN with all losses (based on a pretrained generator):
$ python train_dngan.py
Exporting the generator to a h5 file:
$ python checkpoint_to_h5.py -c /path/to/checkpoints configs/my_config.json /path/to/model.h5
- DnCNN: K. Zhang, W. Zuo, Y. Chen, D. Meng, and L. Zhang, “Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising”
- DRUNet: K. Zhang, Y. Li, W. Zuo, L. Zhang, L. Van Gool, and R. Timofte, “Plug-and-Play Image Restoration with Deep Denoiser Prior”
- VGG Loss: J. Johnson, A. Alahi, and L. Fei-Fei, “Perceptual Losses for Real-Time Style Transfer and Super-Resolution”
- Relativistic Discriminator: A. Jolicoeur-Martineau, “The relativistic discriminator: a key element missing from standard GAN”
- ESRGAN: X. Wang et al., “ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks”
- Move evaluate.py script to other repository, also adapt the dependencies