Code Monkey home page Code Monkey logo

crdoco-pytorch's Introduction

CrDoCo: Pixel-level Domain Transfer with Cross-Domain Consistency

This repository contains the code for the paper CrDoCo: Pixel-level Domain Transfer with Cross-Domain Consistency.

Abstract

Unsupervised domain adaptation algorithms aim to transfer the knowledge learned from one domain to another (e.g., synthetic to real images). The adapted representations often do not capture pixel-level domain shifts that are crucial for dense prediction tasks (e.g., semantic segmentation). In this paper, we present a novel pixel-wise adversarial domain adaptation algorithm. By leveraging image-to-image translation methods for data augmentation, our key insight is that while the translated images between domains may differ in styles, their predictions for the task should be consistent. We exploit this property and introduce a cross-domain consistency loss that enforces our adapted model to produce consistent predictions. Through extensive experimental results, we show that our method compares favorably against the state-of-the-art on a wide variety of unsupervised domain adaptation tasks.

Citation

If you find our code useful, please consider citing our work using the following bibtex:

@inproceedings{CrDoCo,
  title={CrDoCo: Pixel-level Domain Transfer with Cross-Domain Consistency},
  author={Chen, Yun-Chun and Lin, Yen-Yu and Yang, Ming-Hsuan and Huang, Jia-Bin },
  booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2019}
}

Environment

  • Install Anaconda Python3.7
  • This code is tested on NVIDIA RTX 2080 GPU with 24GB memory

Dataset

Demo code

We prepare a demo code so that you can have a better understanding on the workflow of the code. Please refer to demo.py

Pre-training the image-to-image translation network

We use the source code from Zhu et al.. Please follow the training tips here for pre-training the image-to-image translation networks. Please adjust the image size based on the GPU memory.

Note:

We found that the training of image-to-image translation network is not very stable since the domain gap between synthetic datasets and real-world datasets is large. Sometimes, the results will have severe visual artifacts or distortions. Based on our experience, we found that resizing images to resolution higher than 384x384 will implicitly alleviate this issue.

Training the task network

python train.py --model train --img_source_file /path/to/source/dataset --img_target_file /path/to/target/dataset --lab_source_file /path/to/source/label --lab_target_file /path/to/target/label --shuffle --flip --rotation

Evaluation

python test.py --model test --img_source_file /path/to/source/dataset --img_target_file /path/to/target/dataset

Acknowledgement

crdoco-pytorch's People

Contributors

yunchunchen avatar

Watchers

 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.