GithubHelp home page GithubHelp logo

classicvalues / ambient-gan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ashishbora/ambient-gan

1.0 0.0 0.0 6.81 MB

Code to reproduce results from the paper "AmbientGAN: Generative models from lossy measurements"

License: MIT License

Python 86.62% Shell 4.32% Jupyter Notebook 9.06%

ambient-gan's Introduction

AmbientGAN: Generative models from lossy measurements

This repository provides code to reproduce results from the paper AmbientGAN: Generative models from lossy measurements.

The training setup is as in the following diagram:

Here are a few example results:

Measured Baseline AmbientGAN (ours)

Few more samples from AmbientGAN models trained with 1-D projections:

Pad-Rotate-Project Pad-Rotate-Project-theta

The rest of the README describes how to reproduce the results.

Requirements

  • Python 2.7
  • Tensorflow >= 1.4.0
  • matplotlib
  • scipy
  • numpy
  • cvxpy
  • scikit-learn
  • tqdm
  • opencv-python
  • pandas

For pip installation, use $ pip install -r requirements.txt

Get the data

  • MNIST data is automatically downloaded
  • Get the celebA dataset here and put the jpeg files in ./data/celebA/
  • Get the CIFAR-10 python data from here and put it in ./data/cifar10/cifar-10-batches-py/*

Get inference models

We need inference models for computing the inception score.

  • For MNIST, you can train your own by

    cd ./src/mnist/inf
    python train.py
    

    [TODO]: Provide a pretrained model.

  • Inception model for use with CIFAR-10 is automatically downloaded.

Create experiment scripts

Run ./create_scripts/create_scripts.sh

This will create scripts for all the experiments in the paper.

[Optional] If you want to run only a subset of experiments you can define the grid in ./create_scripts/DATASET_NAME/grid_*.sh or if you wish to tweak a lot of parameters, you can change ./create_scripts/DATASET_NAME/base_script.sh. Then run ./create_scripts/create_scripts.sh as above to create the corresponding scripts (remember to remove any previous files from ./scripts/)

Run experiments

We provide scripts to train on multiple GPUs in parallel. For example, if you wish to use 4 GPUs, you can run: ./run_scripts/run_sequentially_parallel.sh "0 1 2 3"

This will start 4 GNU screens. Each program within the screen will attempt to acquire and run experiments from ./scripts/, one at a time. Each experiment run will save samples, checkpoints, etc. to ./results/.

See results as you train

Samples

You can see samples for each experiment in ./results/samples/EXPT_DIR/

EXPT_DIR is defined based on the hyperparameters of the experiment. See ./src/commons/dir_def.py to see how this is done.

Quantitative plots

Run

python src/aggregator_mnist.py
python src/aggregator_cifar.py

This will create pickle files in ./results/ with the relevant data in a Pandas dataframe.

Now use the ipython notebooks ./plotting_mnist.ipynb and ./plotting_cifar.ipynb to get the relevant plots. The generated plots are also saved to ./results/plots/ (make sure this directory exists)

ambient-gan's People

Contributors

ashishbora avatar

Stargazers

 avatar

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.