GithubHelp home page GithubHelp logo

gsurma / style_transfer Goto Github PK

View Code? Open in Web Editor NEW
272.0 8.0 71.0 16.82 MB

CNN image style transfer ๐ŸŽจ.

Home Page: https://gsurma.github.io

License: MIT License

Jupyter Notebook 100.00%
style-transfer cnn deep-learning neural-network machine-learning keras notebook jupyter-notebook python computer-vision

style_transfer's Introduction

Style Transfer

Style Transfer is a process in which we strive to modify the style of an image while preserving its content. Given an input image and a style image, we can compute an output image with the original content but a new style.

Kaggle kernel

Check out corresponding Medium article:

Style Transfer - Styling Images with Convolutional Neural Networks

How does it work?

  1. We take input image and style images and resize them to equal shapes.
  2. We load a pre-trained CNN (VGG16).
  3. Knowing that we can distinguish layers that are responsible for the style (basic shapes, colors etc.) and the ones responsible for the content (image-specific features), we can separate the layers to independently work on the content and style.
  4. Then we set our task as an optimization problem where we are going to minimize:
    • content loss (distance between the input and output images - we strive to preserve the content)
    • style loss (distance between the style and output images - we strive to apply a new style)
    • total variation loss (regularization - spatial smoothness to denoise the output image)
  5. Finally, we set our gradients and optimize with the L-BFGS algorithm.

Results

Input

Style

Output

1 iteration

2 iterations

5 iterations

10 iterations

15 iterations

Other examples

Author

Greg (Grzegorz) Surma

PORTFOLIO

GITHUB

BLOG

style_transfer's People

Contributors

gsurma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

style_transfer's Issues

save model

How do i save that model, I don't want to train it every time with different input image and same style image

def content_loss

Variable += value not supported. Use variable.assign_add(value) to modify the variable value and variable = variable + value to get a new Tensor object.

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.