All Projects → DmitryUlyanov → Fast Neural Doodle

DmitryUlyanov / Fast Neural Doodle

Licence: mit
Faster neural doodle

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Fast Neural Doodle

Torch2coreml
Torch7 -> CoreML
Stars: ✭ 363 (+7.08%)
Mutual labels:  torch, neural-style
Neural Style Audio Torch
Torch implementation for audio neural style.
Stars: ✭ 130 (-61.65%)
Mutual labels:  torch, neural-style
Torch Models
Stars: ✭ 65 (-80.83%)
Mutual labels:  torch, neural-style
Online Neural Doodle
Feedforward neural doodle
Stars: ✭ 183 (-46.02%)
Mutual labels:  torch, neural-style
Texture nets
Code for "Texture Networks: Feed-forward Synthesis of Textures and Stylized Images" paper.
Stars: ✭ 1,147 (+238.35%)
Mutual labels:  torch, neural-style
Neural-Zoom
Infinite Zoom For Style Transfer
Stars: ✭ 34 (-89.97%)
Mutual labels:  torch, neural-style
vak
a neural network toolbox for animal vocalizations and bioacoustics
Stars: ✭ 21 (-93.81%)
Mutual labels:  torch
Tensorflow Style Transfer
A simple, concise tensorflow implementation of style transfer (neural style)
Stars: ✭ 278 (-17.99%)
Mutual labels:  neural-style
gans-collection.torch
Torch implementation of various types of GAN (e.g. DCGAN, ALI, Context-encoder, DiscoGAN, CycleGAN, EBGAN, LSGAN)
Stars: ✭ 53 (-84.37%)
Mutual labels:  torch
torch-asg
Auto Segmentation Criterion (ASG) implemented in pytorch
Stars: ✭ 42 (-87.61%)
Mutual labels:  torch
Akarin
Akarin is a powerful (not yet) server software from the 'new dimension'
Stars: ✭ 332 (-2.06%)
Mutual labels:  torch
Adaptiveattention
Implementation of "Knowing When to Look: Adaptive Attention via A Visual Sentinel for Image Captioning"
Stars: ✭ 303 (-10.62%)
Mutual labels:  torch
Attentionwalk
A PyTorch Implementation of "Watch Your Step: Learning Node Embeddings via Graph Attention" (NeurIPS 2018).
Stars: ✭ 266 (-21.53%)
Mutual labels:  torch
chemicalx
A PyTorch and TorchDrug based deep learning library for drug pair scoring.
Stars: ✭ 176 (-48.08%)
Mutual labels:  torch
Deep Learning Model Convertor
The convertor/conversion of deep learning models for different deep learning frameworks/softwares.
Stars: ✭ 3,044 (+797.94%)
Mutual labels:  torch
pytorch-extras
Some extra features for pytorch.
Stars: ✭ 48 (-85.84%)
Mutual labels:  torch
Nonechucks
Deal with bad samples in your dataset dynamically, use Transforms as Filters, and more!
Stars: ✭ 304 (-10.32%)
Mutual labels:  torch
cyclegan keras
cyclegan reimplimented in keras
Stars: ✭ 18 (-94.69%)
Mutual labels:  neural-style
TOM-Net
TOM-Net: Learning Transparent Object Matting from a Single Image (CVPR 2018)
Stars: ✭ 74 (-78.17%)
Mutual labels:  torch
Dreampower
DeepNude with DreamNet improvements.
Stars: ✭ 287 (-15.34%)
Mutual labels:  torch

Faster neural doodle

This is my try on drawing with neural networks, which is faster than Alex J. Champandard's version, and similar in quality. This approach is based on neural artistic style method (L. Gatys), whereas Alex's 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 Johnson's code for artistic style then this code should work for you too.

You can find even faster version here.

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

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

And Monet. Monet

Multiscale

Processing the image at low resolution first can provide a significant speed-up. You can pass a list of resolutions to use when processing. Passing 256 means that the images and masks should be resized to 256x256 resolution. With 0 passed no resizing is done. Here is an example for cmd parameters:

  • -num_iterations 450,100 -resolutions 256,0 Which means: work for 450 iterations at 256x256 resolution and 100 iterations at original.

Monet and Renoir examples take ~1.5 min to process with these options.

Style transfer

You can also provide target image to use in content loss (in the same way as in neural artisctic style algorithm) via --target_image option of get\_mask\_hdf5.py script.

Example:

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/creek_mask.jpg --target_image=data/Renoir/creek.jpg
th fast_neural_doodle.lua -masks_hdf5 masks.hdf5

Renoir Upper left: target image. Upper right: neural doodle with target image, i.e. both the masks and content loss were used. Lower left: regular neural doodle without content loss. Lower right: stylization without masks, with high style weight, obtained via neural style code. With high style weight, stylization tends to mix unrelated parts of image, such as patches of grass floating in the sky on last picture. Neural doodle with content loss allows to generate highly stylized images without this problem.

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 Johnson's great code for artistic style.

Citation

If you use this code for your research please cite neural-style and this repository.

@misc{Ulyanov2016fastdoodle,
  author = {Ulyanov, Dmitry},
  title = {Fast Neural Doodle},
  year = {2016},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/DmitryUlyanov/fast-neural-doodle}},
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].