arXiv:2610.13242cs.CVOct 2026

Manuscript Offprint

arXiv:2610.13242

Deep Learning Approach for RealTime Contraction Detection in Laboring Dairy Cattle

Sebastian Puchala, Dominik Gronkiewicz, Marcin Gołębiewski, Grzegorz Grodkowski, Grzegorz Gwardys

Abstract

Currently, the animal production sector is undergoing rapid development of techniques that allow automatic monitoring of animal behaviour and health. This paper presents a computer vision-based approach for the automatic recognition of labor contractions in cows. During the course of the study, videos depicting 100 cow births were collected. From the obtained videos, 8500 cow contraction actions and about 25 000 non-contraction sequences were extracted which constituted the dataset. Leveraging image processing techniques and deep learning algorithms like Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs), our methodology extracts relevant features from video frames to detect and classify contractions. Our study demonstrates a high accuracy rate of over 95% in detecting labor contractions. This automated system has the potential to enhance productivity and animal welfare in the dairy industry by providing real-time monitoring and facilitating timely intervention during difficult calvings. The video demonstration of the system can be found at the following URL: https://www.youtube.com/watch?v=8fTSG5D7dZ0

Introduction

Childbirth for both the cow and the calf is a critical period affecting the subsequent health of both the mother and the calfling [1-2]. Difficult births, known as dystocia, are common in dairy cows [10]. Studies show that dystocia rates in the United States range from 28.6 to 51.2% in primiparous cows and from 10.7 to 29.4% in multiparous cows [3-4]. Failure to detect difficult labor in a timely manner and implement birth assistance can result in an increased risk of stillbirth, they also increase the likelihood of birth complications and reduce the productivity and welfare of the cow and calf [1,2,5,7] which consequently reduces farm profit.

Predicting calving time facilitates labor organization, thus minimizing unnecessary pain and stress, especially in situations requiring intervention [6]. External signs such as pelvic ligament loosening, udder swelling, vulvar swelling and behavioral changes are often used to predict the onset of calving in dairy cows. However, visual observations are time-consuming. They require regular and continuous repetition around the clock. Therefore, systems have appeared on the market that allow automatic detection of the second phase of calving. These include the Moocall system consisting of a sensor placed on the tail. It measures contractions using an accelerometer. Another example of a sensor is the C6 Birth Control which requires sewing to the labia to function properly. It measures the degree of dilation of the genital tract. These types of birth detection systems are characterized by high accuracy and reliability, however, they require knowledge of how to install them and it is necessary to remove them after delivery. These devices can also be invasive to animals, especially if not installed properly. Infection can occur or, in the case of the Moocall device, tail necrosis.

An alternative to this type of sensor is to use camera images to analyze the behavior of calving cows. A solution like this eliminates the need for employees to observe the parturient cows and does not require the installation of any device on the animal's body. It is known that the cow's behavior before parturition changes significantly the time of lying in the lateral position increases [1], the time of raised tail increases [8], the time spent in foraging and chewing also decreases [9]. These changes are observed in the first and second stages of parturition, are an individual trait and can vary considerably between different breeds and calving rates [8], hence their correct interpretation is much more difficult and requires a lot of data. On the other hand, a common feature of all parturient cows is the occurrence of labor contractions in the second stage of labor, that is, the fetal displacement phase. In dystocia births, contractions are frequent and strong after which they weaken, a sign of the cow's weakness [5]. At this point, labor assistance is required.

The introduction of computer vision techniques provides a means to automate this recognition process, enabling real-time and continuous monitoring of labor contractions. By analyzing video streams captured from strategically placed cameras within calving areas, computer vision algorithms can extract relevant features to detect labor contractions accurately. Before the Deep Learning era, we could describe these features as motion vectors, texture information, or shape descriptors [10]. However today the burden of determining the appropriate features rests with neural networks and this is the approach we follow. Convolutional Neural Networks (CNNs) have demonstrated exceptional performance in image recognition tasks [11], making them well-suited for the detection of labor contractions. By training CNN models on annotated datasets comprising synchronized video recordings and ground truth annotations of labor contractions, the algorithm can learn to identify contraction patterns. Additionally, Vision Transformers (ViTs) [12], a recent advancement in deep learning, offer an alternative approach for feature extraction and recognition, leveraging self-attention mechanisms to capture spatial relationships in video data.

While the specific domain of labor contraction recognition in cows using computer vision techniques is relatively unexplored, there are various relevant studies that highlight the application of computer vision in various aspects of livestock management.

Authors in work [13] provide an overview of computer vision-based technologies used for cow lameness detection and discuss the advantages and disadvantages of different camera types, also pointing challenges that remain in terms of detection efficacy and practical implementation. Bezsonov Oleksandr et al. [14] present an intelligent system that integrates synchronized 3D cameras and neural network modules for breed recognition and live weight estimation of cows. In [15] Nguyen Chuong et al. propose a prototype that utilizes embedded sensors to monitor cow welfare on farms, ensuring quality control and compliance. In [16], an embedded imaging system is presented to assess dairy cow drinking behaviour in relation to heat stress. In [17] a framework is introduced that predicts the lactation curve for dairy cows using the cow's historical milk yield sequence and reproductive and health events. There are also many works that propose working computer vision components that are not linked directly to the agricultural application, for example, cattle pose estimation algorithms [18-19].

Figure

Fig 1. Example of a keypoint label template of the cow skeleton presented in [19].

By leveraging the capabilities of CNNs and ViTs, this study aims to develop an automated system capable of detecting labor contractions in cows. As stated before this topic is rather neglected, probably due to the cost of producing the relevant data set. We believe that bucketing contractions' amounts and setting thresholds is a good first step to notify famer about an impending birth – this conception is shown in figure 2 and at the following URL: https://www.youtube.com/watch?v=8fTSG5D7dZ0. Comparison between our study and similar works is conducted in the Discussion.

Figure

Last 180s of contractions

Contraction prob: 0.857

Contractions detected!

Fig 2. Screenshot of our demonstration. In the left top corner, there are amounts of contractions in the 5-minute buckets. The chart at the bottom of the photo shows the contractions' score at the current moment. In this example, the cow is during the contractions.