Giter VIP home page Giter VIP logo

neural-style-transfer-tensorflow-keras's Introduction

Neural Style Transfer-TF&Keras (2019/05/20)

Introduction

I implement a tensorflow&keras model described in the papers

Environment

  • Ubuntu 16.04
  • Python 3.6

Depenency

  • Numpy
  • Opencv2
  • Matplotlib
  • Tensorflow (1.4 <= x <=1.13)

Files

  • images(dir) : images for style transfer.
  • neural_style_transfer.py : main code for style transfer.
  • neural_style_transfer.ipynb : you can execute this code on jupyternotebook. recommend 'Colab' of Google.

How to use

Running

python neural_style_transfer.py --content_image_path <content image path> --style_image_path <style image path>
# ex)
python neural_style_transfer.py --content_image_path images/content/tubingen.jpg --style_image_path images/style/starry-night.jpg

Arguments

Required :

  • --content_image_path: Path of the content image. Default: images/content/tubingen.jpg
  • --style_image_path: Path of the style image. Default: images/style/starry-night.jpg

Optional :

  • --model_type: Type of pretrained model. Choices: 0(VGG16), 1(VGG19) Default: 0
  • --image_resize: Resize(int or tuple) images. Default: 512
  • --rescale_image: Rescale the final image to original size. Default: False
  • --content_blocks: Layer list for feature vector of Content image. Default: ['block4_conv2']
  • --style_blocks: Layer list for feature vector of Style image. Default: ['block1_conv1', 'block2_conv1', 'block3_conv1', 'block4_conv1', 'block5_conv1']
  • --loss_ratio: Weight of content-loss relative to style-loss. Alpha over beta in the paper. Default: 1e-3
  • --total_variation_weight: Total Variation weight. Default: 0 (If you want to use this, then 8.5e-5)
  • --initial_type: The initial image to generate image. Choices: content, style, random. Default: 'random'
  • --optimizer_type: The optimizer for optimization. Choices: 0(Adam Optimizer), 1(L-BFGS-B Optimizer). Default: 1
  • --learning_rate: The value of learning rate for Adam Optimizer. Default: 1e+1
  • --beta_1: Beta_1 of Adam Optimizer. Default: 0.9
  • --beta_2: Beta_2 of Adam Optimizer. Default: 0.999
  • --epsilon: Epsilon of Adam Optimizer. Default: 1e-08
  • --iteration: The number of iterations. Default: 150

Sample results

Content Image : Tübingen, Germany

Style Image : starry-night, seated-nude, shipwreck, kandinsky, the_scream

All of results made from default setting and executed on Colab.

Content Image :

Female Knight (source)

blue-moon-lake (source)

Style Image : wave

All of results made from default setting and executed on Colab.




Reference

neural-style-transfer-tensorflow-keras's People

Contributors

devkihyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.