Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Find every object and draw a box around it
A detector answers two questions at once: what is in the picture, and where? For every object it draws a box and says what the box contains and how sure it is. A self-driving car needs boxes for pedestrians and cyclists; an analyst wants every vehicle and aircraft on a satellite image. A detector looks at a fixed-size input, typically 640 × 640 pixels. A satellite scene is many times larger, so shrinking it to fit makes a car a speck of two or three pixels. The demo shows the trade-off between shrinking and cutting the image into tiles.
Detectors count aircraft on airfields, ships in ports and vehicles in car parks from satellite and drone imagery, and find debris, docking targets and obstacles for robots. Most of the engineering is in data, image size and thresholds, not in the network.
- 1. A detector outputs, per object…
- 2. Shrinking a 4096-pixel image to 640 pixels makes a 16-pixel car…
- 3. Cutting a large image into tiles keeps objects…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Output. A set of (class, box, score) triples of variable size. Boxes are axis-aligned (x1, y1, x2, y2) or, for aerial imagery, oriented (centre, size, angle; DOTA).
- Families (architectures in E9). Two-stage: R-CNN (Girshick et al. 2014), Fast and Faster R-CNN (2015), Cascade R-CNN (2018). One-stage: YOLO (Redmon et al. 2016) to YOLOv8 and YOLO11 (Ultralytics 2023–2024), SSD (2016), RetinaNet (2017), FCOS (2019). Set prediction: DETR (Carion et al. 2020), Deformable DETR (2021), RT-DETR (2024). Open-vocabulary: OWL-ViT (2022), Grounding DINO (2023), YOLO-World (2024) detect classes named in text.
- Datasets. PASCAL VOC (20 classes); COCO (Lin et al. 2014; 80 classes, about 118000 training images in the 2017 split); LVIS (Gupta et al. 2019; 1203 long-tailed classes); Objects365; aerial DOTA (Xia et al. 2018) and xView (Lam et al. 2018; 60 classes, about 1 million objects).
- Metrics (defined in E9-14). AP50 (VOC); COCO AP averaged over IoU 0.5 to 0.95; AP for small (area under 32² pixels), medium and large; AR. For deployment: precision and recall at the chosen score threshold, and latency.
- Label formats. COCO JSON stores (x, y, width, height) in pixels; YOLO text stores (class, cx, cy, w, h) normalised to [0, 1]; Pascal VOC XML stores corners. Format mix-ups are a classic silent bug.
- 1. COCO AP averages AP over IoU thresholds…
- 2. A COCO 'small' object has area below…
- 3. YOLO label files store box coordinates…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.From annotation to a deployed detector
Exercise 1.
- Letterbox an image into a square network input and map boxes back.
- Tile origins with overlap, and shifting tile detections to image coordinates.
Practice.
- Label consistently. Write an annotation guide (occlusion, truncation, minimum size, crowds); review a sample; use model-assisted labelling.
- Choose input size from object size. Objects below about 8 pixels at the network input are rarely found; tile large images (SAHI, Akyon et al. 2022) and merge with NMS across tiles.
- Train a pretrained YOLO11 or RT-DETR first; Faster or Cascade R-CNN when localisation precision matters; Grounding DINO to bootstrap labels for new classes.
- Pick the operating point on a validation set: the score threshold sets the precision–recall trade-off that matters to the user, not the AP.
- Analyse errors with TIDE (Bolya et al. 2020): classification, localisation, duplicate, background and missed errors call for different fixes.
- Export to ONNX or TensorRT and re-check accuracy after quantisation.
from ultralytics import YOLO
from sahi import AutoDetectionModel
from sahi.predict import get_sliced_prediction
model = YOLO("yolo11s.pt")
model.train(data="vehicles.yaml", imgsz=640, epochs=100) # tiles of 640 cut from the training scenes
det = AutoDetectionModel.from_pretrained(model_type="ultralytics", model_path="runs/detect/train/weights/best.pt")
res = get_sliced_prediction("scene_4096.tif", det, slice_height=640, slice_width=640,
overlap_height_ratio=0.2, overlap_width_ratio=0.2,
postprocess_type="NMS", postprocess_match_threshold=0.5)- 1. SAHI improves small-object detection by…
- 2. The deployed score threshold should be chosen…
- 3. TIDE separates errors into…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Scale is the dominant variable. A detector’s features at stride s see an object of size a pixels as about a/s cells; at the finest common stride (8) an object below 8 pixels at the input occupies less than one cell and is easily lost. Resizing an S-pixel image to an input of T pixels scales every object by T/S, so scene size directly sets the smallest detectable object.
Tiling trades compute for resolution. Covering an S × S image with T × T tiles at overlap o needs about ⌈(S − o)/(T − o)⌉² passes. Without overlap, an object of size a straddles a seam with probability about 1 − (1 − a/T)²; any overlap of at least a guarantees every object lies whole in some tile, at the cost of duplicate detections that must be merged across tiles.
More passes, more false alarms. Each forward pass contributes its own background false positives, so tiling raises the number of low-score false alarms roughly in proportion to the number of tiles; the score threshold and per-tile calibration matter more after tiling.
AP and the operating point. AP integrates precision over all recalls and all thresholds, so low-score false alarms barely affect it; a deployed system runs at one threshold, where they may dominate.
- 1. Below about 8 pixels at the network input an object…
- 2. An overlap at least the object size guarantees…
- 3. Low-score false alarms affect AP…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How should a detector process a large satellite scene full of small vehicles?
History.
- R. Girshick et al., “Rich feature hierarchies for accurate object detection and semantic segmentation” (2014): R-CNN.
- J. Redmon et al., “You only look once: unified, real-time object detection” (2016).
- N. Carion et al., “End-to-end object detection with transformers” (2020): DETR.
- F. C. Akyon, S. O. Altinuc and A. Temizel, “Slicing aided hyper inference and fine-tuning for small object detection” (2022): SAHI.
Exercise 2. Three 4096 × 4096 scenes with 300 vehicles each (boxes 10–24 pixels).
- Simulated detector: one 640 × 640 input per pass; an object of apparent size a is found with probability 1/(1 + exp(−(a − 8)/1.5)), times its visible fraction in the window (not at all below 0.3); box noise of 8% of the size plus half an input pixel; truncated objects get the truncated box and a lower score; about 2 false alarms per pass.
- Strategies: resize the scene to 640 (1 pass) or 1280 (4 passes); 49 tiles without overlap; 64 tiles with 128 pixels of overlap, with or without class-agnostic NMS at IoU 0.5 across tiles.
| strategy | passes | AP50 | recall | unmatched detections per scene |
|---|---|---|---|---|
| resize to 640 | 1 | 0.011 | 0.014 | 5.3 |
| resize to 1280 | 4 | 0.094 | 0.114 | 19.0 |
| tiles, no overlap | 49 | 0.872 | 0.967 | 160.3 |
| tiles, overlap 128, no merge | 64 | 0.822 | 0.973 | 288.7 |
| tiles, overlap 128, NMS | 64 | 0.932 | 0.980 | 160.3 |
- Downscaling fails outright: vehicles become 1.6–3.8 pixels at 640 and 3–7.5 at 1280, below the detector’s working size.
- Tiling recovers them; without overlap 3.1% of vehicles straddle a seam and are found as partial boxes or not at all.
- Overlap alone made things worse (0.822): every object in an overlap strip is found twice or as a fragment, and the extras count as false positives. Merging with NMS fixed this (0.932).
- False alarms scale with passes: 49–64 passes produced about 160 unmatched, mostly low-score detections per scene against 5 for one pass; AP hides them, a fixed threshold would not.
- Seeds 1 and 2: tiles with NMS 0.939 and 0.937; without overlap 0.867 and 0.876; overlap without merge 0.798 and 0.819; 5.1% and 4.0% of vehicles on a seam.
- Caveat: the detector is a stochastic model of size-dependent recall, not a trained network; the trends match SAHI’s reported gains on small objects, the numbers are illustrative.
Object detection in AI, robotics and aerospace
- Earth observation: vehicle, aircraft and ship counting (xView, DOTA, iSAID); oriented boxes for ships and aircraft; tiling is standard for scenes of tens of thousands of pixels.
- Autonomous driving and drones: real-time detectors (YOLO, RT-DETR) on embedded GPUs, with latency budgets of tens of milliseconds.
- Space robotics: detecting a target spacecraft or docking port before pose estimation (G2-5).
References
- R. Girshick, J. Donahue, T. Darrell and J. Malik (2014). “Rich feature hierarchies for accurate object detection and semantic segmentation.” CVPR.
- S. Ren, K. He, R. Girshick and J. Sun (2015). “Faster R-CNN: towards real-time object detection with region proposal networks.” NeurIPS.
- J. Redmon, S. Divvala, R. Girshick and A. Farhadi (2016). “You only look once: unified, real-time object detection.” CVPR.
- T.-Y. Lin et al. (2014). “Microsoft COCO: common objects in context.” ECCV.
- G.-S. Xia et al. (2018). “DOTA: a large-scale dataset for object detection in aerial images.” CVPR.
- N. Carion et al. (2020). “End-to-end object detection with transformers.” ECCV.
- D. Bolya, S. Foley, J. Hays and J. Hoffman (2020). “TIDE: a general toolbox for identifying object detection errors.” ECCV.
- F. C. Akyon, S. O. Altinuc and A. Temizel (2022). “Slicing aided hyper inference and fine-tuning for small object detection.” ICIP.
- Y. Zhao et al. (2024). “DETRs beat YOLOs on real-time object detection.” CVPR (RT-DETR).