Giter Site home page Giter Site logo

structure-emphasized-multimodal-style-transfer's Introduction

Structure-emphasized Multimodal Style Transfer

DOI

Pytorch(1.0+) implementation of My master paper "Structure-emphasized Multimodal Style Transfer".

We proposed 2 models, called SEMST_Original and SEMST_Auto in this work. More details can be founed in the paper.

This repository provides pre-trained models 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.

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


If you find this work useful for you, please cite it as follow in your paper. Thanks a lot.

@misc{Chen2020,
  author = {Chen Chen},
  title = {Structure-emphasized Multimodal Style Transfer},
  year = {2020},
  month = 1,
  doi = 10.5281/zenodo.3602064
  publisher = {Zenodo},
  url = {https://doi.org/10.5281/zenodo.3602064},
}

Requirements

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

Anaconda environment recommended here!

(optional)

  • GPU environment

Result

Some results of content image will be shown here.

image image image image image image image image



Notice: The train and test procedures as follow are the same for SEMST_Original and SEMST_Auto.



Test

  1. Clone this repository

    git clone https://github.com/irasin/Structure-emphasized-Multimodal-Style-Transfer
    cd Structure-emphasized-Multimodal-Style-Transfer
    cd SEMST_XXX(XXX means Original or Auto)
  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 SEMST_Original, SEMST_Auto and put them under the SEMST_XXX respectively.

  4. Generate the output image. A transferred output image w/&w/o style image and a NST_demo_like image will be generated.

    python test.py -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] [--alpha ALPHA]
                 [--gamma GAMMA] [--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]
    

structure-emphasized-multimodal-style-transfer's People

Contributors

irasin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

structure-emphasized-multimodal-style-transfer's Issues

download vgg_path error

when i am trying to train it ,the vgg weight can't be downloaded.
i want to kown if the download url is available? and how to fix it?
thanks very much!!!

the code :
image

the error:
image

数据集处理出错

作者您好,看了您的方法和效果感觉特别棒!我想尝试着自己训练试试,但是在实现过程中遇到问题如下:

我的content数据集采用的是coco
style数据集是自己的,使用了6张图片
但是训练过程中发现由于使用了zip函数,只生成了6对图片对,无法完成训练。
请问您的style数据集是如何处理的?或者我该如何解决这个问题,十分感谢!!

image

image

result is black

(PY388) G:\proj\YUs_Ai\02PYTORCH\00style_transfer\HD\00Structure-emphasized-Multimodal-Style-Transfer-master\SEMST_Original>python test.py -c ../content/avril.jpg -s ../style/horse.jpg
CUDA available: GeForce RTX 3090
SEMST_Original_model_state.pth loaded
result saved into files starting with avril_horse

————————————————————————————————————
All is good, but the result is black
win10
pytorch 1.8.1
python 3.8
rtx 3090
cuda 11.1
avril_horse_style_transfer_demo

Compare with "Exploring the structure of a real-time, arbitrary neural artistic stylization network" method

Hi Sin,

Great work with SEMST. For past couple of weeks I am learning Style Inference and your work is really helpful.

There is a particular work by Jonathon Shlens, published in 2017 - "Exploring the structure of a real-time, arbitrary neural artistic stylization network" https://arxiv.org/abs/1705.06830 which uses different method to produce the result.

Official implementation -- https://github.com/magenta/magenta/tree/master/magenta/models/arbitrary_image_stylization

Did you got chance to compare your results with this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.