Coder Social home page Coder Social logo

ml-lab / relativisticgan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexiajm/relativisticgan

0.0 4.0 0.0 0 B

Code for replication of the paper "The relativistic discriminator: a key element missing from standard GAN"

Python 67.41% Shell 32.59%

relativisticgan's Introduction

Relativistic GAN

Code to replicate all analyses from the paper The relativistic discriminator: a key element missing from standard GAN Discussion at https://ajolicoeur.wordpress.com/RelativisticGAN.

Needed

To do beforehand

  • Change all folders locations in fid_script.sh, stable.sh, unstable.sh, GAN_losses_iter.py, GAN_losses_iter_PAC.py
  • Make sure that there are existing folders at the locations you used
  • If you want to use the CAT dataset
    • Run setting_up_script.sh in same folder as preprocess_cat_dataset.py and your CAT dataset (open and run manually)
    • Move cats folder to your favorite place
    • mv cats_bigger_than_64x64 "your_input_folder_64x64"
    • mv cats_bigger_than_128x128 "your_input_folder_128x128"
    • mv cats_bigger_than_256x256 "your_input_folder_256x256"

To run

  • To run models
    • Use GAN_losses_iter.py (Version you probably will want to use)
    • Use GAN_losses_iter_PAC.py (Version with PacGAN-2, to use when there is severe mode collapse only)
  • To Replicate
    • Open stable.sh and run the lines you want
    • Open unstable.sh and run the lines you want

Notes

If you just want to generate pictures and you do not care about the Fréchet Inception Distance (FID), you do not need to download Tensorflow.

If you don't want to generate cat, nor get the FID, you can skip ahead and focus entirely on "GAN_losses_iter.py".

Although I always used the same seed (seed = 1), keep in mind that your results may be sightly different. Neural networks are notoriously difficult to perfectly replicate. You never know if something that I changed while working on the paper could have affected the randomness in some of my earlier experiments (I did stable experiments first, then unstable experiments for CIFAR-10, and most recently the unstable experiments for CAT). CUDNN is also said to introduce some randomness and I use it. I forgot to put a seed for the tensorflow FID scripts so FIDs may vary by a 2-3 points, but hopefully they shouldn't change much since I used a very large amount of images for the calculations.

Results

64x64 cats with RaLSGAN (FID = 11.97)

128x128 cats with RaLSGAN (FID = 15.85)

256x256 cats with SGAN (5k iterations)

256x256 cats with LSGAN (5k iterations)

256x256 cats with RaSGAN (FID = 32.11)

256x256 cats with RaLSGAN (FID = 35.21)

256x256 cats with SpectralSGAN (FID = 54.73)

256x256 cats with WGAN-GP (FID > 100)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.