wavelets / fast-neural-doodle

Faster neural doodle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast neural doodle

This is my try on drawing with neural networks, which is much faster than Alex J. Champandards version, and similar in quality. This approach is based on neural artistic style method (L. Gatys), whereas Alexs version uses CNN+MRF approach of Chuan Li.

It takes several minutes to redraw Renoir example using GPU and it will easily fit in 4GB GPUs. If you were able to work with Justin Johnsons code for artistic style then this code should work for you too.

Requirements

  • torch
  • torch.cudnn (optional)
  • torch-hdf5
  • python + numpy + scipy + h5py + sklearn

Tested with python2.7 and latest conda packages.

Do it yourself

First download VGG-19.

cd data/pretrained && bash download_models.sh && cd ../..

Use this script to get intermediate representations for masks.

python get_mask_hdf5.py --n_colors=4 --style_image=data/Renoir/style.png --style_mask=data/Renoir/style_mask.png --target_mask=data/Renoir/target_mask.png

Now run doodle.

th fast_neural_doodle.lua -masks_hdf5 masks.hdf5 -vgg_no_pad

And here is the result. Renoir First row: original, second -- result.

And the result for Monet. Renoir

Misc

  • Supported backends:

    • nn (CPU/GPU mode)
    • cudnn
    • clnn (not tested yet..)
  • When using -backend cudnn do not forget to switch -cudnn_autotune.

Acknowledgement

The code is heavily based on Justin Johnsons great code for artistic style.

About

Faster neural doodle

License:MIT License


Languages

Language:Lua 88.5%Language:Python 9.5%Language:Shell 2.0%