NRC_SFDA icon indicating copy to clipboard operation
NRC_SFDA copied to clipboard

Code for our NeurIPS 2021 paper 'Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation'

Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation (NeurIPS 2021)

Attention! The code is expected to reproduce the results with PyTorch 1.3 with cuda 10.0

Code for our NeurIPS 2021 paper 'Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation'. [project] [paper] (The codes are based on our G-SFDA (ICCV 2021))

Note: In the code, we do not explicitly compute the self-regularization loss (you will find the comment in the code), instead we do not explicitly remove the self features in the nearest neighbor retriving where the occurrence frequency of self feature acts as a dynamic weight.

More results

You can check the ICML 2022 paper "Balancing Discriminability and Transferability for Source-Free Domain Adaptation" and ECCV 2022 paper "Concurrent Subsidiary Supervision for Unsupervised Source-Free Domain Adaptation " (which use our code) for results of our method on Multi-Source Domain Adaptation on DomainNet.

Dataset preparing

Download the VisDA and Office-Home (use our provided image list files) dataset. And denote the path of data list in the code.

Checkpoint

You can find all the weights (before and after the adaptation, and the results of the logfile may not be the correct one) on VisDA and Office-Home in this link. If you want to reproduce the results quickly, please use the provided source model.

VisDA

First train the model on source domain, then do target adaptation without source data:

python train_src.py

python train_tar.py

Office-Home

Code for Office-Home is in the 'office-home' folder.

sh train_src_oh.sh

sh train_tar_oh.sh

PointDA-10

Code in the folder 'pointDA-10' is based on PointDAN. Run the src.sh for source pretraining and tar.sh for source-free domain adaption.