An automated approach for counting ants in densely populated images and gaining insight into ant foraging behavior

CoverCover
This study presents a hardware-agnostic computer vision workflow that integrates deep learning models with Slicing-Aided Hyper Inference (SAHI) to automate the detection of small, densely packed ants across diverse laboratory environments. By systematically optimizing image slicing parameters, the system overcomes the limitations of standard detectors to achieve high accuracy in scenes containing over a thousand individuals, enabling scalable analysis of foraging behaviors in small insect populations like ants.
Verifying Detection Robustness Across Multiple Lab Setups

Verifying Detection Robustness Across Multiple Lab Setups

To verify the system's reliability extends beyond a single controlled environment, the model was validated across multiple distinct experimental setups, ranging from simple clean backgrounds (A01–A03) to complex arenas containing debris and various baiting structures (B01–B03). This figure illustrates the strong linear correlation (r2 >0.88 for most subsets) between manual and automated counts, demonstrating that the pipeline maintains high precision even when deployed in varying imaging conditions that mimic real-world behavioral studies.

Accurate Small Object Detection in Crowded Settings

Accurate Small Object Detection in Crowded Settings

Standard object detection models often fail to identify minute organisms in high-resolution images because the objects disappear during the feature map downsampling process. This figure visually demonstrates the transformative impact of SAHI in these dense scenarios: while inference on the full-scale image fails to detect the colony, the slicing-aided approach effectively divides the image into patches to 'zoom in', allowing the model to accurately localize and count hundreds of tiny ants that were previously undetectable.

Hyperparameter Tuning with SAHI

Hyperparameter Tuning with SAHI

To achieve the best balance between detection accuracy and computational speed, the study investigated key SAHI hyperparameters, specifically the divider (which determines the cropping ratio/patch size) and the overlap ratio between patches. This figure presents heatmaps revealing that increasing the divider number significantly improves Mean Average Precision (up to 81.8%) by making small ants appear larger to the model, though this comes at the cost of increased inference time, guiding users to select the optimal settings for their hardware.