高级检索+

基于改进YOLOv11n与DeepSORT多目标跟踪的鸡蛋计数方法

Egg counting method based on improved YOLOv11n and DeepSORT multi-object tracking

  • 摘要: 为解决蛋鸡养殖过程中人工计数成本高、效率低及误差大等问题,该研究提出一种基于改进YOLOv11n与DeepSORT多目标跟踪的鸡蛋计数方法。该方法涵盖3个主要模块:在检测部分,针对YOLOv11n在鸡蛋遮挡、粘连及异常蛋表型特征差异细微等复杂场景下检测性能不足的问题,提出改进模型YOLO-SR。该模型在骨干网络的通道并行空间注意力机制(cross-channel parallel spatial attention, C2PSA)中引入空间通道协同注意力机制(spatial and channel synergistic attention, SCSA),并在颈部网络引入与重参数化泛化特征金字塔网络(reparameterized generalized feature pyramid network, RepGFPN),以增强特征提取与多尺度融合能力,从而提升检测精度;在跟踪部分,为缓解鸡蛋因遮挡导致重识别过程中出现的ID跳变现象,采用DeepSORT跟踪算法,结合深度提取的表观特征与运动信息,有效维持目标ID的连续性;在计数部分,设计了撞线计数机制,以避免重复计数问题。结果表明,YOLO-SR检测器的平均精确度与F1分数分别达95.4%与89.0%,较原始YOLOv11n分别提升1.9与0.6个百分点;DeepSORT算法的高阶跟踪准确率、多目标跟踪准确率和ID调和平均数分别为93.6%、96.4%和98.2%,且DeepSORT算法的ID切换次数为0;整体系统对鸡蛋计数的平均计数精度为89.46%,较人工计数提升6.66个百分点,均方根误差为2.37,较人工计数降低0.39。综上所述,该研究所提方法在鸡蛋实时跟踪与计数任务中表现出良好的应用潜力,可为正常/异常鸡蛋的自动化计数提供有效技术支撑,并为鸡蛋监测相关研究奠定基础。

     

    Abstract: Manual egg counting is limited by the high labor costs, low efficiency, and large errors in layer hen farming. It is often required for high detection performance in modern agriculture. However, complex farming environments have posed great challenges in the tasks, where eggs are frequently occluded, adhered to one another, or exhibit only subtle phenotypic differences between normal and abnormal eggs. In this study, an egg-counting method was proposed using an improved YOLOv11n model and the DeepSORT multi-object tracking algorithm. Three functional modules were constructed: detection, tracking, and counting. (1) In the detection module, an enhanced detection model, named YOLO-SR, was developed to replace the original YOLOv11n model. Specifically, a spatial and channel synergistic attention (SCSA) mechanism was integrated into the C2PSA module of the backbone network. This attention mechanism adaptively recalibrated feature responses along both spatial and channel dimensions, providing the network with the most discriminative regions of eggs to suppress irrelevant background information. Additionally, a reparameterized generalized feature pyramid network (RepGFPN) was introduced into the neck network of YOLOv11n. The RepGFPN improved multi-scale feature fusion using reparameterization techniques. Inference speed was enhanced with the representation power. Fine-grained features were extracted to manage scale variations, leading to a significant increase in detection accuracy for both normal and abnormal eggs under challenging conditions. (2) In the tracking module, the DeepSORT algorithm was employed to alleviate identity switching that frequently occurred during re-identification, particularly when eggs were temporarily occluded. Unlike conventional tracking on motion cues, appearance features were extracted from a pre-trained convolutional neural network with motion estimation using Kalman filters. Robust performance of egg detection was realized over consecutive frames. The target identities were effectively maintained even under prolonged occlusions or rapid movements. The appearance feature extractor was fine-tuned on egg image data for individual eggs. (3) In the counting module, a virtual line-crossing counting mechanism was designed to prevent duplicate counting. Specifically, a counting line was placed at a designated position in the video frame. An egg was counted only once when its tracked centroid crossed this line from one side to another. As such, the tracking module ensured that each egg was counted exactly once, thereby eliminating both false positives and missed counts. Experimental results demonstrated that the better performance of the YOLO-SR detector was achieved in an average precision of 95.4% and an F1 score of 89.0%, which were 1.9 and 0.6 percentage points higher than those of the original YOLOv11n, respectively. DeepSORT algorithm was obtained with a higher-order tracking accuracy (HOTA) of 93.6%, a multi-object tracking accuracy (MOTA) of 96.4%, and an ID F1 score (IDF1) of 98.2%. Notably, the number of identity switches (IDS) was zero using DeepSORT, indicating its robustness to occlusions. The overall egg counting was achieved with an average counting accuracy of 89.46%, which was 6.66 percentage points higher than that of manual counting, with a root mean square error (RMSE) of 2.37. In conclusion, there was excellent application potential for real-time egg tracking and counting tasks. The findings can provide effective technical support for egg counting in egg health monitoring and smart poultry.

     

/

返回文章
返回