All Projects → LucasSheng → Avatar Net

LucasSheng / Avatar Net

Avatar-Net: Multi-scale Zero-shot Style Transfer by Feature Decoration

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Avatar Net

Adaptive Style Transfer
Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization
Stars: ✭ 85 (-43.33%)
Mutual labels:  style-transfer
Fast Style Transfer Coreml
Stars: ✭ 109 (-27.33%)
Mutual labels:  style-transfer
Chainer Fast Neuralstyle Models
Models for the chainer fast neuralstyle
Stars: ✭ 132 (-12%)
Mutual labels:  style-transfer
Neural Style Transfer Papers
✏️ Neural Style Transfer: A Review
Stars: ✭ 1,372 (+814.67%)
Mutual labels:  style-transfer
Linguistic Style Transfer
Neural network parametrized objective to disentangle and transfer style and content in text
Stars: ✭ 106 (-29.33%)
Mutual labels:  style-transfer
Monoculardepth Inference
Inference pipeline for the CVPR paper entitled "Real-Time Monocular Depth Estimation using Synthetic Data with Domain Adaptation via Image Style Transfer" (http://www.atapour.co.uk/papers/CVPR2018.pdf).
Stars: ✭ 115 (-23.33%)
Mutual labels:  style-transfer
Stif Indonesia
Implementation of "Semi-Supervised Low-Resource Style Transfer of Indonesian Informal to Formal Language with Iterative Forward-Translation".
Stars: ✭ 79 (-47.33%)
Mutual labels:  style-transfer
Tsit
[ECCV 2020 Spotlight] A Simple and Versatile Framework for Image-to-Image Translation
Stars: ✭ 141 (-6%)
Mutual labels:  style-transfer
Fast Style Transfer
TensorFlow CNN for fast style transfer ⚡🖥🎨🖼
Stars: ✭ 10,240 (+6726.67%)
Mutual labels:  style-transfer
Neural Style Audio Torch
Torch implementation for audio neural style.
Stars: ✭ 130 (-13.33%)
Mutual labels:  style-transfer
Mxnet Gluon Style Transfer
Neural Style and MSG-Net
Stars: ✭ 105 (-30%)
Mutual labels:  style-transfer
Pytorch Neural Style Transfer
Reconstruction of the original paper on neural style transfer (Gatys et al.). I've additionally included reconstruction scripts which allow you to reconstruct only the content or the style of the image - for better understanding of how NST works.
Stars: ✭ 106 (-29.33%)
Mutual labels:  style-transfer
Style Transfer
A Keras Implementation of "A Neural Algorithm of Artistic Style"
Stars: ✭ 115 (-23.33%)
Mutual labels:  style-transfer
Deep Image Analogy
The source code of 'Visual Attribute Transfer through Deep Image Analogy'.
Stars: ✭ 1,296 (+764%)
Mutual labels:  style-transfer
Deep Learning With Python
Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.
Stars: ✭ 134 (-10.67%)
Mutual labels:  style-transfer
Frostnet
FrostNet: Towards Quantization-Aware Network Architecture Search
Stars: ✭ 85 (-43.33%)
Mutual labels:  style-transfer
Sketch To Art
🖼 Create artwork from your casual sketch with GAN and style transfer
Stars: ✭ 115 (-23.33%)
Mutual labels:  style-transfer
Fast Neural Style Pytorch
Fast Neural Style Transfer implementation in PyTorch 🎨 🎨 🎨
Stars: ✭ 146 (-2.67%)
Mutual labels:  style-transfer
Deep Image Analogy Pytorch
A python implementation of Deep-Image-Analogy based on pytorch.
Stars: ✭ 140 (-6.67%)
Mutual labels:  style-transfer
Neural Painters Pytorch
PyTorch library for "Neural Painters: A learned differentiable constraint for generating brushstroke paintings"
Stars: ✭ 118 (-21.33%)
Mutual labels:  style-transfer

Avatar-Net: Multi-scale Zero-shot Style Transfer by Feature Decoration

This repository contains the code (in TensorFlow) for the paper:

Avatar-Net: Multi-scale Zero-shot Style Transfer by Feature Decoration
Lu Sheng, Ziyi Lin, Jing Shao, Xiaogang Wang
CVPR 2018

Overview

In this repository, we propose an efficient and effective Avatar-Net that enables visually plausible multi-scale transfer for arbitrary style in real-time. The key ingredient is a style decorator that makes up the content features by semantically aligned style features, which does not only holistically match their feature distributions but also preserve detailed style patterns in the decorated features. By embedding this module into an image reconstruction network that fuses multi-scale style abstractions, the Avatar-Net renders multi-scale stylization for any style image in one feed-forward pass.

teaser

Examples

image_results

Comparison with Prior Arts

  • The result by Avatar-Net receives concrete multi-scale style patterns (e.g. color distribution, brush strokes and circular patterns in candy image).
  • WCT distorts the brush strokes and circular patterns. AdaIN cannot even keep the color distribution, while Style-Swap fails in this example.

Execution Efficiency

Method Gatys et. al. AdaIN WCT Style-Swap Avatar-Net
256x256 (sec) 12.18 0.053 0.62 0.064 0.071
512x512 (sec) 43.25 0.11 0.93 0.23 0.28
  • Avatar-Net has a comparable executive time as AdaIN and GPU-accelerated Style-Swap, and is much faster than WCT and the optimization-based style transfer by Gatys et. al..
  • The reference methods and the proposed Avatar-Net are implemented on a same TensorFlow platform with a same VGG network as the backbone.

Dependencies

Download

  • The trained model of Avatar-Net can be downloaded through the Google Drive.
  • The training of our style transfer network requires pretrained VGG networks, and they can be obtained from the TF-Slim model repository. The encoding layers of Avatar-Net are also borrowed from pretrained VGG models.
  • MSCOCO dataset is applied for the training of the proposed image reconstruction network.

Usage

Basic Usage

Simply use the bash file ./scripts/evaluate_style_transfer.sh to apply Avatar-Net to all content images in CONTENT_DIR from any style image in STYLE_DIR. For example,

bash ./scripts/evaluate_style_transfer.sh gpu_id CONTENT_DIR STYLE_DIR EVAL_DIR 
  • gpu_id: the mounted GPU ID for the TensorFlow session.
  • CONTENT_DIR: the directory of the content images. It can be ./data/contents/images for multiple exemplar content images, or ./data/contents/sequences for an exemplar content video.
  • STYLE_DIR: the directory of the style images. It can be ./data/styles for multiple exemplar style images.
  • EVAL_DIR: the output directory. It contains multiple subdirectories named after the names of the style images.

More detailed evaluation options can be found in evaluate_style_transfer.py, such as

python evaluate_style_transfer.py

Configuration

The detailed configuration of Avatar-Net is listed in configs/AvatarNet.yml, including the training specifications and network hyper-parameters. The style decorator has three options:

  • patch_size: the patch size for the normalized cross-correlation, in default is 5.
  • style_coding: the projection and reconstruction method, either ZCA or AdaIN.
  • style_interp: interpolation option between the transferred features and the content features, either normalized or biased.

The style transfer is actually performed in AvatarNet.transfer_styles(self, inputs, styles, inter_weight, intra_weights), in which

  • inputs: the content images.
  • styles: a list of style images (len(styles) > 2 for multiple style interpolation).
  • inter_weight: the weight balancing the style and content images.
  • intra_weights: a list of weights balancing the effects from different styles.

Users may modify the evaluation script for multiple style interpolation or content-style trade-off.

Training

  1. Download MSCOCO datasets and transfer the raw images into tfexamples, according to the python script ./datasets/convert_mscoco_to_tfexamples.py.
  2. Use bash ./scripts/train_image_reconstruction.sh gpu_id DATASET_DIR MODEL_DIR to start training with default hyper-parameters. gpu_id is the mounted GPU for the applied Tensorflow session. Replace DATASET_DIR with the path to MSCOCO training images and MODEL_DIR to Avatar-Net model directory.

Citation

If you find this code useful for your research, please cite the paper:

Lu Sheng, Ziyi Lin, Jing Shao and Xiaogang Wang, "Avatar-Net: Multi-scale Zero-shot Style Transfer by Feature Decoration", in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018. [Arxiv]

@inproceedings{sheng2018avatar,
    Title = {Avatar-Net: Multi-scale Zero-shot Style Transfer by Feature Decoration},
    author = {Sheng, Lu and Lin, Ziyi and Shao, Jing and Wang, Xiaogang},
    Booktitle = {Computer Vision and Pattern Recognition (CVPR), 2018 IEEE Conference on},
    pages={1--9},
    year={2018}
}

Acknowledgement

This project is inspired by many style-agnostic style transfer methods, including AdaIN, WCT and Style-Swap, both from their papers and codes.

Contact

If you have any questions or suggestions about this paper, feel free to contact me ([email protected])

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].