中国猪业 ›› 2026, Vol. 21 ›› Issue (4): 87-101.doi: 10.16174/j.issn.1673-4645.2026.04.003

• 专题报道 • 上一篇    下一篇

一种用于多层楼房养殖场猪只自动轻量计数算法研究

袁培银1,杨磊1,杨沛鑫1,庞武林2,钟儒清3*,刘向东2,4*   

  1. 1重庆交通大学,重庆400074; 

    2广西扬翔集团股份有限公司,广西贵港537100 ;

    3中国农业科学院北京畜牧兽医研究所,北京100193; 

    4华中农业大学,湖北武汉430070

  • 出版日期:2026-08-25 发布日期:2026-08-25
  • 作者简介:作者简介:袁培银(1987-),男,博士,教授,主要从事机械设计及自动化研究,E-mail:yuanpy@cqjiu.edu.cn 通信简介:刘向东(1983-),男,博士,副教授,研究方向为智慧养猪技术与楼房养猪模式的创新与应用,E-mail:liuxiangdong@mail.hzau.edu.cn; 钟儒清(1990-),男,副研究员,研究方向为猪营养与健康养殖,E-mail:zhongruqing@caas.cn

Research on an automatic lightweight counting algorithm for pigs in multi-story farm buildings

YUAN Peiyin1, YANG Lei1, YANG Peixin1, PANG Wulin2, ZHONG Ruqing3*, LIU Xiangdong2,4*   

  1. 1Chongqing Jiaotong University, Chongqing 400074, China; 

    2Guangxi Yangxiang Group Co., Ltd., Guigang 537100, China; 

    3Institute of Animal Sciences of CAAS, Beijing 100193, China; 

    4Huazhong Agricultural University, Wuhan 430070, China

  • Online:2026-08-25 Published:2026-08-25

摘要: 针对人工计数方式作业效率低下、计数偏差大、易诱发猪群应激反应等突出问题,本文提出一种轻量级猪只检测与计数模型PS-YOLO(Pig shipment YOLO),该模型以YOLOv26n为基线架构,骨干网络中引入EGC-Net轻量化网络结构(ECA-GhostConv),采用线性预热训练策略,对预热轮次参数进行敏感度分析。结果表明,PS-YOLO预热轮次为135轮时,模型表现出最佳性能,mAP50与mAP50-95分别达到0.989和0.749。相比基线YOLOv26n,PS-YOLO参数量、计算量及模型大小分别降低13.0%、13.8%和11.1%,保持较高检测精度时,有效降低了模型复杂度。与YOLOv5n、YOLOv8n、YOLOv11n等主流轻量化模型相比,复杂遮挡与密集转运场景下PS-YOLO表现出更优的轻量化与实时检测性能,可为楼房猪场出栏转运过程的智能化提供一种低成本、高效率的科学支撑。

关键词: 生猪, 多层养殖, 自动计数, PS-YOLO, 轻量化, 线性预热

Abstract: To address prominent issues such as the low efficiency of manual counting operations, large counting deviations, and the susceptibility to stress responses in pig herds, this paper proposed a lightweight pig detection and counting model, PS-YOLO (Pig shipment YOLO). This model was based on the YOLOv26n architecture, incorporating the lightweight EGC-Net structure (ECA-GhostConv) into the backbone network, and adopting a linear warm-up training strategy, conducting sensitivity analysis on the warm-up epochs parameters. Experimental results showed that when the warm-up epochs of PS-YOLO were set to 135, the model exhibited optimal performance, with mAP50 and mAP50-95 reaching 0.989 and 0.749, respectively. Compared to the baseline YOLOv26n, PS-YOLO reduced parameter count, computation, and model size by 13.0%, 13.8% and 11.1%, respectively, effectively lowering model complexity and deployment costs while maintaining high detection accuracy. Compared with mainstream lightweight models such as YOLOv5n, YOLOv8n and YOLOv11n, PS-YOLO demonstrates superior lightweight and real-time detection performance in scenarios with complex occlusion and dense transportation, providing a low-cost, high-efficiency technical solution for the intelligent management of pig transfers in multi-story pig farms.

Key words: pig, multi-layer breeding, automatic counting, PS-YOLO, lightweight, linear warm-up

中图分类号:  S828;TP391.4

[1] REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection[C]//2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). June 27-30, 2016. Las Vegas, NV, USA. IEEE, 2016: 779-788. [2] BOCHKOVSKIY A, WANG C Y, LIAO H M. YOLOv4: optimal speed and accuracy of object detection[PP/OL]. arXiv (2020-04-23)[2026-05-15]. https://doi.org/10.48550/arXiv.2004.10934. [3] SAPKOTA R, KARKEE M. Ultralytics YOLO evolution: an overview of YOLO26, YOLO11, YOLOv8 and YOLOv5 object detectors for computer vision and pattern recognition[PP/OL]. V3. arXiv (2026-03-16)[2026-05-15]. https://doi.org/10.48550/arXiv.2510.09653. [4] 赵宇亮, 曾繁国, 贾楠, 等. 基于DeepLabCut算法的猪只体尺快速测量方法研究[J]. 农业机械学报, 2023, 54(2): 249-255, 292. ZHAO Y L, ZENG F G, JIA N, et al. Rapid measurements of pig body size based on deep lab cut algorithm[J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54(2): 249-255, 292. [5] ZHUANG Y Z, XU L Y, JIANG J Y, et al. Cross-breed few-shot learning for pig detection via improved YOLOv7 and CycleGAN-based sample generation[J]. Biology, 2026, 15(8): 623. [6] PAUDEL S, TSAI T, WANG D Y. A non-invasive alternative to RFID: self-sufficient 3D identification of group-housed livestock[PP/OL]. arXiv (2026-04-24)[2026-04-29]. https://doi.org/10.48550/arXiv.2604.22657. [7] 涂淑琴, 杜佳颖, 梁云, 等. 群养生猪行为识别与目标跟踪的自动监测[J]. 农业工程学报, 2026, 42(4): 300-310. TU S Q, DU J Y, LIANG Y, et al. Behavior recognition and object tracking for the automatic monitoring of group-housed pigs[J]. Transactions of the Chinese Society of Agricultural Engineering, 2026, 42(4): 300-310. [8] 代昕, 王军号, 张翼, 等. 基于时空流特征融合的俯视视角下奶牛跛行自动检测方法[J]. 智慧农业(中英文), 2024, 6(4): 18-28. DAI X, WANG J H, ZHANG Y, et al. Automatic detection method of dairy cow lameness from top-view based on the fusion of spatiotemporal stream features[J]. Smart Agriculture, 2024, 6(4): 18-28. [9] 张立印, 张姬, 杨庆璐, 等. 基于视频和BCE-YOLO模型的奶牛采食行为检测[J]. 华南农业大学学报, 2024, 45(5): 782-792. ZHANG L Y, ZHANG J, YANG Q L, et al. Detection of dairy cow feeding behavior based on video and BCE-YOLO model[J]. Journal of South China Agricultural University, 2024, 45(5): 782-792. [10] 王旺, 王福顺, 张伟进, 等. 基于改进YOLO v8s的羊只行为识别方法[J]. 农业机械学报, 2024, 55(7): 325-335, 344. WANG W, WANG F S, ZHANG W J, et al. Sheep behavior recognition method based on improved YOLO v8s[J]. Transactions of the Chinese Society for Agricultural Machinery, 2024, 55(7): 325-335, 344. [11] SAPKOTA R, CHEPPALLY R H, SHARDA A, et al. YOLO26: key architectural enhancements and performance benchmarking for real-time object detection[J]. ArXiv Preprint: 2509 25164, 2025. https://doi.org/10.48550/arXiv.2509.25164. [12] HAN K, WANG Y H, TIAN Q, et al. GhostNet: more features from cheap operations[C]//2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 13-19, 2020. Seattle, WA, USA. IEEE, 2020: 1577-1586. [13] WANG Q L, WU B G, ZHU P F, et al. ECA-net: efficient channel attention for deep convolutional neural networks[C]//2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 13-19, 2020. Seattle, WA, USA. IEEE, 2020: 11531-11539. [14] LIU S, QI L, QIN H F, et al. Path aggregation network for instance segmentation[C]//2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. June 18-23, 2018. Salt Lake City, UT. IEEE, 2018: 8759-8768. [15] GOYAL P, DOLLáR P, GIRSHICK R, et al. Accurate, large minibatch SGD: training imagenet in 1 hour[PP/OL]. V2. arXiv (2018-04-30)[2026-05-15]. https://doi.org/10.48550/arXiv.1706.02677. [16] YANG B, ZHANG X Y, ZHANG J, et al. EFLNet: enhancing feature learning network for infrared small target detection[J]. IEEE Transactions on Geoscience and Remote Sensing, 2024, 62: 1-11. [17] WOO S, PARK J, LEE J Y, et al. CBAM: convolutional block attention module[C]//Computer Vision – ECCV 2018. Cham: Springer International Publishing, 2018: 3-19. [18] BEWLEY A, GE Z Y, OTT L, et al. Simple online and realtime tracking[C]//2016 IEEE International Conference on Image Processing (ICIP). September 25-28, 2016. Phoenix, AZ, USA. IEEE, 2016: 3464-3468. [19] WOJKE N, BEWLEY A, PAULUS D. Simple online and realtime tracking with a deep association metric[C]//2017 IEEE International Conference on Image Processing (ICIP). September 17-20, 2017. Beijing. IEEE, 2017: 3645-3649. [20] 涂淑琴,汤寅杰,李承桀,等. 基于改进 ByteTrack 算法的群养生猪行为识别与跟踪技术[J]. 农业机械学报,2022, 53(12): 264-272. TU S Q, TANG Y J, LI C J, et al. Behavior recognition and tracking of group-housed pigs based on the improved ByteTrack algorithm [J]. Transactions of the Chinese Society for Agricultural Machinery, 2022, 53(12): 264-272. [21] 肖德琴,吕玉定,黄一桂,等. 生猪智能检测技术研究进展与未来展望[J]. 智慧农业 (中英文), 2026, 8(1): 86-103. XIAO D Q, LYU Y D, HUANG Y G, et al. Research progress and future prospect of intelligent pig detection technology [J]. Smart Agriculture, 2026, 8(1): 86-103.
[1] 康铭, 朱君, 赵文文, 周红, 赵宇亮, 贾楠, 王志彬, 岳健民, 李斌. 猪舍智能巡检机器人关键技术研究进展[J]. 中国猪业, 2026, 21(4): 66-86.
[2] 张海峰, 刘小红, 于福清.. 2025年我国生猪市场变化情况及行业技术发展趋势[J]. 中国猪业, 2026, 21(1): 75-85.
[3] 王力, 朱佳文, 李彬, 刘言, 苏志鹏. 生猪福利影响机制与改善措施的研究进展[J]. 中国猪业, 2025, 20(5): 40-49.
[4] 梁龙华, 周明旭, 覃国喜, 何日靖, 黄小洁, 黄小惠. 应用育肥效率指数综合评价育肥猪饲养管理效果的实践研究[J]. 中国猪业, 2025, 20(3): 89-97.
[5] 张 航, 杨宇泽, Jesse Oluwaseun Ayantoye, 董建华, 潘红梅, 赵学明. 猪精子冷冻保存研究进展[J]. 中国猪业, 2025, 20(1): 35-46.
[6] 雷国凤, 陈奎蓉, 和艺云, 梁 晶. 广西地方猪品种肌内脂肪含量及相关基因表达分析[J]. 中国猪业, 2025, 20(1): 47-54.
[7] 王彦平, 郑凤玲, 赵雪艳, 李菁璇, 王继英, 王怀中. 氟烷基因对杜长大猪胴体、肉品质及血液生化指标的影响研究[J]. 中国猪业, 2024, 19(6): 26-32.
[8] 张海峰,王祖力,陈泽芳,朱增勇,谢水华. 2023 年我国生猪产业发展情况及未来发展趋势[J]. 中国猪业, 2024, 19(5): 90-100.
[9] 姚绿. 绿色金融赋能生猪产业高质量发展影响研究[J]. 中国猪业, 2024, 19(5): 101-109.
[10] 吴秋杰,刘 佳,陈华云,余群莲. 玉米豆粕减量替代营养调控在养猪上的研究进展[J]. 中国猪业, 2024, 19(4): 12-18.
[11] 王如心,王祖力,肖红波. 主要生猪养殖国粪污治理模式经验及启示[J]. 中国猪业, 2024, 19(4): 50-58.
[12] 陈 超,赵宇亮,王海峰,李 斌. 家畜智能分群装备研究进展[J]. 中国猪业, 2024, 19(4): 59-69.
[13] 赵 敏,胡广英,白 海,曹日亮. 智能化养猪装备的研究进展[J]. 中国猪业, 2024, 19(4): 78-85.
[14] 郑瑞强,邱 悦,李 玲,胡 艳. 生猪企业价值创造能力提升策略研究——基于13家生猪上市企业的财务数据[J]. 中国猪业, 2024, 19(4): 86-94.
[15] 田文勇,刘挥琳,吴 蔓,毛 昆. 乡村振兴背景下贵州省生猪产业与其他生猪产业大省的比较研究[J]. 中国猪业, 2024, 19(4): 95-104.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!