This is an official implementation of the paper "SelectNAdapt: Support Set Selection for Few-Shot Domain Adaptation".
Generalisation of deep neural networks becomes vulner�able when distribution shifts are encountered between train (source) and test (target) domain data. Few-shot domain adaptation mitigates this issue by adapting deep neural net�works pre-trained on the source domain to the target do�main using a randomly selected and annotated support set from the target domain. This paper argues that randomly selecting the support set can be further improved for effec�tively adapting the pre-trained source models to the target domain. Alternatively, we propose SelectNAdapt, an algo�rithm to curate the selection of the target domain samples, which are then annotated and included in the support set. In particular, for the K-shot adaptation problem, we first leverage self-supervision to learn features of the target do�main data. Then, we propose a per-class clustering scheme of the learned target domain features and select K rep�resentative target samples using a distance-based scoring function. Finally, we bring our selection setup towards a practical ground by relying on pseudo-labels for cluster�ing semantically similar target domain samples. Our ex�periments show promising results on three few-shot domain adaptation benchmarks for image recognition compared to related approaches and the standard random selection.
The python environment of this project is the same as Dassl.Pytorch.
To download PACS dataset please visit this link , office-31 can be downloaded from here
Datasets should be placed inside "./DATA/selectnadapt/imcls/data"
The source and self-supervised (BYOL) trained models can be downloaded from here and place them inside "output_source_models/" and "output_ss_models/" respectively.
To execute the selection process, you'll have to execute the following command, e.g.
python select_pacs.py --ouput_dir <NAME>
@inproceedings{dawoud2023selectnadapt,
title={SelectNAdapt: Support Set Selection for Few-Shot Domain Adaptation},
author={Dawoud, Youssef and Carneiro, Gustavo and Belagiannis, Vasileios},
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
pages={973--982},
year={2023}
}
This codebase is an extension of LCCS and also depends on Dassl.Pytorch for pre-training using source datasets. Thanks to their implementation which made this work possible.