Official PyTorch implementation of Concept Activation-Guided Contrast Learning.
Note that this project is built upon DomainBed@3fe9d7.
pip install -r requirements.txt
python -m domainbed.scripts.download --data_dir=/my/datasets/path
scripts/train_ours_coverage.py
script conducts leave-one-out cross-validations for the target domain.
CUDA_VISIBLE_DEVICES=0 bash scripts/test_runs.sh CoCo_SelfReg PACS
If you want to search for the best implementation, please use the sweep script provided by Domainbed:
CUDA_VISIBLE_DEVICES=0 bash scripts/sweep_runs.sh CoCo_SelfReg PACS
Please cite the paper if you find the code helpful:
@article{tip-LiuTLW24,
author = {Yibing Liu and
Chris Xing Tian and
Haoliang Li and
Shiqi Wang},
title = {Generalization Beyond Feature Alignment: Concept Activation-Guided
Contrastive Learning},
journal = {{IEEE} Trans. Image Process.},
volume = {33},
pages = {4377--4390},
year = {2024}
}
This source code is released under the MIT license, included here.
This project includes some code from DomainBed, also MIT licensed.