融合YOLO v5n与通道剪枝算法的轻量化奶牛发情行为识别

    Lightweight recognition for the oestrus behavior of dairy cows combining YOLO v5n and channel pruning

    • 摘要: 及时、准确地监测奶牛发情行为是现代化奶牛养殖的必然要求。针对人工监测奶牛发情不及时、效率低等问题,该研究提出了一种融合YOLO v5n与通道剪枝算法的轻量化奶牛发情行为识别方法。在保证模型检测精度的基础上,基于通道剪枝算法,对包括CSPDarknet53主干特征提取网络等在内的模块进行了修剪,以期压缩模型结构与参数量并提高检测速度。为了验证算法的有效性,在2 239幅奶牛爬跨行为数据集上进行测试,并与Faster R-CNN、SSD、YOLOX-Nano和YOLOv5-Nano模型进行了对比。试验结果表明,剪枝后模型均值平均精度(mean Average Precision, mAP)为97.70%,参数量(Params)为0.72 M,浮点计算量(Floating Point operations, FLOPs)为0.68 G,检测速度为50.26 帧/s,与原始模型YOLOv5-Nano相比,剪枝后模型mAP不变的情况下,参数量和计算量分别减少了59.32%和49.63%,检测速度提高了33.71%,表明该剪枝操作可有效提升模型性能。与Faster R-CNN、SSD、YOLOX-Nano模型相比,该研究模型的mAP在与之相近的基础上,参数量分别减少了135.97、22.89和0.18 M,FLOPs分别减少了153.69、86.73和0.14 G,检测速度分别提高了36.04、13.22和23.02 帧/s。此外,对模型在不同光照、不同遮挡、多尺度目标等复杂环境以及新环境下的检测结果表明,夜间环境下mAP为99.50%,轻度、中度、重度3种遮挡情况下平均mAP为93.53%,中等尺寸目标和小目标情况下平均mAP为98.77%,泛化性试验中奶牛爬跨行为检出率为84.62%,误检率为7.69%。综上,该模型具有轻量化、高精度、实时性、鲁棒性强、泛化性高等优点,可为复杂养殖环境、全天候条件下奶牛发情行为的准确、实时监测提供借鉴。

       

      Abstract: An accurate and timely monitoring is a high demand for the oestrus behavior of dairy cows in modern dairy farming. In this research, a lightweight recognition was proposed to detect the oestrus behavior of cows using the combined YOLO v5n and channel pruning. The high precision of the network was established before that. Firstly, the model was sparsely trained, according to different sparsity rates. The best sparsity effect of the model was obtained at the sparsity rate of 0.005. Then, the channel pruning was utilized to prune the modules, including the CSPDarknet53 backbone feature extraction network, in order to compress the model structure and parameters for the high detection speed. 2 239 images of cows' mounting behavior were also collected, including 1 473 images in the daytime, 88 images in the daytime (backlight), and 160 images in the nighttime. Four occlusion situations were considered, including 1 045 images without occlusion, as well as 397, 184, and 95 images with the slight, moderate, and heavy occlusion, respectively. Three target sizes were also considered, including 46, 1 191, and 484 images with the large, medium, and small targets, respectively. The pruned model was veried on the test set, and then to compare with the Faster R-CNN, SSD, YOLOX-Nano, and YOLOv5-Nano. The test results showed that the mean average precision (mAP) of the model after pruning was 97.70%, the Params were 0.72 M, the Floating Point operations (FLOPs) were 0.68 G, and the detection speed was 50.26 fps. Furthermore, the Params and FLOPs were reduced by 59.32%, and 49.63%, respectively, under the condition of constant mAP, and the detection speed increased by 33.71%, compared with the original model YOLOv5-Nano. Consequently, the pruning operation was effectively improved the performance of the model. The mAP of the model was close to the Faster R-CNN, SSD, YOLOX-Nano, but the Params were reduced by 135.97, 22.89, and 0.18 M, respectively, the FLOPs were reduced by 153.69, 86.73, and 0.14 G, respectively, and the detection speed increased by 36.04, 13.22, and 23.02 fps, respectively. In addition, the detection performance of the model was tested in the complex environments, such as different lighting, different occlusion, multi-scale targets, and new environments. The results showed that the mAP was 99.50% in the nighttime environment, the average mAP was 93.53% under the three occlusion conditions, the average mAP was 98.77% under the medium and small targets, the detection rate was 84.62% in the generalization test, and the false detection rate was 7.69%. To sum up, the improved model can fully meet the high requirements for the accurate and real-time monitoring of cows' oestrus behavior under complex breeding environments and all-weather conditions, due to the lightweight, high precision, robust, and high generalization.

       

    /

    返回文章
    返回