Use Tensorflow Object Detection API to detect small objects in images
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Small-object detection is hard because the model gets very few pixels to work with. When an object occupies only a tiny region of an image, even a good detector can miss it unless the training data, input resolution, and model configuration all support fine-scale features. With TensorFlow's Object Detection API, success usually comes from improving data and scale handling rather than from one magic hyperparameter.
Why Small Objects Are Missed
Detectors lose information as feature maps get downsampled. That is fine for large objects, but small objects can disappear into a few pixels before the network reaches the detection head.
Common causes of poor recall on small objects:
- training images are resized too aggressively
- anchor sizes do not match the object scale
- the model architecture focuses on large receptive fields
- annotation boxes are noisy or too coarse
- evaluation uses thresholds that are too strict for tiny detections
That is why "small-object detection" is mostly a scale-management problem.
Start with Better Training Data
The best model will still struggle if the dataset does not teach the detector what tiny objects look like. High-quality bounding boxes matter more than usual because a few pixels of annotation error can be a large percentage of the object.
If possible:
- keep objects large enough in the training crop
- add more examples where the object is small but still visible
- use augmentations that do not blur or erase tiny details
- consider tiled crops rather than only full-frame images
Tiling is especially useful when the original image is large and the object occupies a tiny fraction of it.
Choose a Detector with Multi-Scale Features
Architectures with feature pyramids are usually a better starting point than plain single-scale detectors. In the TensorFlow Object Detection API, that often means selecting models that use FPN-style multi-scale feature maps.
Your pipeline config should also use an input size large enough to preserve details. A higher-resolution input increases compute cost, but it can dramatically improve recall for tiny objects because the detector sees more pixels per object.
The configuration idea is simple:
- larger input images preserve detail
- smaller anchors match small targets better
- multi-scale features let the network detect across size ranges
Tune Anchors and Image Size
If your detector uses anchors, they need to be compatible with your object size distribution. For example, if most objects are very small, default anchor scales may be too large.
The exact pipeline config fields depend on the model family, but the workflow is consistent:
- inspect the pixel sizes of objects in your dataset
- raise input resolution if objects are getting compressed too much
- reduce anchor scales or include smaller anchors
- retrain and compare recall on small-object examples
That feedback loop matters more than blindly copying a config from a tutorial aimed at general-purpose COCO detection.
Tiling and Inference-Time Crops
When full-resolution images are huge, inference on tiles can outperform one global pass. The idea is to cut the image into overlapping patches, run detection on each patch, then merge the predictions.
A simple preprocessing example in Python:
This is not the whole detection pipeline, but it illustrates the strategy. Tiling effectively increases apparent object size within each crop.
Evaluate Small Objects Separately
Do not judge the model only by one overall mAP number. Track performance specifically on the small-object cases that matter to the application. A detector can look fine in aggregate while failing on the only class or scale you actually care about.
Qualitative inspection also matters. Look at false negatives on small objects and decide whether the root cause is:
- scale
- blurry data
- confusing background
- annotation quality
- postprocessing thresholds
Common Pitfalls
- Expecting default detector settings to work well on very small objects.
- Training on low-resolution inputs that destroy fine details.
- Leaving anchor scales tuned for medium and large objects only.
- Ignoring tiling when the source images are large and sparse.
- Evaluating only overall accuracy instead of small-object recall.
Summary
- Small-object detection is mainly a scale and data-quality problem.
- Use higher-resolution inputs and multi-scale detectors when possible.
- Tune anchors to match the actual object sizes in your dataset.
- Tiling large images can dramatically improve small-object visibility.
- Measure small-object performance directly instead of relying on one global metric.

