Skip to content
Permalink
Browse files

internal change

PiperOrigin-RevId: 203387593
  • Loading branch information...
GAN Team
GAN Team committed Jul 5, 2018
1 parent fbbc05a commit 9af70fe38d6cdee602cb01999c3515b6eebe1086
Showing with 4,064 additions and 1,311 deletions.
  1. +1 −1 AUTHORS
  2. +15 −1 README.md
  3. +2 −2 compare_gan/bin/compare_gan_prepare_datasets.sh
  4. +1 −0 compare_gan/bin/compare_gan_run_one_task
  5. +1 −1 compare_gan/bin/compare_gan_run_test.sh
  6. +0 −590 compare_gan/src/classifier_metrics_impl.py
  7. +249 −0 compare_gan/src/datasets.py
  8. +88 −0 compare_gan/src/datasets_test.py
  9. +278 −49 compare_gan/src/eval_gan_lib.py
  10. +28 −15 compare_gan/src/fid_score.py
  11. +105 −145 compare_gan/src/gan_lib.py
  12. +2 −1 compare_gan/src/gan_lib_test.py
  13. +25 −23 compare_gan/src/gans/BEGAN.py
  14. +10 −14 compare_gan/src/gans/DRAGAN.py
  15. +15 −30 compare_gan/src/gans/GAN.py
  16. +9 −13 compare_gan/src/gans/LSGAN.py
  17. +37 −27 compare_gan/src/gans/VAE.py
  18. +18 −18 compare_gan/src/gans/WGAN.py
  19. +10 −14 compare_gan/src/gans/WGAN_GP.py
  20. +143 −87 compare_gan/src/gans/abstract_gan.py
  21. +59 −0 compare_gan/src/gans/consts.py
  22. +239 −0 compare_gan/src/gans/dcgan_architecture.py
  23. +23 −20 compare_gan/src/gans/gan_test.py
  24. +358 −0 compare_gan/src/gans/gans_with_penalty.py
  25. +211 −0 compare_gan/src/gans/gans_with_penalty_test.py
  26. +234 −17 compare_gan/src/gans/ops.py
  27. +570 −0 compare_gan/src/gans/resnet_architecture.py
  28. +89 −0 compare_gan/src/gans/resnet_architecture_test.py
  29. +632 −205 compare_gan/src/generate_tasks_lib.py
  30. +339 −0 compare_gan/src/image_similarity.py
  31. +74 −0 compare_gan/src/ms_ssim_score.py
  32. +151 −31 compare_gan/src/params.py
  33. +2 −4 compare_gan/src/params_test.py
  34. BIN compare_gan/src/test_data/image_celeba-dev-00000-of-00010
  35. BIN compare_gan/src/test_data/image_celebahq-128-00090-of-00100
  36. BIN compare_gan/src/test_data/image_cifar10-dev-00000-of-00001
  37. BIN compare_gan/src/test_data/image_fashion_mnist-dev-00000-of-00001
  38. BIN compare_gan/src/test_data/image_lsun_bedrooms-train-00099-of-00100
  39. BIN compare_gan/src/test_data/image_mnist-dev-00000-of-00001
  40. +42 −0 compare_gan/src/test_utils.py
  41. +4 −3 setup.py
@@ -1,4 +1,4 @@
# This is the list of T2T authors for copyright purposes.
# This is the list of authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
@@ -1,7 +1,15 @@
## Compare GAN code.

This is the code that was used in "Are GANs Created Equal? A Large-Scale Study"
paper (https://arxiv.org/abs/1711.10337).
paper (https://arxiv.org/abs/1711.10337) and in "The GAN Landscape: Losses, Architectures, Regularization, and Normalization" (https://openreview.net/pdf?id=SkeFUsQNx7).

If you want to see the version used only in the first paper - please see the *v1* branch of this repository.


### Best hyperparameters

This repository also contains the values for the best hyperparameters for different combinations of models, regularizations and penalties.
You can see them in ``generate_tasks_lib.py`` file and train using ``--experiment=best_models_sndcgan``

### Installation:

@@ -19,6 +27,12 @@ compare_gan_prepare_datasets.sh

It will download all the necessary datasets and frozen TF graphs. By default it will store them in ``/tmp/datasets``.

WARNING: by default this script only downloads and installs small datasets - it doesn't download celebaHQ or lsun bedrooms.

* **Lsun bedrooms dataset**: If you want to install lsun-bedrooms you need to run t2t-datagen yourself (this dataset will take couple hours to download and unpack).

* **CelebaHQ dataset**: currently it is not available in tensor2tensor. Please use the [ProgressiveGAN github](https://github.com/tkarras/progressive_growing_of_gans) for instructions on how to prepare it.

### Running

compare_gan has two binaries:
@@ -27,10 +27,10 @@ fi
echo "Preparing datasets (mnist, fashionmnist, cifar10, celeba) in ${DATASET_DIR?}"
mkdir ${DATASET_DIR?}

datasets=(image_mnist image_fashion_mnist image_cifar10 image_celeba_tune)
datasets=(image_mnist image_fashion_mnist image_cifar10 image_celeba)
for dataset in "${datasets[@]}"; do
echo "Dataset is ${dataset?}"
`${T2T_DATAGEN?} --data_dir=${DATASET_DIR?} --problem=${dataset?} --tmp_dir=${TMP_DIR?}`
${T2T_DATAGEN?} --data_dir=${DATASET_DIR?} --problem=${dataset?} --tmp_dir=${TMP_DIR?}
done

echo "Getting inception model."
@@ -35,6 +35,7 @@ logging = tf.logging
flags.DEFINE_string("workdir", "", "The working directory for all tasks.")
flags.DEFINE_integer("task_num", 0, "The task number to use.")
flags.DEFINE_string("command", "all", "What command to execute: all, train, eval.")
flags.DEFINE_bool("enable_tf_profile", False, "Whether to run TFProf.")

def main(_):
tf.logging.set_verbosity(tf.logging.INFO)
@@ -17,4 +17,4 @@

rm -rf /tmp/results
compare_gan_generate_tasks --workdir=/tmp/results --experiment=test
compare_gan_run_one_task --workdir=/tmp/results --task_num=0 --alsologtostderr --dataset_root=/tmp/datasets --num_test_examples=50
compare_gan_run_one_task --workdir=/tmp/results --task_num=0 --alsologtostderr --dataset_root=/tmp/datasets

0 comments on commit 9af70fe

Please sign in to comment.
You can’t perform that action at this time.