GithubHelp home page GithubHelp logo

styloint / chainer-fast-neuralstyle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yusuketomoto/chainer-fast-neuralstyle

0.0 1.0 0.0 50.83 MB

Chainer implementation of "Perceptual Losses for Real-Time Style Transfer and Super-Resolution".

License: MIT License

Python 98.89% Shell 1.11%

chainer-fast-neuralstyle's Introduction

Chainer implementation of "Perceptual Losses for Real-Time Style Transfer and Super-Resolution"

Fast artistic style transfer by using feed forward network.

What changes from yusekemoto version

  • Insteand of using tanh as activation function, I use sigmoid. Using tanh, I was having a lot of artefacts (black hole, white hole, points, etc ...) Using sigmoid seems to have solve the issue. So all the models trained with yusekemoto version should not work.
  • Loss graph and results saved at each checkpoint.
  • Can resume a training
  • If the output path for saving the models contains directory that does not exists, they are created
  • Compatible with chainer 4.1
  • Train with size 512 by default and save checkpoints every 1000 iteration

  • input image size: 1024x768
  • process time(CPU): 17.78sec (Core i7-5930K)
  • process time(GPU): 0.994sec (GPU TitanX)

Requirement

$ pip install chainer

Prerequisite

Download VGG16 model and convert it into smaller file so that we use only the convolutional layers which are 10% of the entire model.

sh setup_model.sh

Train

Need to train one image transformation network model per one style target. According to the paper, the models are trained on the Microsoft COCO dataset.

python train.py -s <style_image_path> -d <training_dataset_path> -g <use_gpu ? gpu_id : -1>

Generate

python generate.py <input_image_path> -m <model_path> -o <output_image_path> -g <use_gpu ? gpu_id : -1>
  • example:
python generate.py sample_images/tubingen.jpg -m models/composition.model -o sample_images/output.jpg

or

python generate.py sample_images/tubingen.jpg -m models/seurat.model -o sample_images/output.jpg

Transfer only style but not color (--keep_colors option)

python generate.py <input_image_path> -m <model_path> -o <output_image_path> -g <use_gpu ? gpu_id : -1> --keep_colorsrig

A collection of pre-trained models

Coming soon !

Difference from paper

  • Convolution kernel size 4 instead of 3.
  • Training with batchsize(n>=2) causes unstable result.

License

MIT

Reference

Codes written in this repository based on following nice works, thanks to the author.

  • chainer-gogh Chainer implementation of neural-style. I heavily referenced it.
  • chainer-cifar10 Residual block implementation is referred.

chainer-fast-neuralstyle's People

Contributors

6o6o avatar hiyorimi avatar shinichy avatar soralab avatar styloint avatar vermapratyush avatar yusuketomoto avatar

Watchers

 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.