Skip to content

Implementation of "Harmonizing Transferability and Discriminability for Adapting Object Detectors" (CVPR 2020)

Notifications You must be signed in to change notification settings

chaoqichen/HTCN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harmonizing Transferability and Discriminability for Adapting Object Detectors (CVPR 2020)

A Pytorch Implementation of Harmonizing Transferability and Discriminability for Adapting Object Detectors.

Introduction

Please follow faster-rcnn respository to setup the environment. In this project, we use Pytorch 1.0.1 and CUDA version is 10.0.130.

Datasets

Datasets Preparation

  • Cityscape and FoggyCityscape: Download the Cityscape dataset, see dataset preparation code in DA-Faster RCNN.
  • PASCAL_VOC 07+12: Please follow the instruction to prepare VOC dataset.
  • Clipart: Please follow the instruction to prepare Clipart dataset.
  • Sim10k: Download the dataset from this website.

Datasets Format

All codes are written to fit for the format of PASCAL_VOC.
If you want to use this code on your own dataset, please arrange the dataset in the format of PASCAL, make dataset class in lib/datasets/, and add it to lib/datasets/factory.py, lib/datasets/config_dataset.py. Then, add the dataset option to lib/model/utils/parser_func.py.

Data Interpolation

You should use CycleGAN to generate the interpolation samples for both source and target domain, and then train the model with original and generated data. This step is important for the adaptation from Cityscape to FoggyCityscape and the adaptation from Sim10k to Cityscape. For the adaptation from PASCAL_VOC 07+12 to Clipart, we empirically found that we can also achieve competitive results without interpolation.

Models

Pre-trained Models

In our experiments, we used two pre-trained models on ImageNet, i.e., VGG16 and ResNet101. Please download these two models from:

Download them and write the path in __C.VGG_PATH and __C.RESNET_PATH at lib/model/utils/config.py.

Train

CUDA_VISIBLE_DEVICES=$GPU_ID \
       python trainval_net_HTCN.py \
       --dataset source_dataset --dataset_t target_dataset \
       --net vgg16/resnet101 

Test

CUDA_VISIBLE_DEVICES=$GPU_ID \
       python test_net_HTCN.py \
       --dataset source_dataset --dataset_t target_dataset \
       --net vgg16/resnet101  \
       --load_name path_to_model

Citation

If you find this repository useful, please cite our paper:

@inproceedings{chen2020htcn,
  title={Harmonizing Transferability and Discriminability for Adapting Object Detectors},
  author={Chen, Chaoqi and Zheng, Zebiao and Ding, Xinghao and Huang, Yue and Dou, Qi},
  booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2020}
}
@article{chen2020harmonizing,
  title={Harmonizing Transferability and Discriminability for Adapting Object Detectors},
  author={Chen, Chaoqi and Zheng, Zebiao and Ding, Xinghao and Huang, Yue and Dou, Qi},
  journal={arXiv preprint arXiv:2003.06297},
  year={2020}
}

About

Implementation of "Harmonizing Transferability and Discriminability for Adapting Object Detectors" (CVPR 2020)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published