  In real-world applications, deep learning models often run in non-stationary
environments where the target data distribution continually shifts over time.
There have been numerous domain adaptation (DA) methods in both online and
offline modes to improve cross-domain adaptation ability. However, these DA
methods typically only provide good performance after a long period of
adaptation, and perform poorly on new domains before and during adaptation - in
what we call the "Unfamiliar Period", especially when domain shifts happen
suddenly and significantly. On the other hand, domain generalization (DG)
methods have been proposed to improve the model generalization ability on
unadapted domains. However, existing DG works are ineffective for continually
changing domains due to severe catastrophic forgetting of learned knowledge. To
overcome these limitations of DA and DG in handling the Unfamiliar Period
during continual domain shift, we propose RaTP, a framework that focuses on
improving models' target domain generalization (TDG) capability, while also
achieving effective target domain adaptation (TDA) capability right after
training on certain domains and forgetting alleviation (FA) capability on past
domains. RaTP includes a training-free data augmentation module to prepare data
for TDG, a novel pseudo-labeling mechanism to provide reliable supervision for
TDA, and a prototype contrastive alignment algorithm to align different domains
for achieving TDG, TDA and FA. Extensive experiments on Digits, PACS, and
DomainNet demonstrate that RaTP significantly outperforms state-of-the-art
works from Continual DA, Source-Free DA, Test-Time/Online DA, Single DG,
Multiple DG and Unified DA&DG in TDG, and achieves comparable TDA and FA
capabilities.
