GithubHelp home page GithubHelp logo

liturout / optimaltransportmodeling Goto Github PK

View Code? Open in Web Editor NEW
53.0 2.0 9.0 21.86 MB

The repository contains reproducible PyTorch source code of our paper Generative Modeling with Optimal Transport Maps, ICLR 2022.

Jupyter Notebook 77.70% Python 2.21% HTML 20.09%
optimal-transport generative-modeling image-restoration pytorch inpainting colorization denoising

optimaltransportmodeling's Introduction

Generative Modeling with Optimal Transport Maps

The repository contains reproducible PyTorch source code of our paper Generative Modeling with Optimal Transport Maps, ICLR 2022. It focuses on Optimal Transport Modeling (OTM) in ambient space, e.g. spaces of high-dimensional images. While analogous approaches consider OT maps in the latent space of an autoencoder, this paper focuses on fitting an OT map directly between noise and ambient space. The method is evaluated on generative modeling and unpaired image restoration tasks. In particular, large-scale computer vision problems, such as denoising, colorization, and inpainting are considered in unpaired image restoration. The overall pipeline of OT as generative map and OT as cost of generative model is given below.

Latent Space Optimal Transport

Our method is different from the prevalent approach of OT in the latent space shown below.

Ambient Space Mass Transport

The scheme of our approach for learning OT maps between unequal dimensions.

Prerequisites

The implementation is GPU-based. Single GPU (V100) is enough to run each experiment. Tested with torch==1.4.0 torchvision==0.5.0. To reproduce the reported results, consider using the exact version of PyTorch and its required dependencies as other versions might be incompatible.

Repository structure

All the experiments are issued in the form of pretty self-explanatory python codes.

Main Experiments

Execute the following commands in the source folder.

Training

  • python otm_mnist_32x22.py --train 1 -- OTM between noise and MNIST, 32x32, Grayscale;
  • python otm_cifar_32x32.py --train 1 -- OTM between noise and CIFAR10, 32x32, RGB;
  • python otm_celeba_64x64.py --train 1 -- OTM between noise and CelebA, 64x64, RGB;
  • python otm_celeba_denoise_64x64.py --train 1 -- OTM for unpaired denoising on CelebA, 64x64, RGB;
  • python otm_celeba_colorization_64x64.py --train 1 -- OTM for unpaired colorization on CelebA, 64x64, RGB;
  • python otm_celeba_inpaint_64x64.py --train 1 -- OTM unpaired inpainting on CelebA, 64x64, RGB.

Run inference with the best iteration.

Inference

  • python otm_mnist_32x32.py --inference 1 --init_iter 100000
  • python otm_cifar_32x32.py --inference 1 --init_iter 100000
  • python otm_celeba_64x64.py --inference 1 --init_iter 100000
  • python otm_celeba_denoise_64x64.py --inference 1 --init_iter 100000
  • python otm_celeba_colorization_64x64.py --inference 1 --init_iter 100000
  • python otm_celeba_inpaint_64x64.py --inference 1 --init_iter 100000

Toy Experiments in 2D

  • source/toy/OTM-GO MoG.ipynb -- Mixture of 8 Gaussians;
  • source/toy/OTM-GO Moons.ipynb -- Two Moons;
  • source/toy/OTM-GO Concentric Circles.ipynb -- Concentric Circles;
  • source/toy/OTM-GO S Curve.ipynb -- S Curve;
  • source/toy/OTM-GO Swirl.ipynb -- Swirl.

Refer to Credit Section for baselines.

Results

Optimal transport modeling between high-dimensional noise and ambient space.

Randomly generated samples

Optimal transport modeling for unpaired image restoration tasks.

Following is the experimental setup that is considered for unpaired image restoration.

OTM for image denoising on test C part of CelebA, 64 × 64.

OTM for image colorization on test C part of CelebA, 64 × 64.

OTM for image inpainting on test C part of CelebA, 64 × 64.

Optimal transport modeling for toy examples.

OTM in low-dimensional space, 2D.

Credits

optimaltransportmodeling's People

Contributors

liturout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

optimaltransportmodeling's Issues

Plots issue

Hi,
Thanks for the repo, I think you forgot to include src.plotters
There is no implementation for:
from src.plotters import plot_noise_interp_unequal, plot_inv_noise_interp_unequal

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.