GithubHelp home page GithubHelp logo

changwxx / uniot-for-unida Goto Github PK

View Code? Open in Web Editor NEW
51.0 4.0 5.0 1.87 MB

Source code for the NeurIPS 2022 Spotlight paper: "Unified Optimal Transport Framework for Universal Domain Adaptation"

License: MIT License

Python 95.33% Shell 4.67%

uniot-for-unida's Introduction

[NeurIPS 2022 Spotlight] Unified Optimal Transport Framework for Universal Domain Adaptation

Code release for Unified Optimal Transport Framework for Universal Domain Adaptation (NeurIPS 2022 Spotlight).

[paper] [project page]

Requirements

  • Python 3.7+
  • PyTorch 1.8.0
  • GPU Memory 12 GB

To install requirements:

pip install -r requirements.txt

Preparation

  • Download the dataset: Office31, OfficeHome, VisDA and DomainNet (real, painting and sketch).

  • Prepare dataset in data directory as follows

    /path/to/your/dataset/images/amazon/      # Office
    /path/to/your/dataset/RealWorld/          # OfficeHome 
    /path/to/your/dataset/train/              # VisDA synthetic images
    /path/to/your/dataset/test/               # VisDA real images
    /path/to/your/dataset/sketch/             # DomainNet
    
  • For OfficeHome dataset, make sure that your folder name is RealWorld instead of Real World.

  • Modify root_path with /path/to/your/dataset/ in config files ./config/<dataset>-config.yaml.

  • Make a log directory by mkdir ./log.

  • Make a model directory by mkdir ./model. Download ImageNet pretrained model from Google Drive, then put the downloaded model into ./model.

Getting started

  • Train with command line (take office for example)

    python main.py --gpu 0 --exp office31 --dataset office31 --source amazon --target dslr
    
  • Train with script

    Modify ./config/<dataset>.sh:

    • delete the lines which begin with #SBATCH
    • specify $CUDA_VISIBLE_DEVICES

    then

    cd ./script
    sh office31.sh          # or officehome/visda/domainnet
    
  • Train with Slurm script

    Modify ./config/<dataset>.sh:

    then

    cd ./script
    mkdir output
    sbatch office31.sh      # or officehome/visda/domainnet
    
  • Monitor (TensorBoard required)

    tensorboard --logdir=./log --port xxxx
    
  • Test with command line (take office for example)

    python eval.py --gpu 0 --dataset office31 --source amazon --target dslr --model_path /path/to/your/model/final.pkl
    

Checkpoints

We provide the checkpoints for Office, OfficeHome, VisDA and DomainNet at Google Drive.

Citation

If you find this repository useful in your research, please consider citing:

@inproceedings{
chang2022unified,
title={Unified Optimal Transport Framework for Universal Domain Adaptation},
author={Wanxing Chang and Ye Shi and Hoang Duong Tuan and Jingya Wang},
booktitle={Advances in Neural Information Processing Systems},
editor={Alice H. Oh and Alekh Agarwal and Danielle Belgrave and Kyunghyun Cho},
year={2022},
url={https://openreview.net/forum?id=RTan64GlCLV}
}

uniot-for-unida's People

Contributors

changwxx 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

Watchers

 avatar  avatar  avatar  avatar

uniot-for-unida's Issues

Threading issues

When I run main.py, I get the following error:
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

        if __name__ == '__main__':
            freeze_support()
            ...

    The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.
w.start()

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.