Code Monkey home page Code Monkey logo

chainer-gogh's Introduction

chainer-gogh

Implementation of "A neural algorithm of Artistic style" (http://arxiv.org/abs/1508.06576)

(VGG, lam=0.0075, after 5000 iteration)

Usage:

Chainerをインストール

pip install chainer

詳しくはhttps://github.com/pfnet/chainer

モデルをダウンロード

お手軽。(-m nin)

きれいな絵がかけるがとても重い。(-m vgg, -m vgg_chainer) vgg_chainerではモデルのダウンロードの必要はなく、初回を除いて非常に高速でロードできるようになります(chainer 1.19以降で動作)。

NIN並に軽く、ポテンシャルもあるはずだが、最適なパラメタがわかっていない。(-m googlenet)

VGGより軽く、二次元画像にとても強いはずだが、最適なパラメタがわかってない。(-m i2v)

CPU実行

python chainer-gogh.py -m nin -i input.png -s style.png -o output_dir -g -1

GPU実行

python chainer-gogh.py -m nin -i input.png -s style.png -o output_dir -g GPU番号

VGG実行サンプル

python chainer-gogh.py -m vgg_chainer -i input.png -s style.png -o output_dir -g 0 --width 256

モデルの指定方法

-m nin

のninを、vgg, vgg_chainer, googlenet, i2vに切り替えることが可能。 モデルファイルはディレクトリ直下に置いて、デフォルトの名前のまま変えないこと。

複数枚同時生成

  • まず、input.txtというファイル名で、以下の様なファイルを作る。
input0.png style0.png
input1.png style1.png
...

そして、chainer-gogh-multi.pyの方を実行

python chainer-gogh-multi.py -i input.txt

VGGを使うときはGPUのメモリ不足に注意

パラメタについて

  • --lr: 学習速度。生成の進捗が遅い時は大きめにする
  • --lam: これを上げるとinput画像に近くなり、下げるとstyle画像に近くなる
  • alpha, beta: 各層から伝播させる誤差にかかる係数。models.pyの中でハードコードされている。

注意

  • 現在のところ画像は正方形に近いほうがいいです

chainer-gogh's People

Contributors

mattya avatar stonebig avatar woodrush avatar nyaagoo avatar

Forkers

miu200521358

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.