GithubHelp home page GithubHelp logo

wegiangb / fast-style-transfer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from genekogan/fast-style-transfer

0.0 2.0 0.0 20.33 MB

fast style transfer on your webcam, with pre-trained models at

Home Page: https://drive.google.com/drive/u/0/folders/0B3WXSfqxKDkFUFl3YllzS1ZqbkU

Python 99.46% Shell 0.54%

fast-style-transfer's Introduction

fast-style-transfer webcam script

This is a fork of fast-style-transfer which has an additional script, run_webcam.py to apply style models live to a webcam stream. Go to the README of the original page for instructions on how to train your own models, apply them to images and movies, and all the original functionality of that repository.

Installation

Setting up models

Pre-trained models for Picasso, Hokusai, Kandinsky, Liechtenstein, Wu Guanzhong, Ibrahim el-Salahi, and Google Maps.

At the top of the file run_webcam.py, there are paths to model files and style images in the variable list models. They are not included in the repo because of space. If you'd like to use the pre-trained models referred to up there, these models may be downloaded from this shared folder. To train your own, refer to the original documentation.

Usage

python run_webcam.py --width 360 --disp_width 800 --disp_source 1 --horizontal 1

There are three arguments:

  • width refers to the width in pixels of the image being restyled (the webcam will be scaled down or up to this size).
  • disp_width is the width in pixels of the image to be shown on the screen. The restyled image is resized to this after being generated. Having disp_width > width lets you run the model more quickly but generate a bigger image of lesser quality.
  • disp_source is whether or not to display the content image (webcam) and corresponding style image alongside the output image (1 by default, i.e. True)
  • horizontal is whether to concatenate content/style with output image horizontally (1, which is default) or vertically (0). Only relevant if disp_source=1

You can toggle between the different models by hitting the 'a' and 's' keys on your keyboard.

Example

stylized webcam

Requirements

You will need the following to run the above:

  • TensorFlow 0.11.0
  • Python 2.7.9, Pillow 3.4.2, scipy 0.18.1, numpy 1.11.2
  • If you want to train (and don't want to wait for 4 months):
    • A decent GPU
    • All the required NVIDIA software to run TF on a GPU (cuda, etc)
  • ffmpeg 3.1.3 if you want to stylize video

Citation

  @misc{engstrom2016faststyletransfer,
    author = {Logan Engstrom},
    title = {Fast Style Transfer},
    year = {2016},
    howpublished = {\url{https://github.com/lengstrom/fast-style-transfer/}},
    note = {commit xxxxxxx}
  }

Attributions/Thanks

  • This project could not have happened without the advice (and GPU access) given by Anish Athalye.
    • The project also borrowed some code from Anish's Neural Style
  • Some readme/docs formatting was borrowed from Justin Johnson's Fast Neural Style
  • The image of the Stata Center at the very beginning of the README was taken by Juan Paulo

License

Copyright (c) 2016 Logan Engstrom. Contact me for commercial use (email: engstrom at my university's domain dot edu). Free for research/noncommercial use, as long as proper attribution is given and this copyright notice is retained.

fast-style-transfer's People

Contributors

banus avatar btwael avatar cbonitz avatar drakerehfeld avatar fbcotter avatar genekogan avatar lengstrom avatar lupino avatar minimaxir avatar radarhere avatar schwusch avatar tibbon avatar

Watchers

 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.