基于改进RTDETR算法的产后母牛与犊牛行为实时分类模型

  • 顾禄辉 ,
  • 姚瑶 ,
  • 李佳舟 ,
  • 邓依凡 ,
  • 彭英琦
展开
顾禄辉(2000—),男,四川农业大学在读硕士研究生,主要从事动物行为与检测方向研究.
E-mail: 2023217016@stu.sicau.edu.cn

收稿日期: 2025-12-17

  网络出版日期: 2026-05-15

基金资助

国家自然科学基金项目(32402826)

Real-time behavior classification model of postpartum cows and calves based on improved RTDETR algorithm

  • GU Luhui ,
  • YAO Yao ,
  • LI Jiazhou ,
  • DENG Yifan ,
  • PENG Yingqi
Expand
  • College of Mechanical and Electrical Engineering, Sichuan Agricultural University, Yaan 625014, China

Received date: 2025-12-17

  Online published: 2026-05-15

摘要

基于计算机视觉的行为分类已成为动物行为监测的重要技术.本文基于改进的RTDETR(real-time detection transformer)算法,构建了一种产后母牛与犊牛的行为分类模型.通过在RTDETR-r18模型骨架网络的最后一层引入频率自适应空洞卷积(frequency-adaptive dilated convolution,FADC)模块,并将混合编码层中基于注意力的同尺度特征交互(attention-based intra-scale feature interaction,AIFI)模块替换为高低频注意力(HiLo attention)模块,以增强模型对母牛和犊牛图像全局信息与局部特征的高效捕捉能力.将所提出模型与其他模型在相同的产后母牛与犊牛行为数据集上进行训练与比较,结果表明:改进RTDETR模型的总体精确率为97.3%,召回率为96.2%,均高于其他对比模型;与基线RTDETR-r18模型相比,改进RTDETR模型的精确率和召回率分别提升0.9和0.6个百分点.改进RTDETR模型在产后母牛与犊牛的行为分类任务中表现优异,可为提升养殖场管理效率提供新方法.

本文引用格式

顾禄辉 , 姚瑶 , 李佳舟 , 邓依凡 , 彭英琦 . 基于改进RTDETR算法的产后母牛与犊牛行为实时分类模型[J]. 河北大学学报(自然科学版), 2026 , 46(3) : 237 -248 . DOI: 10.3969/j.issn.1000-1565.2026.03.002

Abstract

At present, behavior classification based on computer vision has become an important technology for animal behavior monitoring. This study developed a behavioral classification model for postpartum cows and calves based on the improved RTDETR(real-time detection transformer)algorithm. To efficiently capture both global information and local features from cow and calf images, a frequency-adaptive dilated convolution(FADC)module was integrated into the final layer of the backbone network in the RTDETR-r18 model, and the attention-based intra-scale feature interaction(AIFI)module in the hybrid encoder was replaced with a HiLo attention module. The proposed and other models were trained- 引用格式:张文恺,杨术明,马永龙,等.基于EDEM的牧场推料机器人参数优化设计与试验[J].河北大学学报(自然科学版),2026,46(3):225-236.引用格式:顾禄辉,姚瑶,李佳舟,等.基于改进RTDETR算法的产后母牛与犊牛行为实时分类模型[J].河北大学学报(自然科学版),2026,46(3):237-248.DOI:10.3969/j.issn.1000-1565.2026.03.002基于改进RTDETR算法的产后母牛与犊牛行为实时分类模型顾禄辉,姚瑶,李佳舟,邓依凡,彭英琦(四川农业大学 机电学院,四川 雅安 625014)摘 要:基于计算机视觉的行为分类已成为动物行为监测的重要技术.本文基于改进的RTDETR(real-time detection transformer)算法,构建了一种产后母牛与犊牛的行为分类模型.通过在RTDETR-r18模型骨架网络的最后一层引入频率自适应空洞卷积(frequency-adaptive dilated convolution,FADC)模块,并将混合编码层中基于注意力的同尺度特征交互(attention-based intra-scale feature interaction,AIFI)模块替换为高低频注意力(HiLo attention)模块,以增强模型对母牛和犊牛图像全局信息与局部特征的高效捕捉能力.将所提出模型与其他模型在相同的产后母牛与犊牛行为数据集上进行训练与比较,结果表明:改进RTDETR模型的总体精确率为97.3%,召回率为96.2%,均高于其他对比模型;与基线RTDETR-r18模型相比,改进RTDETR模型的精确率和召回率分别提升0.9和0.6个百分点.改进RTDETR模型在产后母牛与犊牛的行为分类任务中表现优异,可为提升养殖场管理效率提供新方法.关键词:产后母牛;犊牛;行为分类;改进RTDETR模型中图分类号:TP391.4 文献标志码:A 文章编号:1000-1565(2026)03-0237-12DOI:10.3969/j.issn.1000-1565.2026.03.002Real-time behavior classification model of postpartum cows and calves based on improved RTDETR algorithmGU Luhui, YAO Yao, LI Jiazhou, DENG Yifan, PENG Yingqi(College of Mechanical and Electrical Engineering, Sichuan Agricultural University, Yaan 625014, China)Abstract: At present, behavior classification based on computer vision has become an important technology for animal behavior monitoring. This study developed a behavioral classification model for postpartum cows and calves based on the improved RTDETR(real-time detection transformer)algorithm. To efficiently capture both global information and local features from cow and calf images, a frequency-adaptive dilated convolution(FADC)module was integrated into the final layer of the backbone network in the RTDETR-r18 model, and the attention-based intra-scale feature interaction(AIFI)module in the hybrid encoder was replaced with a HiLo attention module. The proposed and other models were trained- 收稿日期:2025-12-17;修回日期:2026-01-15 基金项目:国家自然科学基金项目(32402826) 第一作者:顾禄辉(2000—),男,四川农业大学在读硕士研究生,主要从事动物行为与检测方向研究.E-mail: 2023217016@stu.sicau.edu.cn 通信作者:彭英琦(1991—),女,四川农业大学副教授,主要从事生物传感器、大数据挖掘与分析、动物行为与检测方向研究.E-mail: pengyingqi@sicau.edu.cn 第3期顾禄辉等:基于改进RTDETR算法的产后母牛与犊牛行为实时分类模型河北大学学报(自然科学版) 第46卷on the same dataset of postpartum cow and calf behaviors. The results showed that the improved RTDETR model achieved an overall precision of 97.3% and a recall of 96.2%, both surpassing those of other models. Compared with the baseline RTDETR-r18 model, the precision and recall of the improved RTDETR model increased by 0.9 and 0.6 percentage points, respectively. The improved RTDETR model demonstrates exceptional performance in behavioral classification of postpartum cows and calves, offering an effective method to enhance livestock farm management efficiency.

参考文献

[1] Dado R G, Allen M S. Variation in and relationships among feeding, chewing, and drinking variables for lactating dairy cows[J]. J Dairy Sci, 1994, 77(1): 132-144. DOI:10.3168/jds.s0022-0302(94)76936-8.
[2] Huzzey J M, von Keyserlingk M A G, Weary D M. Changes in feeding, drinking, and standing behavior of dairy cows during the transition period[J]. J Dairy Sci, 2005, 88(7): 2454-2461. DOI:10.3168/jds.s0022-0302(05)72923-4.
[3] Russello H, van der Tol R, Holzhauer M, et al. Video-based automatic lameness detection of dairy cows using pose estimation and multiple locomotion traits[J]. Comput Electron Agric, 2024, 223: 109040. DOI:10.1016/j.compag.2024.109040.
[4] Barrier A C, Ruelle E, Haskell M J, et al. Effect of a difficult calving on the vigour of the calf, the onset of maternal behaviour, and some behavioural indicators of pain in the dam[J]. Prev Vet Med, 2012, 103(4): 248-256. DOI:10.1016/j.prevetmed.2011.09.001.
[5] Labeur L, Villiers G, Small A H, et al. Infrared thermal imaging as a method to evaluate heat loss in newborn lambs[J]. Res Vet Sci, 2017, 115: 517-522. DOI:10.1016/j.rvsc.2017.09.023.
[6] Ospina Rios S L, Lee C, Andrewartha S J, et al. Temperament of the dairy cow relates to her maternal behaviour in a pasture-based extended suckling system[J]. Appl Anim Behav Sci, 2024, 279: 106400. DOI:10.1016/j.applanim.2024.106400.
[7] Beaver A, Meagher R K, von Keyserlingk M A G, et al. Invited review: a systematic review of the effects of early separation on dairy cow and calf health[J]. J Dairy Sci, 2019, 102(7): 5784-5810. DOI:10.3168/jds.2018-15603.
[8] Meagher R K, Beaver A, Weary D M, et al. Invited review: a systematic review of the effects of prolonged cow-calf contact on behavior, welfare, and productivity[J]. J Dairy Sci, 2019, 102(7): 5765-5783. DOI:10.3168/jds.2018-16021.
[9] Sirovnik J, Barth K, de Oliveira D, et al. Methodological terminology and definitions for research and discussion of cow-calf contact systems[J]. J Dairy Res, 2020, 87(S1): 108-114. DOI:10.1017/s0022029920000564.
[10] Todd C G, McGee M, Tiernan K, et al. An observational study on passive immunity in Irish suckler beef and dairy calves: Tests for failure of passive transfer of immunity and associations with health and performance[J]. Prev Vet Med, 2018, 159: 182-195. DOI:10.1016/j.prevetmed.2018.07.014.
[11] Sustronck B, Hoflack G, Lebrun M, et al. Bayesian latent class analysis of the characteristics of diagnostic tests to assess the passive immunity transfer status in neonatal Belgian Blue beef calves[J]. Prev Vet Med, 2022, 207: 105729. DOI:10.1016/j.prevetmed.2022.105729.
[12] Khan M A, Bach A, Weary D M, et al. Invited review: Transitioning from milk to solid feed in dairy heifers[J]. J Dairy Sci, 2016, 99(2): 885-902. DOI:10.3168/jds.2015-9975.
[13] van Zyl C L, Bokkers E A M, Kemp B, et al. Growth and metabolism of calves in a dairy cow-calf contact system with gradual weaning and separation[J]. J Dairy Sci, 2025, 108(10): 11103-11118. DOI:10.3168/jds.2025-26619.
[14] Gillet R, Schneider M, Barth K. Calf presence in the cow herd: Associations with growth, health, and herd horn status in a cow-calf contact system[J]. Livest Sci, 2025, 302: 105834. DOI:10.1016/j.livsci.2025.105834.
[15] Peng Y Q, Kondo N, Fujiura T, et al. Classification of multiple cattle behavior patterns using a recurrent neural network with long short-term memory and inertial measurement units[J]. Comput Electron Agric, 2019, 157: 247-253. DOI:10.1016/j.compag.2018.12.023.
[16] Wu Y Q, Liu M, Peng Z Y, et al. Recognising cattle behaviour with deep residual bidirectional LSTM model using a wearable movement monitoring collar[J]. Agriculture, 2022, 12(8): 1237. DOI:10.3390/agriculture12081237.
[17] Peng Y Q, Wulandari, Kondo N, et al. Japanese black cattle call patterns classification using multiple acoustic features and machine learning models[J]. Comput Electron Agric, 2023, 204: 107568. DOI:10.1016/j.compag.2022.107568.
[18] Liu M, Wu Y Q, Li G Y, et al. Classification of cow behavior patterns using inertial measurement units and a fully convolutional network model[J]. J Dairy Sci, 2023, 106(2): 1351-1359. DOI:10.3168/jds.2022-22350.
[19] Arcidiacono C, Mancino M, Porto S M C. Moving mean-based algorithm for dairy cow’s oestrus detection from uniaxial-accelerometer data acquired in a free-stall barn[J]. Comput Electron Agric, 2020, 175: 105498. DOI:10.1016/j.compag.2020.105498.
[20] Norbu N, Alvarez-Hess P S, Leury B J, et al. Assessment of RumiWatch noseband sensors for the quantification of ingestive behaviors of dairy cows at grazing or fed in stalls[J]. Anim Feed Sci Technol, 2021, 280: 115076. DOI:10.1016/j.anifeedsci.2021.115076.
[21] Rial C, Laplacette A, Caixeta L, et al. Metabolic-digestive clinical disorders of lactating dairy cows were associated with alterations of rumination, physical activity, and lying behavior monitored by an ear-attached sensor[J]. J Dairy Sci, 2023, 106(12): 9323-9344. DOI:10.3168/jds.2022-23156.
[22] Yin M S, Ma R Q, Luo H L, et al. Non-contact sensing technology enables precision livestock farming in smart farms[J]. Comput Electron Agric, 2023, 212: 108171. DOI:10.1016/j.compag.2023.108171.
[23] Pinge A, Gad V, Jaisighani D, et al. Detection and monitoring of stress using wearables: a systematic review[J]. Front Comput Sci, 2024, 6: 1478851. DOI:10.3389/fcomp.2024.1478851.
[24] Chae J W, Cho H C. Identifying the mating posture of cattle using deep learning-based object detection with networks of various settings[J]. J Electr Eng Technol, 2021, 16(3): 1685-1692. DOI:10.1007/s42835-021-00701-z.
[25] Xiao J X, Si Y S, Xie M L, et al. A novel and convenient lying cow identification method based on YOLOX and CowbodyNet: a study with applications in a barn[J]. Comput Electron Agric, 2024, 225: 109287. DOI:10.1016/j.compag.2024.109287.
[26] Ahmed M I, Cao H P, Perea A R, et al. YOLOv8-BS: an integrated method for identifying stationary and moving behaviors of cattle with a newly developed dataset[J]. Smart Agric Technol, 2025, 12: 101153. DOI:10.1016/j.atech.2025.101153.
[27] Li X X, Cai M R, Tan X J, et al. An efficient transformer network for detecting multi-scale chicken in complex free-range farming environments via improved RT-DETR[J]. Comput Electron Agric, 2024, 224: 109160. DOI:10.1016/j.compag.2024.109160.
[28] Khanam R, Hussain M. YOLOv11: An overview of the key architectural enhancements[A]. arXiv, 2024.
[29] Zhao Y A, Lv W Y, Xu S L, et al. DETRs beat YOLOs on real-time object detection[C] //2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR). June 16-22, 2024, Seattle, WA, USA. IEEE, 2024: 16965-16974. DOI:10.1109/CVPR52733.2024.01605.
[30] Arcidiacono C, Porto S M C, Mancino M, et al. Development of a threshold-based classifier for real-time recognition of cow feeding and standing behavioural activities from accelerometer data[J]. Comput Electron Agric, 2017, 134: 124-134. DOI:10.1016/j.compag.2017.01.021.
[31] Peng Y Q, Chen Y X, Yang Y X, et al. A multimodal classification method: Cow behavior pattern classification with improved EdgeNeXt using an inertial measurement unit[J]. Comput Electron Agric, 2024, 226: 109453. DOI:10.1016/j.compag.2024.109453.
[32] Li J Z, Yang Y X, Yao Y, et al. A dynamic yak heifer pose estimation model based on keypoint detection for complex environmental monitoring[J]. J Dairy Sci, 2025, 108(12): 13704-13719. DOI:10.3168/jds.2025-27099.
[33] Kong X, Liu F, Wu Y S, et al. Nextv2-DETR: lightweight real-time classification model of potatoes based on improved RT-DETR for mobile deployment[J]. Comput Electron Agric, 2025, 239: 110996. DOI:10.1016/j.compag.2025.110996.
[34] Chen L W, Gu L, Zheng D Z, et al. Frequency-adaptive dilated convolution for semantic segmentation[C] //2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR). June 16-22, 2024, Seattle, WA, USA. IEEE, 2024: 3414-3425. DOI:10.1109/CVPR52733.2024.00328.
[35] Pan Z Z, Cai J F, Zhuang B H. Fast vision transformers with HiLo attention[EB/OL]. 2022: arXiv: 2205.13213. https://doi.org/10.48550/arXiv.2205.13213.
[36] Wang Z, Hua Z X, Wen Y C, et al. E-YOLO: Recognition of estrus cow based on improved YOLOv8n model[J]. Expert Syst Appl, 2024, 238: 122212. DOI:10.1016/j.eswa.2023.122212.
[37] Li D, Dai B S, Li Y X, et al. IATEFF-YOLO: Focus on cow mounting detection during nighttime[J]. Biosyst Eng, 2024, 246: 54-66. DOI:10.1016/j.biosystemseng.2024.07.017.
[38] Wang R R, Li Y X, Tian F Y, et al. Estrus detection in dairy cows using advanced object tracking and behavioral analysis technologies[J]. Comput Electron Agric, 2025, 235: 110331. DOI:10.1016/j.compag.2025.110331.
[39] Wang Z, Deng H X, Zhang S J, et al. Detection and tracking of oestrus dairy cows based on improved YOLOv8n and TransT models[J]. Biosyst Eng, 2025, 252: 61-76. DOI:10.1016/j.biosystemseng.2025.02.005.
[40] Zheng Z Y, Qin L F. PrunedYOLO-Tracker: an efficient multi-cows basic behavior recognition and tracking technique[J]. Comput Electron Agric, 2023, 213: 108172. DOI:10.1016/j.compag.2023.108172.
[41] Yang Y X, Deng Y F, Li J Z, et al. An effective yak behavior classification model with improved YOLO-pose network using yak skeleton key points images[J]. Agriculture, 2024, 14(10): 1796. DOI:10.3390/agriculture14101796. (
文章导航

/

〈 〉