Sparse-Coding Consensus Layers for Seamless Tiled Inference

Very large images, such as satellite scenes, drone orthomosaics and 4K frames, do not fit through a vision transformer in one pass. Practitioners cut them into tiles, run each tile separately, and stitch the outputs back together. Two things break when they do this. Objects and edges that cross a tile line get cut, which produces visible seams, double-counted objects and depth jumps. The obvious fix, running the model at full resolution, fails differently: the model now sees inputs far from its training resolution, and its internal features drift. Today each task gets its own repair. Segmentation has content-adaptive clustering, depth has cross-tile attention, and counting has overlapping crops with their borders thrown away. The shared general-purpose backbone ends up surrounded by task-specific seam fixes again.

We propose one task-agnostic repair that works at the feature level. It is a small layer inserted at a few depths of a frozen general-purpose backbone. The layer treats the features of neighbouring tiles as noisy, partly overlapping views of a single continuous feature map and reconciles them. The reconciliation borrows the consensus step of convolutional sparse coding, a classical image model that writes a whole image as a sum of small learned filters placed at sparse locations, so overlapping regions have to agree. Low-confidence features at tile borders become an inpainting problem. That problem is solved by a few unrolled sparse-coding iterations and needs only thin strips of communication between neighbouring tiles. Each tile stays at the backbone's native resolution, which avoids resolution drift. The consensus layer handles the boundaries. Because the fix lives in the backbone's features, every downstream head should benefit at once, whether it does segmentation, depth or detection.

Core Claim

We claim three things. First, reconciling tile features inside the network (not the outputs) closes most of the accuracy gap between naive tiling and full-image inference in bands near tile borders. Second, it does so at a small fraction of the compute that overlap-and-discard needs. Third, the sparse-coding prior is what makes this work: plain averaging or copying of neighbour features across the tile line is not enough. The consensus layer is trained once with a label-free feature-matching objective. We claim it then transfers to segmentation, depth and detection heads without retraining, and generalizes from the tile grids seen in training to larger ones.

Where This Sits

Several works motivate the gap. RADIOv2.5 distills CLIP, DINOv2 and SAM into one backbone. It fixes "mode switching" across resolutions by training at 256², 432² and 1024², but it does not address what happens when an image must be tiled beyond that. One Patch Doesn't Fit All resizes patch-embedding weights with a pseudo-inverse, so a model can take native-resolution inputs without retraining. It changes patch size uniformly across one image and offers nothing for seams between separately processed tiles. UberNet and 4M illustrate the push toward one backbone for many tasks, which is the setting we want to protect.

Other works mitigate seams, and each is tied to one task. Any Resolution Any Geometry (URGT) alternates within-tile and cross-tile attention in a global coordinate frame. It gets strong results, but only for depth and surface normals, it depends on external low-resolution priors, and its cross-tile attention grows costly as tile counts rise. Boundary-Enhanced Patch-Merging Transformer (BPT) replaces grid tiles with clustered tokens and adds an edge module, and it serves segmentation only. MaskCount overlaps crops and discards their borders, which cuts counting error but wastes up to half the computed perimeter. Our proposal differs from all three in scope, since one layer serves all heads. It also differs in mechanism: communication is local and happens in feature space, with no cross-tile attention and no discarded perimeter.

The method comes from sparse coding. Convolutional Sparse Coding for Image Super-Resolution shows that averaging independently coded patches causes blocking and blur, and that a global convolutional model removes those artifacts. Convolutional Dictionary Learning via Local Processing solves the global model with purely local "slices" and a consensus step that forces overlapping slices to agree. That paper also showed the approach works for inpainting, which is exactly how we treat border features. Consensus Convolutional Sparse Coding splits the problem into blocks solved by parallel workers and joined by a consensus update, but uses this only for offline dictionary learning. Unrolling work such as Learned Convolutional Sparse Coding and Convolutional Neural Networks Analyzed via Convolutional Sparse Coding supplies the recipe for turning iterations into fast feed-forward layers.

We make two moves that are, as far as this literature shows, new. We apply the consensus step at inference time to deep features, where prior work applied it to pixels. And we use the Fourier-free local formulation, which sidesteps the periodic-boundary wrap-around that the Local Processing paper identified in FFT solvers.

Mechanism

Take a frozen backbone and a grid of tiles $t$, each processed at the backbone's native resolution. At a chosen layer, tile $t$ yields a token feature map $F_t$. Each tile is extended by a halo of $h$ tokens that will hold its estimate of its neighbours' border region. We seek a single global feature canvas $X$ and per-tile sparse codes $Z_t$ over a small learned convolutional dictionary $D$:

$$\min_{X,\{Z_t\}} \sum_t \big\|M_t \odot (P_t X - F_t)\big\|_2^2 + \mu \sum_t \big\|P_t X - D * Z_t\big\|_2^2 + \lambda \sum_t \|Z_t\|_1$$

Here $P_t$ crops the canvas to tile $t$ plus its halo. $M_t$ is a confidence weight that falls toward tile borders, which encodes the known drop in reliability near truncated context. $\mu$ sets the strength of the sparse prior and $\lambda$ the sparsity level.

The $X$-step has a closed form: a confidence-weighted average of the tile features and the synthesized slices $D*Z_t$ where tiles overlap. The $Z_t$-step is one soft-thresholding (shrinkage) iteration per tile. We unroll $K\approx 3$ alternations and learn $D$, the step sizes, $\lambda$, $\mu$, and a parametric $M_t$ as a function of distance to the border.

Only the halo strips cross tile lines, so memory and communication grow linearly with the number of tiles. The reconciled $P_t X$ replaces $F_t$, and the frozen backbone continues. Later attention layers inside each tile therefore see context that has leaked in from neighbours. Output-level blending cannot provide this, and it matters for objects cut by a tile line.

We insert the layer at two or three depths. Training uses images small enough to run whole, at up to roughly 1024² through the backbone. The layers learn to make tiled features match full-image features, measured by feature error at each inserted layer and at the output, with no task labels. Tile grids are sampled at 1×1, 2×2 and 3×3 with random offsets, in the spirit of URGT's GridMix. At test time we apply the layers to 4×4 and 8×8 grids.

Research Program

We first establish the phenomenon on the frozen RADIOv2.5 backbone. We measure how feature error against a full-image reference grows with distance to tile borders, and how naive tiling compares with a single full-resolution pass, which exposes resolution drift. We then train consensus layers with the label-free objective. Next we attach standard light heads, trained once on untiled crops and then frozen, for segmentation, depth and detection or counting. These heads are evaluated under tiling with and without consensus. The resulting analysis locates where the gain comes from: which layers, how many unrolled steps, and what halo width. It also tests whether the learned dictionary atoms act as shift-invariant feature fillers, by inpainting masked interior regions and comparing against the border case.

Baselines

The naive reference is non-overlapping tiling with the same frozen backbone and heads, with outputs simply concatenated. It costs no extra FLOPs and defines the seam gap we aim to close. A second reference downsamples the whole image to the backbone's native size, which is the "do nothing clever" choice many practitioners make. We expect it to fail on the small objects that MaskCount documents occupying under 0.24% of the image area. A third reference runs the backbone at full resolution in one pass wherever memory allows. This isolates how much of naive tiling's loss is seams and how much a single large pass loses to resolution drift.

The strongest general-purpose competitor is overlap-and-discard, in the style of MaskCount. On DIOCblueberry, MaskCount reports that edge-aware cropping lowered MAE from 6.36 to 3.63. We run it at 25% and 50% overlap with identical backbone and heads. We report it both at its native cost and at a FLOP budget matched to ours; the matched version uses a smaller overlap. Output-space feathering over a 10% overlap is also included.

For depth and normals the strongest task-specific system is URGT. On UnrealStereo4K it reports AbsRel 0.0291, RMSE 1.31, mean normal angular error 18.51° and 0.97 s latency at 4K. For UHR segmentation it is BPT, which reports 76.6% mIoU on DeepGlobe and 77.1% on Inria Aerial. We cite these numbers for context. We will not claim to beat specialized trained systems with a frozen general-purpose backbone and light heads.

Beating a baseline therefore has a precise meaning. Against naive tiling, we must close at least 80% of the boundary-band gap to the full-image reference. Against overlap-and-discard, we must match its accuracy at 15% or less FLOP overhead, where overlap-and-discard pays roughly 1.3–2×. We must also exceed it at matched FLOPs. Against URGT we count as competitive if we come within its reported error while using no external priors and serving other tasks too.

Two ablations isolate the key ingredient. Setting $\mu=0$ reduces the layer to confidence-weighted feature averaging, a learned feathering in feature space. Halo exchange copies neighbour tokens into each tile's halo with no sparse prior. A third ablation swaps our layer for a single cross-tile attention block over the halo tokens, with parameters matched.

Why not just…?

Why not just overlap the tiles and throw away the borders? This is the real threat, since it plainly works; MaskCount's MAE drop shows it. Its cost is computing up to half of every tile perimeter twice or more, and it only fixes outputs, so it never lets a cut object's two halves inform each other. Our claim is therefore about the compute–accuracy frontier. If overlap-and-discard at matched FLOPs equals us on boundary-band metrics, the proposal's practical case fails, and we will report that.

Why not just exchange neighbour features across the tile line, without any sparse coding? Halo exchange is the simplest in-network alternative, and it may carry most of the benefit. The sparse prior is justified only if it helps where borders are unreliable on both sides. That happens when both tiles see truncated context, and there the prior can extrapolate from interiors the way CSC inpainting does in Local Processing. The halo-exchange ablation settles this question. If it matches the full layer, we would drop the CSC framing and publish the simpler result.

Why not just use cross-tile attention like URGT? It is effective for geometry, but its cost grows with tile count, and it is trained per task with external priors. The 8×8-grid experiment tests both its memory scaling and our linear-cost alternative. The parameter-matched attention ablation tests whether attention over halo tokens alone does as well as consensus.

Why not just train the backbone at more resolutions? Multi-resolution training in RADIOv2.5 reduces drift within a single pass up to 1024². It does not remove seams once tiling is forced. Our full-resolution-pass baseline measures how much drift remains at larger sizes.

Proposed Experiments

Segmentation runs on DeepGlobe land cover and Inria Aerial, with boundary-band mIoU (within $k$ tokens of a tile line) reported separately from interior mIoU. Depth and normals run on UnrealStereo4K, with AbsRel, RMSE and angular error again split into band and interior. Detection and counting run on SelvaBox, using RF1₇₅, for which the SelvaBox paper reports 48.60 on its internal test set, and on DIOCblueberry, using MAE and RMSE. For both we add a double-count rate: the fraction of ground-truth instances that cross tile lines and receive more than one detection.

The first decisive check is cross-task transfer. A single consensus layer, trained without labels, must improve all three task families. If it helps only one, the task-agnostic claim fails. The second is grid generalization: training on grids up to 3×3 must still close most of the gap at 8×8, which tests whether the local consensus behaves like the global model it approximates. The third is the ablation ladder of $\mu=0$, halo exchange, and the full layer, measured at equal FLOPs. Together these determine whether the sparse-coding consensus is a necessary ingredient or a dispensable one.