Git Product home page Git Product logo

proca's Introduction

Prototypical Contrast Adaptation for Domain Adaptive Semantic Segmentation (ECCV 2022)

This repository is for ProCA introduced in the following paper

Zhengkai Jiang, Yuxi Li, Ceyuan Yang, Peng Gao, Yabiao Wang, Ying Tai, Chengjie Wang, "Prototypical Contrast Adaptation for Domain Adaptive Semantic Segmentation", ECCV 2022 [arxiv].

Prerequisites

  • Python 3.6
  • Pytorch 1.7.1
  • torchvision from master
  • yacs
  • matplotlib
  • GCC >= 4.9
  • OpenCV
  • CUDA >= 10.1

Step-by-step installation

conda create --name ProCA -y python=3.6
conda activate ProCA

# this installs the right pip and dependencies for the fresh python
conda install -y ipython pip

pip install ninja yacs cython matplotlib tqdm opencv-python imageio mmcv tqdm torchvision==0.8.2 torch==1.7.1

Data Preparation

The data folder should be structured as follows:

├── datasets/
│   ├── cityscapes/     
|   |   ├── gtFine/
|   |   ├── leftImg8bit/
│   ├── synthia/
|   |   ├── RAND_CITYSCAPES/
|   |   ├── synthia_label_info.p
│   ├── gtav/
|   |   ├── images/
|   |   ├── labels/
|   |   ├── gtav_label_info.p

Symlink the required dataset

ln -s /path_to_cityscapes_dataset datasets/cityscapes
ln -s /path_to_synthia_dataset datasets/synthia
ln -s /path_to_gtav_dataset datasets/gtav

Generate the label statics file for SYNTHIA and GTAV Datasets by running

python3 datasets/generate_synthia_label_info.py -d datasets/synthia -o datasets/synthia/
python3 datasets/generate_gtav_label_info.py -d datasets/gtav -o datasets/gtav/

Inference Using Pretrained Model

(1) SYNTHIA -> Cityscapes

Download the pretrained model (ResNet-101) (52.0 mIoU of single scale, extraction code:3e9h) or Google Drive and save it in results/. Then run the command

python test.py -cfg configs/deeplabv2_r101_ssl_synthia.yaml resume results/model_proca_ssl.pth

multi-scale testing results should preduce result

(2) GTAV -> Cityscapes

Download the pretrained model (ResNet-101) (55.1 mIoU of sinle scale, extraction code: f2ve) or Google Drive and save it in results/. Then run the command

python test.py -cfg configs/deeplabv2_r101_ssl.yaml resume results/model_proca_ssl.pth

multi-scale testing results should preduce result

Train

We provide the training script using 4 Tesla V100 GPUs.

bash run_proca_resnet101_gta5.sh

We also provide Memory-Bank implementation which can be seen in train_memory_bank.

Acknowledgements

This code is partly based on the open-source implementations from FADA and SDCA.

Citation

If you find this code or idea useful, please cite our work:

@inproceedings{jiang2022prototypical,
  title={Prototypical Contrast Adaptation for Domain Adaptive Segmentation},
  author={Jiang, Zhengkai and Li, Yuxi and Yang, Ceyuan and Gao, Peng and Wang, Yabiao and Tai, Ying and Wang, Chengjie},
  booktitle={European Conference on Computer Vision (ECCV)},
  year={2022}
}

proca's People

Contributors

jiangzhengkai 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.