arXiv:2608.28706cs.CVAug 2026

Manuscript Offprint

arXiv:2608.28706

Variable-Granularity Tokenization for High-Resolution Object Detection

Khayrul Islam

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

ViT detectors fix a uniform token grid before any learned stage. A native-resolution aerial detector must then choose between resolving few-pixel objects and staying inside compute and memory limits. We introduce VGTok, a training-free tokenizer that sets patch granularity per region from pixels, ahead of the encoder. VGTok scores each region by multi-scale morphological top-hat separability from its surround, then thresholds those scores at a per-image percentile, which fixes the token budget. A structure-tensor gate (λmin⁡\lambda_{\min}) refines only where two-dimensional object structure supports it, leaving one-dimensional clutter coarse. The resulting token set is a strict partition of the image. In a Co-DETR detector with an EVA-02 ViT-L encoder, VGTok clears every published VisDrone-val AP and APSAP_S at every budget from 40% to 100% of tokens. At 40% it records 44.22 AP with three fifths of the sequence discarded before the first transformer block; dense, it reaches 48.38 AP, 6.08 above the strongest published entry. VGTok transfers to AI-TOD-v2 untouched, same scorer and same rank, and sets a new state of the art at 37.27 AP and 19.51 APvt_{vt}. As a pure drop-in into a frozen checkpoint it reaches 36.29 AP at 78.5% of tokens, above every published entry, where our 376.3M-parameter detector clears a 3.0B multi-expert model. We show that a token budget fixed before the backbone, from local separability and structure geometry alone, holds accuracy on the tiny-object regimes that dominate aerial detection, at 3.1×3.1\times less encoder compute and 1.9×1.9\times less encoder memory. Code and models are available at github.com/khayrulbuet13/vgtok and huggingface.co/khayrulbuet13/vgtok.

This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. Release number: LLNL-CONF-2023636.

Figure

(a) Input with ground truth: 317 instances, 280 below 32×3232\times32 px

(b) VGTok allocation: 70% of tokens, 47.8 AP zero-shot (−0.6-0.6 vs dense)

Figure

(c) Close-up of the boxed region

(d) Quadtree: contrast alone refines the paint

(e) λmin⁡\lambda_{\min} gate: the paint costs one token, not four

Figure 1. VGTok on a VisDrone frame at 70% tokens. Contrast alone spends 204 tokens on painted crosswalk bars holding no object; the λmin⁡\lambda_{\min} gate emits the same crop in 174. (a) Ground truth: 317 instances, 280 of them under 32×3232 \times 32 px. (b) The finest patch size stays on the vehicles while empty roadway, plaza and building faces coarsen, at 47.76 AP zero-shot with no weight changed, 5.46 AP above the strongest published val result; Tab. 4 prints this budget trained. (c) The boxed region, enlarged: paint on plain asphalt. (d) Contrast refines that paint to the finest size. (e) The gate stops the descent, one coarse token in place of four fine ones.

1. Introduction

A ViT detector reads an image as a grid of patches of one size, and every later stage computes on that grid. Small objects on aerial imagery occupy a handful of pixels, and a grid fine enough to resolve them is too expensive over a full frame. SAHI [5] regains that resolution by tiling the frame into overlapping chips, but spends the budget uniformly, giving empty background and dense clusters identical per-pixel allocation. Compute must therefore be spent selectively, on evidence cheap enough to read before the backbone runs.

Tokenization fixes the token count NN before any learned stage, so every mechanism that allocates compute after it (token pruning and merging [11, 29, 52, 56, 58, 92], sparse and density-guided detection heads [41, 42, 60, 84, 102], crop-and-tile inference [43, 50, 53, 91, 100], saliency-guided warping [59, 79, 80, 103]) inherits a token budget it cannot enlarge, or leaves N untouched and carries every prediction back through an inverse map.

Any tokenizer that varies the ViT's patch size must decide from pixels alone whether a region deserves resolution, either by learning the decision [15, 39, 75, 93, 99] or by cutting a scalar measure of intra-patch structure (entropy, blur energy, a Laplacian response) at a constant [16, 54, 62, 97]. Either way the measure scores a region in isolation. Detection asks a different question. An object is defined by separation from its surround, so the informative quantity is separability from the surround [33, 69]. The two diverge where the surround is textured and the target smooth. A scalar average attenuates a target in proportion to its area, so the evidence weakens as the target shrinks. VGTok therefore scores a region, ahead of patch projection, by its separability from the surround, a multi-scale morphological top-hat whose max over structuring-element sizes and polarities keeps the score independent of target area.

Both approaches then refine the same way, replacing a selected region with four sub-patches and emitting all four [39, 62, 93], so refining costs four tokens even where the evidence is a single straight edge. Leaving the regular grid costs more still, giving up the pretrained patch embedding [1, 106], and a second uniform scale raises the token count [14]. VGTok instead separates the decision to refine from the evidence that would justify it. A region is refined only where λmin\lambda_{min}, the smaller eigenvalue of the structure tensor [70], reports two-dimensional structure, and otherwise stops at its own coarse size (Fig. 1). The token set stays a strict partition. A road marking costs 1 token where all-or-nothing refinement costs 4.

We cut tokens with these two training-free statistics in a plain ViT-L detector at 2048×11522048 \times 1152 [28, 51, 107]. Every budget from 40% to 100% of the tokens beats every published VisDrone-val AP and AP S_{S}: discarding 60% of the sequence leaves 44.22 AP and 35.56 AP S_{S}, and the same detector run dense reaches 48.38 AP against the 42.3 of the strongest published entrant [85], a margin of 6.08 AP. On AI-TOD-v2, carried across with no returning and no weight changed, VGTok holds 36.29 AP at 78.5% of tokens, and 36.57 at its 70% operating point, against 35.7 for the strongest entrant published on that test split [101], a 3.0B multi-expert model to our 376.3M. The shorter sequence runs packed and variable-length [21–23], which is what turns removed tokens into removed work [3, 26]. Because neither statistic is learned, the budget is not a property of the weights. A learned scorer settles the retained fraction during training [39, 93], and an absolute per-scale threshold settles it implicitly [16, 62, 97]; a per-image percentile makes it an argument the operator supplies at inference. One released checkpoint therefore serves the whole lad-

der, so a deployment picks its own point on the accuracy-compute curve and moves it later without retraining.

References (99)