https://github.com/compvis/adaptive-style-transfer

source code for the ECCV18 paper A Style-Aware Content Loss for Real-time HD Style Transfer

https://github.com/compvis/adaptive-style-transfer

Science Score: 20.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    2 of 5 committers (40.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

source code for the ECCV18 paper A Style-Aware Content Loss for Real-time HD Style Transfer

Basic Info
Statistics
  • Stars: 741
  • Watchers: 39
  • Forks: 142
  • Open Issues: 20
  • Releases: 0
Created about 8 years ago · Last pushed over 5 years ago
Metadata Files
Readme License

README.md

A Style-Aware Content Loss for Real-time HD Style Transfer

Artsiom Sanakoyeu*, Dmytro Kotovenko*, Sabine Lang, Björn Ommer, In ECCV 2018 (Oral)

Website: https://compvis.github.io/adaptive-style-transfer
Paper: https://arxiv.org/abs/1807.10201

pipeline

example Please click on the image for a high-res version.

Requirements

  • python 2.7
  • tensorflow 1.2.
  • PIL, numpy, scipy
  • tqdm

Also tested in python3.6 + tensorflow 1.12.0

Inference

Simplest van Gogh example

To launch the inference on van Gogh style: 1. Download the pretrained model modelvan-goghckpt.tar.gz 2. Download sample photographs.
3. Extract the model to ./models/ folder and sample photographs to ./data/ folder.
4. Run the following command: CUDA_VISIBLE_DEVICES=0 python main.py \ --model_name=model_van-gogh \ --phase=inference \ --image_size=1280 Stylized photographs are stored in the folder ./models/model_van-gogh/inference_ckpt300000_sz1280/

Additional settings

  • --ii_dir INPUT_DIR - path to the folder containing target content images.
    You can specify multiple folders separated with commas (don't use spaces!).
  • --image_size SIZE - resolution of the images to generate.
  • --save_dir SAVE_DIR - path to the output dir where the generated images will be saved.
  • --model_name NAME - the name of the model (all model should as subfolders in ./models/).

Usage example (inference): CUDA_VISIBLE_DEVICES=0 python main.py \ --model_name=model_van-gogh \ --phase=inference \ --image_size=1280 \ --ii_dir ../my_photographs1/,../my_photographs2/ \ --save_dir=../save_processed_images_here/ If your GPU memory is not large enough, set the variable CUDA_VISIBLE_DEVICES="" to use CPU.

Pretrained models

We provide pretrained models for the following artists:
Paul Cezanne,
El-Greco,
Paul Gauguin,
Wassily Kandinsky (Василий Кандинский),
Ernst Ludwig Kirchner,
Claude Monet,
Berthe Morisot,
Edvard Munch,
Samuel Peploe,
Pablo Picasso,
Jackson Pollock,
Nicholal Roerich (Николай Рерих),
Vincent van Gogh.

Download pretrained models: link.
Extract models to the folder ./models/.

Training

Content images used for training: Places365-Standard high-res train mages (105GB).

Style images used for training the aforementioned models: [download link](https://

cloud.iwr.uni-heidelberg.de/index.php/s/NcJj2oLBTYuT1tf).
Query style examples used to collect style images: querystyleimages.tar.gz.

  • For example, Vincent van Gogh style: vincent-van-gogh_road-with-cypresses-1890.tar.gz.
    This is the dataset representing a particular artistic period of Vincent van Gogh and was automatically collected using "Road with Cypress and Star, 1890" painting as query.
  1. Download and extract style archives in folder ./data.
  2. Download and extract content images.
  3. Launch the training process (for example, on van Gogh): CUDA_VISIBLE_DEVICES=1 python main.py \ --model_name=model_van-gogh_new \ --batch_size=1 \ --phase=train \ --image_size=768 \ --lr=0.0002 \ --dsr=0.8 \ --ptcd=/path/to/Places2/data_large \ --ptad=./data/vincent-van-gogh_road-with-cypresses-1890

Evaluation

How to calculate Deception Score and where to download artist classification model is described in evaluation.

Video stylization

To stylize a video you can use the following script:

```

split video on a set of frames

ffmpeg -i myvideo.mp4 -r 25 -f image2 image-%04d.png

CUDAVISIBLEDEVICES=0 python main.py \ --modelname=modelvan-gogh \ --phase=inference \ --imagesize=1280 \ --iidir=input \ --save_dir=output

reassemble the video back from frames:

ffmpeg -i image-%04d_stylized.jpg kktie-out.mp4 ```

Reference

If you use this code or data, please cite the paper: @inproceedings{sanakoyeu2018styleaware, title={A Style-Aware Content Loss for Real-time HD Style Transfer}, author={Sanakoyeu, Artsiom and Kotovenko, Dmytro and Lang, Sabine and Ommer, Bj{\"o}rn}, booktitle={Proceedings of the European Conference on Computer Vision (ECCV)}, pages={698--714}, month = 10, year={2018} }

Copyright

``` Adaptive Style Transfer
Copyright (C) 2018 Artsiom Sanakoyeu, Dmytro Kotovenko

Adaptive Style Transfer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/. ```

Owner

  • Name: CompVis - Computer Vision and Learning LMU Munich
  • Login: CompVis
  • Kind: organization
  • Email: assist.mvl@lrz.uni-muenchen.de
  • Location: Germany

Computer Vision and Learning research group at Ludwig Maximilian University of Munich (formerly Computer Vision Group at Heidelberg University)

GitHub Events

Total
  • Watch event: 13
  • Pull request event: 1
  • Fork event: 3
Last Year
  • Watch event: 13
  • Pull request event: 1
  • Fork event: 3

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 35
  • Total Committers: 5
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.371
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Artsiom a****u@i****e 22
Dmitry Kotovenko d****5@g****m 10
zh-plus z****c@g****m 1
rickdotta r****a@y****m 1
Christopher Schröder c****r@t****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 44
  • Total pull requests: 3
  • Average time to close issues: about 2 months
  • Average time to close pull requests: about 5 hours
  • Total issue authors: 35
  • Total pull request authors: 3
  • Average comments per issue: 2.16
  • Average comments per pull request: 1.67
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ErfolgreichCharismatisch (4)
  • angleboy8 (3)
  • xurong1981 (2)
  • hello-trouble (2)
  • terekita (2)
  • Qudagang (2)
  • alejodosr (1)
  • jgwill (1)
  • kjpoli (1)
  • ycjing (1)
  • ayziksha (1)
  • theRomanMercury (1)
  • jayzhan211 (1)
  • Maven-art (1)
  • HosseinMM (1)
Pull Request Authors
  • llbbl (1)
  • christopher-schroeder (1)
  • zh-plus (1)
  • rickdotta (1)
Top Labels
Issue Labels
Pull Request Labels