Code Monkey home page Code Monkey logo

vae-example's Introduction

VAE (and DDPM) Example

Project for Probabilistic Machine Learning

Report

We write a paper describing image generation models from a probabilistic perspective, which can be found in report.pdf. We cover the math behind variational autoencoders and diffusion models and explain the connection between the two.

Installation

pip3 install torch torchvision matplotlib scikit-learn

Usage

To re-train the VAE, run the following: python3 main_vae.py --latent_dim 2 --save_name sample_1_latents --latents_to_sample 1 Then, add the flags --viz_latent to visualize the latent space and --case_study to visualize the reconstructions.

To re-train the DDPM, run the following: python3 main_ddpm.py --n_steps 1000 Then, add the flags --viz_trajectory to save images of the trajectory of a single sample and --case_study to visualize the reconstructions.

Once you have the trajectory images, you can create a video with the following command: ffmpeg -framerate 120 -pattern_type glob -i '*.png' -r 15 -vf scale=512:-1 ddpm_trajectory.gif;

Results

VAE Generations

Figure 2 in the report.

Degenerate Miss Success
VAE Generations VAE Generations VAE Generations

VAE Latent space

VAE Latent space

DDPM Generations

Figure 3 in the report.

DDPM Generations

DDPM Trajectory

DDPM Trajectory

As mentioned in the code, we thank the authors of https://github.com/cloneofsimo/minDiffusion for their implementation of DDPM.

vae-example's People

Contributors

ajb117 avatar natekimball avatar

Watchers

amroaljundi avatar  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.