Next Article in Journal
Complex Networks and the b-Value Relationship Using the Degree Probability Distribution: The Case of Three Mega-Earthquakes in Chile in the Last Decade
Next Article in Special Issue
Sensor Data Analytics: Challenges and Methods for Data-Intensive Applications
Previous Article in Journal
A Variational Bayesian Deep Network with Data Self-Screening Layer for Massive Time-Series Data Forecasting
Previous Article in Special Issue
Machine Learning Algorithm to Predict Acidemia Using Electronic Fetal Monitoring Recording Parameters
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Analysis of Accelerometer and GPS Data for Cattle Behaviour Identification and Anomalous Events Detection

1
Data Science Laboratory, University Rey Juan Carlos, 28933 Móstoles, Spain
2
Quantitative Methods and Socioeconomic Development Group, Institute for Regional Development, University of Castilla-La Mancha, 02071 Albacete, Spain
*
Author to whom correspondence should be addressed.
Entropy 2022, 24(3), 336; https://doi.org/10.3390/e24030336
Submission received: 23 December 2021 / Revised: 22 February 2022 / Accepted: 23 February 2022 / Published: 26 February 2022

Abstract

:
In this paper, a method to classify behavioural patterns of cattle on farms is presented. Animals were equipped with low-cost 3-D accelerometers and GPS sensors, embedded in a commercial device attached to the neck. Accelerometer signals were sampled at 10 Hz, and data from each axis was independently processed to extract 108 features in the time and frequency domains. A total of 238 activity patterns, corresponding to four different classes (grazing, ruminating, laying and steady standing), with duration ranging from few seconds to several minutes, were recorded on video and matched to accelerometer raw data to train a random forest machine learning classifier. GPS location was sampled every 5 min, to reduce battery consumption, and analysed via the k-medoids unsupervised machine learning algorithm to track location and spatial scatter of herds. Results indicate good accuracy for classification from accelerometer records, with best accuracy (0.93) for grazing. The complementary application of both methods to monitor activities of interest, such as sustainable pasture consumption in small and mid-size farms, and to detect anomalous events is also explored. Results encourage replicating the experiment in other farms, to consolidate the proposed strategy.

1. Introduction

Monitoring activity of animals in livestock farms can provide relevant indicators about their health and welfare level. In fact, ensuring animal well-being through objective evidence has become a major concern for both cattle producers and consumers [1]. For example, EU Directive 98/58/EC regarding the protection of animals kept in farms [2] introduces general rules for protecting all animals species for production of food, wool, skin, fur or other farming purposes. Later on, EU legislation has been progressively extended to increase the well-being of farmed animals. Additionally, current EU regulation regarding organic farming rules encourages high standards for animal welfare, requiring farmers to meet specific behavioural needs of animals [3].
The development of systems to gather and analyse animal behaviour data can certainly help cattle producers to meet these high quality standards. In recent years, wireless sensor networks (WSN) and Internet of Things (IoT) technologies have paved the way for implementing monitoring systems on farms [4,5,6]. Various methods have been proposed for automated recording and identification of animal activity in this context. Sensors embedded in electronic devices attached on animals legs or using neckbands can record activity information, with great detail. Then, activity patterns of interest can be revealed through the analysis of these behavioural records.
A frequent case is the use of accelerometers to create motion logs by tracking movement in a 3-D coordinate system. These devices have been used to register movements of human users [7]. Moreover, it is possible to estimate the vertical component and magnitude of the horizontal component of the user’s motion, even in absence of precise information about the position and orientation of the device with respect to the body [8,9]. Many previous studies of livestock behavioural activity on farms use accelerometers to gather data describing animal movements [10,11,12,13,14,15]. Furthermore, certain studies also use low-cost GPS devices to register the location of animals, augmenting the information obtained from accelerometers [16].
Machine learning (ML) classification algorithms can be used to classify cattle activity patterns automatically, based on registers from accelerometer and GPS sensors [17,18]. Previous studies have documented accurate identification of cattle standing and walking behaviour through accelerometer data [11,19], along with precise estimation of the duration of standing behavioural patterns [20].
A comprehensive survey [21], comparing previous studies on ruminant behaviour prediction, indicates that most of them are focused on identifying a predefined set of activities. For instance, Smith et al. [22] differentiate among five possible classes (grazing, walking, ruminating, resting and other activities), whereas Riaboff et al. [23] distinguish up to 13 different behavioural patterns. Usually, the initial problem is broken down into a set of “one-vs-all” binary classification tasks. Hence, individual outputs from each classifier must be integrated, which leads to some practical challenges. For instance, it is desirable to follow a robust methodology for data acquisition and feature engineering that can be shared among different classifiers [21,24]. In the same way, another limitation of previous studies is the relatively narrow focus on specific cases of outlier detection techniques, such as lameness [25], oestrus periods [14] or parturition events [18,26].
Likewise, current research works exhibit a noticeable scarcity with respect to the early detection of specific cattle social interactions at group level, especially when they lead to anomalous situations involving potential economic impact on livestock farm operations.
Wolf and other predator attacks constitute a prominent example of such anomalies. When there exists a potential threat of attack, herds change their behavioural patterns to put on an alert. They could also stop grazing and ruminating, or even move away to a different location. The growing and perceptible concern among farm producers on this matter, and the pressing need to find sustainable trade-off solutions, that preserves both protected species, such as wolves in the northwest of Spain and other countries, and farmers’ rights to continue their normal operations and guarantee their animals well-being, constitute a challenging issue yet to be solved.
Disease transmission represents another good example. Early detection and subsequent application of proper corrective actions bring in an opportunity to avoid a severe impact on productivity. Unusual resting behaviours, abnormal stance and gaits, the absence of vertical or horizontal neck movements or the observation of too slow displacements can provide key signals of possible ongoing diseases.
Similarly, despite not representing an anomalous activity itself, the detection of an unbalanced use of pasture land can also help farmers to develop strategies aimed at a more rational consumption of natural resources, achieving better management and saving costs. In this regard, recurrent grazing habits and lack of displacement to alternative areas may render valuable information to farmers on pasture land usage. Along these lines, recent results shown in [27] suggest that the combination of movement records and GPS location data can improve detection of anomalous situations on farms.
In this paper, we present a method to classify cattle behaviour from accelerometer and GPS data, collected from collars attached to cows in two field experiments. Time and frequency-domain features are extracted from accelerometer data, to train a supervised ML classification model for cattle behaviour. GPS data is processed with an unsupervised clustering method to estimate the number of herds and their spatial scattering. This general method can be applied to a wide range of scenarios. Furthermore, new activities could be incorporated to the classifier, provided that customised training data describing the new patterns of interest are obtained, following the same preparation procedure. In addition, potential applications for tracking interesting or anomalous activities, such as unbalanced use of pasture land, disease transmission or predator attacks, are also explored.
The rest of the paper is organized as follows. Section 2 describes the equipment and experimental setup for this study, along with our proposed method to analyse animal behaviour records. Section 3 presents the main results from the two field studies to validate the suggested approach. In Section 4, we discuss the main implications that can be drawn from experimental results, as well as potential practical applications of the proposed method. Finally, Section 5 concludes and describes further research directions.

2. Materials and Methods

2.1. Farms and Animals

In our study, we focus on beef cattle located on two different commercial farms, located in the Spanish provinces of Avila and Segovia, respectively. Herds raised on these farms comprise widespread breeds, including Fleckvieh or Salers, among others, along with native Spanish breeds, such as the Berrenda en Colorado (brindle cow in red) or the Avileña-negra Ibérica (Iberian Avila’s black). Most of time, animals were kept on pasture and moved freely within the farm limits. Cows were mainly fed with pasture, although they also received hay and concentrate supplements. A random sample of 30 cows in both livestock farms were equipped with accelerometer and GPS devices (see Section 2.2, below). Selected cows are representative of the most prevalent breeds in cattle from both farms, namely, Fleckvieh, Salers, Berrenda en Colorado and cross-bred dairy specimens.

2.2. Device and Data Loggers

We explore the use of two different procedures to monitor and analyse animal behaviour:
  • Tracking movement: Detailed movement registries are recorded through triaxial accelerometers attached to the neck. In this way, we can identify more different behavioural patterns than when the accelerometer is installed on the leg.
  • Tracking location: Animal location is registered with GPS sensors that periodically transmit this information to a centralized server in a cloud computing infrastructure.
Accelerometers and GPS sensors for this study were provided and installed by Digitanimal (https://digitanimal.com/?lang=en, accessed on 25 February 2022), a private company based in Madrid that develops innovative hardware and software animal monitoring solutions on farms. These sensors are integrated in an electronic device developed by this company, mounted inside a weatherproof plastic case and attached to the cow using a neckband. Figure 1 depicts a model for the collar case containing the device, and the three coordinate axes monitored by the accelerometer sensor. In turn, Figure 2 shows a cow of Fleckvieh breed wearing the neckband attaching the device to monitor movement and location.
Acceleration levels on cows necks are measured by using MEMS (Micro Electro Mechanical System) accelerometers. This type of accelerometer measures acceleration in 3 orthogonal directions (triaxial accelerometer, see Figure 1). The sensor captures DC (direct current or offset) acceleration (earth gravity), providing not only acceleration levels but also sensor orientation. It is a low-power consumption sensor, with a working temperature range of −40º to 85º Celsius, suitable for the required application. Raw data are acquired at a 10 Hz sampling frequency, using a dynamic range of ± 2  g. Data are retrieved continuously since the sensor is connected and directly stored in plain text format in a SD memory card.
With respect to GPS sensors, they must send information at more widely spaced intervals than in the case of accelerometers in order to optimize battery consumption and, therefore, avoid premature battery draining. We must take into account that the monitor device is a commercial hardware solution, conceived to be affordable and remain operative over relatively long time periods (usually, 2–3 months). The GPS device is configured to use a maximum DOP (Dilution of Precision) threshold of 1, and to seek signal reception from a minimum of 7 different satellites. With this configuration, the estimated average measurement error is 1.7 m, and 90% of measurements present an error lower than 5.2 m.
A primary goal for this product is to avoid the need of frequent maintenance tasks (such as replacing the battery or the SD card), that would interfere with normal farm routines. In consequence, the sampling rate of GPS data is set to 5 min, that is, a single message is sent at the end of each 5-min interval. In spite of this initial specification, it is also possible that the GPS signal is lost in certain shadow regions on the farm, or that transmitted data do not successfully arrive at the server, due to propagation issues, network problems or other causes. For this reason, the system must be prepared to deal with missing data in location records.
Next, we describe the procedure for data acquisition, the proposed method for processing accelerometer and GPS data, as well as the approach for identification of animal behaviours using ML algorithms.

2.3. Accelerometer and GPS Data Collection

Figure 3 shows an example of 3 raw signals produced by one of the accelerometers for 220 s. Each individual signal is the result of monitoring acceleration changes along a single axis. The blue signal corresponds to the X-axis, the orange signal represents oscillations along the Y-axis and the green signal stands for acceleration changes along the Z-axis. Raw signals recorded by each accelerometer are inputs for the feature extraction step in data analysis (see Section 2.6 for further details).
While triaxial accelerometers in collars store signal data locally, the GPS sensor monitors the location of the animal and periodically transfer these data to a central server each 5-min interval, containing the following attributes:
  • id: Unique identifier for the monitored cow.
  • timestamp: A timestamp value in the format YYYY-MM-DD HH:MM:SS.
  • longitude: Longitude coordinate for the current animal position.
  • latitude: Latitude coordinate for the current animal position.

2.4. Behavioural Observations

One of the main limitations to validate the automated detection of behavioural patterns in ruminants is the lack of a validation database, providing examples of specific behaviours and their associated patterns captured by the accelerometer. In our experiments, this is addressed by taking video recordings of a sample of animals on pasture fields, wearing the monitoring devices described above. Hence, the main goal of these recordings is to match each logged signal with its corresponding recorded behaviour. Furthermore, video recordings also allow double-checking the correct alignment between signals and video timestamps, a problem addressed via a specific methodology described in Section 2.5.
A team of 10 scientists were trained to supervise the recorded scene, annotating the timestamp and observed behaviours. Each scientist was responsible for tracking a single animal, annotating behavioural patterns over a 5 h session. Operators encoded activities on log files using a shared predefined nomenclature, described in the ethogram shown in Table 1. Annotated behaviours include: grazing, ruminating, steady standing, laying and others. The last category encompasses less frequent behaviours, such as running, scratching, drinking, calf nursing, etc.). The duration of individual behaviours was quite variable, ranging from few seconds (e.g., for scratching) to several minutes, in some cases (e.g., ∼16 min for a single instance of ruminating or ∼11.5 min for one instance of laying). Some behaviours required immediate reactions from human observers, therefore reducing the length of video recordings to identify them (e.g., in running operators must relocate to follow the animals).
Video recordings and observational log files derived from them were subsequently reviewed by independent supervisors, to ensure consistency of activity labelling between files. After an initial screening, 3 animals were selected for this analysis, as their activity logs provided the most accurate registries. A total of 238 unique behavioural patterns were identified from these recordings. These patterns, together with their associated signals recorded by accelerometers, constitute the gold standard for this study.
Figure 4 reports the percentage of samples corresponding to each individual activity, over the total number of logged behaviours. Despite other activities were also annotated by scientists in observational logs, only the most frequent ones are considered in this classification analysis.

2.5. Alignment between Accelerometer Data and Observations

To facilitate the matching of signal and video records, a special procedure was followed to create a distinctive signature that clearly marked the start and the end of the experimental scope:
  • Before the sensor collar is installed, the operator swings the collar for 1 min, so that a unique oscillation pattern is produced by the accelerometer on the 3 axes.
  • When the experiment is finished and just after the collar is taken off from the animal, the operator swings again the collar for 1 min to reproduce the same unique pattern as in the starting point.
This pattern marking the start and the end of the experimental observation time cannot be reproduced naturally by cows while wearing the collar. Hence, this signature signal can be employed to fine tune the alignment between internal clocks in video cameras and the accelerometer clock.

2.6. Processing Accelerometer Data

The procedure for accelerometer raw data processing consists of different steps, which are depicted in Figure 5.
In the first step, time signals are divided in 10 s consecutive, non-overlapping time intervals or time windows. As a result, each interval contains 100 consecutive samples, since 10 samples per second are generated using a 10 Hz sampling rate. From now on, we refer to the time intervals obtained from this process as x i ( t ) , where i denotes the interval index. Figure 6a illustrates the result from this step, dividing the original signal (in this case, for the X-axis) in 4 different time windows, spanning adjacent intervals of 10 s. It must be remarked that, unlike many previous studies of this kind of data (see [21] for a comprehensive survey), we process the signals from each of the 3 accelerometer axes (X, Y, Z) separately. Previous studies analysing animal behaviour in wild habitats [28,29,30] suggest that this alternative data processing method can provide advantages for accurate detection of behavioural patterns, especially dynamic ones.
The second step in Figure 5 involves processing the time interval to obtain their AC (alternating current) component, along with its representation in the frequency domain, which are illustrated in Figure 6b. In this study, the AC component is extracted using a method that differs from several previous research works, where digital filters are applied to remove high-frequency noise and eliminate the DC component [31]. Hämäläinen et al. [9] show that problems may arise when the orientation of the sensor changes (e.g., due to sudden shakes) during data acquisition. Thus, they propose a simple alternative method to avoid these problems, calculating instead the “jerk” (acceleration change) between two consecutive samples. This approach renders orientation-independent features, avoiding the need to estimate the actual acceleration accurately.
As a result, the AC component, identified as x i A C ( t ) , is computed as the regular difference between two consecutive time windows. Finally, the frequency-domain representation of the AC component is calculated in the last stage of this pipeline, as the basis for subsequent spectral processing. To achieve this, we compute the Fast Fourier Transform (FFT) [32,33] of the AC component, using a 1-s window size, a Hanning window type [34] and 50% overlapping between consecutive time windows. Figure 7 summarizes the pipeline for processing the raw signal from the accelerometer in the time and frequency domains.
Calculating the FFT of the AC component renders a spectrogram in a frequency range from 0 Hz to 5 Hz (according to Shannon’s theorem), with a 1 Hz resolution. For this purpose, the Python SciPy signal processing toolbox (https://docs.scipy.org/doc/, accessed on 25 February 2022) is used. This will be denoted as the spectral component, identified as X i A C ( f ) . The complete spectral component comprises 6 individual frequency components, corresponding to each of the 1-Hz resolution bands. The panels in the lower part of Figure 6 represent the three elements calculated in this second step. The lower-left panel represents slice 2 from the original signal in the top panel. The AC component extracted from the original signal in time interval 2 is shown in the lower-centre panel. Finally, the time-domain representation of the spectral component for each frequency band is depicted in the lower-right panel.
The three elements obtained from the preprocessing step (time window, AC component and spectral component) are inputs for the extraction of different features, performed in the third step of Figure 5. Finally, these features are used for automated behaviour detection with ML algorithms. When the data inputs are the time window and the AC component, features obtained in this way correspond to the time domain. In turn, when the input is the spectral component, resulting features correspond to the spectral domain. Table 2 describes the list of features extracted from each data input. Details about their computation are explained below.

2.6.1. Time Domain Features

Table 2 shows the features obtained for each type of data input from accelerometer signals. Using the raw accelerometer axis (X, Y, Z) input, the following features are obtained (see first row in Table 2): mean, maximum, minimum, 5th percentile and 95th percentile. A total of 15 time features are extracted, 5 features per each accelerometer axis (X, Y, Z). Likewise, using the AC component representation in the time domain as a data input (see second row in Table 2) the mean, maximum, standard deviation (STD), skewness, kurtosis, 5th percentile and 95th percentile features are computed. A total of 21 features are extracted using this data source, that is, 7 features per each accelerometer axis.

2.6.2. Frequency Domain Features

The spectrogram represents how acceleration levels progress for each frequency and time instant. According to the processing parameters previously defined, the spectrogram of the AC component comprises 6 different frequency bands, at 0 Hz, 1 Hz, 2 Hz, 3 Hz, 4 Hz and 5 Hz. Since the spectrogram represents information in 3 dimensions simultaneously (time, frequency and amplitude), it cannot be used directly for feature extraction. To achieve this, the spectrogram is decomposed of frequency, obtaining 6 spectral series that progress along time. Figure 6b shows the resulting spectral series for a certain spectrogram.
Once these spectral series are computed for the AC component, they can be used for feature extraction. The third row of Table 2 presents the features that are extracted for each spectral series: root mean square (RMS) value, standard deviation (STD), minimum and maximum value. A total of 72 spectral features are obtained, that is, 4 features for 6 spectral series, resulting in 24 features per axis.

2.7. Processing GPS Data

Location records transferred by GPS sensors to the server are stored in CSV files. There is one file for each tracking collar attached to a cow. To start off, data in all CSV files are coalesced into a single file and records are ordered according to their timestamp value. Duplicate entries that might have been incorrectly recorded or transferred are also elided in this first step. After this, we must clean the dataset filtering incorrect location entries. This may be caused, for instance, due to inaccurate location detection by the sensor in areas of the farm where GPS coverage is insufficient. To attain this, the daily average values for latitude and longitude coordinates are calculated for each monitored farm. Then, any location registry further than 1 km from the average position is eliminated. This figure is well above the average value of the overall area of both livestock farms under analysis (about 50 hectares, in both cases), to filter out clear data registration errors. Once GPS data are completely prepared, the relevant attributes (id, timestamp, longitude and latitude) can be used.

2.8. Machine Learning Algorithms

Features extracted from accelerometer signals are used to train a supervised ML algorithm for behavioural pattern classification, whereas GPS location data is analysed through an unsupervised machine learning method, to detect anomalous activity patterns. Details on these analyses using machine learning models are provided below.

2.8.1. Behaviour Classification Based on Accelerometer Data

Classification of behavioural data from field experiments is performed using the random forests (RF) algorithm [35]. This tool has been selected due to the high number of descriptive features available and the capacity of RF to automatically identify important features to detect each individual behaviour.
The complete set of 238 behavioural samples, including the 108 features extracted from accelerometer signal processing, is split into 5 different folds, following a stratified random sampling approach [36]. Then, a multi-class RF classification algorithm is trained for every fold using 75% of data and the remaining 25% for testing. Video recordings are combined with these input data to produce a validation database. The target categories for the classification task are grazing, ruminating, laying and steady standing, while patterns included in category others are filtered out, since not enough samples for each individual behaviour in this group are available to identify them accurately. The hyperparameters selected for RF are the following: we use information gain (entropy) to measure the quality of splits; the minimum number of samples required to split an internal node is set to 20; we select using out-of-bag samples to estimate the generalization score and we build 100 trees for each forest. Then, the importance of each feature to identify individual activities is obtained in every trained model. Finally, all feature importance values per activity are averaged over the 5 folds to report the final results.

2.8.2. Automated Detection of Herd Scattering Using GPS

The main objective in our analysis of GPS location data is to automatically identify groups of monitored cows within the limits of the farm and sudden changes in the scattering of a given group. Rapid modifications in animal dispersion within a certain group may indicate the occurrence of anomalous events that must be reported to farm operators and managers.
In the first place, data for each livestock farm is identified and analysed separately. Given a location dataset describing the situation in a farm, a centre location for every group of animals must be identified. Then, the dispersion of animals around their corresponding group centre must be estimated and tracked, to account for abrupt alterations. We use the Euclidean distance ( L 2 norm) [37] to measure the separation between any two cows, and generate the distance matrix for all animals in the farm.
Identifying the groups and their representative location leads to an unsupervised learning task. Among the different alternative algorithms that can be applied, partitioning clustering algorithms [38,39] provide a convenient solution, as the total number of location points in each farm is not large. Although the k-means algorithm [37] is a popular solution for this kind of problems, we found that, in many cases, it does not provide representative locations for each group of animals in this application. The main cause behind this problem is the frequent presence of outliers in animal groups, that is, cows that are well-separated from the rest of members of the same cluster, thus pulling the location of the k-means centre for that group.
Due to this, a more robust clustering algorithm, insensitive to the presence of outliers in a cluster, must be employed. The k-medoids algorithm [38,39] forces the selection of one of the actual location points in a certain cluster to act as the centre for that group. We found that cluster identification following this approach is much more reliable and better matches extant information from farm workers and managers about the number and location of herds. The appropriate number of clusters for each farm is selected by calculating the within-clusters sum of squares (WCSS) for different values of k, evaluating the cohesion of clusters in each case. Then, a scree plot of WCSS against k is generated and we choose the value for k using the elbow method [37,40]. Alternatively, farm managers could override this choice of k by entering extant information about the estimated number of herds.
Once the number of herds and a reference location for each group are found, we turn to the problem of estimating the scattering of animals in a given group from their reference point. In this case, we opt for choosing the farthest animal assigned to the cluster as the delimiter of the maximum scattering range for that group, as shown in Figure 8. Since we use the Euclidean distance to measure proximity between cows, we effectively establish a circular region of radius r equal to the distance from the reference location in the group to the farthest member of that herd.
This procedure is periodically repeated for every new sample of locations sent by GPS sensors from the farm. For each new sample, the total number of groups, the reference location and the estimated value of r for each group are computed and stored.

3. Results

In this section, we summarize the results from the field experiments to identify animal behavioural patterns using the features extracted from accelerometer signals represented in the time domain and the frequency domain, and GPS location data.

3.1. Relevant Classification Features

Table 3 shows the rank and feature importance values [35,41] (mean accumulation of impurity decrease within each tree, known as Mean Decrease in Impurity or MDI), averaged from the five RF models trained with time domain and frequency domain features obtained from accelerometer signals. For the sake of conciseness, here we only report the top-five features identified for each activity. Graphs displaying the complete set of features for each activity and their associated importance values are presented in Appendix A.
We can spot several interesting traits regarding the most important features used by the RF algorithm to identify each behaviour. In the case of activity grazing, the most important features to detect this pattern are related to movement along the Z-axis. This is consistent with the observed movements, involving vertical necks displacements as the cow lows down its head to eat pasture and raise it up to continue chewing. Moreover, we also notice that two out of the top five features come from the frequency domain representation of the AC component. This confirms the usefulness of the spectral analysis of accelerometer signals for animal behaviour recognition. Another salient example of the key role of spectral components in activity detection is the case of steady standing. four out of the top five features come from the AC component processing in the frequency domain.

3.2. Classification Performance Metrics

Table 4 presents several performance metrics computed for the RF classification model, namely, accuracy, recall and AUC [42,43]. In general, classification accuracy attained by this algorithm was good for all behavioural patterns, with the highest score for grazing and the lowest for ruminating. However, recall metrics drop for activities with fewer samples in the dataset, such as laying or steady standing. Since we are developing a general detection procedure, that targets a variety of activities, the algorithm still presents limitations detecting all instances from under-represented categories, with fewer samples in the dataset.

4. Discussion

Previous research has shown the high interest of animal behaviour identification on farms [4,5,6]. Therefore, this work aims to propose a general procedure to recognize multiple activities based on accelerometer and GPS data. On top of this, previous studies has been restricted, so far, to the use of one of these two types of data sources for tracking animal behaviour, with only recent exceptions [16,18,44]. In this work, we explore the potential of combining data from both types of sensors to achieve a more advanced activity pattern identification.

4.1. Classification Model from Accelerometer Data

As described in Section 2.6, a separate analysis of accelerometer signals over each axis (X, Y, Z) along with the use of jerk filters and spectrograms to compute relevant features is proposed. Previous studies have shown [30] that the combination of this data processing method with classification trees ML algorithms (like the RF ensemble learning method applied in this work) can render good results for identification of animal behavioural patterns.
According to the feature importance metrics reported by the assessment of the RF classification model, shown in Table 3, time-domain features play an important role in the classification of certain behaviours such as laying or ruminating, where animals tend to remain relatively still. In our data processing method, this is linked to the absence of sudden shakes (“jerk” or “AC component” in this study), which turn the AC signal quite stable over time. In turn, frequency-domain features are also relevant for detection of dynamic behaviours such as grazing, or patterns with sudden activity peaks in any axis such as steady standing, better captured by our definition of AC component.
In this regard, it is of key importance that the internal clock used by the accelerometer marks precise regular intervals between samples. Otherwise, digital signal processing techniques to obtain the spectrogram of the AC component for different frequency bands will not be applicable, in case that sampling intervals present irregularities. However, results from this field study with commercial, low-cost equipment are limited by the accuracy of captured signals (that can be subject to sensor failures, battery drain due to climatic conditions and other adverse situations) and the ability to precisely correlate behaviours observed by human operators and registered on video recordings with the corresponding patterns captured by sensor devices. For example, as shown in Section 3.2, grazing was the most frequent activity pattern detected, which is in line with results from previous studies [16]. Possibly due to this high number of available samples identification of most frequent behaviours is more accurate than for other less represented patterns, according to performance metrics in Table 4.
On top of this, 9.1% of behaviours included in the study were labelled as other. However, detailed annotations were taken by operators regarding actions jointly accounted for in the omnibus other category. These include, among others, cows feeding younger calves, running cows or animals licking themselves. Some of these behaviours were correctly logged by human operators but not enough signal samples were obtained to generalize their detection to other cases. As a result, this study confirms that the proposed methodology could be generalized to other behavioural patterns, as soon as new data becomes available. An important implication in this sense is the absence of publicly available online reference datasets, registering data captured by sensors and their related activity patterns. Therefore, addressing this lack of validation databases could be a very useful contribution in further research works.

4.2. Potential of GPS Data for Activity Detection Based on Herd Scattering

Figure 9 presents the result of a preliminary algorithm for automated detection of herds and within-herd spread, based on GPS data, corresponding to the livestock farm in Avila. The red dots depict the location of animals tracked by the GPS sensors. The map shows two separate herds, represented by the algorithm via the identified k-medoids for each group (black point). Then, the algorithm calculates the scattering of animals around the cow selected as the representative centre for that group. The algorithm could also detect changes in the radii calculated for each herd, following a basic procedure based on change point detection [45].
As shown in previous research [27], accelerometer and GPS data can be combined to detect anomalous events, such as unbalanced use of pasture land or disease transmission, among others. Table 5 describe some potential cases in which both components could be combined to eventually provide farmers with the proper tool for an early detection.
In the case of predator attacks, cows are vigilant and in state of alert. This natural response to a feasible external threat translates into the detection of noticeable periods of time in which cows are not moving their heads (grazing and ruminating activities are stopped). Likewise, herds may move away to an alternative location quite rapidly to mitigate the detected risk [46,47].
As for the use of pasture land, accelerometer data obtained from monitored cows would inform about grazing activities. For its part, GPS data would provide clear indication of the areas on which such activity occurs. Despite not being an anomalous activity, this information may assist farmers to better manage resources and costs, or even reduce pasture land required which is considered as a top priority demand [16,48,49].
Finally, the lack of vertical or horizontal movements in cow necks, an abnormal stance and gait, an unusual resting behaviour or too slow (or even non-existent) displacements detected via GPS data could offer an complementary perspective to detect disease transmission, whose modelling process would also require health scoring for each monitored animal. Early disease detection could prevent severe cases and facilitate immediate application of treatment measures, reducing productivity loss [50,51].
This procedure is also compatible with the automated detection of the number of herds within the farm limits or with manual configuration of the number of herds to be tracked, introduced by human users. Additionally, the proposed method can also be integrated in existing tools for animal monitoring on farms. Operators can configure the appropriate parameters to raise notifications, based on their own management experience with animals. As additional data are tagged and become available, the tool can be linked to the detection of particular patterns of interest (predator attacks, parturition, etc.). Again, the absence of publicly available datasets that can serve as a benchmark for this type of automated tools in animal behaviour recognition calls for filling this gap in further research.
Tracking the evolution of these indicators over time, it would be possible to identify two types of interesting changes:
  • As herds move around the terrain, the reference animal representing that herd will register such displacement. Therefore, at the end of the day farm operators and managers can review the trajectory followed by different herds, leading to a more precise estimation of pasture consumption.
  • Changes in the scattering radius r calculated for each herd may indicate interesting behavioural patterns happening to that group of animals. In particular, a sudden increase in the value of r may indicate among other possibilities) the attack of potential predators or other threats.
Another interesting line for further research is exploring the formal combination of activity records from accelerometers and GPS, for instance, through information fusion techniques [44]. The validity of this approach has already been tested for the case of outlier detection. Moreover, the only previous work that combines GPS and accelerometer datasets [16] is tailored to detecting a single behaviour (grazing) and just employ the GPS coordinates to locate every behaviour interval. However, there is a clear potential in the simultaneous utilization of features extracted from both accelerometer and GPS location data analysis to improve the recognition of animal activity patterns on farms.

5. Conclusions

In this work, we present a new method for automated classification of animal behavioural patterns, through the analysis of activity data registered by a triaxial accelerometer and a GPS sensor. A unique aspect introduced in this approach is the application of techniques for spectral analysis of accelerometer signals in the frequency domain. Descriptive features derived from the spectrogram of these signals play an important role in detecting certain patterns of interest, such as grazing (the most frequent activity observed) or steady standing. Likewise, this method is not restricted to a particular behavioural pattern and it can be readily generalized to any behaviour of interest, provided that labelled activity data is available. Furthermore, the analysis of GPS data recording animals locations through unsupervised machine learning algorithms enables the detection of groups of animals and their dispersion, which can be regularly tracked and reported to users. Jointly, results from these two analyses can build a more complete picture of activity logs and facilitate decision-makers the necessary information to oversee pasture consumption, develop actions in response to anomalous events and improve animal welfare in their farms.

Author Contributions

Conceptualization, R.Y., B.V. and F.O.; methodology, J.C., R.Y., B.V. and F.O.; software, R.Y. and B.V.; validation, M.J.A., E.L.C. and F.O.; formal analysis, F.O.; investigation, J.C., R.Y., B.V. and F.O.; resources, J.N.-G. and F.O.; data curation, J.C., R.Y., B.V. and J.N.-G.; writing—original draft preparation, J.C. and F.O.; writing—review and editing, M.J.A. and E.L.C.; visualization, R.Y. and B.V.; supervision, F.O.; project administration, F.O.; funding acquisition, F.O. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by the Spanish Ministry of Agriculture, Fisheries and Food under project GELOB (ref. 20190020007471), the Spanish Ministry of Economy, Industry and Competitivity under project Advances in Risks Management for Security (ref. AEI/MTM2017-86875-C3-1-R) and the Spanish Ministry of Science and Innovation under grant MODAS-IN (ref. RTI2018-094269-B-I00).

Institutional Review Board Statement

Ethical review and approval were waived for this study by the Spanish Ministry of Agriculture, Fisheries and Food, under project GELOB (ref. 20190020007471).

Informed Consent Statement

Not applicable.

Acknowledgments

We thank Rubén Blanco, Diego Varona and Ignacio Gómez Maqueda from Digitanimal, for providing the sensors used in this study and facilitating access to servers in which GPS location data are stored.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ACAlternating Current
AUCArea Under the Curve
CSVComma Separated Values
DCDirect Current
FFTFast Fourier Transform
GPSGlobal Positioning System
IoTInternet of Things
MDIMean Decrease in Impurity
MEMSMicro Electro Mechanical System
MLMachine Learning
PCAPrincipal Components Analysis
RFRandom Forests
RMSRoot Mean Square
ROCReceiver Operating Characteristic
SDSecure Digital
STDStandard Deviation
WCSSWithin-Cluster Sum of Squares

Appendix A

Next, we provide several graphs presenting the importance values of each feature extracted from the analysis of signals captured by triaxial accelerometers, for identification of the main behavioural patterns considered in this study, as reported by the RF algorithm.
Figure A1. Feature importance in detection of grazing behaviour.
Figure A1. Feature importance in detection of grazing behaviour.
Entropy 24 00336 g0a1
Figure A2. Feature importance in detection of lying behaviour.
Figure A2. Feature importance in detection of lying behaviour.
Entropy 24 00336 g0a2
Figure A3. Feature importance in detection of ruminating behaviour.
Figure A3. Feature importance in detection of ruminating behaviour.
Entropy 24 00336 g0a3
Figure A4. Feature importance in detection of steady standing behaviour.
Figure A4. Feature importance in detection of steady standing behaviour.
Entropy 24 00336 g0a4

References

  1. Wolf, C.; Tonsor, G.; McKendree, M.; Thomson, D.; Swanson, J. Public and farmer perceptions of dairy cattle welfare in the United States. J. Dairy Sci. 2016, 99, 5892–5903. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. European Council. Directive (EC) 98/58/EC of the European Council of 20 July 1998, concerning the protection of animals kept for farming purposes. Off. J. L221 1998, 41, 23–27. Available online: http://data.europa.eu/eli/dir/1998/58/oj (accessed on 25 February 2022).
  3. European Commission. Commission Regulation (EC) No 889/2008 of 5 September 2008 laying down detailed rules for the implementation of Council Regulation (EC) No 834/2007, on organic production and labelling of organic products with regard to organic production, labelling and control. Off. J. L250 2008, 51, 1–84. Available online: http://data.europa.eu/eli/reg/2008/889/oj (accessed on 25 February 2022).
  4. Kwong, K.H.; Wu, T.T.; Goh, H.G.; Sasloglou, K.; Stephen, B.; Glover, I.; Shen, C.; Du, W.; Michie, C.; Andonovic, I. Practical considerations for wireless sensor networks in cattle monitoring applications. Comput. Electron. Agric. 2012, 81, 33–44. [Google Scholar] [CrossRef]
  5. Barriuso, A.L.; Villarrubia González, G.; De Paz, J.F.; Lozano, Á.; Bajo, J. Combination of Multi-Agent Systems and Wireless Sensor Networks for the Monitoring of Cattle. Sensors 2018, 18, 108. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  6. Michie, C.; Andonovic, I.; Davison, C.; Hamilton, A.; Tachtatzis, C.; Jonsson, N.; Duthie, C.A.; Bowen, J.; Gilroy, M. The Internet of Things enhancing animal welfare and farm operational efficiency. J. Dairy Res. 2020, 87, 20–27. [Google Scholar] [CrossRef]
  7. Lee, C.H.; Chen, S.H.; Jiang, B.C.; Sun, T.L. Estimating Postural Stability Using Improved Permutation Entropy via TUG Accelerometer Data for Community-Dwelling Elderly People. Entropy 2020, 22, 1097. [Google Scholar] [CrossRef] [PubMed]
  8. Mizell, D. Using gravity to estimate accelerometer orientation. In Proceedings of the Seventh IEEE International Symposium on Wearable Computers, White Plains, NY, USA, 21–23 October 2003; p. 252. [Google Scholar] [CrossRef]
  9. Hamäläinen, W.; Järvinen, M.; Martiskainen, P.; Mononen, J. Jerk-based feature extraction for robust activity recognition from acceleration data. In Proceedings of the 2011 11th International Conference on Intelligent Systems Design and Applications, Cordoba, Spain, 22–24 November 2011; pp. 831–836. [Google Scholar] [CrossRef]
  10. Robert, B.; White, B.; Renter, D.; Larson, R. Evaluation of three-dimensional accelerometers to monitor and classify behavior patterns in cattle. Comput. Electron. Agric. 2009, 67, 80–84. [Google Scholar] [CrossRef]
  11. Nielsen, L.R.; Pedersen, A.R.; Herskin, M.S.; Munksgaard, L. Quantifying walking and standing behaviour of dairy cows using a moving average based on output from an accelerometer. Appl. Anim. Behav. Sci. 2010, 127, 12–19. [Google Scholar] [CrossRef]
  12. Vázquez Diosdado, J.A.; Barker, Z.E.; Hodges, H.R.; Amory, J.R.; Croft, D.P.; Bell, N.J.; Codling, E.A. Classification of behaviour in housed dairy cows using an accelerometer-based activity monitoring system. Anim. Biotelemetry 2015, 3, 1–14. [Google Scholar] [CrossRef] [Green Version]
  13. Mattachini, G.; Riva, E.; Perazzolo, F.; Naldi, E.; Provolo, G. Monitoring feeding behaviour of dairy cows using accelerometers. J. Agric. Eng. 2016, 47, 54–58. [Google Scholar] [CrossRef] [Green Version]
  14. Shahriar, M.S.; Smith, D.; Rahman, A.; Freeman, M.; Hills, J.; Rawnsley, R.; Henry, D.; Bishop-Hurley, G. Detecting heat events in dairy cows using accelerometers and unsupervised learning. Comput. Electron. Agric. 2016, 128, 20–26. [Google Scholar] [CrossRef]
  15. Arablouei, R.; Currie, L.; Kusy, B.; Ingham, A.; Greenwood, P.L.; Bishop-Hurley, G. In-situ classification of cattle behavior using accelerometry data. Comput. Electron. Agric. 2021, 183, 106045. [Google Scholar] [CrossRef]
  16. Brennan, J.; Johnson, P.; Olson, K. Classifying season long livestock grazing behavior with the use of a low-cost GPS and accelerometer. Comput. Electron. Agric. 2021, 181, 105957. [Google Scholar] [CrossRef]
  17. Dutta, R.; Smith, D.; Rawnsley, R.; Bishop-Hurley, G.; Hills, J.; Timms, G.; Henry, D. Dynamic cattle behavioural classification using supervised ensemble classifiers. Comput. Electron. Agric. 2015, 111, 18–28. [Google Scholar] [CrossRef]
  18. Fogarty, E.S.; Swain, D.L.; Cronin, G.M.; Moraes, L.E.; Bailey, D.W.; Trotter, M. Developing a Simulated Online Model That Integrates GNSS, Accelerometer and Weather Data to Detect Parturition Events in Grazing Sheep: A Machine Learning Approach. Animals 2021, 11, 303. [Google Scholar] [CrossRef]
  19. Arcidiacono, C.; Porto, S.; Mancino, M.; Cascone, G. Development of a threshold-based classifier for real-time recognition of cow feeding and standing behavioural activities from accelerometer data. Comput. Electron. Agric. 2017, 134, 124–134. [Google Scholar] [CrossRef]
  20. Busch, P.; Ewald, H.; Stüpmann, F. Determination of standing-time of dairy cows using 3D-accelerometer data from collars. In Proceedings of the 2017 Eleventh International Conference on Sensing Technology (ICST), Sydney, NSW, Australia, 4–6 December 2017; pp. 1–4. [Google Scholar] [CrossRef]
  21. Riaboff, L.; Shalloo, L.; Smeaton, A.; Couvreur, S.; Madouasse, A.; Keane, M. Predicting livestock behaviour using accelerometers: A systematic review of processing techniques for ruminant behaviour prediction from raw accelerometer data. Comput. Electron. Agric. 2022, 192, 106610. [Google Scholar] [CrossRef]
  22. Smith, D.; Rahman, A.; Bishop-Hurley, G.J.; Hills, J.; Shahriar, S.; Henry, D.; Rawnsley, R. Behavior classification of cows fitted with motion collars: Decomposing multi-class classification into a set of binary problems. Comput. Electron. Agric. 2016, 131, 40–50. [Google Scholar] [CrossRef]
  23. Riaboff, L.; Poggi, S.; Madouasse, A.; Couvreur, S.; Aubin, S.; Bédère, N.; Goumand, E.; Chauvin, A.; Plantier, G. Development of a methodological framework for a robust prediction of the main behaviours of dairy cows using a combination of machine learning algorithms on accelerometer data. Comput. Electron. Agric. 2020, 169, 105179. [Google Scholar] [CrossRef]
  24. Kamminga, J.W.; Le, D.V.; Meijers, J.P.; Bisby, H.; Meratnia, N.; Havinga, P.J. Robust sensor-orientation-independent feature selection for animal activity recognition on collar tags. In Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies; ACM: New York, NY, USA, 2018; Volume 2, pp. 1–27. [Google Scholar] [CrossRef] [Green Version]
  25. Haladjian, J.; Haug, J.; Nüske, S.; Bruegge, B. A wearable sensor system for lameness detection in dairy cattle. Multimodal Technol. Interact. 2018, 2, 27. [Google Scholar] [CrossRef] [Green Version]
  26. Fogarty, E.; Swain, D.; Cronin, G.; Moraes, L.; Trotter, M. Can accelerometer ear tags identify behavioural changes in sheep associated with parturition? Anim. Reprod. Sci. 2020, 216, 106345. [Google Scholar] [CrossRef]
  27. Navarro, J.; Martín de Diego, I.; Carballo Pérez, P.; Ortega, F. Outlier detection in animal multivariate trajectories. Comput. Electron. Agric. 2021, 190, 106401. [Google Scholar] [CrossRef]
  28. Wilson, R.P.; White, C.R.; Quintana, F.; Halsey, L.G.; Liebsch, N.; Martin, G.R.; Butler, P.J. Moving towards acceleration for estimates of activity-specific metabolic rate in free-living animals: The case of the cormorant. J. Anim. Ecol. 2006, 75, 1081–1090. [Google Scholar] [CrossRef]
  29. Shepard, E.L.; Wilson, R.P.; Quintana, F.; Laich, A.G.; Liebsch, N.; Albareda, D.A.; Halsey, L.G.; Gleiss, A.; Morgan, D.T.; Myers, A.E.; et al. Identification of animal movement patterns using tri-axial accelerometry. Endanger. Species Res. 2008, 10, 47–60. [Google Scholar] [CrossRef] [Green Version]
  30. Lush, L.; Ellwood, S.; Markham, A.; Ward, A.; Wheeler, P. Use of tri-axial accelerometers to assess terrestrial mammal behaviour in the wild. J. Zool. 2016, 298, 257–265. [Google Scholar] [CrossRef]
  31. Riaboff, L.; Aubin, S.; Bédère, N.; Couvreur, S.; Madouasse, A.; Goumand, E.; Chauvin, A.; Plantier, G. Evaluation of pre-processing methods for the prediction of cattle behaviour from accelerometer data. Comput. Electron. Agric. 2019, 165, 104961. [Google Scholar] [CrossRef]
  32. Cooley, J.W.; Tukey, J.W. An Algorithm for the Machine Calculation of Complex Fourier Series. Math. Comput. 1965, 19, 297–301. [Google Scholar] [CrossRef]
  33. Cochran, W.; Cooley, J.; Favin, D.; Helms, H.; Kaenel, R.; Lang, W.; Maling, G.; Nelson, D.; Rader, C.; Welch, P. What is the fast Fourier transform? Proc. IEEE 1967, 55, 1664–1674. [Google Scholar] [CrossRef]
  34. Proakis, J.G.; Manolakis, D.G. Digital Signal Processing: Principles, Algorithms and Applications; Pearson: London, UK, 2006. [Google Scholar]
  35. Breiman, L. Random Forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef] [Green Version]
  36. Lohr, S.L. Sampling: Design and Analysis, 3rd ed.; Chapman and Hall/CRC: Boca Raton, FL, USA, 2021. [Google Scholar]
  37. Duda, R.O.; Hart, P.E.; Stork, D.G. Pattern Classification, 2nd ed.; John Wiley & Sons: Hoboken, NJ, USA, 2001. [Google Scholar]
  38. Hastie, T.; Tibshirani, R.; Friedman, J.H. The Elements of Statistical Learning: Data Mining, Inference, and Prediction, 2nd ed.; Springer Series in Statistics; Springer: New York, NY, USA, 2009. [Google Scholar] [CrossRef]
  39. Xu, R.; Wunsch, D. Clustering; IEEE Press Series on Computational, Intelligence; John Wiley & Sons: Hoboken, NJ, USA; IEEE Press: Hoboken, NJ, USA, 2009; Volume 10. [Google Scholar]
  40. Watt, J.; Borhani, R.; Katsaggelos, A.K. Machine Learning Refined: Foundations, Algorithms, and Applications, 2rd ed.; Cambridge University Press: Cambridge, UK, 2020. [Google Scholar] [CrossRef]
  41. Kroese, D.P.; Botev, Z.I.; Taimre, T.; Vaisman, R. Data Science and Machine Learning: Mathematical and Statistical Methods; Machine Learning & Pattern Recognition Series; Chapman & Hall/CRC Press: Boca Raton, FL, USA, 2019. [Google Scholar] [CrossRef]
  42. Fawcett, T. An introduction to ROC analysis. Pattern Recognit. Lett. 2006, 27, 861–874. [Google Scholar] [CrossRef]
  43. Flach, P.A. Machine Learning. The Art and Science of Algorithms that Make Sense of Data; Cambridge University Press: Cambridge, UK, 2012. [Google Scholar]
  44. Navarro, J.; Diego, I.M.d.; Fernández-Isabel, A.; Ortega, F. Fusion of GPS and Accelerometer Information for Anomalous Trajectories Detection. In Proceedings of the 2019 the 5th International Conference on E-Society, e-Learning and e-Technologies; Association for Computing Machinery, Vienna, Austria, 10–12 January 2019; ACM: New York, NY, USA, 2019; pp. 52–57. [Google Scholar] [CrossRef]
  45. Aminikhanghahi, S.; Cook, D.J. A survey of methods for time series change point detection. Knowl. Inf. Syst. 2017, 51, 339–367. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  46. Kluever, B.M.; Howery, L.D.; Breck, S.W.; Bergman, D.L. Predator and heterospecific stimuli alter behaviour in cattle. Behav. Process. 2009, 81, 85–91. [Google Scholar] [CrossRef] [PubMed]
  47. Kluever, B.M.; Breck, S.W.; Howery, L.D.; Krausman, P.R.; Bergman, D.L. Vigilance in cattle: The influence of predation, social interactions, and environmental factors. Rangel. Ecol. Manag. 2008, 61, 321–328. [Google Scholar] [CrossRef]
  48. Hancock, J. Studies of grazing behaviour in relation to grassland management I. Variations in grazing habits of dairy cattle. J. Agric. Sci. 1954, 44, 420–433. [Google Scholar] [CrossRef]
  49. Charlton, G.L.; Rutter, S.M. The behaviour of housed dairy cattle with and without pasture access: A review. Appl. Anim. Behav. Sci. 2017, 192, 2–9. [Google Scholar] [CrossRef]
  50. Phillips, C. Cattle Behaviour and Welfare; John Wiley & Sons: Hoboken, NJ, USA, 2008. [Google Scholar]
  51. de Freslon, I.; Martínez-López, B.; Belkhiria, J.; Strappini, A.; Monti, G. Use of social network analysis to improve the understanding of social behaviour in dairy cattle and its impact on disease transmission. Appl. Anim. Behav. Sci. 2019, 213, 47–54. [Google Scholar] [CrossRef]
Figure 1. Monitoring device with 3-D accelerometer and GPS sensors. Coordinate axes represent movement directions tracked by the accelerometer.
Figure 1. Monitoring device with 3-D accelerometer and GPS sensors. Coordinate axes represent movement directions tracked by the accelerometer.
Entropy 24 00336 g001
Figure 2. A Fleckvieh breed cow wearing the monitoring device, attached with a neckband.
Figure 2. A Fleckvieh breed cow wearing the monitoring device, attached with a neckband.
Entropy 24 00336 g002
Figure 3. Raw signals recorded by the 3-D accelerometer for each coordinate axis.
Figure 3. Raw signals recorded by the 3-D accelerometer for each coordinate axis.
Entropy 24 00336 g003
Figure 4. Proportion of observed behaviours of cows on the field, annotated by scientists.
Figure 4. Proportion of observed behaviours of cows on the field, annotated by scientists.
Entropy 24 00336 g004
Figure 5. Overview of the proposed procedure for accelerometer data processing.
Figure 5. Overview of the proposed procedure for accelerometer data processing.
Entropy 24 00336 g005
Figure 6. Time windows extracted from original signal generated by the accelerometer and their corresponding components. (a) Raw time signal divided in 4 windows. (b) Time-domain signal and components extracted from Window 2 in Figure 6a.
Figure 6. Time windows extracted from original signal generated by the accelerometer and their corresponding components. (a) Raw time signal divided in 4 windows. (b) Time-domain signal and components extracted from Window 2 in Figure 6a.
Entropy 24 00336 g006
Figure 7. Pipeline performed within the accelerometer signal processing stage.
Figure 7. Pipeline performed within the accelerometer signal processing stage.
Entropy 24 00336 g007
Figure 8. Detection of the scattering limits for a herd. The farthest animal assigned to that group determines the scattering radius r.
Figure 8. Detection of the scattering limits for a herd. The farthest animal assigned to that group determines the scattering radius r.
Entropy 24 00336 g008
Figure 9. Example of automated detection of location and scattering of two different herds in one of the farms, near Ávila (Spain).
Figure 9. Example of automated detection of location and scattering of two different herds in one of the farms, near Ávila (Spain).
Entropy 24 00336 g009
Table 1. Behavioural ethogram describing frequent activities observed by operators in the experiment, ordered by total duration of recorded video evidence.
Table 1. Behavioural ethogram describing frequent activities observed by operators in the experiment, ordered by total duration of recorded video evidence.
BehaviourCodeTotal Durat. (sec.)Description
GrazingGRA12,056Regularly lowering and raising its head to eat pasture, while standing or walking slowly
RuminatingRUM4429Ruminating previously eaten food, while standing or laying
LayingLAY1940Laying on the ground without performing any other relevant activity
Steady standingSTA1011Standing almost still without performing any other relevant activity
WalkingOTH#WALK509Walking at normal pace with calm steps
LickingOTH#LICK414Noticeably turning its neck to lick itself
ScratchingOTH#SCRA159Raising one leg to scratch its head or body (also specified if scratching against a tree)
RunningOTH#RUN94Moving at high pace with quick steps
DrinkingOTH#DRI93Lowering its head to drink water
Calf nursingOTH#NUR30Steady while nursing a calf
Table 2. Features extracted from each input generated after preprocessing the accelerometer signal.
Table 2. Features extracted from each input generated after preprocessing the accelerometer signal.
Data InputFeatureDescription
Raw accelerometer axis (X,Y,Z)MeanAverage value of signal
MaxMaximum value of signal
MinMinimum value of signal
Q55th percentile of signal values
Q9595th percentile of signal values
AC component (time domain) x i A C ( t ) MeanAverage value
STDStandard deviation of values distribution
KurtosisKurtosis of values distribution
SkewnessSkewness of values distribution
MaxMaximum value
Q55th percentile of values
Q9595th percentile of values
AC component (freq. domain) x i A C ( f ) RMSRoot mean square spectral density
STDStandard deviation spectral density
MinMinimum value spectral density
MaxMaximum value spectral density
Table 3. Identified animal behaviours, top-5 features used by trained RF models to classify them and their importance (MDI), averaged over the 5 RF models.
Table 3. Identified animal behaviours, top-5 features used by trained RF models to classify them and their importance (MDI), averaged over the 5 RF models.
BehaviourRankFeatureAvg. MDI
Grazing1Z_AC_Q50.06798
2Z_AC_STD0.06274
3Z_2Hz_RMS0.06189
4Z_AC_Q950.06115
5Z_1Hz_RMS0.06007
Laying1Y_Q950.06129
2Z_AC_Q50.05319
3Y_MAX0.04246
4Y_AC_Q950.03975
5Y_MEAN0.03601
Ruminating1Z_AC_Q50.06787
2Z_AC_Q950.04863
3X_Q50.04849
4Z_AC_STD0.03537
5Y_Q_950.03486
Steady standing1X_1Hz_MIN0.06075
2X_5Hz_MIN0.04870
3X_3Hz_MIN0.04429
4X_2Hz_MIN0.04194
5X_AC_KURT0.04022
Table 4. Performance metrics for the RF classification model. All metrics are average values over the 5 folds.
Table 4. Performance metrics for the RF classification model. All metrics are average values over the 5 folds.
BehaviourAccuracyRecallAUC
Grazing0.930.9450.974
Laying0.9070.6110.894
Ruminating0.8810.8930.967
Steady standing0.9220.580.912
Table 5. Examples of anomalous/interesting activities and how analysis of accelerometer and GPS data can be applied to detect them.
Table 5. Examples of anomalous/interesting activities and how analysis of accelerometer and GPS data can be applied to detect them.
Activity of InterestAccelerometer DataGPS Data
Predator attacksVertical axis with no movementQuick displacement to alternative location; possible successive relocations
Pasture land useDetection of grazing behaviourMapping of areas under use (presence longer than a certain time threshold)
Disease transmissionDetection of steady-standing or laying behavioursErratic movements; very slow transitions to alternative areas
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Cabezas, J.; Yubero, R.; Visitación, B.; Navarro-García, J.; Algar , M.J.; Cano, E.L.; Ortega, F. Analysis of Accelerometer and GPS Data for Cattle Behaviour Identification and Anomalous Events Detection. Entropy 2022, 24, 336. https://doi.org/10.3390/e24030336

AMA Style

Cabezas J, Yubero R, Visitación B, Navarro-García J, Algar  MJ, Cano EL, Ortega F. Analysis of Accelerometer and GPS Data for Cattle Behaviour Identification and Anomalous Events Detection. Entropy. 2022; 24(3):336. https://doi.org/10.3390/e24030336

Chicago/Turabian Style

Cabezas, Javier, Roberto Yubero, Beatriz Visitación, Jorge Navarro-García, María Jesús Algar , Emilio L. Cano, and Felipe Ortega. 2022. "Analysis of Accelerometer and GPS Data for Cattle Behaviour Identification and Anomalous Events Detection" Entropy 24, no. 3: 336. https://doi.org/10.3390/e24030336

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop