Computer vision answers · Object Detection

How do I set tile overlap for small object detection in large images?

So objects on a tile edge are not cut in half or missed.

Short answer

Set the overlap between tiles to at least the size of the largest object you need to find, in pixels, so every object sits whole inside at least one tile, then merge the duplicates from neighboring tiles. Roboflow's Image Slicer and Detections Stitch blocks do both, and you can build and run them on Roboflow's free plan. Use the same tile size for training and inference, so objects appear at the same scale the model learned them at.

Roboflow agent · free to start

Skip the setup. Describe your images.

Describe your images and what you need to find. The agent sets up labeling, training and deployment with you.

Key facts

What you need
Large images and a detection model trained on tiles of them
What you get
Small objects found across the whole image, each counted once
Image sources
Drone, satellite, microscope and high-resolution camera images
Runs on
Cloud API, or an edge device or server running Docker
Aerial view of a parking lot with 10 cars, each marked with a green 'car' detection box, overlaid with yellow image processing grid and legend.

How to set tile overlap for small objects, step by step

Six steps from a large image to every small object found once.

  1. Connect Roboflow to your coding agent, ChatGPT or Codex

    Add the Roboflow MCP server to Claude, Cursor or Gemini CLI, or install the Roboflow plugin in ChatGPT or Codex. Your assistant can then upload and auto-label images, start training, build the Workflow and run the model from a prompt, at no extra cost beyond your Roboflow plan.

  2. Measure your largest object in pixels

    Open a few images at full resolution and note the width, in pixels, of the largest object you need to find. That number sets your overlap.

  3. Label your images and train on tiles of the same size

    Label your images in Roboflow Annotate, add tiling as a preprocessing step when you create a dataset version, and train on the tiles with Roboflow Train. Use the tile size you will run inference at.

  4. Set the overlap to at least your largest object

    Divide your largest object's width by the tile width and round up. For 80 pixel objects on 640 pixel tiles that is 0.125, so use an overlap ratio of 0.15. Most cases land between 0.1 and 0.3. More overlap catches more objects on tile edges, but means more tiles and slower runs.

  5. Run tiled inference and merge the duplicates

    Slice the image into overlapping tiles, run the model on each tile, and remove the duplicate detections where tiles overlap, so each object is counted once.

    Python
    import cv2
    import supervision as sv
    from inference import get_model
    
    model = get_model("your-project/1")
    image = cv2.imread("aerial_0031.jpg")
    LARGEST_OBJECT_PX = 80  # widest object you need to find
    
    def callback(tile):
        return sv.Detections.from_inference(model.infer(tile, confidence=0.4)[0])
    
    slicer = sv.InferenceSlicer(callback=callback, slice_wh=640, overlap_wh=LARGEST_OBJECT_PX + 20, overlap_filter="non_max_suppression")
    detections = slicer(image)
    print(len(detections), "objects found")
    # 214 objects found

    Rather not write code? Ask the Roboflow agent to set this up for you

  6. Build the tiling into a Workflow

    In a Workflow, chain the Image Slicer block with your overlap ratio, your model, and the Detections Stitch block set to drop duplicates (nms) or merge them (nmm). Run it with Roboflow Deploy in the cloud or on your own hardware.

Why 2 million engineers build on Roboflow

  • Label faster

    Auto-label with SAM 3 or your own model, then fix the misses instead of drawing every box.

  • RF-DETR

    Roboflow’s open-source real-time detection model, built for accuracy (opens in a new tab) on small objects.

  • Logic built in

    Counting, zones, tracking and alerts are ready-made Workflow blocks, so there is less code to write.

  • Your model, your weights

    Use your trained weights on every plan, including free, through the open-source Inference package.

  • Run it anywhere

    Self-host on a workstation, Docker, an on-prem GPU or an edge device, or call the cloud API.