Coder Social home page Coder Social logo

rogerzhangzz / cag_uda Goto Github PK

View Code? Open in Web Editor NEW
141.0 6.0 20.0 2.13 MB

(NeurIPS2019) Category Anchor-Guided Unsupervised Domain Adaptation for Semantic Segmentation

License: MIT License

Python 92.05% C 0.27% C++ 2.73% Cuda 4.94%
segmentation uda

cag_uda's Introduction

Category-anchor Guided Unsupervised Domain Adaptation for Semantic Segmentation

Qiming Zhang*, Jing Zhang*, Wei Liu, Dacheng Tao

paper

Table of Contents

Introduction

This respository contains the CAG-UDA method as described in the NeurIPS 2019 paper "Category-anchor Guided Unsupervised Domain Adaptation for Semantic Segmentation".

Requirements

The code is implemented based on Pytorch 0.4.1 with CUDA 9.0, Python 3.6.7. The code is trained using a NVIDIA Tesla V100 with 16 GB memory. Please see the 'requirements.txt' file for other requirements.

Usage

Assuming you are in the CAG-UDA master folder.

  1. Preparation:
  • Download the GTA5 dataset as the source domain, and the Cityscapes dataset as the target domain.
  • Then put them into a folder (dataset/GTA5 for example). Please carefully check the directory of the folder whether containing invalid characters.
  • Please notice that images in GTA5 have slightly different resolutions, which has been resolved in our code.
  • Download pretrained models here and put them in the 'pretrained/' folder. There are four models for warmup, stage 1, stage 2, and stage 3 respectively.
  1. Setup the config file with directory 'config/adaptation_from_city_to_gta.yml'.
  • Set the dataset path in the config file (data:source:rootpath and data:target:rootpath).
  • Set the pretrained model path to 'training:resume' and 'training:Pred_resume' in the config file. 'Pred_resume' model is used to assign pseudo-labels..
  • To better understand the meaning of each parameter in the config file, please see 'config/readme'.
  1. Training
  • To run the code:
python train.py
  • During the training, the generated files (log file) will be written in the folder 'runs/..'.
  1. Evaluation
  • Set the config file for test (configs/test_from_city_to_gta.yml): (1). Set the dataset path as illustrated before. (2). Set the model path in 'test:path:'.
  • Run:
python test.py

to see the results.

  1. Constructing anchors
  • Setting the config file 'configs/CAC_from_gta_to_city.yml' as illustrated before.
  • Run:
python cac.py
  • The anchor file would be in 'run/cac_from_gta_to_city/..'

License

MIT

The code is heavily borrowed from the repository (https://github.com/meetshah1995/pytorch-semseg).

If you use this code and find it usefule, please cite:

@inproceedings{zhang2019category,
  title={Category Anchor-Guided Unsupervised Domain Adaptation for Semantic Segmentation},
  author={Zhang, Qiming and Zhang, Jing and Liu, Wei and Tao, Dacheng},
  booktitle={Advances in Neural Information Processing Systems},
  pages={433--443},
  year={2019}
}

Notes

The category anchors are stored in the file 'category_anchors'. It is calculated as the mean value of features with respect to each category from the source domain.

Contact: [email protected] / [email protected]

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.