Home

Awesome

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

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}
}