首页|期刊导航|农业工程学报|基于改进YOLOv11n的猪舍残余饲料检测方法

基于改进YOLOv11n的猪舍残余饲料检测方法OA

Feed residue detection on pig farms using improved YOLOv11n

中文摘要英文摘要

饲料残余状态检测对猪只健康评估和节粮饲喂调控均有重要意义.针对猪舍料槽残余饲料检测中存在的细粒度分类难、类间相似度高等问题,该研究将料槽余料状态划分为无余料、少量余料、中量余料、大量余料4个类别,提出一种基于改进YOLOv11n的残余饲料检测模型SWF-YOLO(SCSA weight fusion YOLO),以实现料槽饲料残余状态的端到端检测.在骨干网络中引入空间通道协同注意力(spatial and channel synergistic attention,SCSA)机制增强细粒度特征提取能力;在颈部网络采用Weight Fusion加权特征融合策略优化多尺度信息整合;在骨干网络末端嵌入位置敏感注意力(C2 position-sensitive attention,C2PSA)模块提升关键区域特征捕捉能力,并采用遗传算法对模型训练超参数进行优化.结果显示,SWF-YOLO模型的平均精度均值、精确率、召回率、F1值分别达到93.78%、84.21%、89.40%、86.73%.与基线模型YOLOv11n相比,SWF-YOLO的mAP50、召回率、F1值分别提升2.21、4.92、3.96个百分点.与 Faster-RCNN、YOLOv8n、YOLOv9t、YOLOv10n、YOLOv12n 相比,SWF-YOLO 表现出最优的综合检测性能.该模型在复杂猪舍环境下实现了余料状态检测,可为精准饲喂管理、饲料浪费控制和猪群健康预警提供技术支撑,为智能养殖装备的研发与应用提供参考.

Feed residue state in troughs has been one of the key indicators to optimize feed conversion rate and reduc waste,providing for early warnings of health abnormalities.Feed costs account for 60%-70%of total expenses in commercial pig production.It is often required to accurately monitor feed residues in troughs.However,residue levels show high inter-class visual similarity,with subtle boundaries between adjacent categories.Existing deep learning models are also confined to environmental factors and mage interference,including uneven illumination,suspended feed dust,and trough reflection.It is still lacking in the fine-grained feature extraction to separate visually similar states,such as small and medium residue.In this study,an improved YOLOv11n model,SWF-YOLO(Spatial and Channel Synergistic Attention Weight Fusion YOLO),was proposed for the end-to-end classification of four residue states.Accurate residue detection was realized to integrate into the baseline.The C2f modules in the backbone were replaced with C2f-SCSA modules for fine-grained feature extraction.A weight-fusion strategy replaced neck concatenation for adaptive multi-scale fusion.A C2PSA module was added to capture long-range spatial dependencies.A dataset of 7 748 annotated samples was constructed from 308 growing pigs in 52 pens.A genetic algorithm was then used to optimize 16 hyperparameters over 300 iterations.The results show that the SWF-YOLO achieved a mean average precision at an IoU threshold of 0.5(mAP50)of 93.78%on the test set.Its precision was 84.21%,recall was 89.40%,and F1-score was 86.73%.Compared with the YOLOv11n baseline,mAP50,recall,and F1-score were improved by 2.21,4.92,and 3.96 percentage points,respectively.Parameters were reduced by 26.74%to 1.89 M,while the computational cost was 3.51 GFLOPs,and the inference speed reached 50.2 frames per second.These configurations fully met the requirements of real-time edge deployment.Ablation experiments showed that the SCSA module contributed the largest precision gain of 6.26 percentage points.The weight-fusion strategy improved the greatest efficiency,where computational cost was reduced by 16.14%.The full three-module combination yielded the best balance between accuracy and efficiency.Fine-grained discrimination also improved markedly.After genetic algorithm optimization,class-specific F1-scores reached 94.91%,88.19%,84.56%,and 80.23%for the no-,small-,medium-,and large-residue categories,respectively.Comparative experiments showed that the SWF-YOLO outperformed Faster R-CNN,YOLOv8n,YOLOv9t,YOLOv10n,and YOLOv12n.The mAP50 improvements were 2.54,2.53,1.95,2.56,and 2.80 percentage points,respectively.Favorable accuracy and efficiency were balanced,suitable for resource-constrained edge devices in commercial pig farms.Grad-CAM visualization showed that the SCSA mechanism directed attention more precisely toward critical trough regions than the SE,CBAM,ECA,SGA,and CA modules.Fine-grained classification of feed residues can be expected to integrate spatial and channel attention,adaptive weighted feature fusion,and position-sensitive attention.High accuracy can also remain lightweight,particularly for feed-waste control and early health warning in precision livestock farming.These findings can provide a practical reference to develop intelligent monitoring equipment in commercial pig production.

刘易雪;曾雅琼;胡义勇;齐仁立;唐湘方;熊本海;王浩

重庆市畜牧科学院,重庆 402460||国家生猪技术创新中心,重庆 402460重庆市畜牧科学院,重庆 402460||国家生猪技术创新中心,重庆 402460牧原食品股份有限公司,南阳 473000重庆市畜牧科学院,重庆 402460||国家生猪技术创新中心,重庆 402460中国农业科学院北京畜牧兽医研究所,北京 100193中国农业科学院北京畜牧兽医研究所,北京 100193重庆市畜牧科学院,重庆 402460||国家生猪技术创新中心,重庆 402460

农业科技

饲喂目标检测深度学习注意力机制特征融合

pigsfeedingobject detectiondeep learningattention mechanismfeature fusion

《农业工程学报》 2026 (11)

69-78,10

重庆市技术创新与应用发展专项(CSTB2025TIAD-qykjggX0263)国家生猪技术创新中心先导科技项目(NCTIP-XD/B16)

10.11975/j.issn.1002-6819.202601273

评论