All Projects → naturomics → Dlf

naturomics / Dlf

Code for reproducing results in "Generative Model with Dynamic Linear Flow"

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Dlf

Generative Models
Collection of generative models, e.g. GAN, VAE in Pytorch and Tensorflow.
Stars: ✭ 6,701 (+10209.23%)
Mutual labels:  generative-model
Discogan Pytorch
PyTorch implementation of "Learning to Discover Cross-Domain Relations with Generative Adversarial Networks"
Stars: ✭ 961 (+1378.46%)
Mutual labels:  generative-model
Notes
The notes for Math, Machine Learning, Deep Learning and Research papers.
Stars: ✭ 53 (-18.46%)
Mutual labels:  generative-model
Cadgan
ICML 2019. Turn a pre-trained GAN model into a content-addressable model without retraining.
Stars: ✭ 19 (-70.77%)
Mutual labels:  generative-model
Simple Variational Autoencoder
A VAE written entirely in Numpy/Cupy
Stars: ✭ 20 (-69.23%)
Mutual labels:  generative-model
Pytorch Mnist Vae
Stars: ✭ 32 (-50.77%)
Mutual labels:  generative-model
Simulated Unsupervised Tensorflow
TensorFlow implementation of "Learning from Simulated and Unsupervised Images through Adversarial Training"
Stars: ✭ 558 (+758.46%)
Mutual labels:  generative-model
Vae protein function
Protein function prediction using a variational autoencoder
Stars: ✭ 57 (-12.31%)
Mutual labels:  generative-model
Ali Pytorch
Adversarially Learned Inference in Pytorch
Stars: ✭ 27 (-58.46%)
Mutual labels:  generative-model
Adain Style
Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization
Stars: ✭ 1,049 (+1513.85%)
Mutual labels:  generative-model
Began Tensorflow
Tensorflow implementation of "BEGAN: Boundary Equilibrium Generative Adversarial Networks"
Stars: ✭ 904 (+1290.77%)
Mutual labels:  generative-model
Dcgan Tensorflow
A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
Stars: ✭ 6,963 (+10612.31%)
Mutual labels:  generative-model
Wavegan Pytorch
PyTorch implementation of " Synthesizing Audio with Generative Adversarial Networks"
Stars: ✭ 33 (-49.23%)
Mutual labels:  generative-model
Delving Deep Into Gans
Generative Adversarial Networks (GANs) resources sorted by citations
Stars: ✭ 834 (+1183.08%)
Mutual labels:  generative-model
Csgnet
CSGNet: Neural Shape parser for Constructive Solid Geometry
Stars: ✭ 55 (-15.38%)
Mutual labels:  generative-model
Segan
Speech Enhancement Generative Adversarial Network in TensorFlow
Stars: ✭ 661 (+916.92%)
Mutual labels:  generative-model
Dcgan Pytorch
PyTorch Implementation of DCGAN trained on the CelebA dataset.
Stars: ✭ 32 (-50.77%)
Mutual labels:  generative-model
Tars
A deep generative model library in Theano and Lasagne
Stars: ✭ 61 (-6.15%)
Mutual labels:  generative-model
Li emnlp 2017
Deep Recurrent Generative Decoder for Abstractive Text Summarization in DyNet
Stars: ✭ 56 (-13.85%)
Mutual labels:  generative-model
Ligdream
Novel molecules from a reference shape!
Stars: ✭ 47 (-27.69%)
Mutual labels:  generative-model

Dynamic Linear Flow (DLF)

Code for reproducing results in "Generative Model with Dynamic Linear Flow"

In our paper, we proposed Dynamic Linear Flow, a new family of exact likelihood-based methods. Our method benefits from the efficient computation of flow-based methods (RealNVP, Glow, etc.) and high density estimation performance of autoregressive methods (PixelCNN, PixelSNAIL etc.). DLF yields state-of-the-art performance in density estimation benchmarks and efficiently synthesizes high-resolution images. Additionally, DLF converges 10x faster than other flow-based models such as Glow. Read our paper for more details.

Requirements

  • python3
  • TensorFlow (tested with v1.12)

Setup

  1. Install requirements

  2. Clone this repo or click the Download ZIP button on upper right corner

git clone https://github.com/naturomics/DLF
cd DLF
  1. Download Datasets

All datasets are saved to folder data/{dataset_name} as default. If your datasets are saved at a different folder, please specify it via --data_dir command line or change the default value in main.py file to point to the right folder.

  • MNIST and CIFAR10 will be directly downloaded by the code.
  • The preprocessed and downsampled ImageNet dataset can be downloaded from https://storage.googleapis.com/glow-demo/data/imagenet-oord-tfr.tar, 32x32 and 64x64 version included. Extract and move files to the corresponding folder (r05 in the filename refers to resolution 2**5=32):
mkdir -p data/imagenet{32x32,64x64}/{train,validation}
tar -xf imagenet-oord-tfr.tar

mv mnt/host/imagenet-oord-tfr/train/*r05*.tfrecords data/imagenet32x32/train
mv mnt/host/imagenet-oord-tfr/validation/*r05*.tfrecords data/imagenet32x32/validation

mv mnt/host/imagenet-oord-tfr/train/*r06*.tfrecords data/imagenet64x64/train
mv mnt/host/imagenet-oord-tfr/validation/*r06*.tfrecords data/imagenet64x64/validation
  • The preprocessed CelebA 256x256 is from https://storage.googleapis.com/glow-demo/data/celeba-tfr.tar. Extract it to folder data/celeba, for example:
wget https://storage.googleapis.com/glow-demo/data/celeba-tfr.tar
tar -xf celeba-tfr.tar
mv celeba-tfr data/celeba

If you are interested, see the scripts here to learn how these tfrecord files were generated.

Train the model

Outputs during training (train loss, validation loss, samples and model checkpoints) are saved to folder specified by --results_dir. Using --num_gpus for multiple GPUs training. Run python main.py -h for more helps.

CIFAR 10 with K=2, non-inverse dynamic linear transformation

# unconditional
python main.py --results_dir results/cifar10_noCond --seed [0/1/2]
# class label conditional
python main.py --results_dir results/cifar10_addCond --conditioning --seed [0/1/2]

CIFAR 10 with K=2, inverse dynamic linear transformation

python main.py --results_dir results/cifar10_noCond_extraDep --decomposition 1 --seed [0/1/2]

CIFAR 10 with K=4 and 6, non-inverse dynamic linear transformation

python main.py --results_dir results/cifar10_noCond_4parts --num_parts 4 --width 308 --seed [0/1/2]
python main.py --results_dir results/cifar10_noCond_6parts --num_parts 6 --width 256 --seed [0/1/2]

ImageNet 32x32

python main.py --problem imagenet32x32 --results_dir results/imgnet32_noCond

ImageNet 64x64

python main.py --problem imagenet64x64 --results_dir results/imgnet64_noCond --num_levels 4 --width 384 --invconv_bias --batch_size 24

MNIST

# unconditional
python main.py --problem mnist --results_dir results/mnist_noCond --num_levels 2 --width 128 --batch_size 256
# class label conditional
python main.py --problem mnist --results_dir results/mnist_addCond --num_levels 2 --width 128 --conditioning --batch_size 256

CekebA-HQ 256x256

python main.py --problem celeba --results_dir results/celeba_noCond --num_levels 6 --width 128 --batch_size 4 --num_gpus 2 --l2_factor 0.1

Interpolation between images

Run the script demo.py to generate linearly interpolated samples between two real images:

# Specify --results_dir with results path of CelebA, e.g.
python demo.py --results_dir results/celeba_noCond

The outputs are saved to demo directory as default.

Pre-trained models

We will soon upload our trained models.

Train with your own dataset

We use tf.data API for data reading pipeline and we have written a script to standardize the code. To train with your own dataset, all you need to do is writing the tfrecords maker and the corresponding parse function, and import it in file datasets/__init__.py. See datasets/cifar10.py, datasets/mnist.py etc. for examples. When training, specify your dataset by --problem {dataset_name} command line, where dataset_name is your script name. We will write a more detailed tutorial if needed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].