Giter VIP home page Giter VIP logo

yuchen-xiyue / brushstroke-parameterized-style-transfer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from compvis/brushstroke-parameterized-style-transfer

0.0 0.0 0.0 38.65 MB

TensorFlow implementation of our CVPR 2021 Paper "Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes".

Home Page: https://compvis.github.io/brushstroke-parameterized-style-transfer/

License: MIT License

Python 90.41% Jupyter Notebook 9.55% Shell 0.04%

brushstroke-parameterized-style-transfer's Introduction

Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes (CVPR 2021)

img

Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes.
Dmytro Kotovenko*, Matthias Wright*, Arthur Heimbrecht, and Björn Ommer.
* denotes equal contribution

Implementations

We provide implementations in Tensorflow 1 and Tensorflow 2. In order to reproduce the results from the paper, we recommend the Tensorflow 1 implementation.

Installation

  1. Clone this repository:
    > git clone https://github.com/CompVis/brushstroke-parameterized-style-transfer
    > cd brushstroke-parameterized-style-transfer
  2. Install Tensorflow 1.14 (preferably with GPU support).
    If you are using Conda, this command will create a new environment and install Tensorflow as well as compatible CUDA and cuDNN versions.
    > conda create --name tf14 tensorflow-gpu==1.14
    > conda activate tf14
  3. Install requirements:
    > pip install -r requirements.txt

Basic Usage

from PIL import Image
import model

content_img = Image.open('images/content/golden_gate.jpg')
style_img = Image.open('images/style/van_gogh_starry_night.jpg')

stylized_img = model.stylize(content_img,
                             style_img,
                             num_strokes=5000,
                             num_steps=100,
                             content_weight=1.0,
                             style_weight=3.0,
                             num_steps_pixel=1000)

stylized_img.save('images/stylized.jpg')

or open Colab.

Drawing App

We created a Streamlit app where you can draw curves to control the flow of brushstrokes.

img

Run drawing app on your machine

To run the app on your own machine:

> CUDA_VISIBLE_DEVICES=0 streamlit run app.py

You can also run the app on a remote server and forward the port to your local machine: https://docs.streamlit.io/en/0.66.0/tutorial/run_streamlit_remotely.html

Run streamlit app from Colab

If you don't have access to GPUs we also created a Colab from which you can start the drawing app.

Other implementations

PyTorch implementation by justanhduc.

Citation

@article{kotovenko_cvpr_2021,
    title={Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes},
    author={Dmytro Kotovenko and Matthias Wright and Arthur Heimbrecht and Bj{\"o}rn Ommer},
    journal={CVPR},
    year={2021}
}

brushstroke-parameterized-style-transfer's People

Contributors

dimakot55 avatar justanhduc avatar matthias-wright avatar yuchen-xiyue 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.