• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    Python
  • Created about 6 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization

Adaptive Style Transfer in TensorFlow and TensorLayer

Update:

  • (15/05/2020) Migrated to TensorLayer2 (backend=TensorFlow 2.x). Original TL1 code can be found here.

This repository is implemented with TensorLayer2.0+.

Before "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization", there were two main approaches for style transfer. First, given one content image and one style image, we randomly initialize a noise image and update it to get the output image. The drawback of this apporach is slow, it usually takes 3 mins to get one image. After that, academic proposed to train one model for one specific style, which input one image to network, and output one image. This approach is far more faster than the previous approach, and achieved real-time style transfer.

However, one model for one style still not good enough for production. If a mobile APP want to support 100 styles offline, it is impossible to store 100 models in the cell phone. Adaptive style transfer which in turn supports arbitrary styles in one single model !!! We don't need to train new model for new style. Just simply input one content image and one style image you want !!!

⚠️ ⚠️ This repo will be moved into here (please star) for life-cycle management soon. More cool Computer Vision applications such as pose estimation and style transfer can be found in this organization.

Usage

  1. Install TensorFlow and the master of TensorLayer:

    pip install git+https://github.com/tensorlayer/tensorlayer.git
    
  2. You can use the train.py script to train your own model. To train the model, you need to download MSCOCO dataset and Wikiart dataset, and put the dataset images under the 'dataset/content_samples' folder and 'dataset/style_samples' folder.

  3. You can then use the test.py script to run your trained model. Remember to put it into the 'pretrained_models' folder and rename it to 'dec_best_weights.h5'. A pretrained model can be downloaded from here, which is for TensorLayer v2 and a decoder using DeConv2d layers.

  4. You may compare this TL2 version with its precedent TL1 version branch to learn about how to migrate TL1 samples. There are also plenty of comments in code tagged with 'TL1to2:' for your reference.

Results

Here are some result images (Left to Right: Content , Style , Result):

Enjoy !

Discussion

License

  • This project is for academic use only.

More Repositories

1

TensorLayer

Deep Learning and Reinforcement Learning Library for Scientists and Engineers
Python
7,333
star
2

SRGAN

Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
Python
3,313
star
3

HyperPose

Library for Fast and Flexible Human Pose Estimation
Python
1,248
star
4

seq2seq-chatbot

Chatbot in 200 lines of code using TensorLayer
Python
837
star
5

RLzoo

A Comprehensive Reinforcement Learning Zoo for Simple Usage 🚀
Python
623
star
6

TensorLayerX

TensorLayerX: A Unified Deep Learning and Reinforcement Learning Framework for All Hardwares, Backends and OS.
Python
506
star
7

text-antispam

商用级垃圾文本分类器
Python
404
star
8

tensorlayer-chinese

TensorLayer 中文文档
361
star
9

DCGAN

The Simplest DCGAN Implementation
Python
339
star
10

awesome-tensorlayer

A curated list of dedicated resources and applications
266
star
11

DAGAN

The implementation code for "DAGAN: Deep De-Aliasing Generative Adversarial Networks for Fast Compressed Sensing MRI Reconstruction"
Python
167
star
12

chinese-book

《深度学习:一起玩转TensorLayer》资源分享、讨论
140
star
13

pretrained-models

76
star
14

TLXZoo

Pre-trained backbones for TensorLayerX
Python
33
star
15

HaoDong_aicourse2023_codes

Python
26
star
16

TLX2ONNX

ONNX Model Exporter for TensorLayerX
Python
21
star
17

cyclegan

CycleGAN in 300 lines of code
Python
20
star
18

TLXCV

A Platform-agnostic Computer Vision Application Library
Python
11
star
19

Paddle2TLX

Transfer PaddlePaddle's codes to TensorLayerX's codes
Python
11
star
20

TLXNLP

A Platform-agnostic Natural Language Processing Application Library
3
star
21

fMRI-deep-image-reconstruction

fMRI deep image reconstruction
Python
2
star
22

arcface-tlx

2
star
23

tlxvision

Computer vision algorithms implemented in TensorLayerX
Python
1
star