
论文:When Does Sliced Inference Pay Off? Resolution, Tiling and Dense Fusion for Small Object Detection 题目译名:《切片推理何时才划算?面向小目标检测的分辨率、切块与稠密融合》
作者:Stefan Becker, Jens Bayer, David Münch, Wolfgang Hübner
机构:Fraunhofer IOSB(弗劳恩霍夫光电、系统技术与图像处理研究所,德国 Ettlingen)|Fraunhofer Center for Machine Learning
发表时间:2026 年 11 月 9 日(arXiv:2611.12657, cs.CV)

博主简介

AI小怪兽 | 计算机视觉布道者 | 视觉检测领域创新者

深耕计算机视觉与深度学习领域,专注于目标检测前沿技术的探索与突破。长期致力于YOLO系列算法的结构性创新、性能极限优化与工业级落地实践,旨在打通从学术研究到产业应用的最后一公里。
🚀 核心专长与技术创新
🏆 行业影响力与商业实践
💡 未来方向与使命
秉持 “让每一行代码都有温度” 的技术理念,未来将持续聚焦于实时检测、语义分割及工业缺陷检测的商业化闭环等核心方向。愿与业界同仁协同创新,共同推动技术边界,以坚实的技术能力赋能实体经济与行业变革。
切片推理(sliced inference,如 SAHI)一直是高分辨率影像里小目标检测的标准补救手段,但它报告的增益通常是拿低分辨率基线做对照测出来的。本文把"尺度"当作显式变量重新审视,追问切块到底什么时候才真正划算。作者在 VisDrone 与 DOTA 上比较了来自四个家族的七个稠密检测器,采用预先设定的假设、仅在校准集上调参、并在留出的测试集上做单次评估。结论有两条:第一,很多被归功于切片的收益其实是分辨率效应——在 VisDrone 上,单次前向在高分辨率下训练,就胜过所有能训到该分辨率的检测器的"切块 + 框融合";同等算力下,提高分辨率比换更大的模型更划算。第二,切块本身携带互补信息,是框融合把它浪费了。为此作者提出 SCAHI(Slicing with Coverage-Aware Hyper Inference,覆盖感知的切片超推理):把各次前向的稠密输出按"让每个图像位置获得相同总覆盖"的权重累加,再在足够精细的峰值网格上把目标读出来,从而分开拥挤的相邻目标。在完全相同的前向次数下,SCAHI 在两个数据集上对所有 YOLO 检测器都优于框融合,对 FCOS 打平;在图像尺寸远超单次可训练分辨率的 DOTA 上,切块 + SCAHI 对每个检测器都超过最佳单次前向,2048 像素下领先 4.3~5.6 mAP50,而仅把 SAHI 的合并步骤换成 SCAHI 也能再加 2.3~4.0 mAP50。消融把增益归因于边界加权与峰值网格的分辨率。
核心代码:
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 Fraunhofer IOSB
#
# SCAHI - Slicing with Coverage-Aware Hyper Inference.
# If you use SCAHI, please cite:
# S. Becker, J. Bayer, D. Münch, W. Hübner. When Does Sliced Inference Pay Off?
# Resolution, Tiling and Dense Fusion for Small Object Detection.
# arXiv:2611.12657, 2026.
"""Phase-5 fusion in the global scale space S(x, y, log2 sigma).
Input: the raw cache of one image, several levels (= one stack), one branch.
* **Predictions:** every cached anchor with max class probability >= ``tau_splat``:
centre (cx, cy), size sigma = sqrt(w h) (global px), class probabilities p,
DFL std, pass = (level, tile).
* **Windows** (normalised so that they form a partition of unity where covered):
- border window b_t(x, y): per tile a sin^2 ramp over the nominal overlap width
at interior tile edges (no taper at image borders), divided by the sum over
the level's tiles; whole-image passes: 1;
- validity window v_k(sigma) in sigma_in = sigma * gain_k (network-input px
of the pass): raised cosine in log2 from 0 at ``a_lo`` = 6 via 0.5 at
``a`` = 8 to 1 at ``a_hi`` = 14, flat up to ``b`` = 192, raised cosine down
to 0 at ``b_hi`` = 256; divided by max(sum over levels, 1).
* **Weights per variant:** F1 w = 1; F2 w = b; F3 w = b v; F3e w = b v_e
(empirical validity per level from calib); F4 = F3 * f(u), f(u) = exp(-u / u_med_k),
u = mean DFL std / sigma; F5 = F4 with per-level temperature on the logits.
* **Coverage** (analytic, from geometry only): F1 C = number of passes covering
(x, y); F2 C = number of levels covering; F3/F4/F5 C = sum_k v_k(sigma) over
levels covering (x, y) (F3e: v_e). F2n: weights of F2, no coverage normalisation
(C = 1: field and score are plain sums over passes).
* **Volume:** sparse pyramid of sigma bins (``bins_per_oct`` per octave from 2 px)
with spatial cells of g_j = max(1, sigma_j / ``cell_factor``) px;
w * max_c p splatted trilinearly; field = numerator / (C + eps).
* **Peaks:** 3x3x3 local maxima in (x, y, sigma-bin) of the field above ``tau_peak``
(neighbouring sigma bins are compared at the same position); top-K <= 500.
* **Score and box of a peak:** predictions whose nearest cell lies in the peak's
3x3x3 neighbourhood and whose box overlaps the neighbourhood's strongest
prediction (IoU >= ``iou_cluster``; peaks with the same strongest prediction are
reported once); per pass the maximum of w * p_c, summed over passes, divided by
C at the peak (= window-weighted mean over the covering passes: a pass that
covers the location but predicts nothing counts as negative evidence);
box = (w * p_max)-weighted mean of (cx, cy, log w, log h). Up to 3 classes per
peak (descending score). Optional final class-wise NMS (IoU 0.7).
"""
from __future__ import annotations
import math
from dataclasses import dataclass, field
from typing import Any
import numpy as np
import pandas as pd
from numpy.typing import NDArray
from scipy.spatial import cKDTree
EPS = 1e-6
SIGMA0 = 2.0 # lower end of the sigma axis (px)
VARIANTS = ("F1", "F2", "F3", "F3e", "F4", "F5", "F2n")
@dataclass(frozen=True)
class FusionParams:
tau_splat: float = 0.01
tau_peak: float = 0.001
cell_factor: float = 4.0
bins_per_oct: int = 4
a_lo: float = 6.0
a: float = 8.0
a_hi: float = 14.0
b: float = 192.0
b_hi: float = 256.0
top_k: int = 500
classes_per_peak: int = 3
iou_cluster: float = 0.5
final_nms: bool = False
@dataclass
class LevelCal:
"""Calib-estimated per-level quantities (F3e, F4, F5)."""
u_med: float = 1.0
temperature: float = 1.0
emp_edges: NDArray | None = None # sigma_in bin edges (px)
emp_quality: NDArray | None = None # quality per bin in [0, 1] (NaN = no data)
@dataclass
class CachedLevel:
key: str
xyxy: NDArray
probs: NDArray
std: NDArray
tile: NDArray
tiles: NDArray # [T, 4]
gains: NDArray # [T]
whole: bool
overlap: float
cal: LevelCal = field(default_factory=LevelCal)
dets: dict[str, NDArray] | None = None
# ----------------------------------------------------------------------------
# windows
def _rc(t: NDArray) -> NDArray:
"""Raised cosine 0 -> 1 on t in [0, 1]."""
return 0.5 - 0.5 * np.cos(np.pi * np.clip(t, 0, 1))
def validity_raw(sigma_in: NDArray, p: FusionParams) -> NDArray:
s = np.log2(np.maximum(sigma_in, 1e-6))
la_lo, la, la_hi, lb, lb_hi = (math.log2(x) for x in (p.a_lo, p.a, p.a_hi, p.b, p.b_hi))
up = np.where(
s < la,
0.5 * (s - la_lo) / (la - la_lo),
0.5 + 0.5 * (s - la) / (la_hi - la),
) # 0 at a_lo, .5 at a, 1 at a_hi
v = _rc(up)
down = 1.0 - _rc((s - lb) / (lb_hi - lb))
return np.where(s >= lb, down, v)
def border_raw(
x: NDArray, y: NDArray, tiles: NDArray, W: int, H: int, overlap: float
) -> NDArray:
"""[n, T] raw sin^2 border ramps of points (x, y) for every tile of a level."""
x1, y1, x2, y2 = (tiles[:, i][None].astype(float) for i in range(4))
dx, dy = overlap * (x2 - x1), overlap * (y2 - y1)
X, Y = x[:, None], y[:, None]
inside = (X >= x1) & (X <= x2) & (Y >= y1) & (Y <= y2)
ramp = lambda d, w: np.sin(0.5 * np.pi * np.clip(d / np.maximum(w, 1e-6), 0, 1)) ** 2 # noqa: E731
wx = np.where(x1 > 0, ramp(X - x1, dx), 1.0) * np.where(x2 < W, ramp(x2 - X, dx), 1.0)
wy = np.where(y1 > 0, ramp(Y - y1, dy), 1.0) * np.where(y2 < H, ramp(y2 - Y, dy), 1.0)
return np.where(inside, wx * wy, 0.0)
def border_norm(
x: NDArray, y: NDArray, lv: CachedLevel, W: int, H: int
) -> tuple[NDArray, NDArray]:
"""Normalised border window per (point, tile) [n, T] and the number of tiles
containing each point [n]."""
if lv.whole:
n = len(x)
return np.ones((n, 1)), np.ones(n)
r = border_raw(x, y, lv.tiles, W, H, lv.overlap)
s = r.sum(1, keepdims=True)
inside = (
(x[:, None] >= lv.tiles[None, :, 0])
& (x[:, None] <= lv.tiles[None, :, 2])
& (y[:, None] >= lv.tiles[None, :, 1])
& (y[:, None] <= lv.tiles[None, :, 3])
)
return np.where(s > 0, r / np.maximum(s, 1e-12), 0.0), inside.sum(1).astype(float)
def level_gain(lv: CachedLevel, x: NDArray, y: NDArray) -> NDArray:
"""Gain (input px per original px) of the level at points; tiles of a level
share the gain up to rounding."""
return np.full(len(x), float(np.median(lv.gains)))
def validity_levels(
sigma: NDArray,
x: NDArray,
y: NDArray,
levels: list[CachedLevel],
p: FusionParams,
empirical: bool,
) -> NDArray:
"""[n, K] normalised validity windows of all levels at (x, y, sigma)."""
raw = np.stack(
[_validity_one(sigma * level_gain(lv, x, y), lv, p, empirical) for lv in levels], 1
)
return raw / np.maximum(raw.sum(1, keepdims=True), 1.0)
def _validity_one(
sigma_in: NDArray, lv: CachedLevel, p: FusionParams, empirical: bool
) -> NDArray:
v = validity_raw(sigma_in, p)
if empirical and lv.cal.emp_quality is not None:
e = lv.cal.emp_edges
idx = np.clip(np.digitize(sigma_in, e) - 1, 0, len(e) - 2)
q = lv.cal.emp_quality[idx]
v = np.where(np.isfinite(q) & (sigma_in >= e[0]) & (sigma_in < e[-1]), q, v)
return v
# ----------------------------------------------------------------------------
# weights
def prediction_table(
levels: list[CachedLevel], W: int, H: int, variant: str, p: FusionParams
) -> pd.DataFrame:
"""All predictions above ``tau_splat`` with their weight w, pass id and
probabilities."""
rows = []
for k, lv in enumerate(levels):
pr = lv.probs
if variant == "F5" and lv.cal.temperature != 1.0:
lg = np.log(np.clip(pr, 1e-7, 1 - 1e-7)) - np.log(np.clip(1 - pr, 1e-7, 1))
pr = 1.0 / (1.0 + np.exp(-lg / lv.cal.temperature))
keep = pr.max(1) >= p.tau_splat
if not keep.any():
continue
b = lv.xyxy[keep].astype(float)
cx, cy = (b[:, 0] + b[:, 2]) / 2, (b[:, 1] + b[:, 3]) / 2
w_, h_ = np.maximum(b[:, 2] - b[:, 0], 1e-3), np.maximum(b[:, 3] - b[:, 1], 1e-3)
sig = np.sqrt(w_ * h_)
df = pd.DataFrame(
{
"cx": cx,
"cy": cy,
"lw": np.log(w_),
"lh": np.log(h_),
"sigma": sig,
"pass": k * 10000 + lv.tile[keep].astype(int),
"level": k,
}
)
df["probs"] = list(pr[keep])
if variant == "F1":
w = np.ones(len(df))
else:
bn, _ = border_norm(cx, cy, lv, W, H)
w = bn[np.arange(len(df)), 0 if lv.whole else lv.tile[keep].astype(int)]
if variant in ("F3", "F3e", "F4", "F5"):
w = w * validity_levels(sig, cx, cy, levels, p, variant == "F3e")[:, k]
if variant in ("F4", "F5"):
u = lv.std[keep].astype(float).mean(1) / np.maximum(sig, 1.0)
w = w * np.exp(-u / max(lv.cal.u_med, 1e-6))
df["w"] = w
rows.append(df)
return pd.concat(rows, ignore_index=True) if rows else pd.DataFrame()
def coverage(
x: NDArray,
y: NDArray,
sigma: NDArray,
levels: list[CachedLevel],
W: int,
H: int,
variant: str,
p: FusionParams,
) -> NDArray:
"""Analytic coverage C at points."""
if variant == "F1":
return sum(border_norm(x, y, lv, W, H)[1] for lv in levels)
if variant == "F2n":
return np.ones(len(x)) - EPS
covered = np.stack([border_norm(x, y, lv, W, H)[1] > 0 for lv in levels], 1).astype(float)
if variant == "F2":
return covered.sum(1)
v = validity_levels(sigma, x, y, levels, p, variant == "F3e")
return (covered * v).sum(1)
# ----------------------------------------------------------------------------
# volume and peaks
def _bins(sigma: NDArray, p: FusionParams) -> NDArray:
return (np.log2(np.maximum(sigma, SIGMA0)) - math.log2(SIGMA0)) * p.bins_per_oct
def _cell(j: NDArray, p: FusionParams) -> NDArray:
sig_j = SIGMA0 * 2.0 ** ((j + 0.5) / p.bins_per_oct)
return np.maximum(1.0, sig_j / p.cell_factor)
def _key(j: NDArray, ix: NDArray, iy: NDArray, nb: int = 13) -> NDArray:
"""Pack (sigma bin, cell x, cell y) into int64 with ``nb`` bits per spatial
index (indices clipped to 2^nb - 1)."""
m = (1 << nb) - 1
return (
(j.astype(np.int64) << (2 * nb))
| (np.clip(ix, 0, m).astype(np.int64) << nb)
| np.clip(iy, 0, m).astype(np.int64)
)
def _unkey(uk: NDArray, nb: int) -> tuple[NDArray, NDArray, NDArray]:
m = (1 << nb) - 1
return (
(uk >> (2 * nb)).astype(int),
((uk >> nb) & m).astype(int),
(uk & m).astype(int),
)
def key_bits(W: int, H: int) -> int:
"""13 bits per spatial index (VisDrone, unchanged) unless the image needs
more cells (>= 1 px each): 15 bits (DOTA, long side up to 13 383 px)."""
return 13 if max(W, H) + 2 <= (1 << 13) - 1 else 15
def fuse_image(
levels: list[CachedLevel],
W: int,
H: int,
variant: str,
p: FusionParams,
nc: int = 10,
box_source: str = "mean",
) -> pd.DataFrame:
"""Detections (x, y, w, h, score, category_id 1-based) of one image."""
P = prediction_table(levels, W, H, variant, p)
if P.empty:
return pd.DataFrame(columns=["x", "y", "w", "h", "score", "category_id"])
probs = np.stack(P["probs"].to_numpy())
pmax = probs.max(1)
m = P["w"].to_numpy() * pmax
kbits = key_bits(W, H)
# trilinear splat in (sigma-bin, x / g_j, y / g_j) with the cell size of
# the lower sigma bin
sb = _bins(P["sigma"].to_numpy(), p)
j0 = np.floor(sb - 0.5).astype(int)
keys, vals = [], []
for dj in (0, 1):
j = j0 + dj
wj = np.where(dj == 0, 1 - (sb - 0.5 - j0), sb - 0.5 - j0)
g = _cell(j, p)
fx, fy = P["cx"].to_numpy() / g - 0.5, P["cy"].to_numpy() / g - 0.5
ix0, iy0 = np.floor(fx).astype(int), np.floor(fy).astype(int)
for dx in (0, 1):
wx = np.where(dx == 0, 1 - (fx - ix0), fx - ix0)
for dy in (0, 1):
wy = np.where(dy == 0, 1 - (fy - iy0), fy - iy0)
ok = j >= 0
keys.append(_key(j[ok], ix0[ok] + dx, iy0[ok] + dy, kbits))
vals.append((m * wj * wx * wy)[ok])
keys, vals = np.concatenate(keys), np.concatenate(vals)
uk, inv = np.unique(keys, return_inverse=True)
num = np.bincount(inv, vals)
cj, cix, ciy = _unkey(uk, kbits)
g = _cell(cj, p)
xc, yc = (cix + 0.5) * g, (ciy + 0.5) * g
sig_c = SIGMA0 * 2.0 ** ((cj + 0.5) / p.bins_per_oct)
C = coverage(xc, yc, sig_c, levels, W, H, variant, p)
fld = num / (C + EPS)
# 3x3x3 local maxima (sparse lookup; neighbouring sigma bins at the same
# position)
order = np.argsort(uk)
is_max = fld >= p.tau_peak
for dj in (-1, 0, 1):
jn = cj + dj
gn = _cell(jn, p)
bx, by = np.floor(xc / gn).astype(int), np.floor(yc / gn).astype(int)
for dx in (-1, 0, 1):
for dy in (-1, 0, 1):
if dj == dx == dy == 0:
continue
kk = _key(np.maximum(jn, 0), bx + dx, by + dy, kbits)
pos = np.searchsorted(uk, kk)
pos = np.clip(pos, 0, len(uk) - 1)
hit = (uk[pos] == kk) & (jn >= 0)
nb = np.where(hit, fld[pos], -np.inf)
is_max &= fld >= nb
del order
pk = np.flatnonzero(is_max)
if not len(pk):
return pd.DataFrame(columns=["x", "y", "w", "h", "score", "category_id"])
pk = pk[np.argsort(-fld[pk])][: max(p.top_k * 2, p.top_k)]
# neighbourhood membership: predictions in sigma bins J-1..J+1 within
# 1.5 cells (Chebyshev) of the peak
pj = np.round(sb - 0.5).astype(int)
det = []
xy = P[["cx", "cy"]].to_numpy()
by_bin = {j: np.flatnonzero(pj == j) for j in np.unique(pj)}
trees = {j: cKDTree(xy[idx]) for j, idx in by_bin.items()}
C_pk = C[pk]
w = P["w"].to_numpy()
passes = P["pass"].to_numpy()
hw, hh = np.exp(P["lw"].to_numpy()) / 2, np.exp(P["lh"].to_numpy()) / 2
boxes = np.stack(
[
P["cx"].to_numpy() - hw,
P["cy"].to_numpy() - hh,
P["cx"].to_numpy() + hw,
P["cy"].to_numpy() + hh,
],
1,
)
seen_top: set[int] = set()
for n, c in enumerate(pk):
J, gJ = cj[c], g[c]
members = []
for jj in (J - 1, J, J + 1):
if jj in trees:
hit = trees[jj].query_ball_point([xc[c], yc[c]], r=1.5 * gJ, p=np.inf)
members.append(by_bin[jj][hit])
idx = np.concatenate(members) if members else np.zeros(0, int)
if not len(idx):
continue
# cluster: members overlapping the strongest member (IoU >= iou_cluster)
top = idx[np.argmax(w[idx] * pmax[idx])]
if top in seen_top:
continue
seen_top.add(top)
idx = idx[_iou_one(boxes[top], boxes[idx]) >= p.iou_cluster]
wp = w[idx, None] * probs[idx] # [m, nc]
# per pass max, summed over passes
ps = passes[idx]
up, pinv = np.unique(ps, return_inverse=True)
mx = np.zeros((len(up), nc))
np.maximum.at(mx, pinv, wp)
score = mx.sum(0) / (C_pk[n] + EPS)
bw = w[idx] * pmax[idx]
sw = bw.sum()
if sw <= 0:
continue
cx = (bw * P["cx"].to_numpy()[idx]).sum() / sw
cy = (bw * P["cy"].to_numpy()[idx]).sum() / sw
bwid = math.exp((bw * P["lw"].to_numpy()[idx]).sum() / sw)
bhei = math.exp((bw * P["lh"].to_numpy()[idx]).sum() / sw)
if box_source == "top":
cx, cy = P["cx"].to_numpy()[top], P["cy"].to_numpy()[top]
bwid, bhei = math.exp(P["lw"].to_numpy()[top]), math.exp(P["lh"].to_numpy()[top])
for cl in np.argsort(-score)[: p.classes_per_peak]:
if score[cl] > 0:
det.append(
(
cx - bwid / 2,
cy - bhei / 2,
bwid,
bhei,
float(score[cl]),
int(cl) + 1,
)
)
out = pd.DataFrame(det, columns=["x", "y", "w", "h", "score", "category_id"])
if p.final_nms and len(out):
out = _nms(out, 0.7)
return out.sort_values("score", ascending=False).head(p.top_k)
def _iou_one(b: NDArray, bs: NDArray) -> NDArray:
ix = np.clip(np.minimum(b[2], bs[:, 2]) - np.maximum(b[0], bs[:, 0]), 0, None)
iy = np.clip(np.minimum(b[3], bs[:, 3]) - np.maximum(b[1], bs[:, 1]), 0, None)
inter = ix * iy
ua = (b[2] - b[0]) * (b[3] - b[1]) + (bs[:, 2] - bs[:, 0]) * (bs[:, 3] - bs[:, 1]) - inter
return inter / np.maximum(ua, 1e-9)
def volume(
levels: list[CachedLevel], W: int, H: int, variant: str, p: FusionParams
) -> dict[str, NDArray]:
"""Sparse scale-space field S = numerator / (C + eps) of one image."""
P = prediction_table(levels, W, H, variant, p)
if P.empty:
return {k: np.zeros(0) for k in ("j", "x", "y", "g", "S", "sigma")}
pmax = np.stack(P["probs"].to_numpy()).max(1)
m = P["w"].to_numpy() * pmax
kbits = key_bits(W, H)
sb = _bins(P["sigma"].to_numpy(), p)
j0 = np.floor(sb - 0.5).astype(int)
keys, vals = [], []
for dj in (0, 1):
j = j0 + dj
wj = np.where(dj == 0, 1 - (sb - 0.5 - j0), sb - 0.5 - j0)
g = _cell(j, p)
fx, fy = P["cx"].to_numpy() / g - 0.5, P["cy"].to_numpy() / g - 0.5
ix0, iy0 = np.floor(fx).astype(int), np.floor(fy).astype(int)
for dx in (0, 1):
wx = np.where(dx == 0, 1 - (fx - ix0), fx - ix0)
for dy in (0, 1):
wy = np.where(dy == 0, 1 - (fy - iy0), fy - iy0)
ok = j >= 0
keys.append(_key(j[ok], ix0[ok] + dx, iy0[ok] + dy, kbits))
vals.append((m * wj * wx * wy)[ok])
uk, inv = np.unique(np.concatenate(keys), return_inverse=True)
num = np.bincount(inv, np.concatenate(vals))
cj, cix, ciy = _unkey(uk, kbits)
g = _cell(cj, p)
xc, yc = (cix + 0.5) * g, (ciy + 0.5) * g
sig = SIGMA0 * 2.0 ** ((cj + 0.5) / p.bins_per_oct)
C = coverage(xc, yc, sig, levels, W, H, variant, p)
return {
"j": cj,
"x": xc,
"y": yc,
"g": g,
"S": num / (C + EPS),
"sigma": sig,
}
def _nms(d: pd.DataFrame, iou: float) -> pd.DataFrame:
import torch
from torchvision.ops import batched_nms
b = torch.tensor(d[["x", "y", "w", "h"]].to_numpy(), dtype=torch.float64)
b[:, 2:] += b[:, :2]
keep = batched_nms(
b,
torch.tensor(d.score.to_numpy()),
torch.tensor(d.category_id.to_numpy()),
iou,
).numpy()
return d.iloc[keep]
def load_levels(
cache_dirs: list[tuple[str, Any]],
stem: str,
branch: str,
overlap: float,
cals: dict[str, LevelCal] | None = None,
dets: bool = True,
) -> tuple[list[CachedLevel], int, int]:
"""Read the cached levels of one image."""
levels, W, H = [], 0, 0
for key, d in cache_dirs:
z = np.load(f"{d}/{stem}.npz")
W, H = (int(v) for v in z["image_wh"])
pd_ = (
{k: z[f"{branch}_det_{k}"] for k in ("xyxy", "score", "cls", "tile")}
if dets and f"{branch}_det_xyxy" in z.files
else None
)
levels.append(
CachedLevel(
key,
z[f"{branch}_xyxy"],
z[f"{branch}_probs"],
z[f"{branch}_std"],
z[f"{branch}_tile"],
z["tiles"],
z["gains"],
bool(int(z["n_input"]) == 0),
overlap,
(cals or {}).get(key, LevelCal()),
pd_,
)
)
return levels, W, H无人机与卫星影像里,目标往往只有十几甚至几个像素。把大图切成重叠小块(tile)再逐块过检测器,几乎成了默认操作。但 AI小怪兽要先点破一个被忽略的事实:切片带来的"目标被放大"效果,和把整张图喂进更高分辨率,本质是同一件事。论文举了个直观例子——VisDrone 图像长边约 1360 像素,一块原生 640 像素的切片把目标呈现出来的大小,跟把整图缩放到 1280 像素做单次推理几乎一样。既然如此,切片的收益到底来自"切"这个动作,还是仅仅来自"看得更清"?

上图是全文的骨架:同一个检测器既跑一次整图前向,也跑重叠切片;橙色分支是传统做法(各次前向先解码出框,再跨框做 NMS/贪心合并),蓝色分支是 SCAHI(在解码成框之前就把稠密输出累加融合)。两种路线用的前向次数完全一样,差别全在"怎么合并"。
这篇论文的价值不在又刷了几个点,而在把一个被默认正确的工程常识拆开称重:它给出可判定的条件(图像尺寸能否在单次前向里训到所需分辨率),并证明"合并方式"才是决定多趟推理划不划算的关键旋钮。对做 YOLO 落地的玩家来说,这直接关系到一个很现实的选择——是花钱堆分辨率/换大模型,还是上一套切片流水线。
本节为论文方法的原理拆解,涉及"为什么这样设计"的判断与类比属 AI小怪兽的工程视角,非论文原文。
问题本质:以往说"切片涨点",其实同时发生了两件事——目标被放大了、以及同一目标被看好几次。低分辨率基线把第一件事的功劳让给了第二件。模块拆解(论文的做法):为每个检测器固定一条评测代码路径,把整图前向也训到 1280 与 2048 像素,再和"1280 像素整图 + 切片 + NMS"正面比;所有可调项只在校准集(VisDrone 594 张、DOTA 141 张)上定,测试集只在最后开一次。设计动机:预注册假设 + 单次留出评估,等于给结论上了"不能事后挑最好那行"的锁——这在充斥着调参挑数的检测论文里,反而是最稀缺的严谨。
问题本质:框融合只能看到每趟前向的最终答案(解码后的框),目标一旦被切块切断,碎片框和完整框重叠不足,NMS 无法抑制,边界误检就来了。模块拆解,SCAHI 分三步(对照方法总览图蓝分支):

上图是融合后的"尺度空间体"切片示意:蓝色越深表示该处证据越强,橙色是该尺寸的真值。可以看到小目标只在小尺度层被点亮、大车落在更粗的层——这正是"按尺度分开累加"直观的样子。
设计动机点评:这套做法本质上借了语义分割里"高斯加权滑窗融合"的思路,但检测比分割多了一步——融合完还得把一个个目标从聚合证据里重新分出来,而论文证明"这一步决定多趟推理划不划算"。框融合是"先各自拍板、再投票",SCAHI 是"先把证据摊开、再一起拍板",后者能用上跨块的互补信息,也更不容易被边界碎片骗到。

上图是最有说服力的一张:横轴算力(每图 GFLOPs)、纵轴 AP,蓝线把 YOLOv10s 从 640 一路拉到 2560 像素几乎单调上涨,而同算力下换更大的 m 模型(方块/深色点)反而落在下面。提分辨率是比换大模型更高效的杠杆。
核心数字(Table 1,val AP):
检测器 | 单次 1280 | 单次 2048 | SAHI | 1280+切块+NMS | Q1 差值(2048−切块+NMS) |
|---|---|---|---|---|---|
YOLOv10s | 33.66 | 38.47 | 31.52 | 35.00 | +3.47 / test +2.75 |
YOLOv10m | 36.81 | 41.03 | 34.18 | 37.66 | +3.37 / test +3.05 |
YOLOv11s | 32.20 | 36.80 | 30.26 | 34.05 | +2.75 / test +1.83 |
YOLOv11m | 35.82 | 40.00 | 33.80 | 37.05 | +2.95 / test +1.90 |
YOLOv12s | 32.64 | 37.94 | 30.95 | 34.87 | +3.07 / test +2.03 |
对所有能训到 2048 像素的检测器,单次高分辨率都赢过切块+框融合(val +2.75~3.47,test-dev +1.83~3.05),标准 SAHI 反而是最弱的一档,Q1 全检测器确认。等算力的直接对照更狠:YOLOv10s@2048(128 GFLOPs)比 YOLOv10m@1280(136 GFLOPs)还高 1.7 AP。

增益分解图把"从单趟到切块+SCAHI"拆成几级台阶:加切片给每个检测器带来的提升都相近(2048 像素下 test-dev 约 1.1~1.5 AP,几乎全在 16 像素以下的小目标上);真正的分水岭在"要不要连整图前向也一起融合",以及"峰值网格够不够细"。粗糙网格(cell factor 5)会让有同类邻居的目标召回掉 22~24 个点,换精细网格能捞回大半。

这张图直接回答标题:横轴是"小于 16 像素目标的占比",纵轴是切块+SCAHI 相对单次的每图增益。在 DOTA-val,小目标占比越高,切块收益越大(Spearman ρ≈0.15~0.21);而 VisDrone 上这条关系很弱。原因很直白——DOTA 图像几千像素宽、单张上万个目标,单次前向根本训不到所需分辨率,这时切片才是刚需。
DOTA 核心数字(Table 3,mAP50 @2048):
配置 | YOLOv10s | YOLOv10m | YOLOv11s |
|---|---|---|---|
单次 2048 | 65.50 | 67.39 | 65.19 |
+切块, 框融合 | 68.46 | 68.13 | 66.68 |
+切块, SCAHI | 71.00 | 71.73 | 69.81 |
Q3(SCAHI − 最强单次) | +5.50 | +4.34 | +4.62 |
切块 + SCAHI 对五个检测器全面超过最强单次前向(2048 下 +4.3~5.6 mAP50,YOLOv12s 因只能训 1024 更是 +9.6),Q3 确认;仅把 SAHI 的合并步骤换成 SCAHI(Q4)也能再加 2.3~4.0 mAP50。代价同样清楚:切块的算力约是单次的 5.5 倍、延迟 4.8 倍(134 vs 28 ms),其中 90% 花在所有切块方法都要跑的前向上。

上图汇总了预注册问题在各检测器上的差值和置信区间,可以一眼看出 Q2/Q3 在 DOTA 稳稳成立、Q1((高分辨率单独能否胜切块)则不再清晰。
Table 4 逐件拆掉 SCAHI 的组件(相对预设设置的 AP 变化):
变体 | VisDrone AP | DOTA mAP50 | 拥挤目标召回 |
|---|---|---|---|
去掉显式归一化 | ±0.00 | ±0.00 | ±0 |
去掉边界渐变权重 | −0.74~−1.01 | −1.12 / −0.99 | −2~+1 |
加尺度有效性窗口 | −1.61~−1.79 | −19~−20(有害) | −1~−2 |
精细峰值网格 | +1.32~+1.38 | +0.36 / +0.41 | +18~+24 |
结论一句话:边界加权提供稳定但有限的正贡献,峰值网格分辨率才是拥挤场景的决定性设计——网格变细,拥挤目标召回直接涨 18~24 个点。归一化可以省(渐变权重本身已实现等覆盖),而"按尺度设有效性窗口"会误伤 DOTA 的大目标,被明确排除在 SCAHI 之外。


两栏对比(左框融合 NMS / 右 SCAHI):绿色为正确、红色为误检、黄色虚线为漏检。可以明显看到 SCAHI 一侧红色误检更少(边界碎片被压住)、黄色漏检也更少,尤其密集人群与小车辆区域——这正是"融合前不分框、精细网格分邻居"带来的直观效果。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。