Adaptive Contextual Perception: How To Generalize To New Backgrounds and Ambiguous Objects
Authors: Zhuofan Ying
Peter Hase
Mohit Bansal
Venue: NeurIPS 2023 poster (2023)
Keywords: Computer vision
out-of-distribution generalization
representational geometry

Abstract: Biological vision systems make adaptive use of context to recognize objects in new settings with novel contexts as well as occluded or blurry objects in familiar settings. In this paper, we investigate how vision models adaptively use context for out-of-distribution (OOD) generalization and leverage our analysis results to improve model OOD generalization. First, we formulate two distinct OOD settings where the contexts are either beneficial Object-Disambiguation or irrelevant Background-Invariance, reflecting the diverse contextual challenges faced in biological vision. We then analyze model performance in these two different OOD settings and demonstrate that models that excel in one setting tend to struggle in the other. Notably, prior works on learning causal features improve on one setting but hurt on the other. This underscores the importance of generalizing across both OOD settings, as this ability is crucial for both human cognition and robust AI systems. Next, to better understand the model properties contributing to OOD generalization, we use representational geometry analysis and our own probing methods to examine a population of models, and we discover that those with more factorized representations and appropriate feature weighting are more successful in handling Object-Disambiguation and Background-Invariance tests. We further validate these findings through causal intervention, manipulating representation factorization and feature weighting to demonstrate their causal effect on performance. Motivated by our analysis results, we propose new augmentation methods aimed at enhancing model generalization. The proposed methods outperform strong baselines, yielding improvements in both in-distribution and OOD tests. We conclude that, in order to replicate the generalization abilities of biological vision, computer vision models must have factorized object vs. background representations and appropriately weigh both kinds of features.

Adaptive Contextual Perception: How to Generalize to New Backgrounds and Ambiguous Objects
Zhuofan Ying
Peter Hase
Mohit Bansal
UNC Chapel Hill
CColumbia University (zEying, peter, mbansal| |ccs unc. edu
Abstract
Biological vision systems make adaptive use of context to recognize objects new settings with novel contexts well as occluded blurry objects in familiar settings [3, 35J. In this paper, we investigate how vision models adaptively use context for cuttr--distribbtion (OOD) generalization and leverage analysis re- sults to improve model OOD generalization. First, we formulate two distinct OOD settings where the contexts either irrelevant (BACKGROUND- IN VARIANCE) reflecting the diverse contextual chal- lenges faced in biological vision. We then analyze model performance in these different OOD settings and demonstrate that models that excel in one setting tend to struggle in the other. Notably, prior works learning causal features improve on one setting but hurt in the other. This underscores the importance of generalizing across both OOD settings, this ability crucial for both human cognition and robust Al systems. Next, to better understand the model properties contributing to OOD generalization, we use representational geometry analysis and our own prob- ing methods to examine population of models, and we discover that those with more factorized representations and appropriate feature weighting are more suc- and OBJECT-DISAMMIIUAATAE tests. We further validate these findings through causal intervention, manipulating representation factorization and feature weighting to demonstrate their causal effect on performance. These results show that interpretability-baan -baeed model metrics can predict OOD generalization and are causally connected to model generalization. Motivated by our analysis results, we propose new data augmentation methods aimed at enhancing model generalization. The proposed methods outperform strong baselines, yielding improvements in both in-distribution and OOD tests. We conclude that, in order to replicate the generalization abilities of biological vision, computer vision models must have factorized object vs. background representations and appropriately weight both kinds of features.'
or beneficial (OBJECT-DISAA)
cessful in handling B BACK
Introduction
Humans can recognize objects even when the objects appear in novel settings like new viewpoints, lighting, and background conditions [6, 17J. This kind of generalization has been the subject of many studies in computer vision, where past methods have optimized models avoid relying on "spurious correlations" (such as the object's background) in order to encourage generalization [46, 2, 38). However, human vision can also generalize to settings where objects are occluded, blurred, or otherwise distorted, as illustrated by the blurred keyboard in Fig. 1. In fact, research in psychology shows that humans accomplish this task largely by relying on background information, which helps disambiguate the identity of the foreground object [24, 53, 39, 23).
OOr code is available https: http://gtttuuuu.........t.a/aaet htt.://.....oo....oooo///aaaattt
AdaptiveConter:t
37th Conference on Neural Information Processing Systems (NcurIPS 2023).

---

In-Distributton
Representation Space Bockground Subapace
Orthogonal Subspaces
Feature
Factorization
(2b) Background Invariance
cause
Subspace Importance to Model Decision
(1b) Feature
Weighting
(2c) Object Disambiguation
(1) Model Properties
(2) Adaptive Use of Context
Figure 1: Feature factorization and appropriate feature weighting support Adaptive Contextual Perception. Humans can flexibly generalize to object settings where the context is irrelevant (2b) or helpful (2c). To achieve similar generalization, models should have factorized representations (Ia) with strong weights on object features and small but non-zero weights on background features (Ib). (2a) In-distribution: In natural environments, foreground and background information correlates strongly. (2b) OOD: BACKGROUND BRROOUNDIINVAIIANE INVARIANCE. When the background is inconsistent with the foreground object, humans can ignore the background [46]. (2c) OOD: OBJECт- DISAMBIGUATION. When the object is hard to recognize on its own (like the highly blurred keyboard), humans can rely on the background (office setting) to infer what the object [31].
How can humans both ignore backgrounds to recognize objects in new contexts as well as rely on background information to recognize ambiguous objects? Past work suggests that this adaptive use of context is possible via the factorization of foreground objects versus background contexts in visual representations [4, 53, 7, 28). Factorized representations have the property that the features of the data are represented in different subspaces in the feature space. Specifically, for a model with representations in Rd, with two orthogonal subspaces V Id and V-L say the model factorizes its foreground and background representations when foreground information is represented in the subspace V and background information is represented in V-.
The bases for the subspaces V and V do not have align with the dimensions of the feature vectors (i.e. the standard basis of IR"),, nor do representations have to be sparse, unlike common definitions of modularity or disentanglement [8]. Bengio al. [5] suggest that factorization should broadly improve model generalization; we state this hypothesis specifically for the adaptive use of context as the Factorization Hypothesis:
Factorization Hypothesis: factorized representation is necessary for adaptive use of context.
This is not to say that factorized representation is sufficient for generalization. A model must also use the factorized representations in a certain way to generalize to both new contexts and ambiguous objects. In human vision, object-context interactions occur very small timescales. suggesting simple feedforward weighting of evidence is sufficient [53]. For computer vision, we argue that the object representation typically provides strong evidence for the object's 's identity, while the context representation can serve as a fie-breaking feature that provides a small amount of evidence that is useful when the features of the object itself ambiguous (all within a single forward pass). In this view, background information becomes useful for identifying objects when they are occluded, blurry, far away, or otherwise difficult recognize. We state this view as the Feature Weighting Hypothesis:
Feature Weighting Hypothesis: model predictions should depend on both object and context features, with stronger weight given to object features but non-zero weight context features.
In this paper, we argue that models generalize to new contexts and ambiguous objects by following the Factorization Hypothesis and the Feature Weighting Hypothesis. Experimentally, we (1) design testing procedures that capture generalization to both new contexts and ambiguous objects, (2) show that current models' generalization is predicted by how factorized their representations are and how they weight object/context features, and (3) design novel objectives for improving model generalization based on these hypotheses.

---

First, we formulate two kinds of OOD generalization settings where the context is either irrelevant or helpful: BACKGROUND-IVARLAN in Fig. 1. In BACKGROUND- BACCKGRROND--VVARANNCEE foreground objects and the background contexts are randomly paired (i.e., objects in new contexts), breaking spurious correlations observed in naturalistic training distributions. In DBJECT-DISAMBIIUUATTI
and BBJECT-DISAMBIGUAN
which are illustrated
the object itself is hard to recognize or ambiguous (due to motion, lighting conditions, noise, etc.), while the background context is of the kind usually observed for the object. We find that there is fundamental tradcoff in performance on our MACKGROUND-INVARIANGO vs. OBJECT-DISAL DISIAAAIIUUATTOON tests. This poses a problem for past work, which far has only evaluated on setting or the other. We show that methods focusing on BEIKGROOUNDINVARIANN
[2, 38, 21, 42] will hurt performance on OBJECT-DISAMBIOE DIMID-IIIAIIIITIIO without realizing it, and vice versa [29]. Following how human vision generalizes, we should aim for a single computer vision system that generalizes well to both OOD settings.
Second, we test the Factorization and Feature Weighting hypotheses by training a population of models on two standard benchmarks, COL.OROBJECT and SCENeOBJECT [51, 27]. For each model, we measure factorization using interpretability methods including linear probes, representational sim- ilarity analysis [20], and a geometric analysis [28]. To test for feature weighting, we measure model sensitivity to foreground vs. the background. We do so by randomly switching the foreground or back- ground and measuring the relative differences in the changes to model representations. Results show that more factorized models with appropriate feature weighting tend to achieve higher performances on both OOD settings, meaning they adaptively use the context to generalize to novel settings. We further confirm this finding by causal analysis where we directly manipulate model representations.
Third, we design novel objectives for improving model generalization on BACKGROUND- INVARIANCE and BAJECT-DISAMBIGH and feature weighting analysis. In order to encourage model factorization, we augment the data with random-backgrrund and background-only images (using ground-truth masks or pseudo-masks from SAM [19], and we weigh the corresponding objective terms to encourage appropriate feature weight- ing of the foreground and background information. On two benchmark datasets, our method improves significantly over strong baselines on one OOD setting while matching performance on the other.
tests, motivated by the results of our factorization
We summarize our main findings as follows:
1. We show that models that do better on BEAKKGROUND-NNVAIIANN tend to do worse on OBJECT- DISAMBIGUATION and vice versa, highlighting need to design systems that generalize across both OOD settings, similar to biological vision (Sec. 5).
2. We obtain both correlational and causal evidence for our Factorization and Feature Weighting hypotheses: more factorized models achieve better OOD generalization, and this requires models to assign appropriate weight to foreground features over background features (Sec. 6).
3. We design new model objectives motivated by the Factorization and Feature Weighting hypotheses. We find these objectives achieve a Pareto improvement over strong baselines, increasing performance on one OOD setting while matching performance the other (Sec. 7).
2 Related Works
Evaluating vision model generalization. Much research has evaluated the generalization capabilities of vision models in various OOD settings [37, 13, 12]. In particular, several benchmarks have been proposed for evaluating OOD generalization, such as ImageNet-C and ImageNet-9 [15, 46). However, most prior works fail to test on OOD settings where spurious features like background are beneficial [38, 2, 21]. Liu et al. [29] test on an extreme version of OBJECT-DISS DISAMBIGUATION, where the fore- ground object is completely masked out, but they do not test the OOD setting where backgrounds are irrelevant. We evaluate vision models on two kinds of OOD settings where the context is either helpful or irrelevant. To our knowledge, no prior works have evaluated models in both settings.
Understanding how vision models generalize. Various works have explored the relationship between model properties, inductive biases, and generalization capabilities [32, 50, 16]. Many recent works try to predict OOD performance using in-distribution
(ID) measures like model invariance and smoothness [45, 10, 33], but they do not control for in-distribution accuracy which has historically been the best predictor of OOD accuracy [43]. More recent work that controls for ID accuracy suggests that properties like model invariance, calibration, and robustness do not predict OOD generalization
3

---

(Iajin distribution
(1b) Beckground-
(1c) Object
(Zajiin distribution
(2b) Background
(2c) Object- Disambiguation
Inverience
Disembiguation
Invanance
ColorObject
(2) SceneObject
Figure 2: The visualization of COLOROBJECT (left) and SCENEOBJECT (right) datasets and their corresponding OOD test sets. For in-distribution sets (Ia, 2a), there are certain natural co-occurrenes probabilities between the foreground object classes and the background classes (e.g. 80%, shown by the random background of the last column of (la, 2a)). For BACKGROUND-IN INARIANCE sets (Ib, 2b), there is correlation between the foreground and background. For ORJECT- DISAMBIGUATION sets (1c, 2c), there is a perfect correlation between the foreground and the background classes, but the foreground objects themselves are hard to recognize due to natural corruptions
better than ID accuracy [47]. Moreover, past analysis is generally correlational in nature. In this paper, we use interpretability methods measure factorization and feature weighting metries in vision models and analyze both correlational and causal relations to generalization in our two OOD settings. We do not know of an analysis that demonstrates a causal relationship between model properties and OOD generalization. In their review, Bengio et al. [5] hypothesize that models with more factorized representations should generalize better, but they do not test this experimentally. Our work provides empirical support for this claim specifically for the adaptive use of context for generalization.
Improving generalization. Various methods have been proposed to improve the OOD generalization of deep learning models. One line of research relying on metadata of multiple training domains to learn the causal (or 'invariant') features from multiple domains [36, 2, 40, 42]. Other methods make use of data augmentation to improve both ID and OOD performances, like MixUp [52]. CutMix [48], and AutoAugment [9]. However, these works do not test on OOD settings where spurious features like background are beneficial. We show in Sec. 5 that methods designed to learn causal features either do not improve or even hurt the performances in the OBJECT- DIS MMSIGAATIOO setting. Our augmentation method is built on the insight that both causal and spurious features can be useful, and these features need to be weighted properly so that the models can generalize to both OOD settings.
3 Problem Setup: Two OOD Generalization Settings for Vision Models
Here we introduce the training and testing environments that we would like vision models to perform well in, inspired by biological vision systems. Specifically, we consider scenarios where there are test-time shifts in (I) the correlations between foreground objects and background contexts and (2) the reliability of causal features (features of foreground objects), which can be corrupted by shifts in image lighting, blurring, object occlusion, or other sources of noise. We show an illustrative example in Figure I: the butterfly easily recognizable regardless of the background; the keyboard looks like a white blob in isolation but can be easily recognized when put in context. We use train and test sets constructed based on these scenarios to understand how vision systems can effectively use both the causal features of the foreground objects and the spurious features of the background contexts to adaptively generalize to domain shifts.
Notation. We use X and Y denote random variables of the input and the output, while and y denote data samples. We assume there is set of environments & (instantiated as datasets), which can be divided into in-distribution (ID) and oft-s--distiibutio (OOD) sets: Eid, Ensi C E. The models are trained on Eid, and our goal is to learn function f X + Y that generalizes well to Eood-
Data construction process. We consider settings where the inputs X from environment are generated from latent variables z;; Z;, where 2 denotes the causal foreground class while Z denotes the spurious background class. The label Ye is equivalent to Z5 (analogous to e.g. an object recognition task where the label the object identity). The input x contains both causal features (foreground object) x. and spurious features (background context) x,. For each sample

---

= 2 and 2 = 2g. we generate causal and spurious inputs by x = GG(zz) and (zT), where G, and G2 are maps from the latent space to the imput space. We then corrupt the causal features with the random function & (for example, by blurring or adding noise to the image). Finally, we generate the complete input x G()(x,), x.), where G combines the causal and spurious features (e.g. overlays a foreground object onto background image). Each environment differs in its co-occurrence probability Peo between : and Zz. and the level of corruption applied to the causal features x.. For ID environments eid E E, we assume high co-occurrence probability and no corruption in the causal feature, identical to past works [38, 51].
Two OOD Settings. For OOD environments Good E E, we use two particular settings where the spurious background features are either irrelevant or helpful. We call them BACKGROUND- INVARIANCE and OBJECT-DIS DOUECT-DISAMBIGUTTUON for vision datasets, we need additional annotation of the background classes and the segmentation mask of the foreground objects. We assume we have access to these metadata in all our experiments.
settings, respectively. To create these OOD settings
setting, foreground objects are randomly paired with background contexts (the co-occurrence probability Peo = 0). We assume there is no noise to the causal features in this setting (ø is an identity function). Here, models need to mainly rely on the causal features X. to achieve good performances. See Figure and 2 for examples.
CCCKGROUND-NVARIAAN
In our BACKGROUND-INNAAAII
In our DBJECT-DDSAMBBIUATTON setting, the noise level of the causal features is very high while the co-occurrence probability is also high (like it in natural images). Here, models need to learn the correspondence between the foreground and background features and make use of the spurious contextual features x, to achieve good performance. That is, models must mimic how humans rely on context for object recognition given that objects in the real world can vary significantly appearance due to factors such as lighting conditions, occlusions, and viewpoint changes [6, 17, 44, 35]. Contextual information, including scene layout, spatial relationships, and semantic associations allows humans to make educated guesses and disambiguate the identity of objects. For example, in Figure 1, the keyboard itself is highly blurred and hard to recognize, but it easily recognizable in context. Also see Figure 2 for examples in our datasets.
OBJECT-DISAMBIGUUS
4 Experiment Setup
Datasets. We conduct our analysis and experiments on two standard benchmarks, COLOROBIECT and SCENEORJECT [38, 51J. The datasets and their experimental settings follow the conventions in the IRM literature [2, 21, 38). but we add novel OBJECT-DISAMBIGGU DISA-IIIAAIIAATION test by using the available metadata. Please refer to Appendix A for further details of the experimental settings.
To set up the COLOROBJECT dataset, following prior works [51], we build biased dataset using 10 classes of objects selected from MSCOCO dataset [26], which are then superimposed onto 10 colored backgrounds. We set a one-to-one relationship between the foreground classes and the background colors. The co-occurrence probabilities Peo are 1.0 and 0.7 for training (i.e., data from these two environments make up the training data), 0.0 for BACKGROUND BAAKGGROUN-INVARIANNCE INVARIANCE, and 1.0 for ORIRCT-DDSSAMBICUUATON (see Sec. for definitions). To create the OBJECT- OBJECT-DISAMEN DISAAIIIAAAAOOO setting for COIOORBBIECT dataset where the object itself is hard to recognize, we apply 15 kinds of natural corruptions (like motion blur, contrast change, and fog and snow effects) from Hendrycks and Dietterich [15] to the foreground object before superimposing it the background image. The natural corruptions come in levels, and we use the average accuracy across 5 levels as the final result. There are 16000 images for training, 2000 for validation, and 2000 for each of the test sets. See Appendix for accuracies across different levels of distribution shift. C. See Figure for examples of ID, BACKGROUND BACKKGROUDD-LVARIANCEE INVARIANCE, and OBJECT- IGUATION images.
To set up the SCeneOBJect dataset, following prior works [51], we use objects from 10 classes of the MSCOCO dataset and superimpose them onto scene background from 10 classes of the Places dataset to create the SCEnFOBJECT dataset [54, 26). We bind each object category to one scene category. The rest of the data construction is the same as for COLORORJECT, except for that the co-occurrence probabilities Peo are 0.9 and 0.7 for training COLOROBIECT. See Figure for examples.
Model Population. Following prior works, we use Wide ResNet 28-2 for the two datasets [49]. Using this model backbone, we train models based on the following methods: empirical risk minimiza-
5

---

tion (ERM), IRM[2]. VREx[21]. GroupDRO[38], Fish[42], MLDG[25), and our own augmentation method (described Sec. 7). The models are trained on a fixed set of training enviromments using different loss functions, random seeds, and other hyperparameters. Note that, across datasets, the noise level and the Peo in the training sets do not cover the noise level and the Peo in the two OOD test sets, so the OOD test sets remain nut-of-distribution. We trained total of 340 models, 170 for each of COLOROBJECT, and SCENEOBJECT datasets. See Appendix for more details.
5 Negative Correlation Between BACKGROUND-IVAARIACE and OBJECT.DISSMMIIUUATIN Accuracy
Design. In this section, we evaluate population of models in our two OOD settings where the background is either helpful or irrelevant, namely BACKGROUND-INVARIANE DISAMBIGUATION. As far as we know, no previous work has evaluated models along both of these dimensions of generalization. We use the population of 170 models for each dataset, described See. 4. We aim to compare how models tend to perform the two OOD settings.
and OBJECT-
Results. As shown in Figure- 3, models that perform better the BACKGROUND- INVARIANCE setting tend to perform worse on the OBJECT-DISAMBIGUNA
ColorObject
SoinaObject
0:975
Osjec QHick-taambaquum atttmmiuuutio
0.75
$0.550
setting, and vice versa. The Pearson correlation coeffi- cients are -0,938 for COLOROBJECT and -0.877 for SCENEOBJECT, showing strong nega- tive correlation between the performances in the two OOD settings. The results are con- sistent when using a Transformer-based model (Swin) and across training sizes as well (see Appendix Table 7) [30]. Additionally, we find that methods designed to learn causal features, such as IRM, VREx, GroupDRO, Fish, and MLDG, demonstrate improved performance in the BACKGROUND INVARIANCE setting, but they significantly hurt OBJECT- BEEECT--DSAMBEE DISAAMIIAAAAATIIA ERM and four of five lower performances on SceneObject (see Appendix Table 3). These results highlight the need to make choice about the tradeoff between foreground and background depending on the environment that is expected for deployment.
0.332
0.70
0.875
2.65
30.450
R36 Parelo Frosterr
2.60
[m-0.377
Purcto Frunc
51
02 5.
0:30 5.15 0.00 0.5
Backgrourd moadanne
Backyssunddrwwreeee
Figure 3: BACKGROUND-INAARIANCE OBJECT-DISAAIIIUUTTON performances of all models in the COLOROBJECT (left), and SCE- NEOBJECT (right). Models that do better in one OOD setting tend to do worse in the other, showing strong negative correlations.
vs.
performance COLOROBJECT compared to
6 Understanding OOD Generalization: Which Vision Models Generalize
Better And Why?
In this section, analyze why some models generalize better than others by testing the Factorization and Feature Weighting hypotheses (see Sec. 1). We do this through a regression analysis that shows that metrics for model factorization and feature weighting help predict OOD generalization, while controlling for in-distribution accuracy and model objectives. We also show that the relationship between the metrics and OOD generalization is causal by directly manipulating feature factorization and feature weighting. Later in Sec. 7, we leverage this analysis to improve model generalization via new objectives. We the same datasets and population of models the previous section (Sec. 5).
6.1 Regression Analysis
Using our population of models, we a fit simple linear regression that predicts model's average accuracy between the two OOD settings based on several metrics measured on ID test data. Each metric can be measured for given hidden layer of a model; we measure each metric across the 3 blocks of Wide-ResNet and include each measurement as a variable in the regression. As result, we have 9 factorization metrics and 4 feature weighting metrics (see Appendix B for the full list). In total, the regression variables we consider include IDD accuracy, model objectives, and our proposed factorization and feature weighting metrics. For each dataset, a bootstrap with 10k samples,

---

using 80% of the 170 models for training and 20% for testing, to obtain an average test R regression value that we report along with its standard deviation.
Factorization Metrics. We measure model factorization using three metrics described below. These metrics are computed on representations from a given hidden layer of the model.
1. Linear Probing. To measure factorization with a linear probe, we first create foreground-only and background-only imputs using segmentation masks available in our datasets. We then extract model representations and predict the foreground or background class with a linear model. That is, if there are 10 foreground and 10 background classes, we train a linear classifier to do 20-way classifications. The probe classification accuracy measures factorization because if the model represents foregrounds and backgrounds in overlapping subspaces, the linear classifier will mix up the foreground and background classes, leading to low decoding accuracies [28].
2. Representation Similarity Analysis (RSA). RSA is method for measuring the separation of inter-class representations and closeness of intra-class representations, which yields more fine-graine' information than linear probing [20, 34]. Again, we extract model representations using foreground-only and background-only inputs. Then we compute pairwise similarities of the extracted features with Euclidean distance, giving a Representation Dissimilarity Matrix (RDM). We then calculate the correlation between the model RDM and a predefined reference RDM, which represents the ideal factorized representation structure where each foreground/backkroundd class has small intra-class distances and large inter-class distances. For details and figure of the reference RDM, see Appendix B.
3. Geometric Analysis. While linear probing and RSA are influenced by class separation within each foreground/backgroundd subspace, a geometrie method may more directly measure factorization independently of this class separation. We adopt the method from Lindsey and Issa [28]. For complete details, see Appendix B, but in short: we compute the factorization of foregrounds against backgrounds as factorization,, fg
salta where var denotes the variance in the var representation space induced by foreground perturbations and var ig denotes the variance induced by foreground perturbations within the background subspace. If representations factorized, changing foregrounds should not affect the background representations, so var falhy should be near zero, and factorization,, fg will be near 1.
Feature Weighting Metric. We propose new method, called the Bnreground-Backgreee Pertur- bation Score (FBPS), to measure the relative weight that a model assigns to foreground features vs. background features. First, drawing on ID test data, we create a set of inputs with random foreground and backgrounds. Then, we randomly switch the foreground of each input to get X Xig flipped and measure the distance in model representations (or outputs). 8fg dist(f(X). f( fl_ppepd)) with dist as the L2 distance (or KL divergence for model outputs). Similarly, we randomly switch the background contexts to create flipped and measure the change in model repre- sentations dng = dist(f(XX,, f f(Xng (lippea)) Finally, we compute the difference in these terms FBPS 8زg dag. This approach yields four measurements per ResNet, one per block of the model and one for the model output. This metric is computed and averaged over 5000 samples. See Appendix B for more details.
Results. In Table 1, report R2 values for regressions predicting the average of the BECKGROUND-INVAARIAN
Table 1: Regression analysis between metrics and the average OOD accuracy. Confidence intervals are one standard deviation over 10k bootstrapping.
and OBJECT- DISAMBIGUATION accuracies, based on a population of models trained on each dataset. The ID accuracy alone obtains an R²2 of 191 and 0.691 on the two datasets, respectively. The model objectives serve as a control here.
R² predicting average 0OD Acc
Metric
COLOROBJECT
SCENEOBJECT
ID Acc
0.191+0.150
0.691=0.091
+ Obj.
0.505+0.1 106
0.69620.084
showing significant improvement over ID ac-
+ Obj. & Factor.
0.925+0.023
0.838=0.044
curacy alone. Meanwhile, adding either fea-
+ Obj. & Ft. Wgt.
0.961
0.857=0.043
ture factorization or feature weighting met-
+ AAll
0.963+0.010
0.868+0.041
rics can significantly improve R² in predict-
ing average OOD accuracies. But adding feature factorization and feature weighting metrics
together achieves extremely high R² values of 0.963 and 0,868 for predicting OOD accuracy
7

---

Background-lnvarianee
Object-Disambiguation
Normalized Avg OOD
97.5
56
95.0
55
50
Acc (96)
90.0
54
40
87.5
83.0
62.5
52
0.05
0.05
0.05
0.05
0.00
0.05
0.10
Weighting
Figure 4: Feature Weighting vs OOD Accuracies. The three plots show the relationship between feature weighting metrics and BACKGROUND-LLVARIA. average OOD accuracies in COLOROBIECT, The green lines show the mean and one standard deviation of each bin of data. As models weigh foreground features more, the performance increases in BACKGROUND SI---INVARRAN VARRIANE and decreases in OBJECT- OBJECT-DISAMBIGUAN DISAMBIGUATION, resulting in an initially increasing and subsequently decreasing average OOD performance. We observe the same trend in SCeneOBJeCT as well (see Appendix C).
OBJECT-DISAMBIGUATI
and the
the two datasets. We note that in past studies, various model properties do predict OOD general- ization better than ID acc does [43, 47J. See Appendix C for additional regression visualizations and results in individual OOD settings. Overall, our results suggest that both feature factorization and feature weighting play important roles in models' adaptive use of context.
In Fig. 4, show the relationship between feature weighting metrics (as measured by FBPS at the final hidden layer of the Wide-ResNet models) and OOD generalization performances in COLOROBJECT. We observe that the feature weighting metric increases, the performance increases in BOOKGROUND-INVARIANNE
and decreases in OBJECT-DISAM DISAMBIGUATIONN resulting in an initially increasing and subsequently decreasing average OOD performance. The trend is the same in SCENEOBJECT too (see Appendix C). This shows that generalization is maximized at a specific feature weighting level, suggesting the need find an appropriate weight between foreground and background features. We show that this relationship is also causal in the next subsection.
6.2
Causal Manipulation Analysis
Apart from the regression analysis, we also manipulate factorization and feature weighting in the representational space directly to show their causal effects on performances. We conduct these experiments with 10 ERM models, for both datasets.
Factorization Manipulation. Following Lindsey and Issa [28], directly manipulate the factor- ization of the model representations. We first identify foreground and background subspaces and then rotate the model representations that the foreground subspace overlaps more with the background subspace. This transformation directly decreases the feature factorization while holding constant other representation properties that may affect model accuracy [28] (full details in Appendix B). As this intervention applies to the final hidden states of the model, we compute model predictions by applying the linear classifier layer to the transformed representations.
Feature Weighting Manipulation. We manipulate the feature weighting by manipulating the variance in a certain subspace, which would bias a linear classifier with L2 regularization to rely on that subspace more (higher variance) or less (lower variance) [14, 41]. We do so by computing the importance, with respect to subspace of interest (foreground or background), of each feature in the original space and manipulating them by boost factor g. Note this step followed by retraining the final classifier layer using the adjusted hidden representations. See Appendix B for full details.
Results. After we rotate the data to overlap the foreground and background subspaces, feature factorization (measured by the geometric method) drops significantly in SCENEOBJECT, as expected. As result, the generalization performance in BACKGROUND-INWARRR decreases while the

---

0.0200
100
1.0
Before intervention
0.0175
0.016
After intervention
82.50
90
0.0150
80
Change OOD Acc (9)
00 rccuu oy 198
Factorization
0.0125
0.0100
0.0075
43.18
-0.5
0.0050
35.30
40
0.002
0.0025
30
-1.0
Backgound-Invariane
Object Disambiguation
0.0000
20
Factorization
Background Invariance
Object Disambiguation
Decrease
Decrease Background
Foreground
(a) Factorization manipulation
Feature weighting manipulation
Figure 5: Causal intervention results using 10 ERM models in SCENEORIECT. (a) Rotating the foreground subspace into the background subspace has the effect of reducing model factorization and changing the OOD accuracies opposite directions. Lighter-colored bars show metries after the intervention. (b) Decreasing the foreground (or background) subspace by a factor of 64 has the accuracy and improving (or hurting)
effect of hurting (or improving) BACKGROUND-INVARIIAN OBJECT-DISE BBJECT-DSAMBIIGUATOO accuracy. We observe the same trend in COLOROBJECT (see Appendix Fig. 11).
performance OBBECT-DISAMMIIUUXIOO increases. This is also expected since the less fac- torized model conflates foreground and background information, and background information is irrelevant for BACKGROUND-INVARI..
but perfectly correlated with object identity in OвJECТ- DISAMBIGUATION. Shown in Fig. 5(a), the factorization metric drop by 85.63% (paired t-test: p<lle-8), and the BACKGROUND- VARIANCE performance drop by 18.24% (p<lee-4), while the OBJECT-DISS DISAAIIIIABAITIIO performance increases by 5.97% (p< 1e-).. Therefore, conclude that the change in performance is a causal result of decreased factorization. For results on COLOROBJJCCT, see Appendix C.
As shown in Fig. 5(b), when we decrease model weight on foreground features, the BACKGROUND- INVARIANCE performance decreases by 0.63 points (paired t-test: p<le-5) while the OBJECT- DISAMBIGUATION performance increases by 0.68 points (p<le-5) SCENEOBJECT, This shows that increasing the feature weighting of foreground over background causally helps in BACKGROUND- In other direction, when we decrease reliance on background features. the BACKGROUND- INVARIANCE performance increases by 0.35 points (p = 1c-3) while the OBIECT-DISAMBIGUATTE performance decreases by 0.92 points (p<c le- 5). showing that decreasing the feature weighting causally hurts BACKGROUND-INE BINEROUND-INVRIINNCE INVRIANCE gener- alization but helps in
INVARIANCE but hurts in
These results highlight the dichotomy between the two OOD settings test, since interventions improve performance in setting while hurt in the other. This trend expected since the background is irrelevant in (where decreasing the background importance helps), while the background helpful in OBJECT- DISAMBIGUATION (where decreasing background importance hurts). Overall, our results show the causal effect of feature weighting on model generalization, further strengthening our hypothesis.
Proposed Methods: Objectives for Adaptive Contextual Perception
Finally, in this section, we propose an augmentation method for improving the generalization ability to both OOD settings, based on our analysis in Sec. 6. Like prior methods [18, 11], our approach leverages additional annotations, including background identity and segmentation masks of foreground objects, which are available in our COLOROOJJCC and SCENeOBJECT datasets. We also experiment with using Segment-Anything (SAM) to automatically generate segmentation masks to alleviate the need for additional annotation and achieve similar performances (see Appendix C.4 [19].

---

Table 2: Accuracy of our proposed method (plus/minus one standard deviation over 10 seeds). OOD1
denotes BACKGROUND--NVARIANG. and OOD2 denotes OBJECT-DISAMBIGUATII
COLOROBJECT
Method
ID
OODI
OOD2
Avg OOD
Factorization
FBPS
ERM
87.15+0.40
29.11=3.39
95.24+0.83
62. 17.1771.40
71.27=1.14
0.012+0.013
Best Baseline
88,48:0.85
41.13=7.27
92.65+2.37
66.89+2.73
72.87=1.58
0.044+0.027
Ours
87.45+0.48
42.97=3.02
92.02+1.06
67.50=1.80
76.93+1..3
0.047*0.018
SCENeOBJECT
Method
ID
OODI
0OD2
Avg OOD
Factorization
FBPS
ERM
72.28+0.93
35.37=1.97
71.93+1.27
53.65=0.70
64.07=0.98
0.000#0.006
Best Baseline
73,47=0.79
36.91=1.49
71.30+0.74
54,11=0.61
04.95=0..85
0.005#0 005
Ours
74.13+0.48
36.83#1.34
73.86+1.11
55.34+0.51
68.22*1.01
0.011+0.008
Augmentation Objectives. Our augmentation method consists of two parts: random-backgrount and guckkround-only augmentation. First, we extract the foreground object from an image and combine it with randomly chosen background segmented from another image in the batch. This process encourages the model to recognize the object regardless of the background.
The cross-entropy loss for these images is denoted as Lgg- Second, we create background-ong images by replacing the foreground objects with black pixels and then ask the model to predict background labels. This prevents the model from ignoring all backgrounds so that it can still rely on the background when the foreground object hard recognize. We denote cross-entropy loss for background-only images as Lbg. The final loss is: L = atak + o1L + 0.2Log. where Ltask the task loss and og 0tj and 02 are scalar weights for different losses. By adjusting the value of co, 01, and a2, we can find the optimal balance among the original task loss and two augmentation types, enabling the model to learn more effectively from both background and foreground features and adaptively generalize to the two OOD settings. See Appendix A for method and tuning details.
Our proposed augmentation method demonstrates significant improvements in both ID and OOD accuracies compared to ERM and the best baseline, Fish [42]. On COI,ORORJECT, we match the best baseline on both OOD settings. Here, ERM still does better on OBJECT-DISAMRE DISAMBIGUATION, but on average OOD accuracy, our method improves over ERM by over 5.6 points, matching the best baselines. On BCENEOBJECT, we match the best baseline on BACKGROUND-INVARIAN while significantly improving over it by 2.5 points OBJECT-DISAMBIGUATTEI where no other baseline methods can beat
Results.
We also improve
upon ERM by 1.9 points on ERM. We also improved the average OOD performance by 1.2 points over ERM and other baselines. We get similar improvements over baselines for our method with aseudo-masks generated by SAM (see Appendix Table 6). And the improvements are even sizes (also see Appendix Table 6). In both datasets, our method improves over ERM or the best baseline feature factorization and feature weighting, suggesting causal relationship between these model properties and model generalization. For results of varying combination weights for the two augmentations, Appendix C.4.
significant with smaller training
8 Conclusion
In summary, we find that: (1) Vision models face a tradcoff in performing well on BACKGROUND- INvarIancE and OBJECT-DIE SIEEECT-DIAABBIEE DISAMMBIUATIOO tests. By evaluating population of 170 models, we find a strong negative correlation coefficient of about r 0.9 between the accuracies for each OOD test. (2) OOD generalization in models is explained by the Factorization Hypothesis and the Feature Weighting Hypothesis. In our correlational analysis, metries for factorization and feature weighting are highly predictive of OOD generalization (R² up to .96, controlling for in-distribution accuracy). In our causal analysis, we find that directly manipulating factorization and feature weighting in models allows us to control how well they generalize. (3) Lastly, we propose data augmentation methods that achieve Pareto improvements over strong baselines, as they are able to improve either BACKGROUND- VARRINNC OBJECT- BIAECTT-DDAABGGAAAAAAAI without hurting the other setting.
10

---

Acknowledgements
We thank Jack Lindsey and Elias Issa for valuable discussion regarding the causal analysis. This work was supported by ARO Award W911NF2110220, DARPA Machine- Commnns--ommnsensee (MCS) Grant N66001-19-2-408
ONR Grant N00014-23-1-2333 DARPA ECOLE Program No. HR001 12390060, and Google PhD Fellowship. The views contained in this article are those the authors and not of the funding agency.
References
[1] Faruk Ahmed, Yoshua Bengio, Harm Van Seijen, and Aaron Courville. Systematic generalisa- tion with group invariant predictions. In International Conference on Learning Representations, 2021.
[2] Martin Arjovsky, Léon Bottou, Ishaan Guirajani, and David Lopez-Paz. Invariant risk mini- mization, 2020.
[3] Moshe Bar. Visual objects in context. Nature Reviews Neuroscience, 5(8):617-629, 2004.
[4] Moshe Bar and Elissa Aminoff. Cortical analysis of visual context. Neuron, 38(2)3347-358. 2003.
[5] Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8): 1798-1828, 2013.
[6] Irving Biederman. Recognitoon-by--omomenn Psychological review, 94(2):115, 1987.
theory of human image understanding.
[7] Stefania Bracci, Jakob Mraz, Astrid Zeman, Gaëlle Leys, Hans Op de Beeck, and Stefania Bracci. Object-scene conceptual regularities reveal fundamental differences between biological and artificial object vision. Center for Mind/Brain Sciences- CIMe,, 7:8, 2021.
[8] Madr-André Carbonneau, Julian Zaidi, Jonathan Boilard, and Ghyslain Gagnon. Measuring disentanglement: A review of metrics. IEEE Transactions on Neural Networks and Learning Systems, 2022.
[9] Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv: 2018.
[10] Weijian Deng, Stephen Gould, and Liang Zheng. On the strong correlation between model invariance and generalization. Advances in Neural Information Processing Systems, 2022.
[11] Hao-Shu Fang, Guansong Lu, Xiaolin Fang, Jianwen Xie, Yu-Wing Tai, and Cewu Lu. Weakly and semi supervised human body part parsing via pose-guided knowledge transfer. arXiv preprint 1805:1800.04311 2018
[12] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096-0300, 2016.
[13] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and hamnessing adversar- ial examples. arXiv preprint arXiv:1412.6677 2014.
[14] Trevor Hastie, Robert Tibshirani, Jerome H Friedman, and Jerome H Friedman. The elements of statistical learning: data mining. inference, and prediction, volume 2. Springer, 2009.
[15] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv: 12261, 2019.
[16] Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardr, and Dawn Song. Natural adversarial examples. In Proceedings of the IEFF/CVF Conference on Computer Vision and Pattern Recognition, pages 15262-15271, 2021.

---

[17] Andrew Hollingworth. Scene and position specificity in visual memory for objects. Journal of Experimental Psychology: Learning, Memory, and Cognition, 32(1):58. 2006.
[18] Ronghang Hu, Piotr Dollár, Kaiming He. Trevor Darrell, and Ross Girshick. Learning to segment every thing. In Proceedings the IEEE conference on computer vision and pattern recognition, pages
2018.
[19] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan- Yen Lo, et al. Segment anything. arXiv preprint 3rX1v:23044.02443, 2023.
[20] Nikolaus Kriegeskorte, Maricke Mur, and Peter A Bandettini. Representational similarity analysis-connecting the branches of systems neuroscience. Frontiers systems neuroscience, page 4, 2008.
[21] David Krueger, Ethan Caballero, Joern- Jacobsen, Amy Zhang, Jonathan Binas, Dinghuai Zhang, Remi Le Priol, and Aaron Courville. Out-of-distributis generalization via risk extrapo- lation (rex). In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 5815-5826. PMLR, 18-24 Jul 2021. URL https:/ httpp::/proceeddeeeeee /proceedings.... mlr press/ v139 / (1099//ruuggeee www.gereeeereeeee html.
[22] Xin Lai, Zhuotao Tian, Yukang Chen, Yanwei Li, Yuhui Yuan, Shu Liu, and Jiaya Jia. Lisa: Reasoning segmentation via large language model. arXiv preprint arXiv:2308.0088 2023.
[23] Tim Lauer and Melissa L-H Vo. The ingredients of scenes that affect object search and percep- tion. Human perception of visual information: Psychological and computational perspectives, pages 1-32, 2022.
[24] Tim Lauer, Verena Willenbockel, Laura Maffongelli, and Melissa L-H Vō. The influence of scene and object orientation on the scene consistency effect. Behavioural Brain Research, 394: 112812, 2020.
[25] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy Hospedales. Learning to generalize: Meta- learning for domain generalization. In Proceedings of the AAAI conference on artificial intelligence, 2018
[26] Tsung-Yi Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision-ECCV 2014: 13th Europeun Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pages 740-755. Springer, 2014.
[27] Yong Lin, Hanze Dong, Hao Wang, and Tong Zhang. Bayesian invariant risk minimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16021-16030, 2022.
[28] Jack Lindsey and Elias B Issa. Factorized visual representations in the primate visual system and deep neural networks. bioRxiv, pages 2023-04 2023.
[29] Xiao Liu, Ankur Sikarwar, Joo Hwee Lim, Gabriel Kreiman, Zenglin Shi, and Mengmi Zhang. Reason from context with self-supervised learning. arXiv preprint arXiv:2211 12.02227111117,, 2022.
[30] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF international conference on computer vision, pages 10012-10022, 2021.
[31] Oge Marques, Elan Barenholtz, and Vincent Charvillat. Context modeling in computer vision: techniques, implications, and applications. Multimedia Tools and Applications, 51:303-339, 2011.
[32] Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning, Advances in neural information processing systems, 30, 2017.
12

---

[33] Nathan Ng, Kyunghyun Cho, Neha Hulkund, and Marzyeh Ghassemi. Predicting out-of-domain generalization with local manifold smoothness. arXiv preprint (XXiv:2007002093, 2022.
[34] Hamed Nili, Cai Wingfield, Alexander Walther, Li Su, William Marslen- Marslen-Wilson, and Nikolaus Kriegeskorte. A toolbox for representational similarity analysis. PLoS computational biology, 10(4)=e000355, 2014.
[35] Aude Oliva and Antonio Torralba. The role of context in object recognition. Trends in cognitive sciences, 11(12):20-557, 2007.
[36] Jonas Peters, Dominik Janzing, and Bernhard Schölkopf. Elements of causal inference: founda- tions and learning algorithms. The MIT Press, 2017.
[37] Joaquin Quinonero-Canded Masashi Sugiyama, Anton Schwaighofer, and Neil Lawrence. Dataset shift in machine learning. Mit Press, 2008
[38] Shiori Sagawa*, Pang Wei Koh*, Tatsunori B. Hashimoto, and Percy Liang. Distributionally robust neural networks. In International Conference on Learning Representations, 2020. URL https:://peereet
net. forum? weeruumid=ryxxoe id=ryxuuJEEVS.
[39] Gergo Sastyin, Ryosuke Niimi, and Kazuhiko Yokosawa. Does object view influence the scene consistency effect? Attention, Perception, & Psychophysics, 77:856-866, 2015.
[40] Bernhard Schölkopf, Francesco Locatello, Stefan Bauer, Nan Rosemary Ke, Nal Kalchbrenner, Anirudh Goyal, and Yoshua Bengio. Toward causal representation learning, Proceedings of the IEEE, 10965)6612-634, 2021.
[41] Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014.
[42] Yuge Shi, Jeffrey Seely, Philip Torr, Siddharth N, Awni Hannun, Nicolas Usumier, and Gabriel Synnaeve. Gradient matching for domain generalization. In International Confer- ence on Learning Representations, 2022. URL. http:t/s::/// /tppss////ppeeeeeeeee net/ forum? id=
VDWBW4 HmO.
[43] Damien Teney, Yong Lin, Seong Joon Oh, and Ehsan Abbasnejad. and ood performance are sometimes inversely correlated real-world datasets. arXiv preprint UrXix:2209.00633, 2022.
[44] Antonio Torralba, Aude Oliva, Monica Castelhano, and John M Henderson. Contextual guidance of eye movements and attention in real-world scenes: the role of global features in object search. Psychological review, 113(4):766, 2006.
[45] Jindong Wang, Cuiling Lan, Chang Liu, Yidong Ouyang, and Tao Qin. Generalizing to unseen domains: A survey domain generalization. In Zhi-Hua Zhou, editor, Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pages 4627-4635. International Joint Conferences on Artificial Intelligence Organization, 8 2021. doi: /4496///jaai.222///663 URL httthttp///dde /do:: wrgg100/00. 24 24922/996332 piaaijjaaiia// .tt.caaii.......0 /28. Survey Track.
[46] Kai Xiao, Logan Engstrom, Andrew Ilyas, and Aleksander Madry. Noise or signal: The role of image backgrounds in object recognition. arXiv preprint arXiv:2006.0999 2020.
[47] Zhuofan Ying, Peter Hase, and Mohit Bansal, Visfis: Visual feature importance supervision with taab--fo-thh--rghh-ree objectives. In Advances in Neural Information Processing Systems, 2022.
[48] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choc, and Youngjoon Yoo. Cutmix: Regularization strategy train strong classifiers with localizable features. In Proceedings of the IEFE/CVE international conference on computer vision, pages 6023-6032, 2019.
[49] Sergey Zagoruyko and Nikos Komodakis. d:Xiv:1605.0714..200 2016.
Wide residual networks.
arXiv preprint
13

---

[50] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3): 107-115, 2021.
[51] Dinghuai Zhang, Kartik Ahuja, Yilun Xu, Yisen Wang, and Aaron Courville. Can subnetwork structure the key to out-of-distribution generalization? In International Conference on Machine Learning, pages
PMLR, 2021.
[52] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. Mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2017.
[53] Mengmi Zhang, Claire Tseng, and Gabriel Kreiman. Putting visual object recognition in context. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2020.
pages
[54] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A
10 million image database for scene recognition. IEEE transactions on pattern analysis and machine intelligence, 40(6):1452-1460 2017.
14

---

A Experiment Design Details
A.1 Dataset Details
Dataset License. Our datasets are created using MSCOCO and Places [26, 54], both under the CC BY 4.0 license.
Synthetic Dataset. We design a synthetic dataset for a clear demonstration of our hypothesis and results. Following the data generation process formulated in Sec. 3, we create synthetic data with distribution shifts in co-occurrence probability and noise in foreground features. The ground truth label Y and latent variables Ze, Z, are all in (0, 13. Y and Ze is sampled uniformly: Y= Ze ~ U((0,1)) The causal features x, and spurious features x, are generated from Gaussian distributions based on Ze and Z, respectively: Ie ~N( d²)
for 2 = i, and Fs N o?) for 2, = i. We choose continuous features and Gaussian distributions instead of binary features and Berouulli distributions like prior works [51, 27] model noise and the OBJECT-DIS DISAMIIDTSAIIII setting more easily, We set μ400 Pnr0 = 0.2, 1411 Marl 0.8, and ar onr = 0.2. The dimensions of inputs are 80 + 10 + 10 = 100 for useless, robust, and non-robust features respectively. We then add noise to causal features: e ~ ~N NN0 o²). Finally, we have irrelevant features x; that do not correlate with the label and are sampled from another Gaussian distribution: In, ~ NN o?)- Finally, we combine the noisy causal features, spurious features, and irrelevant features to create the complete inputs. In training sets, the co-occurrence probability Peo varies between [0.5, 0.98] and the noise level a between [0.6, 1.6) (see Sec. 3 for definitions). Each train set has 1000 samples. In BACKGROUND-INVARIANN setting, Peo = 1 and 1.5.
setting, Pco = 0 and = 0, while in OBJECT- DISCMBIATSSIIIU
COLOROBJECT. Following Ahmed et al. [1]and Zhang et al. [51], we superimpose objects from 10 classes in MSCOCO dataset onto 10 colors. The RGB values of the predefined colors are: [0, 100, 0). [188, 143, 143], [255, 0, 0]. [255, 215, 0), [0, 255, 0), [65, 105, 225], [0, 225, 225], [0, 0, 255], [255, 20, 147]. [160, 160, 160]. The object classes are: boat, airplane, truck, dog, zebra, horse, bird, train, bus, motorcycle. Each image has the size 3 x 64 x 64, and the dataset sizes are 8000 for the train set and 1000 for validation, ID test, and the two OOD test sets. Since we use two environments in training (Peo = 0.7), models see 16000 images during training. In the setting, Peo is set 0.0. In the BBJECT-DISAMBIGUS pco is set to 1.0, and we apply 15 kinds of natural corruption, each with 5 levels of severity, to the foreground images before superimposing them with the backgrounds.
setting,
SCENEOBJECT. Following Ahmed et al. [1], Zhang et al. [51], we superimpose objects from 10 classes in MSCOCO dataset onto 10 scene classes in Places dataset. The object classes are the same as COLOROBJECT, and the background scene classes are: beach, canyon, building facade, staircase, desert sand, crevasse, bamboo forest, broadleaf, ball pit, and kasbah. The co-occurrence probabilities Peo are set to 1.0 and 0.7. The image size and dataset sizes are the same as COLOROBJECT as well.
A.2 Model and Training Details
Model Architecture and Hyperparameters. For the synthetic dataset, we use simple MLPs with 3 hidden layers and 5 neurons each hidden layer with ReLU activation. We train each model for 750 epochs with SGD with learning rate of 0.1. The learning rate is decreased by a factor of 10 every 250 epochs. For COLOROBJECT and SCENEOBJECT, we use Wide ResNet 28 following prior works [49]. To adapt to the 64 by 64 image size, we change the average pooling layer window size from 8 to 16. The learning rate is set to 0.1, which is by factor of 10 for every 1500 update steps. The model updated with 4000 steps in total. The batch sizes are 128 and 64 for COIJOROJJCCT and SCEneOBJeCT respectively.
Tuning for Proposed Augmentation Method. We tune the weights for different objectives by fixing 0g 1 and 01 + 022 1 so that we can keep the same learning rate. We train on all combinations with a stride of 0.1 for an, 42 (ranging from 0.0 to 1.0). This results 11 conditions, and we train 10 models with different random seeds. Model checkpoints are selected based on in-distribution validation set accuracy. To pick one condition to report in Sec. Sec. and Table 2, we pick hyperparameter values for which our method matches the performance of the best bascline one
15

---

Model RDM
Reference RDM
1.0
250
250
0.8
500
500
Correlation=0.31
750
750
1250
1250
1500
1500
0.2
1750
1750
0.0
500
1000
1500
500
1000
1500
Figure 6: Framework RSA. We compute the model RDM and its correlation with the reference RDM, which is used as metric for factorization. Each cell in the RDM represents the dissimilarity between representations of two images (the value at the position (ł,j) represents the dissimilarity between representations of image i and image j). The diagonal cells represent the dissimilarity of each image with itself, which is always zero.
OOD test while improving the other (i.e. achieves Pareto improvement). These hyperparameters are 0 = 0.7 and 02 = 0.3 in both datasets.
Model Population. For the synthetic dataset, train 196 models in total. We vary the occurrence probability Peo in [0.7, 1.6] and noise level in [0.5, 0.98), yielding 200 environments, and we train model per environment. For COLOORBJJECT and SCENEOBJECT, models total. All methods are trained with 10 random seeds. Therefore, we have 60 models for the baseline methods (ERM, IRM[2), VREx[21], GroupDRO[38], Fish[42], and MLDG[25]). For our proposed augmentation method (see Sec. 7), we fix a1 + 02 = 1 so that we can keep the learning with 0.1 as the intervals and train 10 models for each,
train 170
rate the same. We then vary aj from which gives us 110 models.
Training Environments. All experiments are conducted using Nvidia RTX 2080 Ti. It takes about half an hour to train one Wide ResNet model. Simple MLPs are trained on CPUs.
B Analysis Details
B.1 Regression Analysis Details
We use factorization metrics and feature weighting metrics to predict OOD performances in linear regression analysis. We measure the three factorization metries (linear probing, RSA, and geometric methods) across the blocks of Wide-ResNet and our simply MLPs, giving us 9 metrics in total. We also measure the FPPS metrics across the 3 blocks and the final output probability layer. We use 1.2 distance for the 3 blocks and KI. divergence for the output layer, giving us 4 metrics in total. These metries are used predict OOD performances with 10k booststrapping.
Factorization Metrics Details.
Linear Probing. We first create foreground-omd and background-onj, images using ID test set data. We then extract model representations and predict the foreground or background class with a linear model. That is, if have n foreground classes and n corresponding background classes in total, we do 2n-way classification. We name this probing method probezn- The probing dataset size therefore 2000, twice the size of the test set. We compute average accuracy with 5-fold cross-validation and use it as the measurement of feature factorization.
RSA Analysis. We first extract foreground-ond and background-only features using test data with additional annotation. Then we compute pairwise similarities of the extracted features with Fuclidean distance, giving model Representation Dissimilarity Matrix (RDM) (see Fig. 6 for visualization). The RDMs have size of n by where n denotes the number of images in
16

---

the dataset. The value at position (i is the Euclidean distance between image i and image in the representational space. The diagonal values represent the dissimilarity of each image with itself, which is always zero. The reference RDM shows an ideal representational geometry. In the case of factorization, we want the images of the same class to have similar representations (dissimilarity=0), while images of different classes to have different representations (dissim- ilarity=I). Similar to the probing method, foreground and background classes are regarded as different classes in order to test the ability of the models to separate foreground features from back features (e.g. 20 classes in total for our COLOROBIECT and SCENEOBJECT datasets). We then compute the Pearson correlation between the model RDM and the reference RDM and use the r number as a metric for factorization. Note that since we do not normalize the model RDM. the absolute value of r is meaningless. In regression analysis where we are trying to predict OOD generalization, the relative differences among the r values are what matters.
Geometrie Analysis. Following Lindsey and Issa [28]. we compute the factorization of foregrounds against backgrounds as factorization,, = /alba, where var denotes the variance in the representation space induced by foreground perturbations and var denotes the variance induced by foreground perturbations within the background subspace.
var
To get var we compute the variance induced by the foreground perturbations. Specifically, for each of the 1000 test background images, we pair it with 100 random foregrounds and obtain model representations for each combined image. For each background image, we compute the scalar variance induced by the 10 random foregrounds by first computing the variance within each vector dimension and then summing over all dimensions. Then we average this per-background-imag variance over the 1000 backgrounds to get ya- Second, to compute var fol big need to find subspace for background information. To do so, we use the same set of background images paired with 10 random foreground images. We obtain special set of background representations from 1000 test background images, each paired with 10 random foregrounds. The representations are the average model representation per background image, averaged across the image's 's 10 random foregrounds. Then, we conduct PCA on this set of representations, and we select the top-k principal components get a subspace Uhg that explains 99% of the variance in the representations. Finally, to get var Jylbg- we project the representations of the 100,000 background plus random foreground images (same as used to compute var into the background subspace. For these projected representations, we repeat the process of computing a single scalar variance (as with sa) to obtain the variance induced by foreground perturbation the background subspace, var fglbg-
B.2 Causal Analysis Details
Manipulating Factorization We first compute the top-k PCs of the mean representation of each foreground class so as to explain 99% of the variance, referred to as the inter-class PCs Unnter Specifically, for each class, we have 100 foreground images, each randomly paired with 100 back- grounds. The mean representation of each class (class center) is the average representation of the 10000 images. Then we also computed the PCs of the data with corresponding class centers subtracted from each activity pattern, referred to as the intra-class PCs Unntra- Specifically, for each datapoint x, we subtract its corresponding class center from it: x' = x - c, where c, is its class center. Then we compute Unntra with all subtracted datapoints. Then, we transformed the data by applying to the class centers a change of basis matrix that rotated each inter-class PC into the corresponding (according to the rank of the magnitude of its associated eigenvalue) intra-class * Uniter. where U is the desired transformation, the rows of Uinter Unntra are sorted according to their eigenvalue, and pww_off_clseee classes (10 in our cases). We limit the intra-class PCs to its top-nwm_of _clases PCs since the number of classes is much smaller than the dimensionality of the extracted features and Unter has much fewer rows than Unntra This transformation has the effect of decreasing factorization while controlling for all other statistics of the representation that may be relevant to object classification performance (like invariance). Finally, after transforming the data by x * UT, we can measure the OOD performances and the factorization metrics and observe the causal relationship between them.
PC: U (Uintrll: : mam_of_ pf_cassssss)
is the number of
Manipulating Feature Weighting. To manipulate feature weighting, we first compute the subspace of interest (foreground or background) using PCA. Specifically, similar to the geometric method of measuring factorization, we compute the average representations of foreground/hackround images by averaging it over 100 images paired with random backgrounds/fforggrondd. We then conduct
17

---

Table OOD evaluation for baseline models. OOD1 refers to SIINGGROUND-NNVARIANIE while OOD2 refers to OBJECT-DISAMBICTATTI consistently improve generalization on BACKGROUND-IIVARIAACE settings, but are unhelpful or even hurt performances OBJECT-DISAMMIIUATTU settings. Confidence intervals are one standard deviation across seeds.
Prior methods focusing on learning causal features
COLOROBJECT
SCENEOBJECT
ID Ace
OODI Ace
OOD2 Acc
ID Acc
OODI Acc
OOD2 Acc
ERM
87.15+0.40
29.11
95.24+0.83
72.28+0.93
35.37+1.97
71.93+1.27
IRM
87.10+0.58
31.68=1.70
94.15+0.82
71.53=0.69
34.33+0.97
70.98+1.37
VREx
87.60=0.48
36.38+3.16 16
92.65+0.77
72.01=0.56
35.43+1.15
71.27
GroupDRO
87.47=0.70
40.92+3.72
90.58+2.06
69.71=0.67
34.18+0.96
68.19+1.15
Fish
88.48+0.85
41.13+7.27
92.6542.37
73.47=0.79
36,91
71.30+0.74
MLDG
87.90
36.5442.63
93.30#1192
73.7920.63
36.5941.01
72.2640.82
PCA on the average representations for both the foregrounds (Ufg) and the backgrounds (Ubg). Then, we compute the importance relative subspace of interest (foreground or background) e, for each feature in the original space, where i is the index of the feature. To do so, we sum up the absolute weights in the PCA transformation matrix weighted by the ratio of variance explained: Ej Ur j. vTj. where ffg i] refers the i-th weight of the j-th PC component and rj refers to the ratio of variance explained by the j-th PC component. We then normalize and multiply them by factor g to get the boost weights for each feature in the original space. Finally, we get the boosted feature Xboosted X e * g.
Since changing the variance of the data already has an effect on the accuracy of a linear classifier because of the L2 regularization, we control for this effect by computing the accuracy of boosting all features uniformly: Ncontrol = X*g. We report the differences in 5-fold of linear classifiers trained Xboosted versus Xcontrol- Note that if the foreground and background subspaces are overlapping. then boosting one will boost the other as well. But as long as the two subspaces are not completely overlapping,
validatiin performances
boost or decrease one of them more than the other.
C
Additional Results
C.1 OOD Evaluation
Methods focusing on learning causal features improve performance on BACKGROUND- INVARIANCE but lower perfomance on DBJJECT-DISAMBIIIATTOO As shown in Table 3, methods designed to learn causal features (e.g. IRM, VREx, GroupDRO, Fish, and MLDG) demon- strate improved performance in the BEAEGGGOUNDDNNVARIAAE setting, but they significantly hurt OBBECT-DISAMBIIUATOO performance on COLOROBIECT compared to ERM and four of five lower performances SCENEOBJECT.
OOD Evaluation with various training sizes. We evaluate performances with various training sizes (4k, 8k, 16k). As shown in Figure 7(a), sizes. In addition, the Pareto frontiers move outwards as the training size gets larger. With 8k data, the frontier is close to the frontier with 16k data, suggesting that the frontier is close saturation and that our argument is unlikely to be restricted by our training size.
clear Pareto frontiers across various training
OOD Evaluation on transformer architecture. We also evaluate performances on vision trans- formers (Swin-tiny) on the two OOD settings in SCeneObJect [30]. Since applying domain generalization methods (like Fish) to transformers requires a significant amount of hyperparameter tunings, we only evaluate a population of models trained with our augmentation method and baseline ERM. As shown in Figure 7(b), we see clear trade-offs between BACKGROUND-ING IIAIUNNND-IVAIANNNN and BIBCC-DDAAAMIGUAATTAIAA
for Swin-tiny, despite that they have significantly better performances than ResNets. This suggests that our argument is unlikely be restricted to particular architecture choices.
18

---

0.75
0.90
Object- Dicc-Diamiiigaiioo
Dulet-Disambiguaiin
0.70
0.89
0.65
0.88
0.60
0.87
0.55
4000
8000
0.86
0.50
16000
Swin Transformers
0.3
0.4
0.5
0.5
0.6
0.7
Background-Invariine
Background-Invariaee
(a) Pareto Frontier with Various Training Sizes
(b) Pareto Frontier with Vision Transformers
Figure Pareto frontier on SCENEOBIECT. We see clear trade-offs between BACKGROUND- INVARIANCE, and OBJECT-DISSAMBBGCATTO across different training sizes (4k, 8k, 16k) and for vision transformers (Swin-tiny) [30]-
Performances Across Different Levels of OOD. We present the results of baseline models (ERM, IRM, VREx. GroupDRO, Fish, and MLDG) across varying degrees of OOD settings in Fig. 8. For BOOKGROUND-INVARIANN
we run on varying levels of Pco 0.6, 0.45, 0.3, 0.15, 0.0. Here, 0.0 is the setting that we report in all other sections. Importantly. all these settings are considered OOD as the training environment Peo always at least 0.7. For OBJECT- BBJECT-DISAMBICE DISAMBIGUATION,, we present results on five distinct levels of corruption. The level of corruption here refers to the severity of the deviation from the original distribution, where a higher level signifies more extreme corrpption. We report the mean performance across these five levels in all other sections of this study, Across these diverse OOD settings, we observe that the performance of each model decreases as the settings become increasingly OOD. Consistent across different levels of OOD, other baselines can improve over ERM BACKGROUND-INWARIAN highlighting need to design systems that generalize across both OOD settings, similar to biological vision.
but generally hurts the performance in
C.2 Regression Analysis
Full Regression Results. We use 9 factorization metrics and feature weighting metrics total for our regression analysis. We use all metrics, together with the ID) accuracy and model objectives, to predict OOD generalization. combine all metrics into one single metric that correlates strongly with the average OOD performance. This single metric obtained by combining all metrics with weights from the linear regression that predicts the average OOD accuracy. The Pearson correlation between the average OOD accuracy and the combined metrics has r values of 0.926, 0.986, 0.952 for the synthetic dataset, COLOROBJECT, and SCJCE respectively. The regression weight and p value for each individual metric shown in Table 5. Note that different metrics have different scales, so the absolute values of the coefficients not comparable each other. The bold numbers are ones with p-values smaller than 0.05. ID accuracy, as well as our feature weighting metrics FBPS, is important in all three datasets for predicting OOD generalization. All three kinds of metrics of feature factorization useful in some cases (the RSA and geometric methods in COLORORJECT and the probing method in SCENEOBJECT), As shown in Table our factorization and feature weighting metrics significantly improve the ability to predict performances in all three settings: BACKGROUND-IVARIAUEE OBJECT-DISAMBIGUATII and average OOD.
visualize our regression analysis results, as shown in Fig. we
Feature Weighting Results on COL.RROBJECT. We observe the same trend SCENEOBJECT (in Fig. 10) as in SCENEOBJECT (in Fig. 4). As models weigh foreground features more, the performance increases in BEEKGGROUND-INVARIANN and decreases ORIECT-DDSSAMBIIUUTTON resulting in an initially increasing and subsequently decreasing average OOD performance.
19

---

ERM
Other Baselines
ColorObject Background-Invarien
SceneObject background-Inarrince
0.8
0.7
0.6
accuracy
0.6
accuracy
0.5
0.5
0.4
0.4
0.3
0.6
0.45
0.3
0.15
0.6
0,45
0.3
0.15
co-occurrence probability
co-occurrence probability
ColorObject Object-Disambiguation
SceneObject Object-Disambiguttin
0.80
0.95
0.75
accuracy
accuracy
0.90
0.70
0.85
0.65
0.80
level1
level2
level3
level4
level5
level1
level2
level3
level4
level5
corruption level
corruption level
Figure& 8: Performances across Different Levels of OOD settings. Confidence intervals are one standard deviation across 10 random seeds. As the test sets become more OOD, the performances for all methods drops (training co-occurence 0.7, e.g.). Other baselines sometimes improve in BACKGROUND-IVVARIANC but consistently hurt the performances in
Table 4: R2 for the regression analysis between metrics and BACKGROUND--VVARIINNE. ORJECT- DISAMBIGUATION, and the average OOD accuracy. Confidence intervals are one standard deviation over 10k bootstrapping. Bold numbers are p<0.05 with independent t-test.
COLOROBJECT
SCENEOBJECT
Metric
OOD1
O0D2
Avg OOD
OODI
O0D2
Avg OOD
ID Acc
0.162=00.37
0.067+0.118
0.191=0.150
0.238#0. 122
-0.036+0.078
0.691=0.091
+ Obj.
0.505=0.095
0,413+0.105 103
0.505=0.106 106
0.271#0.121 121
0.012+0. 104
0.69620.08.
Factor.
0.952=0.014
0,900+0.030
0.925=0.023
0.780=0.06 0.06
0.798=0.048
0.838=0.044
Ft. Wgt.
0.981=0.006
0.856+0.033
0.961+0.013
0.977+0.006
0.905+0.027
0.857=0.043
All
0.985+0.004
0.915=0.024
0.963+0.010
0.978:0.006
0.93620.021
0.868+0.041
C.3
Causal Analysis
Causal Analysis Results on COLORORJECT. For the causal analysis on factorization in COL- ORÖBJECT, we see a similar trend to SCENEOBJECT in that both the factorization (as measured by the geometric method) and the BAAKGGOONN-INVARINNNN However, the OBJECT-DIAAMIIIATTE
performance decrease significantly. accuracies remain the same as opposed increasing. This is because the decoding accuracies of linear classifiers on backgrounds are near the ceiling (100%) both before and after the causal intervention, which result of the backgrounds (10 pure colors) being too easy to decode. For the causal analysis on feature weighting in COLOROBJECT, we observe the same trend as in SCENEOBJECT: when we decrease the foreground (or background) features, the BACKGROUND-INNARIIAAA DISAMBIGUATION performances increase (or decrease). All results are significant (paired t-test p<le-3).
performances decrease (or increase) while the OBJECT-
20

---

Synthetic dataset
ColerObject
SceneObject
Lincar rw0.926
r=0.552
0.74
0.58
Reerepeed DGD accumeyy
Average 000 ScCuaCy
0.70
Average accurery
0.56
0.70
0.65
0.08
0.00
0.52
0.64
0.55
0.30 0.34
Factortation Weighted
Factorization Weighted Evidence
Factortation Weighted metrics
Figure 9: Correlation between combined metrics and combine OOD performance, A dot donates a model. The axis is the combined metrics, including ID accuracy, objectives, and all factorization and feature weighting metrics. These metrics are combined with weights from a linear regression. The y axis is the average OOD performance from the two settings. The green lines are fit by linear regressions, and the shaded areas are 95% confidence intervals. We can observe strong correlations between the combined metries and the combined OOD performances across the two datasets.
Table 5: Regression Weight and Value. We have 9 metrics for measuring factorization and metrics for feature weighting. The p-values are put in brackets. Confidence intervals are one standard deviation across 10k bootstrapping. Bold numbers ones with p-value smaller than 0.05. Note that different metrics have different scales, so the absolute values of the coefficients are not directly comparable.
Regression Coeffcients & p-value
Synthetic
COLOROBJECT
SCENEOBJECT
ID Acc
0.044+0.039
(p=0.242)
18803+0.122 (p=0.000)
0.78220.059
(p=0.000)
probing_laye layer!
-0.057+0.019 (p=0.005)
-0.151+0. 108 (p=0.160)
-0.027+0.02
(p=0.357)
probing layer2
0.03920.030
179)
-0.200a0. 104 (p=0.060)
0.128+0.038
(p=0.001)
probing_lay layer3
00008=000026
(p=0.762)
-0.013+0.11 117 (p=0.907)
0.338#0.053
(p<0.001)
RSA RSA_aayer
0.126=0.025 (p<0.001)
0.17220.039
(p<0.001)
-0.071 049 (p=0.140)
RSA_layer2
-0.010=0.027 (p=0.714)
-0.031=0.033
(p=0.355)
-0.108::0.035
(p=0.003)
RSA_layer3
0.218=0.034 (p<0.001)
-0.021=0.033
(p=0.558)
0.214:0.062
(p=0.001)
coometric_layeri
0.040=0.010 (p<0.001)
-0.487=0.090
(p<0.001)
-0.130+0. 149 (p=0.368)
geometric layer2
0.020=0.007
(μ=0.004)
-0.012+0.04]
(p=0.769)
-0.3
(p=0.173)
geometric layer3
-0.021
(p=0.075)
0.191
(y=0.025)
-0.174+0.113 (p=0.120)
FBPS $$$s__2_laae L2_layerl
0.009=0.000
(p=0.262)
0.001=0.001
(p=0.439)
0.047#0.008
(p<0.001)
FBPS 1.2_aayr22
0.010=0.000
(p=0.157)
-0.001#0.001
(p=0.156)
0.009900.00
(p=0.287)
FBPS L2___a_aaaa la_ee333
0.004=0.000 (p=0.070)
-0.099=0.041
(p=0.025)
0.732=0.215
(p=0.002)
FBPS KI__output
-0.36420.014 (p<0.001)
0.375+0.019 (p<0.001)
0.055+0.036 (p=0.123)
Feature Weighting Manipulation Across Different Boost Factor. When decreasing the fore- ground features, as the boost factor gets smaller, BACKGROUND-INVARI.. crease more while OBJECT-DISS MBIGUATION performances increase more both datasets. Con- versely, when decreasing the background features, the boost factor gets smaller, BACKGROUND- INVARIANCE performances increase more while OBJECT-DISA DIAMIAUUAAAIIII performances decrease more in both datasets. However, when increasing the feature importance in either foreground or background subspaces, the performances never deviate significantly from the control experiments. We suspect that this is because when boosting the subspaces, the resulting weights of the linear classifiers are smaller, and thus the regularization that penalizes larger weights will have a weaker effect.
performances de-
C.4 Proposed Augmentation Method
Augmentation using pseudo-masks generated by Segment-Anything (SAM). We also experi- ment with using the pseudo-masks generated by SAM to alleviate the need for additional annotations. However, since SAM over-generates masks, we cross-check the pseudo-masks with ground-truth masks by selecting the highest IoU. This process should be easily automated with methods like Lai
21

---

bockground-lnvariiann
Object-Disambiguation
Normalized OOD
53
75
45
(96)
(96)
51
-50
35
49
30
48
0.00
Weighting
Figure 10: Feature Weighting vs OOD Accuracies in SCENEOBJECT. The three plots show the relationship between feature weighting metries and BACKGROUND-IVARLIAN OBJЕCT- DISAMBIQUATION, and the average OOD accuracies.
0.9
110
0.8
Before intervention
99.9299.88
100
After intervention
0.594
0OD acccuu (ccuracc (96)
Factorization
0.6
80
0.5
70
Change OOD
-1-
0.4
0.3
43.96
50
37.46
0.2
-3
0.025
30
Backgound-Inve Invariance
Object-Disamb Diw.-iiiammaaana mubatiioonnoon
0.0
20
Factorization
Background Invariance
Object
Decrease
Decrease
Disambiguation
Foreground
Background
(a) Factorization manipulation
(b) Feature weighting manipulation
Figure 11: Causal intervention results using 10 ERM models in COLOROBJECT.
et al. [22], providing ground for future work to explore. As shown in Table 6, with the generated pseudo-masks, we achieve similar performances as the original method using the ground-truth masks.
Training size ablation. We evaluate the effectiveness of our augmentation methods on various training sizes (4k, 8k, 16k) SCENeOBJECT. The effect size our data augmentation method more significant when the data size is smaller. The improvements go up 4.5% BACKGROUND- INVARIANCE and 1.1% on OBJECT-DISAMBIGE DISAMBIGUATION compared to the baseline ERM with 4k training data, while the best baseline (Fish) does not achieve better OOD performances than the baseline.
Effect of Mixing Weight OOD Performances. We show the effect of mixing weight OOD performances this section. The two loss items our proposed augmentation method are combined using mixing weight (from 0 to 1) that we can keep the learning rate fixed. We show the impact of mixing weight on WEEKGGOONNDDNVVAIAAANNE the average accuracies in both datasets in Fig. 13. In both COLOROBJECC and SCENEOBJECT, accuracy increases while OBJECT-
and
as the mixing weight increased, DISAMBIGUATION accuracy decreases gradually. This suggests that the models become more invariant to the backgrounds and rely more on the foreground features. However, the average accuracy exhibits different pattern. Initially, the mixing weight increased, the average accuracy showed an upward trend. The accuracy reached a peak and then started to decrease gradually as the mixing weight continued to increase. This finding indicates that there exists an optimal mixing weight that maximizes the overall accuracy of the model on different OOD settings, suggesting the need to find an appropriate weight between foreground and background features.
22

---

Badiground
Aug
SceneObject_ ChangeFG
SimeoObjet_Chhaneeee
ColorObject @lloobejetCChanneFG
ColorObject ChangeBG
1.00
0.50
0.25
1.0
0.25
Ch
0.00
Chance in 0:0 Alz
0.5
C20
-0.25
-2
-0.25
-0.50
0.0
-0.50
-0.75
0.5
-1.00
1/641/16 1/4
16
1/54:/66 1/4
16
64
1/641/16
1/4
16
54
1/541/15
1
4
64
Boost Flactor
Boost Factor
Boost Pactor
Boost Factor
Figure 12: Effect of Boost Factor OOD Performances.
Table 6: Accuracy our proposed method with pseudo-masks generated by Segment-Anything (SAM) with various training sizes (4k, 8k, 16k) on SCENEOBJECT [19]. Our method with pseudo- masks achieves similar generalization performances as the one with ground-truth masks. The effect size of our data augmentation method is more significant when the data size is smaller.
SCENEOBJECT
Method
ID
O0D1
OOD2
Avg OOD
FRM
72.28=0.93
35.37
71.93
53.65+0.70
Best Baseline
73.47=0.79
36.91#1.49
71.30=0.74
54.11+0.61
Ours (pseudo-masks)
75.00=1.08
37.96+2.04
73.34+2.09
55.65+2.07
Ours (gt-masks)
74.13+0.48
36.83+1.34
73.86#1.11
55.3420.51
ERM (8k data)
66.97=1.05
31.29+1.37
68.57=0.60
49. 93+0.99
Best Baseline (8k data)
67.13=t0.74
32.19+0.64
67.08=0.46
49. 19.64+00.5
Ours (8k data)
71.43+0.89
34.52+0.97
72.16#1.24
53.34+1.11
ERM (4k data)
60.7420.89
26.27+1.08
62.79=1.04
14.53+1.06
Best Baseline (4k data)
11.35=1.60
26.77+1.45
63.3440.90
45. 45.0641.11
Ours (4k data)
63.94#0.51
30.72+0.60
63.8620.54
47.29+0.57
ColorObject
SceneObject
100
60
Acc (96)
60
40
Backgronnd-rvvariane
Object- Disambiguation Acc
30
Average Acc
0.2
0.8
1.0
0.0
0.2
0.4
0.6
0.8
1.0
mixing weight
mixing weight
Figure 13: Effect of Mixing Weight on OOD Performances. As the mixing weight increases, performance increases while the DOBECT-DDSAMBIIUUAIIN performance decreases. The average OOD performances either flattens out (as in COLOROBJECT) or peaks and then starts decreasing in SCENEOBJECT)
the BACKGROUND-INVARIANCE
23


Reviews:
[{"review_id": "TstCEDocDD", "reviewer": "Reviewer_D3vS", "summary": "This work investigates how vision models use background information in various contexts and find that models that are more invariant to backgrounds are less able to use the background to disambiguate. A new objective function and augmentations are proposed to control the balance between ignoring the background and using it for disambiguation. It is hypothesized that in order to make adaptive use of background as in biological vision, computer vision models must have factorized (orthogonal) object vs background representations.", "questions": "See weaknesses.", "limitations": "Yes.", "rating": 5, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "1. Clear presentation and motivation. \n2. While many works have investigated the role of background vs foreground, much of the literature has focused on over-reliance on the background leading to spurious correlations, though background can also disambiguate. While this is still \"known to the field\", this  systematic study can still be helpful to the community. ", "weaknesses": "1. There is some re-treading of scientific points from Xiao et al, 2020.\n\n2. The architecture is limited to Wide ResNet-28 and MLP for synthetic datasets. Transformers are known to make adaptive use of context (and are an important, broadly applicable architecture, arguably more so than ResNets).  How do these findings change when using vision transformers is an important unanswered question and a limitation. Also unknown is how the findings change with respect to model scale.\n\n3. The augmentations proposed are possible on toy or synthetic datasets, but the need for dense annotations like segmentation masks for foreground objects makes the approach not really practical - especially for more complex scenes, with many objects and scales. If the authors really want to argue that the augmentation they propose is a new *methodological contribution*, then they will need to demonstrate it's feasibility on more practical datasets with more complex scenes. If the authors could please elaborate on this in the response, that would be great.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> “There is some re-treading of scientific points from Xiao et al, 2020.”\n\nXiao et al. 2020 focus on showing that models over-rely on background. In fact, they argue that models rely on background too much, writing that models “exploit background correlations” and hoping for models to exhibit “robustness to misleading background signals.” We argue instead that models need both foreground and background by proposing a novel mechanism (feature factorization + appropriate weighting), which is supported by our regression and causal analysis and augmentation method.\n\n\n> “How do these findings change when using vision transformers is an important unanswered question and a limitation.”\n\nThanks for the suggestion. We have extended our results to include Vision Transformers (Swin), focusing first on the tradeoff between generalization to background-invariance and object-disambiguation tests. As shown in the General Response and pdf Fig. R1, we are pleased to find that Transformers show the same tradeoff in generalization as ResNets. We will add these additional results in the final version.\n\n\n> “need to demonstrate it's feasibility on more practical datasets with more complex scenes.”\n\nWe appreciate the suggestion, and we agree that it would be ideal to showcase the data augmentation method on more practical datasets. Please refer to the General Response and pdf Table R1, where we add results using Segment Anything masks rather than our ground-truth masks on ColorObject and SceneObject. We are pleased to see performance improvements with SegmentAnything masks that are similar to our original results (though note we require heuristic cross-checking with the ground-truth masks, which we believe could be alleviated with more controllable segmentation methods like https://arxiv.org/abs/2308.00692). Since the Segment Anything Model obtains impressive segmentation results with complex naturalistic images, we are hopeful that future work can build on our method to improve how SOTA models generalize across background-invariance and object-disambiguation tests with naturalistic data. \n"}, {"review_id": "74Oj8yWNck", "reviewer": "Reviewer_WSbu", "summary": "This work investigates how visual models leverage background and foreground information for out-of-distribution (OOD) generalization. The authors trained a large number of models and evaluate their performance in two OOD settings. They find that there is a tradeoff for the models in these two OOD settings as they need to balance how much foreground and background are separately used during the recognition task. Multiple analyses are further conducted to better understand this tradeoff. The authors find that “factorized representations and appropriate feature weighting are more successful in handling” the OOD tests. They also present experiments supporting the causal influence of these factors. Finally, they propose a new method to train the models through adding more background and foreground related augmentations. This method yields a better model compared to existing methods.", "questions": "See comments in the weakness.", "limitations": "yes", "rating": 5, "confidence": 4, "soundness": 4, "presentation": 4, "contribution": 3, "strengths": "The paper is well written. The logic is clear. The results are clearly presented. I enjoy reading the paper.\n\nThe main idea in this paper is analyzing the models’ performance in two separate but relevant OOD tests: OBJECT-DISAMBIGUATION and BACKGROUND-INVARIANCE, where the background information is either beneficial or irrelevant. This idea is also innovative. To thoroughly investigate the performance of different algorithms, the authors train a lot of models, which makes the results general.\n\nThe regression and probing analysis is also neat. After leveraging the results from this analysis, the authors also create a new method that yields a better model.\n", "weaknesses": "My biggest worry is that the results reported in this work is just reflecting the models trained on small amount of data and cannot generalize to models trained with much more data. The training set of the models only contain 16000 images, not mentioning that many of these images are generated from the same object. So these images contain very limited diversity across objects and natural background. State-of-the-art models in recognition are trained with at least 2 magnitude more images, not mentioning very recent models trained on almost billion scale images (like Segment-Anything). Is the tradeoff observed in this work just a result due to not enough training data? When there are more data, maybe the model can achieve the optimal performance in both benchmarks. Then how would the finding in this paper be general to more realistic settings that are used in actual applications?\n\nIn addition to this worry, the proposed new method is also over-engineered for the constructed benchmarks. The new method is simply augmenting the data with background and foreground operations, with clear implications to benefit the constructed benchmarks. How would this augmentation benefit other OOD settings? Is this augmentation useful for training on more images?\n", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> “Is the tradeoff observed in this work just a result due to not enough training data? When there are more data, maybe the model can achieve the optimal performance in both benchmarks.”\n\nThe two standard settings (ColorObject and SceneObject) we test on for fair comparison with prior works are indeed small. While we aren’t able to conduct experiments with data of the SAM size (1B images) due to academic resource constraints, we are able to produce “scaling laws” results in the form of training size ablations. Shown in the General Response and pdf Fig. R1, we find a clear trade-off between the two OOD settings regardless of how much training data is available to the model. Note the frontier moves “outward” as the training size increases, since models become more accurate on both tests. We expect the same trade-off to hold with more training data with the frontiers moving further outwards. \n\n\n> “the proposed new method is also over-engineered for the constructed benchmarks… How would this augmentation benefit other OOD settings?”\n\nWe test our method on two standard datasets with metrics in three domains, in-distribution, Background-Invariance, and Object-Disambiguation. Past published work has proposed new methods with only these datasets, and using only one of our two OOD tests (including the strongest baseline, Fish [39]). We believe this is a good proof of concept for the new data augmentation method. It would be interesting to test other domains shifts, but we consider that out of scope for our paper. \n\n> “Is this augmentation useful for training on more images?”\n\nWhile we are not able to conduct large scale experiments on larger sizes than 16000 training points, we provide an ablation of our data augmentation method across different training sizes in the General Response and pdf Table R1. We do observe that the boost to OOD performance from the data augmentation method is larger when there is less training data available, although for now we cannot say for certain that the effect would entirely dissipate with larger training sizes, especially given the fundamental mismatch between the in-distribution training data and the Background-Invariance and Object-Disambiguation tests. Moreover, we believe one additional benefit of the data augmentation method is that it allows one to bias the model toward higher performance on either the Background-Invariance _or_ Object-Disambiguation tests, by adjusting the weight on the objective terms in the loss. This is a new benefit of the method that would enable one to tailor their model to perform better in one setting or the other, based on an expectation of how the test-time distribution will look for a model in deployment. \n"}, {"review_id": "NQC4Q7GPy9", "reviewer": "Reviewer_FMxu", "summary": "This paper examines the influence of context on visual recognition capabilities. The authors distinguish two regimes, one where background context can help disambiguate objects and another one where the object information is orthogonal to the background information. The study shows that models can thrive in one regime but fail to extrapolate to the other regime. The paper then suggests that factorizing object and background information can help in out-of-distribution generalization and proposed data augmentation methods to help models generalize.\n\n", "questions": "The authors distinguish situations where context can help recognition or where context is irrelevant and the desired output is invariance to contextual noise. Context can also hurt performance (see e.g., Bomatter et al ICCV 2021 and multiple studies on incongruent context conditions, summarized in Oliva and Torralba, TICS 2007). \n\nThe addition of feature weights and especially the transition to All features lead to small improvements in Table 1. All the other entries are clearly justified and critical for the model. Similar comments apply to Fig. 4b. The enhancement is small.\n\nHow is the pareto frontier computed in Fig. 3 and why is it called a frontier if there are points that can trespass this line?\n", "limitations": "There is minimal discussion of limitations in the current version.", "rating": 7, "confidence": 4, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "The work is clearly written and presents a nice systematic examination of different aspects of how context can impact visual recognition.\n\nThe work nicely puts the emphasis on generalization to OOD, which is not always tested in other context-aware models.\n\nFigure 3 is nice and clearly demonstrates the trade-off between invariance and the ability to use contextual features.\n", "weaknesses": "No major weaknesses noted, but see questions below.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> “Context can also hurt performance.”\n\nWe thank the reviewer for pointing out the relevant works. We believe that the referred works are consistent with ours and will add them to our references. It is true that context can also hurt performance for both models (as observed in our experiments too) and humans. Although the ideal behavior in the Background-Invariance setting is to ignore the background completely, we argue that there needs to be some assumption about what the test distributions will look like, in order to decide how sensitive the model should be to the backgrounds. This is because models and humans need to deal with both Background-Invariance and Object-Disambiguation settings. Our Pareto plots show that models should not be completely invariant to the background, because this would drastically lower performance in an object-disambiguation setting. \n\n> “The addition of feature weights and especially the transition to All features lead to small improvements in Table 1… Similar comments apply to Fig. 4b. The enhancement is small.”\n\nWe want to clarify that in Table 1, the row for Feature Weighting metrics do not include Factorization metrics. That is, the Factor. row does not include Feature Weighting in the regression, nor does the Feature Weighting row include the Factorization metric in the regression. In other words, both feature factorization and weighting on their own are both strong predictors. We apologize for any confusion in the table formatting and will clarify this further. This said, the transition to the All row (final row) does show that these two variables are fairly collinear, with each providing a relatively smaller amount of information that the other does not contain. However, the first takeaway from this table is the very large improvement over the ID baseline, resulting in high R^2 values above 0.85. Past work has not been able to obtain _any improvement_ over ID, while we're getting quite large improvements in R2. \n\nIn Figure 4, we wanted to show causal evidence for our hypotheses about OOD generalization, which has not been done before, to our knowledge. We believe the changes in accuracy of up to 3 points are meaningful, especially when considered alongside the high R^2 values of our regressions. The results are also all statistically significant (Lines333-337), so we believe this experiment supports the overall argument for the causal importance of these features. \n\n> “How is the pareto frontier computed in Fig. 3 and why is it called a frontier if there are points that can trespass this line?”\n\nWe fit a polynomial function to the outer edge of all the data points as the Pareto frontier. Since the data is noisy, we would see some points trespassing this line. This is not the ground truth frontier, which no points should pass through. Considering the large size of the model population, we believe the ground truth frontier would be in a similar shape as our approximate frontier, showing a similar kind of trade-off. We can add these details to the final paper.\n"}, {"review_id": "pmRgWndJ6i", "reviewer": "Reviewer_Qyp3", "summary": "This paper presents an empirical study on out-of-distribution (OOD) generalization in two different settings: contexts that are either beneficial or irrelevant. The authors highlight an interesting finding that models performing well in one setting tend to struggle in the other. They analyze a population of models and demonstrate that those with more factorized representations and appropriate feature weighting achieve improved performance in handling both OOD settings. Additionally, the paper introduces novel data augmentation methods aimed at enhancing model generalization.", "questions": "In section 7, the authors describe the proposed data augmentation method without adequately establishing its connection to the motivation of “adaptively using context to recognize objects in new settings” due to the following reasons: (1) The weight of the training loss is set as fixed hyperparameters and lacks the adaptive nature required to effectively utilize context. (2) The data augmentation method does not provide clear instructions on how context can be effectively employed for object recognition.", "limitations": "The method requires additional annotation of the background classes and the segmentation of the foreground objects.", "rating": 5, "confidence": 5, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "One of the major strengths of this paper is its detailed analysis of generalization and the identification of factors that influence generalization performance.", "weaknesses": "While the paper proposes a data augmentation method, the motivation behind its introduction lacks strong support.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> “the authors describe the proposed data augmentation method without adequately establishing its connection to the motivation of “adaptively using context to recognize objects in new settings””\n\nWe establish the connection between our analysis and our proposed method in the introduction “In order to encourage model factorization, we augment the data with random-background and background-only images, and we weight the corresponding objective terms to encourage appropriate feature weighting of the foreground and background information” (Lines89-91). Our proposed method does not directly manipulate the representation geometry, but we reason that our proposed method encourages the models to represent the foreground and background in the right way (Lines367-369). \n\n> “The weight of the training loss is set as fixed hyperparameters and lacks the adaptive nature required to effectively utilize context.”\n\nWe want to clarify what “adaptive” means here. Adaptive means the model uses context when the object features are ambiguous but ignores the context when the object is easily recognizable (Lines35-38), which is viable with a fixed weight. And this is evidenced by the improved performances in two OOD settings, which is what our method achieves. It is not the case that making the weight variable would make the method \"adaptive\". The weight only shows how the evidence is combined. And we argue there is an optimal weight depending on the domains for optimal generalization (see Line 338-340 & Figure 4b).\n\n> “The method requires additional annotation of the background classes and the segmentation of the foreground objects.”\n\nWe appreciate the concern, and we agree that it would be ideal for the method to not require any additional human annotations. Please refer to the General Response and pdf Table R1, where we add results using SegmentAnything pseudo-masks rather than our ground-truth masks on ColorObject and SceneObject. We are pleased to see performance improvements with SegmentAnything masks that are similar to our original results (though note we require heuristic cross-checking with the ground-truth masks, which we believe could be alleviated with more controllable segmentation methods like https://arxiv.org/abs/2308.00692). This result should provide a pathway for future work to obtain good foreground/background separation masks without the need for additional human annotation, enabling the application of our data augmentation method to improve generalization to background-invariance and object-disambiguation tasks. \n"}]

Author rebuttal:
We thank the reviewers for their time and effort in reading our paper. We are glad to see that reviewers view the paper to be “helpful to the community” (D3vS) and “innovative” (WSbu), with a “systematic examination” (FMxu) and “detailed analysis…of factors that influence generalization performance” (Qyp3). In our individual responses to each review, we try to address any noted questions about the paper. 

Here, we wish to highlight a few extensions of our experiments with additional training sizes, model architectures, and SAM-generated image masks, all of which are consistent with our original results and demonstrate robustness across additional experiment setups. 

**Training Size Ablations and Transformer Results.** First, to strengthen our analysis results, we provide OOD Pareto frontier plots for (a) models with varying amounts of training data and (b) Vision Transformers (Swin) in addition to ResNets. See Fig. R1 in the response pdf for these results, respectively. Our goal here is to demonstrate that models must tradeoff between background-invariance and object-disambiguation performance in general, regardless of training data scale or model architecture. Our results are consistent with our original experiments using ResNet and 16k training points: all models show a clear tradeoff between generalization to background-invariance and object-disambiguation tests. 

**Segment Anything Model Experiments.** Second, to provide a stronger proof of concept for our data augmentation method, we present a new heuristic masking method based on the Segment-Anything model. We show that this model can automatically segment images into foreground and background, which enables our data augmentation method to apply generically without the need for ground-truth foreground/background masks. Using pseudo-masks generated by Segment-Anything, we achieve comparable results to using the ground-truth masks (see Table R1). In addition, new segmentation datasets like SA-1B provide billions of segmentation masks for tens of millions of naturalistic images. Thus we believe our method can provide fertile ground for future work to explore with Segment-Anything and more complex scenes.

Meta-review: All reviewers reached a consensus to accept the paper. The authors are encouraged to incorporate all the feedback and suggestions from the reviewers into the final version of the manuscript.
Decision: Accept (poster)