欢迎您访问《智慧农业(中英文)》官方网站! English

Smart Agriculture ›› 2025, Vol. 7 ›› Issue (3): 173-184.doi: 10.12133/j.smartag.SA202502010

• 信息处理与决策 • 上一篇    

基于改进YOLOv11的轻量化肉牛面部识别方法

韩宇1,2, 齐康康1, 郑纪业1,2(), 李金瑷1,2, 姜富贵3, 张相伦3, 游伟3, 张霞2   

  1. 1. 山东省农业科学院农业信息与经济研究所,山东 济南 250100,中国
    2. 聊城大学 物理科学与信息工程学院,山东 聊城 252000,中国
    3. 山东省农业科学院畜牧兽医研究所,山东 济南 250100,中国
  • 收稿日期:2025-02-12 出版日期:2025-05-30
  • 基金项目:
    国家重点研发计划项目(2024YFD1300600); 山东省重点研发计划项目(2022TZXD0013); 泰山产业领军人才工程专项经费; 烟台市科技计划项目(2023ZDCX024)
  • 作者简介:

    韩 宇,硕士研究生,研究方向为深度学习农业应用。E-mail:

  • 通信作者:
    郑纪业,博士,副研究员,研究方向为智慧农业。E-mail:

Lightweight Cattle Facial Recognition Method Based on Improved YOLOv11

HAN Yu1,2, QI Kangkang1, ZHENG Jiye1,2(), LI Jinai1,2, JIANG Fugui3, ZHANG Xianglun3, YOU Wei3, ZHANG Xia2   

  1. 1. Institute of Agricultural Information and Economics, Shandong Academy of Agricultural Sciences, Jinan 250100, Shandong, China
    2. School of Physics Science and Information Engineering, Liaocheng University, Liaocheng 252000, Shandong, China
    3. Institute of Animal Science and Veterinary Medicine, Shandong Academy of Agricultural Sciences, Jinan 250100, China
  • Received:2025-02-12 Online:2025-05-30
  • Foundation items:National Key R&D Program of China(2024YFD1300600); Key R&D Program of Shandong Province, China(2022TZXD0013); Taishan Industry Leading Talents Program of Shandong Province; Science and Technology Plan Project of Yantai City(2023ZDCX024)
  • About author:

    HAN Yu, E-mail:

  • Corresponding author:
    ZHENG Jiye, E-mail:

摘要:

【目的/意义】 牛只个体的精准识别是现代化畜牧业发展的关键需求,也是推进肉牛精细化管理与高效生产的基础。基于面部特征的精准识别技术对推动畜牧业智能化发展具有重要研究价值和应用前景。针对牛脸识别准确性与效率提升需求,本研究提出一种基于改进YOLOv11的轻量级牛脸识别模型YOLO-PCW。 【方法】 将部分卷积(PConv)设计融合C3K2,借助PConv对特征图的独特卷积特性,在保障识别精度稳定的同时大幅削减模型计算量,以适配实际快速处理场景,此外,引入CBAM注意力机制,引导模型聚焦牛脸关键部位如牛眼、口鼻等,精准捕捉细微特征,显著提升检测精度。采用WIoU损失函数取代CIoU,重新优化目标框定位误差衡量模式,合理分配不同类型误差权重,进一步精细模型训练过程,使牛脸检测框更为精准。 【结果和讨论】 经实验验证,YOLO-PCW模型的准确率P达到了96.4%,召回率R达到96.7%,平均精度均值达到98.7%,其参数量、计算量分别为2.3 M、5.6 GFLOPs。与YOLOv11相比,YOLO-PCW不仅在准确率、召回率、平均精度分别提升了3.6、5.0、4.4个百分点,同时还将浮点计算量和参数量大小分别降低至原模型的88.9%和88.5%。消融实验表明,CBAM模块使精确率从92.8%提升至95.2%,WIoU优化目标定位精度,精确率提升至93.8%,PConv模块将计算量从6.3 GFLOPs降至5.5 GFLOPs,大幅减少了模型的计算量。多组件协同配合,为牛脸识别模型性能的提升提供了有力支持。将改进后的YOLO-PCW与Faster-RCNN、SSD、YOLOv5、YOLOv7-tiny、YOLOv8算法在相同的条件下进行比对,YOLO -PCW模型优势最为突出,能够兼顾识别精度与运算效率,实现计算资源的高效利用。 【结论】 提出的YOLO-PCW模型不仅提升了检测精度,还降低了模型的部署难度,可在实际生产环境中精准实现牛脸识别,为动物福利养殖、牧场智能化管理等多种场景提供一种可行的个体精准识别方案。

关键词: 深度学习, YOLOv11, 肉牛个体识别, 牛脸识别

Abstract:

[Objective] Beef cattle breeding constitutes a pivotal component of modern animal husbandry, where accurate individual identification serves as the cornerstone for advancing automated technologies, including intelligent weight measurement, body condition scoring, body conformation assessment, and behavior monitoring. However, practical breeding environments are riddled with challenges: soiled conditions, cluttered backgrounds, and constant animal movement collectively result in high variability in cattle facial data features. Furthermore, inconsistent lighting and diverse shooting angles often obscure key features, increasing the risk of misjudgment during detection. To tackle these issues, this study introduces an improved model, YOLO-PCW, which enhances detection performance while maintaining a lightweight structure, effectively addressing the complexities of precise cattle face recognition in challenging breeding settings. [Methods] The research leveraged the Cow Fusion dataset (CFD), a comprehensive collection of real-world cattle face images captured under variable lighting conditions, from multiple angles, and against complex backgrounds, for model training and validation. Concurrently, a Custom Cow Monitor Dataset (CMD) was created from video footage obtained through the a breeding farm's monitoring system, providing a robust basis for evaluating the model's generalization capabilities. The YOLOv11 architecture served as the foundational framework for implementing the following performance improvements. The partial convolution (PConv) was seamlessly integrated into the C3K2 module within the YOLOv11 head network. Utilizing the sparse convolutional properties of PConv on the feature maps, the convolutional structure was meticulously optimized, reducing computational redundancy and memory access while preserving the model's accuracy, rendering it highly suitable for real-time applications. Additionally, the convolutional block attention module (CBAM) was incorporated to enhance feature map processing through adaptive channel-wise and spatial attentions. This refinement enabled precise extraction of target regions by mitigating background interference, allowing the model to focus on critical anatomical features such as the eyes, mouth, and nose. Furthermore, the weighted intersection over union (WIoU) loss function was adopted to replace the CIoU, optimizing the weighted strategy for bounding box regression errors. This innovation reduced the adverse effects of large or outlier gradients in extreme samples, enabling the model to prioritize average-quality samples for refinement. The resulting improvement in key region localization accuracy bolstered the model's generalization capability and overall performance, establishing a state-of-the-art cattle face recognition framework. [Results and Discussion] The YOLO-PCW model achieved a remarkable accuracy rate (P) of 96.4%, recall rate (R) of 96.7%, and mean average precision (mAP) of 98.7%. With 2.3 million parameters and a computational load of 5.6 GFLOPs, it not only improved accuracy, recall, and mAP by 3.6, 5, and 4.4 percentage point respectively, but also achieved a significant reduction in floating-point computational load and parameter size, down to 88.9% and 88.5% of the original model's, respectively. Ablation studies revealed that the CBAM module enhanced precision from 92.8% to 95.2%. The WIoU loss function optimized target positioning accuracy, achieving a precision of 93.8%. The PConv module substantially reduced computational load from 6.3 GFLOPs to 5.5 GFLOPs, thereby lightening the model's computational burden significantly. The synergistic collaboration of these components provided robust support for enhancing the performance of the cattle face recognition model. Comparative experiments demonstrated that under identical conditions, the YOLO-PCW model outperformed algorithms such as Faster-RCNN, SSD, YOLOv5, YOLOv7-tiny, and YOLOv8 under identical conditions, exhibiting the most outstanding performance. It effectively balanced recognition accuracy with computational efficiency, achieving optimal utilization of computational resources. [Conclusions] The improved YOLO-PCW model, featuring a lightweight architecture and optimized attention mechanism, could successfully improve detection accuracy while simplifies deployment. It can achieve precise cattle face recognition in real-world breeding environments, providing an efficient and practical solution for individual identification in applications such as animal welfare breeding, intelligent ranch management, smart ranch construction, and animal health monitoring.

Key words: deep learning, YOLOv11, cattle individual identification, cattle facial recognition

中图分类号: