GithubHelp home page GithubHelp logo

tanelp / fauxtograph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stitchfix/fauxtograph

0.0 2.0 0.0 109 KB

Tools for using a variational auto-encoder for latent image encoding and generation.

License: MIT License

Python 100.00%

fauxtograph's Introduction

fauxtograph

This code can be used for using a variational auto-encoder for latent image encoding and generation. It implements the algorithm found in

Kingma, Diederik P., and Max Welling. "Auto-encoding variational bayes." arXiv preprint arXiv:1312.6114 (2013).

The model takes in a series of images and trains an auto-encoder to perform an encoding transform step as well as a generative inverse_transform step. It's built on top of the Chainer framework and has an easy to use command line interface for training and generating images.

Both the module itself as well as the training script are available by installing this package through PyPI. Otherwise the module itself containing the main class which does all the heavy lifting is in fauxtograph/fauxtograph.py while the training/generation CLI script is in fauxtograph/fauxto.py

To learn more about its functionality and to get a better sense of how one might us it, please see the blog post on the Stitch Fix tech blog, multithreaded.

##Installation

The simplest step to using the module is to install via pip:

$ pip install fauxtograph

this should additionally grab all necessary dependencies including the main backend NN framework, Chainer. However, if you plan on using CUDA to train the model with a GPU you'll need to additionally install the Chainer CUDA dependencies with

$ pip install chainer-cuda-deps

##Usage

To get started, you can either find your own image set to use or use the downloading tool to grab some of the Hubble/ESA space images, which I've found make for interesting results.

To grab the images and place them in an images folder run

$ fauxtograph download ./images

This process can take some time depending on your internet connection.

Then you can train a model and output it to disk with

$ fauxtograph train ./images ./models/model_name 

Finally, you can generate new images based on your trained model with

$ fauxtograph generate ./models/model_name ./generated_images_folder

Each command comes with a --help option to see possible optional arguments.

##Tips

  • In order to get the best results for generated images it'll be necessary to either have a rather large number of images (say on the order of several hundred thousand or more), or images that are all quite similar with minimal backgrounds.

  • As the model trains you should see the output of the KL Divergence average over the batches and the reconstruction loss average as well. You might wish to adjust the ratio of these two terms with the --kl_ratio option in order to get better performance should you find that the learning rate is driving one or the other terms to zero too quickly(slowly).

  • If you have an CUDA capable Nvidia GPU, use it. The model can train over 10 times faster by taking advantage of GPU processing.

  • Sometimes you will want to brighten your images when saving them, which can be done with the --image_multiplier argument.

  • If you manage to train a particularly interesting model and generate some neat images, then we'd like to see them. Use #fauxtograph if you decide to put them up on social media.

ENJOY

fauxtograph's People

Contributors

cemoody avatar genekogan avatar tjtorres avatar

Watchers

 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.