Giter VIP home page Giter VIP logo

adaattn's Introduction

AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer

[Paper] [PyTorch Implementation] [Paddle Implementation]

Overview

This repository contains the officially unofficial PyTorch **re-**implementation of paper:

AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer,

Songhua Liu, Tianwei Lin, Dongliang He, Fu Li, Meiling Wang, Xin Li, Zhengxing Sun, Qian Li, Errui Ding

ICCV 2021

Updates

  • [2022-12-07] Upload script of user control. Please see user_specify_demo.py
  • [2022-12-07] Upload inference code of video style transfer. Please see inference_frame.py. Please download checkpoints from here and extract the package to the main directory of this repo before running.

Prerequisites

  • Linux or macOS

  • Python 3

  • PyTorch 1.7+ and other dependencies (torchvision, visdom, dominate, and other common python libs)

  • Getting Started

    • Clone this repository:

      git clone https://github.com/Huage001/AdaAttN
      cd AdaAttN
    • Inference:

      • Make a directory for checkpoints if there is not:

        mkdir checkpoints
      • Download pretrained model from Google Drive, move it to checkpoints directory, and unzip:

        mv [Download Directory]/AdaAttN_model.zip checkpoints/
        unzip checkpoints/AdaAttN_model.zip
        rm checkpoints/AdaAttN_model.zip
      • Configure content_path and style_path in test_adaattn.sh firstly, indicating paths to folders of testing content images and testing style images respectively.

      • Then, simply run:

        bash test_adaattn.sh
      • Check the results under results/AdaAttN folder.

    • Train:

      • Download 'vgg_normalised.pth' from here.

      • Download COCO dataset and WikiArt dataset and then extract them.

      • Configure content_path, style_path, and image_encoder_path in train_adaattn.sh, indicating paths to folders of training content images, training style images, and 'vgg_normalised.pth' respectively.

      • Before training, start visdom server:

        python -m visdom.server
      • Then, simply run:

        bash train_adaattn.sh
      • You can monitor training status at http://localhost:8097/ and models would be saved at checkpoints/AdaAttN folder.

      • You may feel free to try other training options written in train_adaattn.sh.

    Citation

    • If you find ideas or codes useful for your research, please cite:

      @inproceedings{liu2021adaattn,
        title={AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer},
        author={Liu, Songhua and Lin, Tianwei and He, Dongliang and Li, Fu and Wang, Meiling and Li, Xin and Sun, Zhengxing and Li, Qian and Ding, Errui},
        booktitle={Proceedings of the IEEE International Conference on Computer Vision},
        year={2021}
      }
      

    Acknowledgments

adaattn's People

Contributors

huage001 avatar ananonymousprogrammer avatar hywang66 avatar

Stargazers

Danee avatar

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.