This is the official code for the "Multi-Scale and Multi-Layer Contrastive Learning for Domain Generalization" paper, which has been published in the IEEE Transactions on Artificial Intelligence journal. The preprint is also available here.
In this work, we argue that the problems caused by domain shift between data drawn from unknown domains can be mitigated by utilizing multiple levels of information passed throughout a Convolutional Neural Network, in order to derive disentangled representations.
Download the datasets:
python3 -m domainbed.scripts.download \
--data_dir=./domainbed/data
Available alogrithms in algorithms.py.
Train a model:
python3 -m domainbed.scripts.train\
--data_dir=./domainbed/data/PACS/\
--algorithm ERM\
--dataset PACS\
--test_env 2
Train with our models:
# Train with M2 model
python3 -m domainbed.scripts.train\
--data_dir=./domainbed/data/PACS/\
--algorithm M2\
--dataset PACS\
--test_env 2
# Train with M2CL model
python3 -m domainbed.scripts.train\
--data_dir=./domainbed/data/PACS/\
--algorithm M2CL\
--dataset PACS\
--test_env 2
If you use the above code for your research please cite our paper, which as of the 8th of March 2024 has been accepted in IEEE TAI:
@ARTICLE{10472869,
author={Ballas, Aristotelis and Diou, Christos},
journal={IEEE Transactions on Artificial Intelligence},
title={Multi-Scale and Multi-Layer Contrastive Learning for Domain Generalization},
year={2024},
volume={},
number={},
pages={1-14},
keywords={Feature extraction;Training;Task analysis;Self-supervised learning;Adaptation models;Representation learning;Image classification;Domain generalization;Representation learning;Contrastive learning;Image classification},
doi={10.1109/TAI.2024.3377173}
}