Image patching (also called tiling or slicing) cuts a high-resolution image into smaller, usually overlapping crops. The model runs on each crop separately, and the crop-level predictions are mapped back onto the full frame and merged. It matters when the objects you care about are small in a large frame, because resizing the whole frame loses their detail. In a 2018 study of 4K video, a YOLO v2 detector scored 33.6 AP50 on a downscaled frame and 75.4 AP50 when it evaluated every overlapping crop. The catch is cost. One forward pass per image becomes many, so patch size, overlap and merge rules are design decisions, not preprocessing defaults.
What’s Worth Understanding About Image Patching First
The word “patch” has two meanings in computer vision. A vision transformer splits its input into small patch embeddings inside the network. Image patching, as this article uses the term, happens outside the model: the image is cut into sub-images that each go through the detector or segmenter on their own.
Three design choices control a patching pipeline: how big each patch is, how much neighbouring patches overlap, and how predictions from different patches are combined into one answer.
Tiling has been widely adopted partly because it can be applied only at inference, with no retraining. Fine-tuning on sliced images adds further gains. The SAHI paper reports AP gains of 6.8%, 5.1% and 5.3% from sliced inference alone on FCOS, VFNet and TOOD, rising to cumulative gains of 12.7%, 13.4% and 14.5% with slicing-aided fine-tuning.
How Does Image Patching Work, and What Does It Mean in Practice?
The mechanism is simple. The implementation details are where accuracy is won or lost. A standard sliced-inference pipeline runs these steps in order:
- Slice. Lay a grid of fixed-size windows over the image. The stride is the patch size minus the overlap, so the overlap has to be smaller than the patch for the stride to stay positive. Where the image size and the stride do not divide evenly, extra patches are needed to cover the remaining edge.
- Resize (optional). Each patch can be enlarged before inference so that small objects take up more pixels relative to what the network sees. The SODA benchmark authors cropped 800×800 patches with a stride of 650 and resized them to 1200×1200.
- Infer. Run the model on each patch. Batching several patches into one forward pass beats concurrent single-image calls competing for the same CUDA device, and avoids multiplying peak VRAM.
- Map back. Shift each prediction by its patch’s offset into full-image coordinates.
- Merge. Resolve duplicates from overlapping regions, usually with non-maximum suppression (NMS) for boxes or averaging or clipping for segmentation masks.
- Full-frame pass (optional). A pass on the whole downscaled image can be added and merged in to catch large objects that no single patch contains.
Libraries already package these steps. Roboflow’s Supervision exposes slice_wh and overlap_wh on its InferenceSlicer. MONAI’s sliding_window_inference takes a window size and an overlap that defaults to 0.25, with an option to move stitching to the CPU when GPU memory runs out. These defaults are where you start, not tuned values.
Why Can’t I Just Downscale a High-Resolution Image Instead?
Downscaling is the fast option. It costs one forward pass, but it throws away the detail that small objects depend on. Object detector backbones already reduce the spatial resolution of feature maps. Large and medium objects survive that, but for small objects the weak signal is almost wiped out before it reaches the detection head. In the 4K study, the downscale baseline reached only 33.6 AP50 against 75.4 for exhaustive crops.
Other studies point the same way. Static SAHI tiling with 640-pixel tiles and 20% overlap raised mAP50 to 0.62, with small-object mAP50 at 0.42. The authors note that a 5456×3632 frame from over 200 metres, shrunk to 640×426, leaves swimmers with no discernible features to detect. A crowd and harbour study went further: several detectors found no objects at all without slicing, and with 256-pixel tiles and 50% overlap their results were checked against about 1,100 people counted by hand.
If the objects that matter are large relative to the frame, they are likely to be detected even after downscaling. And in the maritime study, static tiling slightly reduced accuracy on medium and large objects even as it lifted small ones. It is how many pixels your smallest important object covers once the frame has been resized to the model’s input. Where those pixels are never captured, tiling cannot recover them, and the fix lies with the machine vision camera and optics.
How Do I Choose Patch Size and Overlap for My Objects and Resolution?
Pick patch size from object size, then pick overlap from how often objects land on a seam. GPU memory sets the upper limit on patch size and the network’s receptive field sets the lower limit. Between those limits, the studies measured the following trade-offs.
| Setting | What the sources measured | What it implies |
|---|---|---|
| Small patches (256×256) | UHR-DETR (2026): mAP fell to 31.7% and latency rose to 416 ms, as small patches fragment the scene and truncate objects | Good for tiny objects, bad for anything larger than the patch |
| Mid patches (512×512) | UHR-DETR: best balance of accuracy and speed; SAHI ensemble study: 512 with 50% overlap gave the best efficiency for people detection with TorchVision, YOLOX and YOLOv8 | A sensible starting point |
| Large patches (1024×1024) | UHR-DETR: mAP fell to 30.1% as large patches took in uninformative background; SAHI ensemble study: TorchVision at 1024 with 25% overlap gave the lowest counting error (3.32%) on boats, while TorchVision at 512 with 50% overlap gave 90.54% error | Right when objects are big; background dilutes accuracy on small ones |
| Higher overlap (0.5 vs 0.25) | Fewer objects split across boundaries, more patches to process | Pay for it when objects are dense or often sit on seams |
| 25% overlap vs none | SAHI paper: raises small and medium AP but slightly lowers large-object AP through false positives from slices | Overlap is not free accuracy |
TorchVision’s best setting for people, 512-pixel tiles with 50% overlap, gave its worst accuracy on boats, which needed larger tiles. Smaller patches also raise the chance that a large object never fits wholly inside one slice. The same study concluded that the effect of cutting overlap from 50% to 25% depends on the model and tile size and needs experiments to settle.
A working rule: size the patch so the smallest object you must detect keeps enough pixels after any resizing, and the largest object still fits inside one patch. Then set the overlap so that objects on a seam are captured whole by an adjacent tile. Where object scale changes over time, as with a drone changing altitude, a fixed tiling strategy risks degrading detection. That is the case for adaptive tiling.
What Does Patching Cost Me in Inference Passes, Latency and Compute?
Patching multiplies forward passes by the number of tiles. Computation grows roughly linearly with that count, while memory per pass stays fixed. Exhaustive overlapping crops pay the full computational cost of every crop.
Worked Example: Counting Passes on a 4K Frame
- Stride = 640 − 128 = 512 pixels, following the slice-minus-overlap definition.
- Horizontally, tile starts at 0, 512, … cover 3,840 pixels in ⌈(3840 − 640) / 512⌉ + 1 = 7 + 1 = 8 tiles.
- Vertically: ⌈(2160 − 640) / 512⌉ + 1 = 3 + 1 = 4 tiles.
- Total: 32 forward passes where downscaling needed 1. Adding a full-frame pass makes it 33.
Raise the overlap to 50% and the stride drops to 320, giving 11 × 6 = 66 tiles on the same frame. Raising the overlap from 20% to 50% roughly doubled the tile count in this case, from 32 to 66, which is why overlap should be justified by measured boundary misses and not set high “to be safe”.
What the Measured Slowdowns Look Like
The maritime UAV study puts numbers on it: static 640-pixel tiling with 20% overlap ran at 0.60 FPS, which the authors call impractical. Their altitude-aware dynamic tiling ran at 1.87 to 2.60 FPS and reached small-object mAP50 of 0.45–0.47, above static tiling’s 0.42. In the 4K study, selective cropping reached 3 to 6 fps on 4K video and 2 fps on 8K. At 8K, opening and saving images became a bottleneck alongside inference itself.
The cost-cutting options all rest on one observation. Small objects in high-resolution images tend to be sparse, so exhaustive tiling spends much of its compute on empty patches.
- Attention-then-crop. A cheap first pass finds candidate regions and only intersecting crops are evaluated at full resolution. The 4K study reports that inspecting fewer crops this way raised processing performance by up to 27% over evaluating every crop.
- Learned sparse patch selection. UHR-DETR reports close to a 10× speedup over sliding-window baselines. Raising its budget from 40 to 60 patches moved mAP only from 34.9% to 35.6% but latency from 357 ms to 479 ms.
- Fewer, merged passes. Dynamic Tiling packs on-demand patches into composite images to reduce forward passes, cutting average inference time from 0.160 to 0.148 seconds in its best configuration.
- Bigger patches where memory allows. For segmentation, larger inference patches reduce running time because fewer forward passes and fewer stitching operations are needed.
Sparse methods have a limit. UHR-DETR’s authors state that when objects are spread uniformly across the whole frame, the patch count climbs and latency approaches that of exhaustive sliding windows. Object detection on a dense production line or a packed crowd may get none of the savings. Our notes on latency and hardware trade-offs on edge devices take up the hardware side of this budget.
How Do I Handle Objects That Straddle Patch Boundaries Without Double-Counting or Missing Them?
Overlap ensures that objects on patch borders are captured by an adjacent tile. Merging then removes the copies that overlap creates. Skip either and you either miss it or count it twice.
Without NMS, sliced inference produces many duplicate detections for objects that appear in several patches, and smaller tiles produce more of them, which drives false positives up. The SODA benchmark authors ran NMS twice, once per patch and once on the whole image, both at an IoU threshold of 0.5.
Plain NMS is not enough when an object is larger than the grid cell or is cut in half by a seam. The object can come back as separate fragments detected in neighbouring patches instead of one box. The 4K study handled this with class-specific distance thresholds for merging nearby boxes, merging only vertically for people. The Dynamic Tiling authors list the same weaknesses of blind NMS: fragmented large objects, irregular shapes, and similar classes such as cars and trucks being split into conflicting labels. Their fixes:
- Flag predictions within 2% of a tile edge as near-edge, or near-corner when close to two edges, and generate extra patches centred on them to recover the whole object.
- Apply a size filter: keep large predictions only from the full downscaled image and small ones only from tiles, on the reasoning that large objects are better seen in context.
Library choices matter here too. Supervision offers both NMS and non-max merge as overlap filters, and merge compares metadata within each merge group. The SAHI ensemble study compared NMS, NMM, Greedy NMM and LSNMS and found that all significantly reduced the number of detections compared with the raw output, which included many false positives. For long, thin or rotated objects (ships, vehicles in aerial views), axis-aligned IoU between fragments behaves poorly. That is where oriented bounding boxes for dense or elongated objects start to earn their cost, alongside rotated NMS.
How Do I Stitch Patch-Level Predictions Back into a Coherent Whole-Image Result?
For detection, stitching means coordinate offsets plus the merge rules above. For segmentation, authors report higher error rates for labels near patch edges.
The remote-sensing stitching study groups segmentation stitching into three families: averaging overlapping labels, clipping each patch’s edges and concatenating what remains, and plain concatenation. The study traces all three to translational variance: a pixel’s label depends on where it sits in the input patch. Zero-padding is one cause, raising edge error rates by as much as 35% in its U-Net experiment. Averaging helped only modestly and needed 15× more processing for 15 translated inputs. The study’s recommendation is to clip the 20 to 40 pixels nearest each patch edge and enlarge the inference patch to offset the cost. MONAI’s averaging merger and Gaussian-weighted windows are the soft-blending alternative.
Overlap Alone Does Not Guarantee Clean Seams
A 2025 ICCV paper found that when a network uses InstanceNorm, each pixel’s prediction depends on the content of the whole tile, so no halo size can make the stitching seamless. The authors propose BatchRenorm, which uses global statistics during both training and inference, as a way to get artifact-free stitching without losing prediction quality. A seismic fault study found grid-like noise at patch boundaries that no single threshold could fix. Training on paired overlapping patches with a consistency loss reduced it.
The practical upshot: check the normalisation layers before blaming the tiling grid when seams appear in tiled segmentation output. The Mask R-CNN trade-offs in production are related reading for tiled instance masks.
When Does Image Resolution Make an Off-the-Shelf CV Model Fail, Pushing Me Toward a Custom Build?
An off-the-shelf detector fails on resolution when the objects that matter shrink below what it can resolve at its default input size, and the patching needed to recover them breaks your latency or cost budget. Small-object failure on its own can be tackled without a custom model. Sliced inference wraps a pretrained detector and needs no retraining. The custom-build threshold comes after that, when any of the following holds:
- Default tiling recovers recall but the frame rate drops to the levels seen in the static-tiling study (0.60 FPS) and your application needs live throughput.
- Object scale varies so widely that no single patch size works, as the people-versus-boats results showed.
- Seam artifacts or fragmented boxes persist after tuning overlap and NMS.
- Objects are dense and uniform enough that sparse patch selection saves nothing.
This is one concrete case of a wider pattern we hold: open-source detection is treated as a solved problem, but production conditions and scale change the picture, and models that work in demos fail at the edge cases and throughput real deployments demand. Where the objects that matter are large in the frame, an off-the-shelf model may detect them even after downscaling. For a fuller set of reasons off-the-shelf computer vision models fail in production beyond resolution, see the companion piece. Whether those reasons add up to commissioning a model is the custom vs off-the-shelf computer vision decision, which weighs build cost against the extra passes, frame-rate loss and tuning effort described here.
Before that decision, three numbers can be measured on your own images in a pilot: small-object recall under downscaling versus tiling, forward passes per image at the tiling that recovers that recall, and end-to-end latency per image including merge and I/O. If tiling recovers recall within budget, you have a configuration problem. If it recovers recall only at a cost you cannot run, you have a computer vision engineering problem, and patch strategy becomes part of the model design. Our guide to sizing a CV inspection pilot before scaling covers setting those acceptance criteria.