Bridging the Gap between Continual Learning and Test-Time Adaptation with Domain Preview
Organizations: Sorbonne University · Mercari · The University of Tokyo
Abstract
Domain shift is a major problem for training machine learning models. While Continual Learning (CL) assumes distribution shift during training and Continual Test-Time Adaptation (CTTA) considers new domains at test time, setups that require explicit online adaptation to domain shift during both phases remain under-explored. We propose continual learning with domain preview (CL-P), a new combination of CL and TTA where both train and test data suffer from distribution shift. The training phase of CL-P is analogous to domain-incremental learning while the testing phase consists of a TTA phase on a future domain (which we call preview), and an evaluation phase on all seen domains. The model must then adapt to new domains at train and test time. In this paper, we evaluate mainstream CL and TTA methods that adapt only at train or test time, as well as their naive combination. Experimentally, TTA heavily damages the domain on which the CL method has just trained and increases forgetting. Notably, this damage mostly comes from the BatchNorm statistics shared by all domains. In that sense, we propose DOSE (Dosing by Online Statistics of Each domain), which allows a seamless combination of any CL and TTA methods by adaptive domain inference at test time, where the adaptation is applied to each image in proportion to the probability that it comes from the preview domain. Through extensive experiments with ResNet and ViT backbones, various combinations of CL and TTA baseline methods and datasets considering diverse domains, we show that DOSE matches or improves on CL methods alone in all 24 settings and on the naive combination in all but one. The code can be found in appendix.
Figures & tables
| FT (no buffer) | ER (200 images) | |||||||
| old | new | dmg. | forg. | old | new | dmg. | forg. | |
| no TTA | 50.6 | 30.4 | – | 34.1 | 65.9 | 43.2 | – | 11.5 |
| +TTA | 39.3 | 56.4 | 27.5 | 36.6 | 42.3 | 55.7 | 25.2 | 32.9 |
| Dose | 58.6 | 55.1 | 0.5 | 24.6 | 65.7 | 55.1 | 0.2 | 11.8 |
| Oracle | 64.7 | 56.7 | 0.6 | 10.9 | 64.7 | 55.9 | 2.6 | 11.1 |
| Trained | 71.5 | 71.1 | ||||||
| ResNet, FT | ResNet, ER | ViT-B/16, FT | ViT-B/16, ER | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| no TTA | +TTA | Ours | no TTA | +TTA | Ours | no TTA | +TTA | Ours | no TTA | +TTA | Ours | |
| C100-C | 48.6 | 44.0 | 60.7 | 64.7 | 46.3 | 65.9 | 65.6 | 66.5 | 67.0 | 69.0 | 69.1 | 69.5 |
| C100-TF | 49.7 | 48.5 | 66.4 | 63.1 | 51.6 | 68.9 | 73.4 | 73.8 | 74.6 | 75.2 | 75.7 | 76.4 |
| C20 | 63.7 | 64.1 | 63.9 | 68.1 | 68.1 | 68.6 | 76.9 | 77.0 | 77.9 | 79.1 | 79.2 | 79.9 |
| DomainNet | 39.1 | 37.2 | 43.5 | 51.1 | 39.3 | 51.1 | 62.8 | 62.7 | 63.4 | 63.9 | 64.0 | 64.7 |
| Inet-TF | 42.1 | 40.7 | 76.7 | 70.8 | 42.7 | 80.0 | 95.7 | 95.8 | 96.1 | 96.0 | 95.9 | 96.3 |
| ResNet | ViT-B/16 | ||||
| variant | TF/Inet | DN | C20 | TF/Inet/C20 | DN |
| Dose (score) | 73.1 | 47.6 | 66.3 | 83.9 | 64.2 |
| Domain detection | |||||
| only the latest domain’s recorded statistics | 8.3 | 1.7 | 0.2 | 0.1 | 0.2 |
| statistics recorded on , every layer | 1.1 | 0.1 | 0.1 | 0.3 | 0.3 |
| statistics recorded on the frozen last block | 2.0 | 0.7 | 0.0 | 0.4 | 0.3 |
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Setup | Labeled | Unlabeled | Labels later | Adaptation | Evaluation |
|---|---|---|---|---|---|
| Domain-incremental CL [ 47 ] | sequence of domains | none | n/a | n/a | all seen domains |
| CTTA [ 51 , 31 ] | source domain only | stream of new domains | never | online | current stream |
| Continual UDA [ 40 , 8 , 44 ] | source domain only | sequence of new domains | never | offline, several epochs | seen domains |
| Initially labeled streams [ 13 ] | first batch only | drifting stream | never | online | current stream |
| Label delay [ 10 ] | same stream, steps late | latest batches of the stream | after steps | online | latest batch |
| DoSAPP [ 42 ] | sequence of tasks (class-inc.) | test data of current and seen tasks | never | unsupervised phase after each task | all seen tasks |
| Method | CIFAR datasets | ImageNet-scale datasets |
|---|---|---|
| Tent | Adam | SGD |
| EATA, SAR, ROID, CMF | Adam | SGD |
| CoTTA | Adam | SGD |
| RoTTA, PETAL | Adam | Adam |
| LAW, PALM, NOTE | Adam , , | same |
| LCoTTA | SGD (ViT ) | same |
| ResNet, validation | ||||
|---|---|---|---|---|
| CIFAR-100-C | 89.4 | 88.3 | 77.2 | 50.0 |
| CIFAR-100-TF | 93.0 | 91.3 | 82.5 | 58.6 |
| CIFAR-20 | 68.4 | 72.7 | 70.1 | 58.3 |
| Imagenette-TF | 92.1 | 93.0 | 91.3 | 82.0 |
| DomainNet | 41.4 | 48.6 | 42.9 | 29.3 |
| average | 76.9 | 78.8 | 72.8 | 55.6 |
| ResNet | ViT-B/16 | ||||
|---|---|---|---|---|---|
| Evaluated | Development benchmarks | separate | leave one out | separate | leave one out |
| C100-C, C100-TF | DomainNet | ||||
| C20 | Imagenette-TF, DomainNet | ||||
| Inet-TF, IN-C | CIFAR-20, DomainNet | ||||
| DomainNet | the four others | ||||
| shift | tasks | classes | training | preview | eval. | ||
| images | per class | ||||||
| C100-TF | corruption | 5 | 100 | 10,000 | 100 | 1,000 | 1,000 |
| Inet-TF | corruption | 5 | 10 | 1,900 | 190 | 390 | 390 |
| C100-C | corruption | 14 | 100 | 3,333 | 33 | 5,000 | 2,000 |
| IN-C | corruption | 14 | 1,000 | 25,000 | 25 | 20,000 | 5,000 |
| C20 | sub-class | 4 | 20 | 10,000 | 500 | 1,000 | 1,000 |
| ROID | EATA | Tent | ||||
|---|---|---|---|---|---|---|
| old 0-1 | old 0-1 | old 0-1 | ||||
| adapted | 47.5 | 14.9 | 48.3 | 21.7 | 43.4 | 10.2 |
| from | 60.9 | 56.9 | 60.4 | 56.0 | 60.3 | 57.3 |
| preview 1,000 | 55.1 | 41.7 | 56.5 | 48.6 | 54.8 | 45.3 |
| no bank | 48.0 | 55.0 | 48.2 | 54.4 | 46.6 | 54.2 |
Continual Test-Time Adaptation
Continual test-time adaptation updates pretrained models on unlabeled, changing deployment data while retaining useful knowledge across shifts.
See all 77 papers