All Projects → irasin → Pytorch_AdaIN

irasin / Pytorch_AdaIN

Licence: GPL-3.0 License
Pytorch implementation from scratch of [Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization [Huang+, ICCV2017]]

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytorch AdaIN

stylizeapp
A flask website for style transfer
Stars: ✭ 34 (-60%)
Mutual labels:  styletransfer
tf-adain
TensorFlow implementation of the paper "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization" by Xun Huang and Serge Belongie
Stars: ✭ 61 (-28.24%)
Mutual labels:  adain
awesome style transfer
The style transfer paper collection in International CV conference
Stars: ✭ 42 (-50.59%)
Mutual labels:  styletransfer
Meetup-Content
Entirety.ai Intuition to Implementation Meetup Content.
Stars: ✭ 33 (-61.18%)
Mutual labels:  styletransfer
SANET
"Arbitrary Style Transfer with Style-Attentional Networks" (CVPR 2019)
Stars: ✭ 21 (-75.29%)
Mutual labels:  styletransfer
color-aware-style-transfer
Reference code for the paper CAMS: Color-Aware Multi-Style Transfer.
Stars: ✭ 36 (-57.65%)
Mutual labels:  styletransfer
StyleGAN demo
The re-implementation of style-based generator idea
Stars: ✭ 22 (-74.12%)
Mutual labels:  adain
Image-Style-Transfer-Using-CNNs
Implementation of Image Style Transfer Using CNNs using Pytorch.
Stars: ✭ 16 (-81.18%)
Mutual labels:  styletransfer
Pytorch Style Swap
Unofficial Pytorch(1.0+) implementation of paper [Fast Patch-based Style Transfer of Arbitrary Style](https://arxiv.org/abs/1612.04337).
Stars: ✭ 56 (-34.12%)
Mutual labels:  styletransfer

Pytorch_Adain_from_scratch

Unofficial Pytorch implementation of Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization [Huang+, ICCV2017]

Original torch implementation from the author can be found here.

Other implementations such as Pytorch_implementation_using_pretrained_torch_model or Chainer_implementation are also available.I have learned a lot from them and try the pure Pytorch implementation from scratch in this repository.This repository provides a pre-trained model for you to generate your own image given content image and style image. Also, you can download the training dataset or prepare your own dataset to train the model from scratch.

I give a brief qiita blog and you can check it from here.

If you have any question, please feel free to contact me. (Language in English/Japanese/Chinese will be ok!)

Notice

I propose a structure-emphasized multimodal style transfer(SEMST), feel free to use it here.


Requirements

  • Python 3.7
  • PyTorch 1.0+
  • TorchVision
  • Pillow
  • Skimage
  • tqdm

Anaconda environment recommended here!

(optional)

  • GPU environment for training

Usage


test

  1. Clone this repository

    git clone https://github.com/irasin/Pytorch_Adain_from_scratch
    cd Pytorch_Adain_from_scratch
  2. Prepare your content image and style image. I provide some in the content and style and you can try to use them easily.

  3. Download the pretrained model here

  4. Generate the output image. A transferred output image and a content_output_pair image and a NST_demo_like image will be generated.

    python test -c content_image_path -s style_image_path
    usage: test.py [-h] 
                   [--content CONTENT] 
                   [--style STYLE]
                   [--output_name OUTPUT_NAME] 
                   [--alpha ALPHA] 
                   [--gpu GPU]
                   [--model_state_path MODEL_STATE_PATH]
    
    
    

    If output_name is not given, it will use the combination of content image name and style image name.


train

  1. Download COCO (as content dataset)and Wikiart (as style dataset) and unzip them, rename them as content and style respectively (recommended).

  2. Modify the argument in the train.py such as the path of directory, epoch, learning_rate or you can add your own training code.

  3. Train the model using gpu.

  4. python train.py
    usage: train.py [-h] 
                    [--batch_size BATCH_SIZE] 
                    [--epoch EPOCH]
                    [--gpu GPU]
                    [--learning_rate LEARNING_RATE]
                    [--snapshot_interval SNAPSHOT_INTERVAL]
                    [--train_content_dir TRAIN_CONTENT_DIR]
                    [--train_style_dir TRAIN_STYLE_DIR]
                    [--test_content_dir TEST_CONTENT_DIR]
                    [--test_style_dir TEST_STYLE_DIR] 
                    [--save_dir SAVE_DIR]
                    [--reuse REUSE]
    

Result

Some results will be shown here.

image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image image

References

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].