The code repository for "Cross-Sample Relational Fusion: Unifying Domain Generalization and Class-Incremental Learning" in PyTorch. If you use any content of this repo for your work, please cite the following bib entry:
@article{Xie26CORF,
author = {Zhen-Hao Xie and Yan Wang and Hao Sun and Han-Jia Ye and De-Chuan Zhan and Da-Wei Zhou},
title = {Cross-Sample Relational Fusion: Unifying Domain Generalization and Class-Incremental Learning},
journal = {{IEEE} Trans. Multim.},
year = {2026},
}[05/2026] Accepted to TMM 2026.
[05/2026] Code has been released.
[05/2026] arXiv paper has been released.
Class-Incremental Learning (CIL) requires a learning system to learn new classes while retaining previously learned knowledge. However, in real-world scenarios like autonomous driving, a system trained on urban roads in sunny weather may later need to operate in rural or highway environments under different traffic patterns and weather conditions. This requires the model not only to overcome catastrophic forgetting, but also to effectively handle domain shifts. In this paper, we propose CrOss-sample Relational Fusion (CORF), a unified framework to address domain shift and catastrophic forgetting simultaneously. To enhance generalizability, we perform selective refinement of training samples by leveraging spatial contribution maps to highlight semantically informative regions. Furthermore, we incorporate predictive confidence to adaptively weigh samples, thereby facilitating the learning of domain-agnostic representations. To alleviate forgetting, we propose a cascaded distillation framework that captures cross-sample relational dependencies across multiple feature hierarchies, enabling the multi-grained transfer of knowledge from previous tasks. CORF can be seamlessly integrated into existing CIL algorithms to enhance their generalizability, achieving competitive performance across various benchmark datasets.
Environment
We have implemented the pre-processing datasets as follows:
- OfficeHome: Official website: link or Hugging Face: link
- PACS: Official benchmark website: link or Hugging Face: link
- DomainNet: Official website: link or TensorFlow Datasets: link
To prepare your JSON files, refer to the settings in the exps folder and run the following command. All main experiments from the paper are already provided in the exps folder, you can simply execute them to reproduce the results found in the logs folder.
python main.py --config ./exps/[config_name]/[dataset_name]/[increment]/[target_name].json
This repo is based on CIL_Survey and PyCIL.
If you have any questions, please contact me via email.
