JCBrouwer / maua

Generative Art with Machine Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maua

This repo is pretty stale at the moment...

v0.2

Maua is a framework that allows for easy training of and interoperability between multiple state of the art image processing networks. Maua provides a modular object oriented API that allows uses ranging from piecing together low level components into a new architecture to training a GAN with a single command.

Those with little experience can use Maua without needing to know all of the details of what's running under the hood (just point at a folder of images and train), while those confident in their skills can dive deep into the building blocks of the various networks and put them together in new and interesting ways.

Maua seeks to integrate many different approaches under a single umbrella to streamline pipelines which would otherwise span multiple frameworks/languages/repositories/etc. with manual intermediate steps into a couple short and sweet python scripts. This way it is easier to push the creative boundaries of machine learning approaches without having to spend so much time installing and figuring out new, badly documented research repositories.

NOTE: Maua is still at an early stage of development, weird bugs/behaviors/expectations still lurk in the code that will slowly be ironed out as the framework matures.

Installation

Maua requires Python 3.7 and PyTorch 1.0 (which can be installed here). Training neural networks takes a lot of compute so most of the included networks require a decent GPU to get results in a reasonable amount of time.

Furthermore Maua relies on Pathos(pip install pathos) for multithreading.

There are also some optional dependencies required for running a GLWindow with network outputs, namely PyCuda and Glumpy. These can be installed with pip or conda.

After installing the needed dependencies this repository can be cloned and you can get to work!

Usage

The best way to use Maua at the moment is by creating a script in the scripts/ folder. Then it can be run from command line (from the folder with the repository in it) with python3 -m maua.scripts.my_script.

There are some example scripts included that show how to train and test all the currently implemented networks.

Pretrained example checkpoints and the datasets they were trained on can be downloaded from here, they should be placed in the folders with the corresponding name in the repository. The datasets are based on the 102 Category Oxford Flowers Dataset. The images have been cropped to squares and prepared in the folder structure that Maua expects. You can replicate any checkpoint by simply running its respective training script.

Here are some results from Maua v0.1:

ProGAN

Latent Bouquet

Training FlowerGAN

Training took about 12 hours on a GTX 1080 Ti.

Pix2Pix

Edges2Flowers

Training took about 10 hours on a GTX 1080 Ti.

From left to right: the input to the network, the result for pix2pix without multiscale GAN, pix2pix with no_vgg=False, and pix2pix with no_vgg=True.

The implementation of pix2pixHD is still a work in progress. Expect an improvement in results when using the VGG feature loss in future versions.

Style Transfer

Stylish Rose

From left to right: the content image, style image, output using NeuralStyle, and MultiscaleStyle.

Also included is a script, voltaStyle.py, that uses progressively smaller ImageNet classifiers to achieve up to 28 megapixel style transfer images (5300x5300 px) on a graphics card with 11 GB VRAM.

Note that using NeuralStyle without specifying a model_file will download the respective model to your modelzoo.

Normalizing gradients is not yet fully functioning, this feature should be left False for the time being.

Acknowledgments

Maua contains partial/full implementations of and/or uses code from the papers/repositories listed below:

ProGAN: paper, code

Pix2Pix: paper, paper, code

Neural Style: paper, code

GLWindow: code

R1 Regularization: paper, code

Relativistic Average Discriminator: paper

License

This repository is licensed under the GPL v3 license, you can find more information in LICENSE and gpl3.txt

The pretrained network checkpoints and their datasets are not for commercial use, they are only included to illustrate functionality and verify the included example scripts.

About

Generative Art with Machine Learning

License:Other


Languages

Language:Python 100.0%