基于YOLOX-NGS的群养猪只攻击行为识别

    Recognizing attack behavior of herd pigs using improved YOLOX

    • 摘要: 为解决复杂猪舍环境下猪只堆叠和粘连导致群养猪只攻击行为识别准确率低和有效性差的问题,该研究提出一种改进的YOLOX模型,引入攻击活动比例(PAA)和攻击行为比例(PAB)2个优化指标,对群养猪只的撞击、咬耳和咬尾等典型攻击行为进行识别。首先,为提高模型特征提取能力添加归一化注意力模块获取YOLOX颈部的全局信息;其次,将YOLOX中的IoU损失函数替换为GIoU损失函数,以提升识别精度;最后,为保证模型的实时性将空间金字塔池化结构SPP轻量化为SPPF,增强检测效率。试验结果表明,改进的YOLOX模型平均精度达97.57%,比YOLOX模型提高6.80个百分点。此外,当PAAPAB阈值分别为0.2和0.4时,识别准确率达98.55%,有效解决因猪只攻击行为动作连续导致单帧图像行为识别可信度低的问题。研究结果表明,改进的YOLOX模型融合PAAPAB能够实现高精度的猪只攻击行为识别,为群养生猪智能化监测提供有效参考和技术支持。

       

      Abstract: Image data was collected at the Pig Breeding Base in Fenxi County, Linfen City, Shanxi Province in July 2020. Nine 5-month-old fattening pigs were selected to raise in a closed pig house. Hikvision DS-2CD3345D-I model camera was used in a downward tilt angle of 60 degrees to collect data under incandescent light. This angle was utilized to obtain the rich behavioral features of pigs, in order to avoid large-scale occlusion, compared with the head-up and overhead views. In the process of data collection, the daily behavior videos of pigs were first repeatedly observed, and 185 video clips of pigs with aggressive behavior were extracted; Inter frame difference method was used to extract the key frames from these video clips. Slow pig movement and long rest time were removed as well. An improved YOLOX model was proposed to identify the typical attack behaviors of herd pigs, such as impact, ear biting, and tail biting. The high accuracy and effectiveness were achieved to reduce pig stacking and adhesion in complex pen environments. Firstly, a Normalization based Attention Module (NAM) was added to obtain the global information about the YOLOX neck; Secondly, the loss function IoU Loss in the YOLOX was replaced with the GIoU to improve the recognition accuracy; Finally, the real-time performance of the model was realized to enhance feature extraction and detection efficiency. Feature pyramid structure SPP was lightweight to SPPF. The experiment showed that the integrated NAM modules, GIoU Loss replacing, and SPPF feature pyramid structures in the original backbone network improved the average accuracy of the model by 2.50, 2.12, and 0.98 percentage points, respectively. The model with SPP feature pyramid structure reduced the parameter by 0.1 MB and improved the accuracy by 0.98 percentage points, indicating the minimum impact of the model parameter after the integrated NAM module. The average accuracy of the improved model increased from 90.77% to 97.57%, with an increase of 6.80 percentage points; The parameter quantity decreased from the highest 34.7 to 34.5 MB with a decrease of 0.2 MB. In addition, there was the continuous attack behavior of pigs in the low credibility of single-frame images. Two optimization indicators (proportion of attack activities (PAA) and proportion of attack behavior (PAB))were introduced to further confirm whether the attack behavior occurred. When the PAA and PAB thresholds were 0.2 and 0.4, respectively, the recognition accuracy (Accuracy) reached 98.55%. Video segments with frequent attacks were selected to verify the effectiveness of the optimization. Usually, PAA and PAB posed a significant impact on the recognition of pig aggressive behavior; If the threshold set was too small, it was easy to misjudge frames without attack behavior as having occurred; If the threshold set was too large, the frame without the attack was assumed as the occurrence. The experimental results show that the improved YOLOX model was achieved in the high-precision recognition of pig attack behavior by the integrated PAA and PAB. The finding can provide effective reference and technical support for the intelligent monitoring of herd health pigs.

       

    /

    返回文章
    返回