domain-generalization-eval
Rethinking the Evaluation Protocol of Domain Generalization — Han Yu et al. (2023) (arXiv:2305.15253, 2023)
What this evaluates
This benchmark evaluates a model's out-of-distribution (OOD) generalization capability across multiple domain-shift datasets. It specifically probes whether models rely on true domain-invariant features learned from training domains versus leaking test-domain information through ImageNet pretraining weights or oracle hyperparameter selection. The protocol mandates training from scratch without pretrained weights and evaluating across multiple test domains to ensure a fair comparison of OOD generalization algorithms.
Datasets
- PACS — total 9991; splits: train (-1), val (-1), test (-1)
- VLCS — total 10729; splits: train (-1), val (-1), test (-1)
- OfficeHome — total 15588; splits: train (-1), val (-1), test (-1)
- DomainNet — total 586575; splits: train (-1), val (-1), test (-1)
- NICO++ — total 88866; splits: train (-1), val (-1), test (-1)
Metrics
test accuracy (primary) — range: percent
- Average classification accuracy across all test domains, computed as the mean of per-domain accuracy scores. Reported as percentage ± standard deviation over random seeds.
Input / output format
Input: RGB images from multiple source domains with corresponding class labels.
Output: Class predictions (or probability distributions) for each test image.
Scoring recipe
def compute_accuracy(preds, golds):
return sum(p == g for p, g in zip(preds, golds)) / len(golds) * 100
def evaluate(model, test_domains):
domain_accs = []
for domain in test_domains:
preds = model.predict(domain.images)
domain_accs.append(compute_accuracy(preds, domain.labels))
return sum(domain_accs) / len(domain_accs)
Common pitfalls
- Using ImageNet-pretrained weights for initialization, which can leak test-domain information for datasets containing real photos and inflate OOD performance.
- Performing oracle model selection by tuning hyperparameters on the test set instead of a validation set drawn from the training distribution.
- Evaluating on only a single test domain per model, which makes it easier to overfit hyperparameters to that specific domain compared to evaluating across multiple test domains simultaneously.
Evidence (verbatim from paper)
For IID model selection, we choose the test accuracy corresponding to the hyperparameters with the highest accuracy on validation data. For oracle model selection, we directly choose the highest test accuracy across all hyperparameter sets.
Citation
@misc{yu2023rethinking,
title={Rethinking the Evaluation Protocol of Domain Generalization},
author={Han Yu et al. (2023)},
year={2023},
note={arXiv:2305.15253}
}
1---2name: domain-generalization-eval3description: This benchmark evaluates a model's out-of-distribution (OOD) generalization capability across multiple domain-shift datasets. It specifically probes whether models rely on true domain-invariant features learned from training domains versus leaking test-domain information through ImageNet pretraining weights or oracle hyperparameter selection. The protocol mandates training from scratch without pretrained weights and evaluating across multiple test domains to ensure a fair comparison of OOD generalization algorithms. Use when the user wants to benchmark on PACS, VLCS, OfficeHome, DomainNet, NICO++, or asks about evaluating this task. Reports test accuracy.4---56# domain-generalization-eval78> Rethinking the Evaluation Protocol of Domain Generalization — Han Yu et al. (2023) (arXiv:2305.15253, 2023)910## What this evaluates1112This benchmark evaluates a model's out-of-distribution (OOD) generalization capability across multiple domain-shift datasets. It specifically probes whether models rely on true domain-invariant features learned from training domains versus leaking test-domain information through ImageNet pretraining weights or oracle hyperparameter selection. The protocol mandates training from scratch without pretrained weights and evaluating across multiple test domains to ensure a fair comparison of OOD generalization algorithms.1314## Datasets1516- **PACS** — total 9991; splits: train (-1), val (-1), test (-1)17- **VLCS** — total 10729; splits: train (-1), val (-1), test (-1)18- **OfficeHome** — total 15588; splits: train (-1), val (-1), test (-1)19- **DomainNet** — total 586575; splits: train (-1), val (-1), test (-1)20- **NICO++** — total 88866; splits: train (-1), val (-1), test (-1)2122## Metrics2324- `test accuracy` **(primary)** — range: percent25 - Average classification accuracy across all test domains, computed as the mean of per-domain accuracy scores. Reported as percentage ± standard deviation over random seeds.2627## Input / output format2829**Input**: RGB images from multiple source domains with corresponding class labels.3031**Output**: Class predictions (or probability distributions) for each test image.3233## Scoring recipe3435```python36def compute_accuracy(preds, golds):37 return sum(p == g for p, g in zip(preds, golds)) / len(golds) * 1003839def evaluate(model, test_domains):40 domain_accs = []41 for domain in test_domains:42 preds = model.predict(domain.images)43 domain_accs.append(compute_accuracy(preds, domain.labels))44 return sum(domain_accs) / len(domain_accs)45```4647## Common pitfalls4849- Using ImageNet-pretrained weights for initialization, which can leak test-domain information for datasets containing real photos and inflate OOD performance.50- Performing oracle model selection by tuning hyperparameters on the test set instead of a validation set drawn from the training distribution.51- Evaluating on only a single test domain per model, which makes it easier to overfit hyperparameters to that specific domain compared to evaluating across multiple test domains simultaneously.5253## Evidence (verbatim from paper)5455> For IID model selection, we choose the test accuracy corresponding to the hyperparameters with the highest accuracy on validation data. For oracle model selection, we directly choose the highest test accuracy across all hyperparameter sets.5657## Citation5859```bibtex60@misc{yu2023rethinking,61 title={Rethinking the Evaluation Protocol of Domain Generalization},62 author={Han Yu et al. (2023)},63 year={2023},64 note={arXiv:2305.15253}65}66```6768- arXiv: 2305.15253