Welcome to visit China Swine Industry,
  • 中国农林核心期刊
  • 全国畜牧兽医精品(优秀)科技期刊
  • 中国期刊全文数据库收录期刊
  • 中文科技期刊数据库收录期刊

China Swine Industry ›› 2026, Vol. 21 ›› Issue (4): 87-101.doi: 10.16174/j.issn.1673-4645.2026.04.003

• Special Report • Previous Articles     Next Articles

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

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

CLC Number: 

  • S828
[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] SUN Wenxuan, JIANG Bo, WANG Wenwen. The application status and optimization path of automatic feed lines and feeding stations in smart pig farming [J]. China Swine Industry, 2026, 21(4): 17-25.
[2] GAN Yuening, LIU Hui, JIANG Haihua, LIU Chenghan, WU Ruiting, WANG Lingli, Zhong Ruqing, WANG Yan, ZHAO Yunxiang, LIU Xiangdong. Effects of intelligent precision feeding system on the reproductive performance of sows in multi-story pig farms [J]. China Swine Industry, 2026, 21(4): 26-36.
[3] GUI Chuchen, WU Ruiting, WANG Yan, DENG Jinping, ZHANG Lingna, LIU Xiangdong. Effects of different floors on indoor air quality in finishing pig barns of multi-story pig farms [J]. China Swine Industry, 2026, 21(4): 48-56.
[4] WU Guanglin, WANG Zixuan, YANG Mengjuan, WANG Lijun, LIU Xiangdong, WU Shaoqin. multi-story pig farm; environment; temperature; relative humidity; carbon dioxide; ammonia [J]. China Swine Industry, 2026, 21(4): 57-65.
[5] KANG Ming, ZHU Jun, ZHAO Wenwen, ZHOU Hong, ZHAO Yuliang, JIA Nan, WANGZhibin, YUE Jianmin, LI Bin. Research progress on key technologies of intelligent inspection robots for pig houses [J]. China Swine Industry, 2026, 21(4): 66-86.
[6] CHEN Xinrong, PANG Wulin, SUN Erchao, ZHONG Ruqing, YUAN Peiyin, LIU Xiangdong. System design of unmanned disinfection equipment for multi-story livestock farms [J]. China Swine Industry, 2026, 21(4): 102-111.
[7] WAN Rong, NONG Siwei, ZOU Zhimiao, HUANG Wei, WAN Changqian, GAN Qifu, YANG Ming, WANG Yun, HUANG Jian, CHEN Jianghuai. Effects of fermented mulberry leaves on growth performance, diarrhea, and intestinal microecology in weaned piglets [J]. China Swine Industry, 2026, 21(4): 112-121.
[8] WU Peng, HUANG Xingguo, JIANG Wenxin, LI Huali, HU Xionggui, REN Huibo, LIU Yingying. Research progress on the application of fermented alfalfa in pig production [J]. China Swine Industry, 2026, 21(4): 122-134.
[9] . [J]. China Swine Industry, 2026, 21(3): 4-6.
[10] . [J]. China Swine Industry, 2026, 21(3): 7-22.
[11] . [J]. China Swine Industry, 2026, 21(3): 23-35.
[12] . [J]. China Swine Industry, 2026, 21(3): 36-42.
[13] . [J]. China Swine Industry, 2026, 21(3): 43-51.
[14] . [J]. China Swine Industry, 2026, 21(3): 52-59.
[15] . [J]. China Swine Industry, 2026, 21(3): 60-67.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!