Saltar al contenido


Sliced Inference on 4K Drone Imagery: Why Small Objects Need SAHI (a Simulation)


A synthetic, fully reproducible illustration of the core mechanism behind the AgriDrone Vision Evaluation Pipeline: when a 4K frame is resized to the 640-px input of a YOLO detector, a 30-px weed becomes a 5-px smudge. Slicing the frame into native-resolution tiles (SAHI) keeps the object at its real size — at the cost of one forward pass per tile.
Under a fixed detector, how much recall on small objects is lost to resizing alone, and how much of it does slicing recover?

Case study AgriDrone Vision Blog: Objetos pequeños, imágenes grandes


Paso a paso


Método

1) Scatter 150 objects with log-normal sizes (8–120 px) over a 3840×2160 frame. 2) Full-frame mode: scale every size by 640/3840 and sample a detection from the toy curve. 3) Sliced mode: same curve at native size; count the 640-px tiles with 20 % overlap that SAHI would produce. 4) Report recall by COCO-like size bins and the inference cost (number of forward passes).


IMAGE_W, IMAGE_H = 3840, 2160      # 4K frame
INPUT_SIZE = 640                   # detector input (longest side)
SLICE_SIZE, OVERLAP = 640, 0.2     # SAHI tiles

full_scale = INPUT_SIZE / max(IMAGE_W, IMAGE_H)       # 0.167: objects shrink 6x
p_full   = detection_probability(sizes * full_scale)   # whole frame, resized
p_sliced = detection_probability(sizes)                # tiles at native resolution
                    

La escena y la rejilla de recortes

150 objetos sintéticos sobre un fotograma de 3840×2160, cubierto por 32 recortes de 640 px con 20 % de solape. Verde: detectado en ambos modos. Naranja: recuperado sólo con recortes. Rojo: perdido en ambos.

Synthetic 4K frame with SAHI slicing grid

Probabilidad de detección según el modo de inferencia

El reescalado multiplica el tamaño de cada objeto por 0.167 antes de que la red lo vea. El mismo detector de juguete, evaluado sobre los tamaños encogidos, se hunde con todo lo que mide menos de ~60 px en el fotograma original; a resolución nativa conserva casi todo lo que supera 12 px.

Detection probability vs object size

Recall por tamaño de objeto y coste de los recortes

Recall global en esta simulación: 16,0 % a fotograma completo frente a 96,0 % con recortes. El precio: 33 pasadas por la red por fotograma en vez de 1 (los recortes más el fotograma entero, que SAHI conserva para los objetos grandes).

Objects Recall full-frame (%) Recall sliced (%)
bin
< 16 px 18 11.1 66.7
16-32 px 76 10.5 100.0
32-64 px 52 21.2 100.0
> 64 px 4 75.0 100.0
All 150 16.0 96.0

Límites: The detector curve is an assumption, not a fit. Tile-border effects, NMS merging across overlapping tiles, false positives and the latency of 32+ passes per frame are deliberately left out; they are exactly what the real pipeline measures.


Ver código