Coder Social home page Coder Social logo

mukosame / aoda Goto Github PK

View Code? Open in Web Editor NEW
78.0 7.0 11.0 9.69 MB

Official implementation of "Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis"(WACV 2022/CVPRW 2021)

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
gan deep-learning pytorch image2image sketch cvpr cvpr2021 wacv wacv2022 gans computer-vision image-manipulation image-generation open-domain

aoda's Introduction

AODA

By Xiaoyu Xiang, Ding Liu, Xiao Yang, Yiheng Zhu, Xiaohui Shen, Jan P. Allebach

This is the official Pytorch implementation of Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis.

aoda

Updates

  • Our paper will be presented on WACV-2022 on Jan 5, 19:30 pm GMT-10. Welcome to come and ask questions!
  • 2021.12.26: Edit some comments of the code.
  • 2021.12.25: Upload all codes. Merry Christmas!
  • 2021.12.21: Update the LICENSE and repo contents.
  • 2021.4.15: Create the repo

Contents

  1. Introduction
  2. Prerequisites
  3. Get Started
  4. Contact
  5. License
  6. Citations
  7. Acknowledgments

Introduction

The repository contains the entire project (including all the util scripts) for our open domain sketch-to-photo synthesis network, AODA.

AODA aims to synthesize a realistic photo from a freehand sketch with its class label, even if the sketches of that class are missing in the training data. It is accepted by WACV-2022 and CVPR Workshop-2021. The most updated paper with supplementary materials can be found at arXiv.

In AODA, we propose a simple yet effective open-domain sampling and optimization strategy to "fool" the generator into treating fake sketches as real ones. To achieve this goal, we adopt a framework that jointly learns sketch-to-photo and photo-to-sketch generation. Our approach shows impressive results in synthesizing realistic color, texture, and maintaining the geometric composition for various categories of open-domain sketches.

If our proposed architectures also help your research, please consider citing our paper.

framework

Prerequisites

  • Linux or macOS
  • Python 3 (Recommend to use Anaconda)
  • CPU or NVIDIA GPU + CUDA CuDNN

Get Started

Installation

First, clone this repository:

git clone https://github.com/Mukosame/AODA.git

Install the required packages: pip install -r requirements.txt.

Data Preparation

There are three datasets used in this paper: Scribble, SketchyCOCO, and QMUL-Sketch:

Scribble:

wget -N "http://www.robots.ox.ac.uk/~arnabg/scribble_dataset.zip"

SketchyCOCO:

Download from Google Drive.

QMUL-Sketch:

This dataset includes three datasets: handbags with 400 photos and sketches, ShoeV2 with 2000 photos and 6648 sketches, and ChairV2 with 400 photos and 1297 sketches. The complete dataset can be downloaded through Google Drive.

Training

Train an AODA model:

python train.py --dataroot ./dataset/scribble_10class_open/ \
                --name scribble_aoda \
                --model aoda_gan \
                --gan_mode vanilla \
                --no_dropout \
                --n_classes 10 \
                --direction BtoA \
                --load_size 260

After training, your models models/latest_net_G_A.pth, models/latest_net_G_B.pth and its training states states/latest.state, and a corresponding log file train_scribble_aoda_xxx are placed in the directory of ./checkpoints/scribble_aoda/.

Testing

Please download the weights from [GoogleDrive], and put it into the weights/ folder.

You can switch the --model_suffix to control the direction of sketch-to-photo or photo-to-sketch synthesis. For different datasets, you need to change the --name and the corresponding --n_classes:

python test.py --model_suffix _B --dataroot ./dataset/scribble/testA --name scribble_aoda --model test --phase test --no_dropout --n_classes 10

Your test results will be saved at ./results/test_latest/.

Contact

Xiaoyu Xiang.

You can also leave your questions as issues in the repository. I will be glad to answer them!

License

This project is released under the BSD-3 Clause License.

Citations

@inproceedings{xiang2022adversarial,
  title={Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis},
  author={Xiang, Xiaoyu and Liu, Ding and Yang, Xiao and Zhu, Yiheng and Shen, Xiaohui and Allebach, Jan P},
  booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
  year={2022}
}

Acknowledgments

This project is based on the CycleGAN PyTorch.

aoda's People

Contributors

mukosame avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

aoda's Issues

Unet Generator

Thank you for the work.
I would like to train a model like Anime2Sketch.
Will Unet generator version be available?

Link to weights?

Please download the weights from [GoogleDrive], and put it into the weights/ folder.

Could you please attach a link to the GoogleDrive, thanks!
or would you be able to provide pretrained model ?

Code

Hello, thank you for your excellent work !
When will you give the code ?

Steps to train SketchyCOCO "cat" dataset

Thanks for the awesome work!

After we downloaded and extracted the data into ./datasets/Object/
There are 3 different folders (i.e. Edge , GT and Sketch)

My questions:

  1. What are the steps required in order to train a cat images (i.e. class no 17) so that we can use it for "Photo-to-Sketch Synthesis"? It appears that it is required to create trainA , trainB folder? how could we restructure it from the original dataset?
  2. What are the parameters to use for train.py ?

where [GoogleDrive]

I want to test, but the link to Google Drive is not available:
Please download the weights from [GoogleDrive], and put it into the weights/ folder.

the value of lambda_E

If the value of lambda_E is 0, does net R still work?
What is the appropriate value of lambda_E?

Uploading model weights to Hugging Face

Hello! Would you be interested in hosting your model weights on the Hugging Face Hub? Hosting is free, and it would make your model visible to our users, who I know would love to work with this model 🤗

We have guides on uploading models, but I'm also more than happy to help you out if you'd need assistance! We've also found that models get a lot of traction when they have a demo, which we can host for free on Hugging Face Spaces. (Docs available here)

Just like with uploading the models, I'd love to help you out with getting a demo set up! Let me know if these are things you'd find interesting 😄

cc: @osanseviero

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.