dsanno / chainer-high-resolution-texture-transfer

Neural style stransfer with high resolution texture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

High Resolution Texture Transfer

Implementation of Neural Style Transfer using High-Resolution Multi-Scale Neural Texture Synthesis

Requirements

Usage

Download VGG 19 layers caffe model

Convert caffemodel to chainer model

$ python src/create_chainer_model.py

Transfer image style using "A Neural Algorithm of Artistic Style"

$ python src/run.py content_image style_image output_dir [options]

Example:

$ python src/run.py content_image.png style_image.png output/texture -g 0

Parameters:

  • content_image: (Required) Content image file path
  • style_image: (Required) Style image file path
  • output_dir: (Required) Output directory path
  • -g (--gpu) <int>: (Optional) GPU device index. Negative value indecates CPU (default: -1)
  • -w (--width) <int>: (Optional) Image width (default: 256)
  • --iter <int>: (Optional) Number of iteration for each iteration (default: 2000)
  • --initial-image <str>: (Optional) Initial image of optimization: "random" or "content" (default: random)
  • --save-iter <int>: (Optional) Learning rate (default: 1)
  • --content-layers <str> <str> ...: (Optional) Layer names to use for content reconstruction (default: relu3_3 relu4_3)
  • --style-layers <str> <str> ...: (Optional) Layer names to use for style reconstruction. (default: pool1 conv3_2)
  • --content-weight <float>: (Optional) Weight of content loss (default: 5)
  • --style-weight <float>: (Optional) Weight of style loss (default: 100)
  • --tv-weight <float>: (Optional) Weight of total variation loss (default: 1e-3)

Experimantal options:

  • --keep-color: (Optional) Keep color phase
  • --match-color-histogram: (Optional) Use "Color histogram matching" algorithm in "Preserving Color in Neural Artistic Style Transfer"
  • --luminance-only: (Optional) Use "Luminance-only" algorithm in "Preserving Color in Neural Artistic Style Transfer"

Example

Command

$ python src/run.py sample/tubingen.jpg sample/block.jpg output/synthesized -g 0 -w 800

Content Image

Content Image

Style Image

Style Image

Synthesized Image

Synthesized Image

License

MIT License

About

Neural style stransfer with high resolution texture

License:Other


Languages

Language:Python 100.0%