GithubHelp home page GithubHelp logo

fullfanta / real_time_style_transfer Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 16.3 MB

tensorflow implementation of 'Perceptual Losses for Real-Time Style Transfer and Super-Resolution'

Python 97.58% Shell 2.42%
styletransfer tensorflow

real_time_style_transfer's Introduction

Style transfer

This is tensorflow implementation of 'Perceptual Losses for Real-Time Style Transfer and Super-Resolution'.

Download program

$ git clone https://github.com/fullfanta/real_time_style_transfer.git

Download training data

$ cd real_time_style_transfer
$ sh get_coco.sh

Download vgg16 model

$ sh get_vgg16.sh

Train

$ python train.py

If you have multiple GPU cards, use CUDA_VISIBLE_DEVICES to specify GPU card. Trained model is in summary. To adjust weights of content loss and style loss, you can set the parameter alpha. loss equation is alpha * content loss + (1 - alpha) * style loss. Default is 0.1 During training, you can see generated images through tensorboard.

$ tensorboard --logdir=summary

Freeze model

$ sh freeze.sh 40000

It generates pb file which contains weights as contant. First arugment means the iteration number of saved check point file.

Test

$ python stylize.py --model=models/starry_night.pb --input_image=test_images/Aaron_Eckhart_0001.jpg
$ python stylize.py --model=models/starry_night.pb --input_image=test_images/jolie.jpg --resize_ratio=2
$ python stylize.py --model=models/starry_night.pb --input_image=test_images/dinosour.png --resize_ratio=2
$ python stylize.py --model=models/starry_night.pb --input_image=test_images/ryan.png --resize_ratio=3
$ python stylize.py --model=models/starry_night.pb --input_image=test_images/herb.png --resize_ratio=2
$ python stylize.py --model=models/starry_night.pb --input_image=test_images/cheez.png --resize_ratio=4

It generates stylized images and save them to 'test_images'.

Examples

Input Output
Aaron Echart
Angelina Jolie
Dinosour
Ryan
Herb
Cheez

real_time_style_transfer's People

Contributors

fullfanta avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

dr1115262020

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.