曾繁国, 朱君, 王海峰, 贾楠, 赵宇亮, 赵文文, 李斌. 改进帧间差分-深度学习识别群养猪只典型行为[J]. 农业工程学报, 2022, 38(15): 170-178. DOI: 10.11975/j.issn.1002-6819.2022.15.018
    引用本文: 曾繁国, 朱君, 王海峰, 贾楠, 赵宇亮, 赵文文, 李斌. 改进帧间差分-深度学习识别群养猪只典型行为[J]. 农业工程学报, 2022, 38(15): 170-178. DOI: 10.11975/j.issn.1002-6819.2022.15.018
    Zeng Fanguo, Zhu Jun, Wang Haifeng, Jia Nan, Zhao Yuliang, Zhao Wenwen, Li Bin. Typical behavior recognition of herd pigs based on improved frame difference and deep learning[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2022, 38(15): 170-178. DOI: 10.11975/j.issn.1002-6819.2022.15.018
    Citation: Zeng Fanguo, Zhu Jun, Wang Haifeng, Jia Nan, Zhao Yuliang, Zhao Wenwen, Li Bin. Typical behavior recognition of herd pigs based on improved frame difference and deep learning[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2022, 38(15): 170-178. DOI: 10.11975/j.issn.1002-6819.2022.15.018

    改进帧间差分-深度学习识别群养猪只典型行为

    Typical behavior recognition of herd pigs based on improved frame difference and deep learning

    • 摘要: 群养猪行为是评估猪群对环境适应性的重要指标。猪场环境中,猪只行为识别易受不同光线和猪只粘连等因素影响,为提高群养猪只行为识别精度与效率,该研究提出一种基于改进帧间差分-深度学习的群养猪只饮食、躺卧、站立和打斗等典型行为识别方法。该研究以18只50~115日龄长白猪为研究对象,采集视频帧1 117张,经图像增强共得到4 468张图像作为数据集。首先,选取Faster R-CNN、SSD、Retinanet、Detection Transformer和YOLOv5五种典型深度学习模型进行姿态检测研究,通过对比分析,确定了最优姿态检测模型;然后,对传统帧间差分法进行了改进,改进后帧间差分法能有效提取猪只完整的活动像素特征,使检测结果接近实际运动猪只目标;最后,引入打斗活动比例(Proportion of Fighting Activities, PFA)和打斗行为比例(Proportion of Fighting Behavior, PFB)2个指标优化猪只打斗行为识别模型,并对模型进行评价,确定最优行为模型。经测试,YOLOv5对群养猪只典型姿态检测平均精度均值达93.80%,模型大小为14.40 MB,检测速度为32.00帧/s,检测速度满足姿态实时检测需求,与Faster R-CNN、SSD、Retinanet和Detection Transformer模型相比,YOLOv5平均精度均值分别提高了1.10、3.23、4.15和21.20个百分点,模型大小分别减小了87.31%、85.09%、90.15%和97.10%。同时,当两个优化指标PFA和PFB分别设置为10%和40%时,猪只典型行为识别结果最佳,识别准确率均值为94.45%。结果表明,该方法具有准确率高、模型小和识别速度快等优点。该研究为群养猪只典型行为精准高效识别提供方法参考。

       

      Abstract: Typical behavior of herd pigs is one of the most important indicators to evaluate the adaptability of pigs to the environment. This study aims to improve the accuracy and efficiency of herd behavior recognition. A novel recognition system was proposed for the typical behavior of herd pigs (such as eating, lying, standing, and fighting) using an improved frame differential-deep learning. The video image data was collected from two pens of group-fed Landrace pigs. A total of 18 Landrace pigs aged 50~115 days were selected with nine pigs per pen. 1117 video frames were collected. Then, a total of 4468 images were obtained after image enhancement as the dataset. Firstly, five models of typical deep learning (including Faster-RNN, SSD, Retinanet, Detection Transformer, and YOLOv5) were selected for posture detection. An optimal model of posture was determined after the comparative analysis. Secondly, a pixel feature extraction was implemented on the pig activity to promote the traditional frame differential approach, such as, the slow motion pigs were easy to miss the detection, and more holes were detected in the pigs. Finally, the Proportion of Fighting Activities (PFA) and Proportion of Fighting Behavior (PFB) were used to optimize the pig fighting behavior in the recognition model. An optimal behavior model was determined during this time. The result showed that the average accuracy of YOLOv5 reached 93.80% for the typical posture detection of group-reared pigs. Among them, the model size was 14.40 MB, and the detection speed was 32.00 f/s, indicating that the detection speed fully met the demand for real-time posture detection. Once the Intersection over Union (IoU) threshold was set as 0.50, the mean average accuracy of YOLOv5 increased by 1.10, 3.23, 4.15, and 21.20 percentage points, respectively, and the model size was reduced by 87.31%, 85.09%, 90.15%, and 97.10%, respectively, compared with the Faster-RNN, SSD, Retinanet, and Detection Transformer models. Meanwhile, the original frame difference was expanded from the frame difference of 2, to 4 after experimental analysis. The improved frame difference was utilized to effectively eliminate the fine holes that were produced by the slow-moving pigs and background interference, such as lighting, as well as the outstandingly retained pixel characteristics of vigorous movement activities, when the pigs were fighting. The better performance of detection was achieved close to the actual movement targets. The pig eating, lying, and standing behaviors were directly discriminated by the single-frame posture images of pigs. Furthermore, 100 video frames containing fighting behavior (frame speed of 30 f/s, duration of 5~60s) and video frames without fighting behavior were selected to verify the accuracy of the pig fighting behavior recognition. The reason was that the pig fighting behavior was a continuous process. The test results showed that the best average value of typical behavior recognition accuracy was 94.45%, when the two optimized indexes of PFA and PFB were set as 10% and 40%, respectively. Therefore, the high accuracy, small model size, and fast recognition can provide technical support and strong reference for the accurate and efficient identification of typical behaviors of herd pigs in group breeding.

       

    /

    返回文章
    返回