Skip to content
/ CoCo Public

[TIP'24] Official PyTorch implementation of Concept Activation-Guided Contrast Learning.

Notifications You must be signed in to change notification settings

BierOne/CoCo

Repository files navigation

Generalization Beyond Feature Alignment: Concept Activation-Guided Contrast Learning (TIP'24)

Official PyTorch implementation of Concept Activation-Guided Contrast Learning.

Note that this project is built upon DomainBed@3fe9d7.

Preparation

Dependencies

pip install -r requirements.txt

Datasets

python -m domainbed.scripts.download --data_dir=/my/datasets/path

How to Run

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

Citation

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

License

This source code is released under the MIT license, included here.

This project includes some code from DomainBed, also MIT licensed.

About

[TIP'24] Official PyTorch implementation of Concept Activation-Guided Contrast Learning.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published