Giter Club home page Giter Club logo

keras-arbitrary-style-transfer's Introduction

keras-arbitrary-style-transfer

An attempt to reproduce the results of Ghiasi et al 2017 "Exploring the structure of a real-time, arbitrary neural artistic stylization network" with Keras layers

Usage

To train the model, put content images in content_images and style images to style_images python3 train.py model_name

To run the model (i.e. re-style image): python3 run.py model_name content_img style_img

To run the original, optimization based style transfer based on Gatys2015 that requires no model python3 single.py content_img style_img

Disclaimer

What I've learned doing this

  • Tricks needed to get models working with no labels and no input (single)

  • Colors - make sure you limit to range 0-255

  • Weighting between style and content is important - read original Gatys2015 for good illustrations

  • Instance normalization is really handwaved in Ghiasi2017. Read Dumoulin2016 instead for that.

  • Normalization/scaling of loss functions also matters (esp since different layers have different magnitude activations)

  • Decent models take a lot of time to train. As in days.

  • Optimization based system is good for testing the loss functions

  • Total variation loss is really important in opt based system to get it to converge to a smooth image

  • Activation (relu) goes after normalization

  • Getting tensorflow graph saved is annoying. https://leimao.github.io/blog/Save-Load-Inference-From-TF2-Frozen-Graph/ helped

  • Tensorflow 1 vs 2 is different, and 2 requires you use tf.keras everywhere or crashes with non-descriptive error message "NameError: free variable 'do_return_2' referenced before assignment in enclosing scope"

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.