/EADA

[AAAI 2022] Official Implementation of Active Learning for Domain Adaptation: An Energy-based Approach https://arxiv.org/abs/2112.01406

Primary LanguagePythonMIT LicenseMIT


Active Learning for Domain Adaptation: An Energy-based Approach

Binhui Xie, Longhui Yuan, Shuang Li, Chi Harold Liu, Xinjing Cheng and Guoren Wang

Paper   Bilibili   Slides  

Unsupervised domain adaptation (UDA) has recently emerged as an effective paradigm for generalizing deep neural networks to new target domains. However, there is still enormous potential to be tapped to reach the fully supervised performance.

We start from an observation that energy-based models exhibit free energy biases when training (source) and test (target) data come from different distributions. Inspired by this inherent mechanism, we empirically reveal that a simple yet efficient energy-based sampling strategy sheds light on selecting the most valuable target samples than existing approaches requiring particular architectures or computation of the distances.

Our algorithm, Energy-based Active Domain Adaptation (EADA), queries groups of target data that incorporate both domain characteristic and instance uncertainty into every selection round. Meanwhile, by aligning the free energy of target data compact around the source domain via a regularization term, domain gap can be implicitly diminished.

UDA over time

Through extensive experiments, we show that EADA surpasses state-of-the-art methods on well-known challenging benchmarks with substantial improvements, making it a useful option in the open world.

For more information on EADA, please check our [Paper].

If you find this project useful in your research, please consider citing:

@inproceedings{xie2022active,
  title={Active learning for domain adaptation: An energy-based approach},
  author={Xie, Binhui and Yuan, Longhui and Li, Shuang and Liu, Chi Harold and Cheng, Xinjing and Wang, Guoren},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={36},
  number={8},
  pages={8708--8716},
  year={2022}
}

Setup Environment

For this project, we used python 3.7.5. We recommend setting up a new virtual environment:

Step-by-step installation

conda create --name activeDA -y python=3.7
conda activate activeDA

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

pip install -r requirements.txt

Setup Datasets

The data folder should be structured as follows:

├── data/
│   ├── office31/	
|   |   ├── amazon/
|   |   ├── dslr/
|   |   ├── webcam/	
│   ├── home/     
|   |   ├── Art/
|   |   ├── Clipart/
|   |   ├── Product/
|   |   ├── RealWorld/
│   ├── visda2017/
|   |   ├── train/
|   |   ├── validation/
│   └──	

Symlink the required dataset

ln -s /path_to_office31_dataset data/office31
ln -s /path_to_home_dataset data/home
ln -s /path_to_visda2017_dataset/clf/ data/visda2017

Running the code

For Office-31

python main.py --cfg configs/office.yaml

For Office-Home

python main.py --cfg configs/home.yaml

For VisDA-2017

python main.py --cfg configs/visda2017.yaml

Acknowledgements

This project is based on the following open-source projects. We thank their authors for making the source code publicly available.

Contact

If you have any problem about our code, feel free to contact

or describe your problem in Issues.