1. Introduction
In recent years, the Internet of Things (IoT) and machine learning (ML) have proven to be effective tools in the agricultural sector, enabling increased productivity and reducing labor dependency [
1]. Technologies such as smart collars and machine learning algorithms have emerged as promising solutions for automating the detection of bovine behaviors, marking a key advancement in livestock modernization. According to [
2], which reviewed 413 papers on cattle monitoring, the most common types of technology were found to be inertial sensors (37%) and images or videos (35%). Simple classification methods were used in 48% of the papers, while machine learning was employed in 29%. The two most common objectives in PLF (Precision Livestock Farming) papers were determining animal behavior (30%) and animal health (12%).
The type and quantity of movements performed by cattle indicate their current state. For example, the time cows spend lying down can signal changes in comfort, well-being, and health [
3]. Certain behaviors must be detected immediately in dairy farms, such as lameness, which can be identified through characteristics like gait symmetry or gait parameters, such as real-time step counting [
4].
Heat detection is one of the most critical aspects in this context. According to [
5], cited by [
6], estrus signs in cattle can manifest in various ways, including increased physical activity and cow restlessness. Often, interruptions in grazing and feeding are observed, along with a reduction in rumination time and decreased milk production. Instead of grazing, the cow tends to move more, exhibiting behaviors such as attempting to mount other cows or allowing itself to be mounted, regardless of its position in the social hierarchy.
In [
7], the authors highlight the occurrence of mounts during the estrus period, whether through attempts or acceptance of this action among cattle.
In [
8], the scoring scale proposed by [
7] is used to quantify estrus through visual observation of herd behavior. According to this scale, the following scores were assigned to observed behaviors: 100 points for standing to be mounted, 45 points for mounting from the front, 35 points for attempting to mount other cows, 15 points for chin resting, 10 points for mounting without standing, 10 points for vulva sniffing, 5 points for restlessness, and 3 points for the Flehmen response. A cow is considered in estrus upon reaching or exceeding 100 points.
In this study, the action of attempting to mount other cows is defined as active mounting.
Although artificial insemination has been established as a routine practice in livestock production systems, it presents lower conception rates compared to natural mating. According to [
9], the primary cause of this phenomenon is inadequate heat detection, which prevents artificial insemination from being performed at the optimal time. This deficiency in detection not only affects the effectiveness of the procedure but also reduces the total milk production throughout the animal’s productive life, decreases the number of calves born per cow, increases open days, and raises the replacement rate due to reproductive issues [
6]. The longer a cow remains unpregnant after calving, the lower its milk production, resulting in significant economic losses [
10].
Traditionally, the heat detection process is carried out through visual observation, a technique that, although cost-effective, is subjective, time-consuming, and prone to errors [
11]. This technique becomes even more challenging in countries like Chile, where dairy farms do not operate under a confined system, but cows feed through grazing. Generally, extensive grazing fields imply a considerable distance between observers and the cattle, making adequate inspection difficult and generating a high dependency on workers and weather conditions.
Various monitoring techniques based on Inertial Measurement Unit (IMU) sensors have been implemented to reduce reliance on visual observation by dairy farm personnel. These sensors include three-axis accelerometers, three-axis gyroscopes, and three-axis magnetometers, allowing the measurement of cows’ inertial movement. In [
12], waterproof enclosures with IMUs were installed on collars fixed to cows’ necks. Behaviors classified using machine learning models included feeding, resting, lying-down rumination, standing rumination, social licking, head movement, and headbutting other cows.
Similarly, in [
13], IMUs were used to classify different types of behaviors, applying supervised automatic classification algorithms such as Support Vector Machine (SVM), Random Forest, and XGBoost. These achieved high performance indicators, obtaining an overall F1 Score of 0.87, with specific results of 0.93 for lying down, 0.85 for walking, 0.94 for ruminating, 0.89 for feeding, 0.86 for standing, 0.93 for drinking, and 0.59 for other activities. This demonstrates that supervised classification algorithms effectively identify cow behaviors, yielding good results in this context.
A representative and robust database and the application of appropriate preprocessing and model evaluation techniques are necessary to achieve good results in movement classification through training models with supervised learning algorithms. In this sense, in [
4], the authors highlight the scarcity of public databases in bovine behavior classification, as most existing ones are commercial or private. To address this limitation, they developed CowScreeningDB, a multisensory database designed to detect lameness in dairy cows. The database includes data from 43 cows collected through smartwatches under natural conditions, organized transparently and replicable, and is publicly available in a GitHub repository, facilitating its use in future research. However, this database does not include specific labels for normal walking or lameness events; instead, it provides a continuous collection of approximately 7 h of daily activity data from healthy and lame cows. It is worth noting that data collection was conducted on cows confined to at least 10 square meters.
The literature contains numerous studies analyzing bovine behavior using databases based on inertial movement signals [
12,
13,
14,
15,
16,
17]. However, these studies use accelerations in the Body Frame (BF) instead of the World Frame (WF). Using the WF instead of the BF for motion data analysis offers several advantages. First, it allows acceleration and orientation measurements to be independent of the sensor’s posture or position, facilitating a more consistent interpretation of the data. Additionally, the WF provides a fixed reference relative to the ground, simplifying the analysis of motion patterns in absolute terms and improving individual comparisons. This characteristic is also advantageous for machine learning algorithms, as it reduces variability unrelated to target behaviors. The hypothesis is proposed that using acceleration data in the terrestrial reference frame would improve the performance of a model trained in this frame compared to one trained in the body reference frame, which must be verified through corresponding experimentation.
This work is part of a research project developed at the Universidad de La Frontera, titled “Towards reliable movement identification for dairy cattle based on self-calibration attitude estimate algorithms”, (Fondecyt 1220178 project) which employs IoT collars equipped with IMUs to capture bovine movement signals. These signals are then used to train classification models to identify cows’ movements associated with heat detection and lameness. As part of this project, a previous database [
18] was developed, which included accelerations in the BF measured by the MPU9250 IMU, where various events such as walking, resting, trotting, passive mounting, active mounting, and lameness were labeled. In this instance, a new database is developed, adding orientation information in the form of quaternions obtained from the BNO055 IMU, allowing for the transformation of accelerations from the BF to the WF, using the algorithm developed by its manufacturer, Bosch [
19].
This work aims to describe the procedure used to generate a public database focused on detecting active cows’ mounts and making it publicly available to keep improving the classification of cows’ mounts in a free-grazing regime. The database includes the full nine-axis signals (3D accelerometers, gyroscopes, and magnetometers) acquired at 10 samples per second from IMUs in IoT collars worn by the cows, with reference frames in both BF and WF. The cow’s movements are manually identified and labeled using video records obtained with a PTZ camera installed in a 9-m post in the center of the grazing fields.
4. Discussion and Conclusions
This study presents the development of a public database for detecting active mounts in cattle using IoT collars with inertial sensors and a reference frame in WF and BF. The generation of this database involved the collection, processing, and manual labeling of inertial signals obtained in the Maquehue Experimental Farm. Additionally, a classification model based on SVM was implemented to assess the effectiveness of the data in detecting active mounts.
The data captured in this project comes from free-grazing cattle, unlike related works [
12,
13,
14,
17], which have been conducted in confined environments. This represents a different environment where the cows live, transitioning from a more controlled and smaller space to larger, free-grazing systems. These conditions are less controlled and more representative of real-world dairy farms in countries like Chile. Additionally, signal capture is less invasive since the cameras are mounted on poles and do not directly interfere with the animals’ behavior, allowing them to act naturally. The database developed comprised 415 labeled behaviors (in five categories), with a total duration of 3:00:03, including 21 active mountings.
Previous studies, such as the one by Ismail et al. [
4], have focused on detecting lameness in dairy cows using CowScreeningDB. This public database includes data from cows in confined environments. While this dataset includes information from multiple cows and various behaviors, it does not specifically address active mounts. Furthermore, this study expands upon previous databases from this project, such as [
18], by incorporating acceleration data in both the WF and BF, enhancing the analysis and classification of bovine movements.
Similar studies by Liang et al. [
13] and Peng et al. [
12] implemented SVM and other classifiers such as Random Forest and XGBoost, achieving F1 Scores between 0.85 and 0.94 for specific behaviors like walking, resting, and feeding. In this work, active mounts are analyzed, being a more complex behavior. The mean F1 Score obtained in this study with an SVM is comparable, achieving 0.92 for active mounts when applying SBS reduction in features obtained on the BF.
The results from training the model with all the proposed features show that using the WF improves performance compared to the BF, achieving a mean F1 Score value of 10% higher, with a statistically significant difference.
This may be because measurements in the WF are more consistent and less susceptible to variations caused by sensor orientation. In BF, accelerations directly depend on the attitude estimation of the IoT collar’s IMU, which can introduce variability in the signal and affect the model’s accuracy. In contrast, accelerations in WF are referenced to a fixed frame of reference, allowing for a more stable representation of movements and, consequently, better discrimination between active mounts and other types of movement.
After applying the SBS technique to reduce the features for training the SVM, the difference between the means of the F1 Score obtained with the training group in the WF and the BF vanished. This is suitable because the IMU’s magnetometer needs to be recalibrated to obtain a good attitude estimation. This enables the coordinate rotation to translate the IMU’s accelerations from the BF to the WF.
However, it is noteworthy that the amount of active mount data in the training set is relatively low. This could introduce some bias into the model, making the obtained results not entirely representative. Although the observed improvement suggests that WF provides more helpful information for classification, the model’s performance may still be limited by the availability of data, which could affect its generalization to new scenarios.
External validation remains a critical challenge for sensor-based livestock technologies, as highlighted by Gómez et al. [
33]. If the proposed system is deployed in other farms, it is relevant to compare the precision of automatic mount detection in free-grazing cattle, concerning different environmental conditions or cattle breeds.
Despite the progress in developing the database, some limitations must be considered. Firstly, the number of labeled active mount events is relatively low compared to the other classes. Specifically, 21 labeled active mount events out of 415 labels make up a small portion of the dataset. Therefore, future research should focus on increasing the number of labeled events and the number of cows under study to improve the model’s generalization.
In this study, hundreds of hours of video recordings had to be reviewed to manually identify and label active mounting events, primarily because we aimed to analyze the cow’s behavior in a natural environment. This means that the cows were video recorded on 80 hectares when free grazing, and in a significant portion of the footage, the camera did not adequately focus on the cattle at the precise moment of the event. This limitation posed a considerable challenge in the construction of the dataset. However, recent advancements in automated cattle tracking techniques have been implemented [
25], which are streamlining the manual labeling process and boosting the database’s expansion. With these improvements, the number of labels associated with active mounts and other specific movements keeps increasing daily, enhancing the dataset’s representativeness and overall quality for future research.
Future database versions will increase the amount of registers, and could also incorporate other cow-related behaviors in natural environments, such as increased activity, grazing, passive mounting, and others, to create a more comprehensive tool for detecting cattle behavior. Moreover, exploring additional classification techniques could further enhance the detection accuracy and diminish the processing power requirements.
Although a dedicated time-series database or relational database management system was not required for the current data scale and processing needs, we consider including such systems in future iterations of this project, especially as the database grows or a real-time feed becomes necessary.
Currently, the data acquisition process is partially automated. The IoT collars collect IMU signals and store them locally, while GPS and battery status are transmitted via LoRaWAN to a Grafana dashboard. The PTZ cameras are also automatically controlled using GPS data from the collars as a reference. However, some processes remain manual, including data transfer, video-labeling synchronization, and feature extraction. We plan to develop a data pipeline to further automate these tasks using Python scripts. This will significantly reduce processing time and improve the efficiency of incorporating new data into the repository. Planned improvements include the development of a user-friendly interface for the labeling team, automated synchronization between IMU signals and video events, and semi-automated feature extraction routines.