https://github.com/hwunrow/bayesian-cyclegan
[TNNLS] Bayesian Cycle-Consistent Generative Adversarial Networks via Marginalizing Latent Sampling
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, ieee.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.1%) to scientific vocabulary
Last synced: 8 months ago
·
JSON representation
Repository
[TNNLS] Bayesian Cycle-Consistent Generative Adversarial Networks via Marginalizing Latent Sampling
Basic Info
- Host: GitHub
- Owner: hwunrow
- License: mit
- Default Branch: master
- Homepage: https://ieeexplore.ieee.org/document/9186319
- Size: 11.8 MB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Fork of ranery/Bayesian-CycleGAN
Created over 3 years ago
· Last pushed over 5 years ago
https://github.com/hwunrow/Bayesian-CycleGAN/blob/master/
# Bayesian CycleGAN This is the PyTorch implementation for [***Bayesian Cycle-Consistent Generative Adversarial Networks via Marginalizing Latent Sampling***](https://ieeexplore.ieee.org/document/9186319) published on IEEE TNNLS. ## Introduction Recent techniques built on Generative Adversarial Networks (GANs) like [CycleGAN](https://arxiv.org/abs/1703.10593) are able to learn mappings between domains from unpaired datasets through min-max optimization games between generators and discriminators. However, it remains challenging to stabilize the training process and diversify generated results. To address these problems, we present the non-trivial Bayesian extension of cyclic model and an integrated cyclic framework for inter-domain mappings. The proposed method stimulated by [Bayesian GAN](https://arxiv.org/abs/1705.09558) explores the full posteriors of Bayesian cyclic model (with latent sampling) and optimizes the model with maximum a posteriori (MAP) estimation. By exploring the full posteriors over model parameters, the Bayesian marginalization could alleviate the risk of model collapse and boost multimodal distribution learning. Besides, we deploy a combination of L1 loss and GANLoss between reconstructed images and source images to enhance the reconstructed learning, we also prove that this variation has a global optimality theoretically and show its effectiveness in experiments. ## Prerequisites The code has the following dependencies: - python 3.5 - torch 0.3.0 - torchvision 0.2.0 - pillow (PIL) - NVIDIA GPU + CUDA CuDNN Install PyTorch and dependencies on linux please follow instructions at https://pytorch.org/. Install python libraries [visdom](https://github.com/facebookresearch/visdom) and [dominate](https://github.com/Knio/dominate). ```` pip install visdom pip install dominate ```` ## Core training and testing options ### Training options - `gamma`: balance factor that adjust l1-GAN loss - `niter`: number of epoches with starting learning rate - `niter_decay` number of epoches with non-linearly decay learning rate to zero periodically - `beta1`: momentum term of adam - `lr`: initial learning rate for adam - `no_lsgan`: do not use least square GAN if it is active - `lambda_A`: weight for cycle loss (A -> B -> A) - `lambda_B`: weight for cycle loss (B -> A -> B) - `lambda_kl`: weight for KL loss - `mc_y`: Mento Carlo samples for generate zy - `mc_x`: Mento Carlo samples for generate zx ### Testing options - `which_epoch`: use which model to test - `use_feat`: if true, replace SFM to other latent variables in inference process - `how_many`: how many test images to run The crutial options, like `--gamma`, take control over our model, which should be set carefully. We recommend batchSize set to 1 in order to get final results, we didn't have time to test other values that may lower FCN scores. ## Usage ### Installation 1. Install the required dependencies 2. Clone this repository 3. Download corresponding datasets ### Unsupervised and Semi-supervised Learning on benchmark datasets #### EXP1: Cityscapes * training scripts for cityscapes ```` # for cityscapes (128 x 256) using Bayesian cyclic model with noise margalization. python train_bayes_z.py --dataroot ~/data/cityscapes --name cityscapes_bayes_L1_lsgan_noise --batchSize 1 --loadSize 256 --ratio 2 --netG_A global --netG_B global --ngf 32 --num_D_A 1 --num_D_B 1 --mc_x 3 --mc_y 3 --n_blocks_global 6 --n_downsample_global 2 --niter 50 --niter_decay 50 --gamma 0 --lambda_kl 0.1 ```` If you want to use Bayesian model with encoder margalization, you only need to change `train_bayes_z.py` to `train_bayes.py`. By the same token, you can set `--gamma` to 0.5 if you want use L1 loss combined with GANLoss in the recycled learning. * continue train If your machine encounters some questions and stops work, you may need revive machanism to help you. In our train scripts, you should change the `start_epoch` and `epoch_iter` to that cut point and continue train by adding the following clause to the command: ```` --continue_train --which_epoch latest ```` * testing scripts for cityscapes ```` python test_bayes_z.py --dataroot ~/data/cityscapes --name cityscapes_bayes_L1_lsgan --phase test --loadSize 256 --ratio 2 --netG_A global --netG_B global --ngf 32 --n_blocks_global 6 --n_downsample_global 2 --which_epoch latest --how_many 500 ```` You can choose which model to use by reset the option `--which_epoch`. * Pre-trained model Our latest model are avaliable in [Google drive](https://drive.google.com/open?id=1C4W3xJ8kiqtDVnMmflSsmlxsfv_BIVWH) #### EXP1: Qualitative result display - Final qualitative results samples for Bayesian cyclic model in unsupervised setting under condition `gamma = 0`- Comparison about model stability: When `gamma = 0.5`, our method maintain stable convergence while the original one collapses to one distribution for photo2label task.
- FID and Inception score  #### EXP1: Quantitative metrics: FCN scores In our experiment, we use Bayesian cyclic model with random noise marginalization for the first 100 epoches, and finetune the model with SFM latent sampling for the later 100 epoches. The results show that Bayesian version cyclic model outperform original one. Pre-trained models are available at [Google drive](https://drive.google.com/open?id=1m-9REP_JNYP_3AQ6fO1oVHcuoIcUAE0E)![]()
| Methods | Per-pixel acc. | Per-class acc. | Class IOU |
|---|---|---|---|
| CycleGAN (dropout) | 0.56 | 0.18 | 0.12 |
| CycleGAN (buffer) | 0.58 | 0.22 | 0.16 |
| Bayesian CycleGAN | 0.73 | 0.27 | 0.20 |
| Pix2pix (supervised) | 0.85 | 0.40 | 0.32 |
Owner
- Name: Han Yong Wunrow
- Login: hwunrow
- Kind: user
- Location: New York, NY
- Company: Columbia University
- Website: hwunrow.github.io
- Repositories: 2
- Profile: https://github.com/hwunrow
(he/him pronouns) Applied Math Ph.D. student at Columbia APAM