Skip to content

Vibashan/irg-sfda

Repository files navigation

Instance Relation Graph Guided Source-Free Domain Adaptive Object Detection [CVPR 2023]

Framework: PyTorch

Vibashan VS, Poojan Oza, Vishal M Patel

[Project Page] [arXiv] [pdf] [Slides] [BibTeX]

Contributions

  • We investigate the problem of source-free domain adaptation for object detection and identify some of the major challenges that need to be addressed.
  • We introduced an Instance Relation Graph (IRG) framework to model the relationship between proposals generated by the region proposal network.
  • We propose a contrastive loss which is guided by the IRG network to improve the instance-level representations for the target data.

Contents

  1. Installation Instructions
  2. Dataset Preparation
  3. Execution Instructions
  4. Results
  5. Citation

Installation Instructions

  • We use Python 3.6, PyTorch 1.9.0 (CUDA 10.2 build).
  • The codebase is built on Detectron.
conda create -n irg_sfda python=3.6

Conda activate irg_sfda

conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=10.2 -c pytorch

cd irg-sfda
pip install -r requirements.txt

## Make sure you have GCC and G++ version <=8.0
cd ..
python -m pip install -e irg-sfda

Dataset Preparation

  • PASCAL_VOC 07+12: Please follow the instructions in py-faster-rcnn to prepare VOC datasets.
  • Clipart, WaterColor: Dataset preparation instruction link Cross Domain Detection . Images translated by Cyclegan are available in the website.
  • Sim10k: Website Sim10k
  • CitysScape, FoggyCityscape: Download website Cityscape, see dataset preparation code in DA-Faster RCNN

Download all the dataset into "./dataset" folder. The codes are written to fit for the format of PASCAL_VOC. For example, the dataset Sim10k is stored as follows.

$ cd ./dataset/Sim10k/VOC2012/
$ ls
Annotations  ImageSets  JPEGImages
$ cat ImageSets/Main/val.txt
3384827.jpg
3384828.jpg
3384829.jpg
.
.

Execution Instructions

Training

  • Download the source-trained model weights in source_model folder Link
CUDA_VISIBLE_DEVICES=$GPU_ID python tools/train_st_sfda_net.py \ 
--config-file configs/sfda/sfda_foggy.yaml --model-dir ./source_model/cityscape_baseline/model_final.pth

Evaluation

  • After training, load the teacher model weights and perform evaluation using
CUDA_VISIBLE_DEVICES=$GPU_ID python tools/plain_test_net.py --eval-only \ 
--config-file configs/sfda/foggy_baseline.yaml --model-dir $PATH TO CHECKPOINT

Results

  • Pre-trained models can be downloaded from Link.

Citation

If you found IRG SFDA useful in your research, please consider starring ⭐ us on GitHub and citing 📚 us in your research!

@inproceedings{vs2023instance,
  title={Instance relation graph guided source-free domain adaptive object detection},
  author={VS, Vibashan and Oza, Poojan and Patel, Vishal M},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={3520--3530},
  year={2023}
}

Acknowledgement

We thank the developers and authors of Detectron for releasing their helpful codebases.

About

Official Pytorch codebase for Instance Relation Graph Guided Source-Free Domain Adaptive Object Detection [CVPR 2023]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published