Image classifiers trained on photographs fail badly on sketches, cartoons and paintings. A large part of the reason is that different layers of a network carry different kinds of evidence. Early layers encode texture and color, which disappear in a line drawing. Deeper layers encode shape and object parts, which survive the change in style. A natural fix is to let the classifier read from several depths at once and weight them per image, leaning on deep shape features for a sketch and on texture-rich features for a photo of a fine-grained bird. The difficulty is deciding which weighting each image needs when the training data contains no sketches and no domain labels. A weighting network trained end to end through the classification loss has no reason to learn anything beyond "always use the last layer."
This note proposes to discover that weighting from the data itself. For every training image we measure how well a simple classifier reading each depth alone predicts its label. That gives a "depth-reliance signature" per image. We then cluster these signatures into a small number of latent regimes, for example images whose label is carried by texture and images whose label is carried by shape. Each regime gets its own blend of depths. A light router learns to predict the regime from the image, and at test time it blends the regime-specific fusions. The claim is that latent tasks defined by which depth is informative, rather than by how an image looks or which dataset it came from, give the depth-fusion router an explicit training target. That target is what lets it extrapolate to unseen non-photorealistic domains, including from a single photo-only source domain.
Core Claim and Its Position in Prior Work
Three bodies of work meet here, and none of them does this. Fusing multiple depths for domain generalization is known to help. CLIPCEIL fuses all layers of a frozen CLIP Vision Transformer with a one-layer adapter and reports that intermediate layers keep useful structure. Its fusion is static, and its channel refinement needs source-domain labels, so by its own account it cannot run in single-source generalization. The older evidence from Pixel-wise Deep Learning for Contour Detection concatenates AlexNet Conv1–5 for contour detection (ODS 0.699 from Conv2 alone versus 0.741 from all five). That result motivates multi-depth reading but uses one fixed blend for every input.
Instance-adaptive methods supply the opposite ingredient. Dynamic Domain Generalization predicts per-image mixing coefficients over four convolution kernel shapes inside layers. It never changes how depths are combined, and its adjuster is trained only through the task loss.
Unsupervised task discovery supplies the method we reuse. MMAML and M3L infer task embeddings from support sets and modulate or gate each layer independently. Task-level Mixture-of-Experts routes using task fingerprints such as Fisher information, and its experts specialize by task format without labels. Our depth-reliance signature is a fingerprint in that spirit, but it is computed per image and is aimed at a specific question: which depth carries the label. Unlike MMAML and M3L, we need no support set at test time and we route across depths rather than gating within them. Unlike DDG, the router gets a target computed from measurable probe losses, not just backpropagated classification error.
The texture-bias literature constrains the design. RandConv and the shape-prior adversarial training of Kashyap et al. push every input toward shape, and the RandConv authors note this hurts tasks where texture is the signal. A method that routes per regime should keep the sketch gains without that cost, and our experiments test exactly this.
In Search of Lost Domain Generalization adds a sobering constraint. Under standardized model selection, no specialized algorithm beats tuned empirical risk minimization (ERM, ordinary training on pooled data) by more than about a point on average. Every comparison here is therefore run inside that protocol.
Mechanism
Take a backbone, frozen in the main experiments to keep compute comparable and to sidestep fine-tuning distortion. Read pooled features $\phi_l(x)$ from $L$ depths $l = 1,\dots,L$. Train one linear probe per depth on source data with cross-fitting, so that each image's probe loss comes from a probe that did not see it. The signature of image $x$ with label $y$ is the vector of these held-out losses, $s(x) = (\ell_1(x,y), \dots, \ell_L(x,y))$, normalized per image so that it captures the relative informativeness of depths rather than overall difficulty.
The signatures are computed over source images and over augmented views of them: RandConv outputs, edge maps, and AdaIN stylizations, the same synthetic views used by Kashyap et al. No view or domain identity is ever given to the method. The views simply widen the range of signatures available for clustering.
Signatures are clustered with a Dirichlet-process mixture, so the number of regimes $K$ is inferred rather than fixed. This targets the mode-count sensitivity noted for MUSML-style subspace methods, and we additionally report stability of the assignments across seeds and cross-fitting folds. Each regime $k$ owns softmax depth weights $w_{k,l}$ over shared per-depth projections $P_l$. A small router $r(x)$, a two-layer network over cheap early-layer channel statistics concatenated with the final-layer feature, outputs regime probabilities. The fused representation fed to a single linear classifier is
$$z(x) = \sum_{k=1}^{K} r_k(x) \sum_{l=1}^{L} w_{k,l}\, P_l\, \phi_l(x).$$
Training minimizes classification loss on $z$, plus a cross-entropy term that pulls $r(x)$ toward the image's discovered regime. The router and the weights $w$ are initialized from the probe-loss profile of each cluster. Because the fusion lives in a head over frozen features, the overhead is $K \times L$ scalars plus the router. That is small compared with the roughly 9M parameters DDG adds to ResNet-50.
Research Program
The work has three parts, run on a ResNet-50 and on a CLIP ViT-B backbone.
The first is a measurement study, which is publishable even if the method underperforms. Do depth-reliance signatures cluster stably? Do the clusters correspond to interpretable regimes? And, most importantly, when labels are used only for analysis on held-out PACS and DomainNet domains, do sketch and quickdraw images have signatures resembling a discoverable subset of source photos and augmentations? If held-out non-photorealistic images occupy a region of signature space that no source cluster covers, the premise fails and we would report that.
The second part is the routed fusion method under the DomainBed protocol, in multi-source and single-source settings. The third part is the trade-off study. Does routing recover sketch gains comparable to RandConv while avoiding RandConv's loss on texture-reliant fine-grained classification?
Baselines
The naive reference point is tuned ERM on final-layer features with the same frozen backbone, selected by training-domain validation as in DomainBed. Gulrajani and Lopez-Paz report 66.6% average accuracy for ResNet-50 ERM across the DomainBed suite. We rerun it rather than borrow it, because our backbone and head differ.
The texture-destroying reference is ERM plus RandConv with its mixing and consistency loss, given access to the same augmented views our method uses. Xu et al. report ImageNet-Sketch top-1 rising from 10.28% to 18.09%, and PACS Sketch rising from roughly 55% to 69% with AlexNet.
The strongest existing multi-source method is CLIPCEIL, which reports 77.3% average over PACS, VLCS, Office-Home, TerraIncognita and DomainNet, against 70.2% for zero-shot CLIP. No per-domain PACS or DomainNet breakdown for CLIPCEIL was found on Lacuna. We will run it on the identical CLIP backbone and splits. It is the strongest competitor because it already reads all depths and already wins on this suite. Beating it means matching or exceeding its suite average while also running in single-source settings, where it cannot run at all.
For instance-adaptive computation, DDG reports 86.21% on PACS against an 82.95% ResNet-50 baseline in its own setup, and 46.89% on DomainNet. We rerun it on our ResNet-50 under DomainBed selection, which the Section 4 tension in the literature demands.
Two ablations isolate the key ingredient. The first is a static learned depth blend: our head with $K=1$, the same depths and projections, and no router. The second is an end-to-end instance gate with exactly our router architecture, trained only through the classification loss with no signature clustering or regime target.
Fairness is enforced by giving every method the same backbone, the same augmented views, and the same random hyperparameter search budget per DomainBed, with three or more seeds. Our method must beat the end-to-end gate and the static blend by more than seed variance on the non-photorealistic target domains, and must not trail CLIPCEIL on the multi-source average.
Why not just…?
Why not just augment with RandConv or style transfer and train ERM? This is the most direct route to shape bias, and StyleCOCO-style fine-tuning (Kadish et al., AP50 0.68 versus 0.58 on People-Art) shows augmentation alone can go far. Its known cost is lost texture signal on fine-grained tasks, which the RandConv authors acknowledge. Our trade-off experiment measures both sides on the same model. If RandConv-plus-ERM matches us on sketches and loses nothing on texture-reliant classes, the routing adds nothing, and we will say so.
Why not just fuse all depths statically, as CLIPCEIL does? Static fusion may already capture most of the gain. The $K=1$ ablation answers this directly. Our hypothesis predicts the gap should be concentrated on target domains whose signatures differ from the source majority, such as sketch and quickdraw, and near zero on photo-like domains. A uniform gap, or no gap, would argue against regime-specific fusion.
Why not just let a per-image gate learn depth weights end to end, without discovering regimes? This is the real threat, since it has the same capacity as our router. Our argument is that, trained only through classification loss on photos, such a gate tends to settle on the deepest layer and extrapolates arbitrarily to unseen styles. The signature target gives it something measurable to fit. The end-to-end gate ablation settles this. We will also report the entropy of each gate's depth weights and how well its weights correlate with oracle per-depth probe losses on held-out domains. If the end-to-end gate matches us on both, the discovery component is unnecessary.
Why not just use a bigger backbone? The DomainBed study found that moving from ResNet-18 to ResNet-50 bought about four points, more than most DG algorithms. We address this by running the full comparison on both ResNet-50 and CLIP ViT-B and checking whether the routing gain persists at the larger backbone. Gains that vanish at scale would limit the contribution to small models.
Proposed Experiments and Decisive Checks
Multi-source evaluation uses leave-one-domain-out on PACS, Office-Home and DomainNet, plus VLCS and TerraIncognita for comparability with CLIPCEIL's suite. Single-source evaluation trains on PACS Photo only and tests on Art, Cartoon and Sketch, and trains on DomainNet Real and tests on the other five domains. ImageNet-trained models are evaluated on ImageNet-Sketch and ImageNet-R. For the texture side, we evaluate fine-grained CUB and Aircraft classification from photo training. This is the regime where RandConv is expected to hurt. No reported domain-generalization result was found on Lacuna for RandConv on CUB or Aircraft, so all numbers there are new. Metrics are per-domain and average accuracy under training-domain validation, together with parameter and FLOP overhead.
Four checks decide the outcome. First, held-out non-photorealistic images must be routed to regimes whose depth weights agree with their oracle per-depth probe losses better than the end-to-end gate's weights do. Second, the routed model must beat the static blend specifically on sketch, quickdraw and cartoon targets. Third, in single-source settings it must beat RandConv-plus-ERM on sketch targets, or match it while staying within a point of plain ERM on CUB and Aircraft. Fourth, regime assignments must be stable across cross-fitting folds and seeds; if they are not, the "discovered latent task" reading of the result does not hold, whatever the accuracy.
References
- CLIPCEIL: Domain Generalization through CLIP via Channel rEfinement and Image-text aLignment
- Pixel-wise Deep Learning for Contour Detection
- Dynamic Domain Generalization
- Multimodal Model-Agnostic Meta-Learning via Task-Aware Modulation
- Multimodal meta-learning through meta-learned task representations
- Eliciting and Understanding Cross-task Skills with Task-level Mixture-of-Experts
- Robust and Generalizable Visual Representation Learning via Random Convolutions
- Towards Domain Adversarial Methods to Mitigate Texture Bias
- In Search of Lost Domain Generalization
- Improving Object Detection in Art Images Using Only Style Transfer