Giter Club home page Giter Club logo

pytorch-neural-style-transfer's Introduction

Neural Style Transfer

The repository contains PyTorch implementation of the Gatys et al. paper with some modifications. In the paper, the authors proposed algorithm that transfers style from one input image (the style image) into second image (the content image).

Examples

Some of the hand picked results:

The green bridge + Walk in the rain The green bridge + Starry night The green bridge + Bronze leaf pattern The green bridge + Rainbow swirl Breakfast + Mosaic Breakfast + Bronze leaf lattern Nature + Candy Nature + Starry night

Setup

  1. Clone the repository git clone https://github.com/gcerar/pytorch-neural-style-transfer
  2. Enter directory cd pytorch-neural-style-transfer
  3. Run conda env create -f ./environment.yml
  4. Run conda activate style-transfer

It is recommended to use GPU to accelerate the style transfer process.

Usage

python style_transfer.py --input <TargetImgPath> --style <StyleImgPath>

Optional parameters:

  • --help or -h print help with all available parameters
  • --epochs <number> (default: 7000)
  • --seed <number> (default: 1)
  • --no-cuda disables CUDA acceleration and use CPU instead
  • --optimizer <adam|adamw|lbfgs|sgd> (default: adam)
  • --init <input|noise> decide on what is init of output image (default: input)

Acknowledgment

Helpful articles with code and code repositories while writing my implementation:

Sample content images:

Gray Bridge and Trees
"Gray Bridge and Trees", Martin Damboldt

Style images to play with:

The Persistence of Memory Colorful whirlpool Mondrian World Map
"The Persistence of Memory", Salvador Dali Colorful whirlpool, ??? "Mondrian World Map", Michael Tompsett
Fractal Patterns The Scream Udnie
Fractal Patterns, ??? "The Scream", Edvard Munch "Udnie", Francis Picabia
Hand with Reflecting Sphere Bamboo forest Mysterious Rain Princess
"Hand with Reflecting Sphere", M. C. Escher Bamboo forest, ??? "Mysterious Rain Princess", Leonid Afremov
June tree La Muse Lady
"June tree", Natasha (Wescoat) Bouchillion "La Muse", Pablo Picasso "Lady", ???
Composition VII Walking in the Rain The Starry Night
"Composition VII", Wassily Kandinsky "Walking in the Rain", Leonid Afremov "The Starry Night", Vincent van Gogh
Edtaonisl Seated Nude The Night Café
"Edtaonisl", Francis Picabia "Seated Nude", Pablo Picasso "The Night Café", Vincent van Gogh
Under the Wave off Kanagawa Flowers Doomguy
"Under the Wave off Kanagawa", Katsushika Hokusai Flowers, ??? "Doomguy", ID Software

pytorch-neural-style-transfer's People

Contributors

gcerar avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

cstichbury

pytorch-neural-style-transfer's Issues

About the init parameter

Author, your work is great! However, I have a problem. When I set the init parameter to noise, that is, start training with a noise map, and the final result is still a noise map, such as the following figure:
image
Looking forward to your reply!

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.