Small Object Detection Method for Farmed Animals in UAV Images Based on Improved YOLOv7-Tiny (Contemporary Mathematics, 2025)
Unmanned Aerial Vehicle (UAV) technology plays a vital role in the animal husbandry industry. Highresolution images can monitor the spatial distribution and behavior patterns of animal populations in real time, thereby significantly improving the efficiency of animal breeding management. In view of the technical difficulties commonly found in animal husbandry, such as small target size, frequent occlusion, and unbalanced category distribution, this study proposes an enhanced animal small target detection algorithm based on the YOLOv7-tiny framework, named SPF-YOLOv7-tiny. The algorithm contains three key innovations: first, the Segment Anything Model (SAM) image segmentation technology is integrated to optimize the Mosaic data enhancement strategy, significantly improving the diversity of training samples; second, the dedicated small target detection head module enhances the feature extraction capability of tiny targets. Third, the Focal_DIoU loss function is used to replace the original SIoU, which effectively alleviates the impact of category imbalance on detection accuracy. In order to verify the performance of the algorithm, a special farmed animal image dataset was constructed and a comparative experiment was conducted. Experimental data show that the improved SPF-YOLOv7-tiny algorithm achieved a recognition accuracy of 92.6% on the self-built data set, and the detection speed reached 103 FPS, which is 2.5% higher than the baseline YOLOv7-tiny model mean Average Precision (mAP). Compared with Faster Region-based Convolutional Neural Network (R-CNN), YOLOX, YOLOv5s, NanoDet and Single Shot multiBox Detector (SSD), the SPF-YOLOv7-tiny algorithm has excellent detection performance. Although the detection speed is slightly lower than NanoDet, it can also meet the needs of real-time detection, providing strong technical support for real-time detection applications in actual farming scenarios.
Keywords: target detection; YOLOv7-tiny; SAM; deep learning