Awesome
Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes (CVPR 2021)
<div align="center"><img src="docs/img/title_figure.jpg" alt="img" width="1050"></div>Project page | Paper | Colab | Colab for Drawing App
Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes.
Dmytro Kotovenko*, Matthias Wright*, Arthur Heimbrecht, and Björn Ommer.<br>
* denotes equal contribution <br>
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
- Clone this repository:
> git clone https://github.com/CompVis/brushstroke-parameterized-style-transfer > cd brushstroke-parameterized-style-transfer
- 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
- 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.
<div align="center"><img src="docs/img/streamlit.jpg" alt="img" width="700"></div>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}
}