Git Product home page Git Product logo

crvae's Introduction

CR-VAE

Official code release for Consistency Regularization for VAEs, NeurIPS 2021.

Samarth Sinha, Adji B. Dieng

Arxiv, Proceedings

If there are any questions, please email: [email protected]. Github issues are not checked often, and may be missed.

Installation

  git clone https://github.com/sinhasam/CRVAE.git
  cd CRVAE
  pip3 install -e .

Usage

Basic usage of the CR-VAE API, that can be added to your favorite VAE variant and training:

  from CRVAE import CRVAE
  
  ... data loading
  
  crvae = CRVAE(gamma=self.gamma, beta_1=self.beta_1, beta_2=self.beta_2)
  loss, log = crvae.calculate_loss(model, images, augmented_images)
  loss.backward()
  
  ... optimizer step
  

To use base hyperparameters, simply use

  from CRVAE import CRVAE
  
  ... data loading
  
  loss, logs = CRVAE().calculate_loss(model, images, augmented_images)
  loss.backward()
  
  ... optimizer step
  

There are two simple VAE architechtures implemented but can be easily extended.

To use the architectures:

from CRVAE.models import CNNVAE, MLPVAE

cnn_model = CNNVAE(in_channels=3)
mlp_model = MLPVAE(latent_dim=32)

There are few image augmenatation policies implemented which can be used as:

from CRVAE.augmentations import get_augmentation

simple_augmentation = get_augmentation('simple')
large_augmentation_normalize = get_augmentation('large', normalize=True)
large_color_jitter_augmentation = get_augmentation('large_jitter', normalize=True)
# vertical flip might not be suitable for all datasets since it assumes data symmetry
large_vertical_flip = get_augmentation('large_vertical_flip', normalize=True)
...

crvae's People

Contributors

sinhasam 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.