Giter Site home page Giter Site logo

exgan's Introduction

ExGAN

Implementation of

Our goal is to generate samples which are both realistic and extreme, based on any user-specified extremeness criteria (in this case, high total rainfall). Left: Existing GAN-based approaches generate typical rainfall patterns, which have low (green) to moderate (red) rainfall. Right: Extreme samples generated by our approach have extreme (violet) rainfall, and realistic spatial patterns resembling that of real floods.

Getting Started

Environment

This code has been tested on Debian GNU/Linux 9 with a 12GB Nvidia GeForce RTX 2080 Ti GPU, CUDA Version 10.2 and PyTorch 1.5.

Reproducing the Experiments

The first step is to get the data. We have prepared a script to download precipitation data from water.weather.gov/precip/. The data downloaded is for the duration 2010 to 2016 as mentioned in the paper.

python PrepareData.py

Now, we can train a DCGAN Baseline on this data.

python DCGAN.py

Distribution Shifting on this DCGAN can be performed using

python DistributionShifting.py

Finally, we can train ExGAN on the distribution shifted dataset.

python ExGAN.py

The training of ExGAN and DCGAN can be monitored using TensorBoard.

tensorboard --logdir [DCGAN\EXGAN]

Evaluation and Visualizing the Results

Generate samples from DCGAN of different extremeness probabilities, and mark the time taken in sampling.

python DCGANSampling.py

Similarly, Generate samples from ExGAN of different extremeness probabilities, and mark the time taken in sampling.

python ExGANSampling.py

We provide FID.py to calculate the FID score, as described in the paper, on the trained models. We also provide DCGANRecLoss.py, and ExGANRecLoss.py to evaluate DCGAN and ExGAN on their Reconstruction Loss Note that, both of these metrics are calculated on a test set. PrepareData.py can be used to curate the test set for the duration described in the paper.

The python file, plot.py, contains the code for plotting rainfall maps like the figures included in the paper. Note that this requires the Basemap library from matplotlib.

We also provide an IPython notebook, EVT_Analysis.ipynb to play with and visualize the effect of different thresholds for the Peaks over Threshold approach.

Citation

If you use this code for your research, please consider citing our arXiv preprint

@misc{bhatia2020exgan,
    title={ExGAN: Adversarial Generation of Extreme Samples},
    author={Siddharth Bhatia and Arjit Jain and Bryan Hooi},
    year={2020},
    eprint={2009.08454},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

exgan's People

Contributors

arjitj avatar bhatiasiddharth avatar

Watchers

 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.