Giter Site home page Giter Site logo

diffusion-autoencoders's Introduction

Diffusion Autoencoders

demo_diffae

This is an unofficial implementation of Diffusion Autoencoders. You can find the official implementation here.

๐Ÿ› ๏ธ Setup

If you are using poetry, you can install the required packages by running the following command:

poetry install

For more details on the required packages, refer to pyproject.toml.

๐Ÿš€ Run

Training Diff-AE

You can train Diff-AE on CelebA or CelebA-HQ datasets.
There is no need to download the datasets manually; they are automatically downloaded when you run.

export DATA_NAME="celebahq"
export IMAGE_SIZE=128
export EXPN="hoge"

poetry run diffae_train \
    --data_name=$DATA_NAME \
    --image_size=$IMAGE_SIZE \
    --expn=$EXPN

You can modify the settings before training. If you wish to create custom settings, modify the diffae/cfg/{IMAGE_SIZE}_model.yml file according to your GPU specs. โš™๏ธ

The training results will be saved in output/{EXPN}. If the --expn argument is not provided, the directory name will be generated based on the current time.

Note that Latent DDIM is not implemented as unconditional image synthesis by Diff-AE is not the focus of this repo.

Evaluating Diff-AE

You can evaluate the trained model by calculating its MSE and LPIPS.

export PATH_TO_OUTPUT_DIR="output/hoge"
export MODEL_CKPT="last_ckpt.pth"

poetry run diffae_test \
    --output=$PATH_TO_OUTPUT_DIR \
    --model_ckpt=$MODEL_CKPT

Training the Classifier

You can also train a classifier for attribute manipulation.

export PATH_TO_OUTPUT_DIR="output/hoge"
export MODEL_CKPT="last_ckpt.pth"

poetry run clf_train \
    --output=$PATH_TO_OUTPUT_DIR \
    --model_ckpt=$MODEL_CKPT

Evaluating the Classifier

The classifier can be evaluated by calculating its accuracy and AUROC.

export PATH_TO_OUTPUT_DIR="output/hoge"
export MODEL_CKPT="last_ckpt.pth"
export CLF_CKPT="clf_last_ckpt.pth"

poetry run clf_test \
    --output=$PATH_TO_OUTPUT_DIR \
    --model_ckpt=$MODEL_CKPT \
    --clf_ckpt=$CLF_CKPT

๐Ÿ“š Example Notebooks

You can check out the minimal working examples in the notebooks found here.


If you find this repository helpful, please consider giving a star โญ!

diffusion-autoencoders's People

Contributors

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