Register      Login
Animal Production Science Animal Production Science Society
Food, fibre and pharmaceuticals from animals
RESEARCH ARTICLE (Open Access)

Determination of ewe behaviour around lambing time and prediction of parturition 7 days prior to lambing by tri-axial accelerometer sensors in an extensive farming system

Rajneet Sohi https://orcid.org/0000-0003-0773-0826 A * , Fazel Almasi https://orcid.org/0000-0002-1997-1208 A , Hien Nguyen B , Alexandra Carroll A , Jason Trompf C , Maneka Weerasinghe D , Aidin Bervan D , Boris I. Godoy E , Awais Ahmed A , Michael J. Stear https://orcid.org/0000-0001-5054-1348 A , Aniruddha Desai D and Markandeya Jois https://orcid.org/0000-0002-0636-066X A
+ Author Affiliations
- Author Affiliations

A School of Life Sciences, La Trobe University, Bundoora, Vic. 3086, Australia.

B School of Mathematics and Physics, University of Queensland, St. Lucia, Qld 4072, Australia.

C Northgate Park, Glenrowan, Wangaratta, Vic. 3675, Australia.

D Centre for Technology Infusion, La Trobe University, Bundoora, Vic. 3086, Australia.

E Department of Mechanical Engineering, Boston University, Boston, MA 02215, USA.

* Correspondence to: r.sohi@latrobe.edu.au

Handling Editor: Dana Campbell

Animal Production Science 62(17) 1729-1738 https://doi.org/10.1071/AN21460
Submitted: 7 September 2021  Accepted: 6 June 2022   Published: 8 July 2022

© 2022 The Author(s) (or their employer(s)). Published by CSIRO Publishing. This is an open access article distributed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY-NC-ND)

Abstract

Context: Lamb loss and dyctocia are two major challenges in extensive farming systems. While visual observation can be impractical due to the large sizes of paddocks, number of animals and high labour cost, wearable sensors can be used to monitor the behaviour of ewes as there might be changes in their activities prior to lambing. This provides sufficient time for the farm manager to nurse those ewes that are at risk of dyctocia.

Aim: The objective of this study was to determine whether the behaviour of a pregnant ewe could predict the time of parturition.

Methods: Two separate trials were conducted: the first trial (T1), with 32 ewes, included human/video observations, and the second trial (T2), with 165 ewes, conducted with no humans present, to emulate real extensive farming settings. The ewes were fitted with tri-axial accelerometer sensors by means of halters. Three-dimensional movement data were collected for a period of at least 7 and 14 days in T1 and T2 respectively. The sensor units were retrieved, and their data downloaded using ActiGraph software. Ewe behaviour was determined through support vector machine learning (SVM) algorithm, including licking, grazing, rumination, walking, and idling. The behaviours of ewes predicted by analysis of sensor data were compared with behaviours determined using visual observation (video recordings), with time synchronisation to validate the results. Deep learning and neural-network algorithms were used to predict lambing time.

Key results: The concordance percentages between visual observation and sensor data were 90 ± 11, 81 ± 15, 95 ± 10, 96 ± 6, and 93 ± 8% ± s.d. for grazing, licking, rumination, idling, and walking respectively. The deep-learning model predicted the time of lambing with 90% confidence via a quantile regression method, which can be interpereted as 90% prediction intervals, and shows that the time of lambing can be predicted with reasonable confidence approximately 240 h before the actual lambing events.

Conclusion: It was possible to predict the time of parturition up to 10 days before lambing.

Implications: The behaviour of ewes around lambing time has a direct effect on the survival of the lambs and therefore plays an important part in animal management. This knowledge could improve the productivity of sheep and considerably decrease lamb mortality rates.

Keywords: accelerometer sensors, extensive farming, lamb survival, lambing time, machine learning, parturition, quantile regression, sheep behaviour.

Introduction

Monitoring livestock under extensive farming systems and, in particular, observing the behaviour of individual animals can be challenging. Sensor technology can provide valuable information on animal health, behaviour and welfare without the need for visual observations (Alvarenga et al. 2016; Barwick et al. 2018; Walton et al. 2018; Barwick et al. 2020). Monitoring behaviour of ruminants can be a reliable tool for predicting lameness (Borghart et al. 2021), detecting oestrus (Kamphuis et al. 2012; O’Neill et al. 2014), identifying the mother (Sohi et al. 2017), evaluating gastrointestinal nematode infection (Ikurior et al. 2020), predicting lambing time (Fogarty et al. 2020a, 2020b; Smith et al. 2020; Gurule et al. 2021) and predicting calving time (Borchers et al. 2017). Therefore, the wearable sensors can be used to facilitate management of farms as well as increase their profitability.

Dystocia is one of the major diseases of sheep in Australia and it costs the sheep industry more than AUD780 million every year (Bruce et al. 2021). Dystocia can be reduced by genetic improvement but the heritability of dystocia is low; therefore, it takes a long time to improve dystocia by selective breeding (Jacobson et al. 2020). While dystocia causes loss of lambs, up to 80% of neonatal mortality occurs in the first few days after lambing as a consequence of starvation, exposure, mismothering and predation (Hinch and Brien 2014). Predicting the lambing time could allow farmers to provide supplementary care to ewe prior to lambing and nurse the newborn lamb. Previously, the global navigation satellite system (GNSS) was used to detect lambing the day of lambing; however, detecting the hour of lambing was determined to be impossible (Fogarty et al. 2020a). In another study, HR Tag was placed on the left side of the neck to collect neck activity and rumination, and IceQube sensor was attached to the left rear leg to collect number of steps, total motion, number of transition from standing to lying of dairy cattle (Borchers et al. 2017). The time of calving was predicted by the following three different methods: random forest, linear discriminant analysis and neural network. The neural network was the best method for predicting calving time, with 82.8% sensitivity and 80.4% specificity 8 h before calving. In another study, Fogarty et al. (2020b) used ear-tag accelerometers on 27 ewes to record the changes in their behaviour around lambing time. They developed three machine-learning algorithms for each ethogram, namely, linear kernel support vector machine (SVM) for grazing, lying, standing and walking behaviours, with 76.9% accuracy; classification tree for active and inactive behaviour, with 98.1% accuracy; and linear discriminant analysis for upright and prostrate behaviours, with 90.6% accuracy. There was a decrease in grazing, lying and active behaviour prior to lambing and a peak in standing and walking on the day of parturition. Therefore, monitoring different behaviours can predict lambing or calving time; however, complex machine-learning techniques are required for accurate predictions.

There are two approaches to develop a classifier, namely, parametric and non-parametric. If the classifier is non-parametric then neural network (Abe 1997), fuzzy system (Bezdek et al. 1999) and SVM techniques (Abe 2010) can be applied. SVM is a powerful tool used in supervised learning, which has been widely applied in classification and regression problems (Byun and Lee 2003; Yang 2004). SVM classifiers have been applied to a range of real-world applications such as particle identification, text categorisation, facial recognition, and bioinformatics. The key idea is to find optimal separating hyperplanes between observations that have differing labels. This separation is found by obtaining the maximum margin between the training examples that are closest to the hyperplane, with slackness allowing for some misclassifications (Abe 2010). The SVM technique has been used to predict the behaviours of cows, with 78% precision (Martiskainen et al. 2009). While the SVM technique can be used to classify behaviours, other machine-learning techniques, such as deep learning, could also be used for the prediction of calving time (Borchers et al. 2017). Thus, the first aim of this study was to classify five behaviours of ewes, including grazing, rumination, idiling, walking and licking before lambing, through the SVM technique. The second aim was to develop a non-linear neural network model to accurately predict the lambing time.


Materials and methods

Animal management

Two trials were conducted at a commercial farm at Northgate Park, Greta, Vic., Australia. The first trial in 2015 focused on the behaviours of ewes 6 days before the estimated time of lambing, until a day after lambing. First-cross Merino ewes (Merino × Border Leicester and East Friesian, n = 32) were kept in a 9-ha paddock with fairly uniform pastures consisting of predominantly perennial ryegrass and clover with 5% phalaris and 5% other annual grasses. All 32 ewes were fitted with sensors for the study.

The second trial focused on the analysis of sensor data in 2018, to predict the lambing date. Ewes were ultrasound-scanned for pregnancy by a commercial operator 45 days after the 35-day mating period. Pregnant ewes were fitted with sensors 15 days before the estimated time of lambing. The sensors were retrieved at the end of the lambing period. In total, 165 first-cross Merino ewes (Merino × Border Leicester and East Friesian) were kept in a 9-ha paddock with fairly uniform pastures consisting of predominantly perennial ryegrass and clover, with 5% phalaris and 5% other annual grasses.

All of the procedures and experimental protocols were in accordance with the Australian Code of Practice for the Care and Use of Animals for Scientific Purposes (National Health and Medical Research Council 2013) and were approved by the La Trobe University Animal Ethics Committee (AEC approval no. AEC15-09, approval date 4 May 2015).

Sensors

Commercially available tri-axial accelerometer sensors were used for both trials (ActiGraph wGT3X-BT; ActiGraph, LLC, Pensacola, FL, USA). The dimensions were 4.6 cm × 3.3 cm × 1.5 cm. The weight of each sensor was 19 g, and each had four Gb of memory. The devices communicated by Bluetooth technology, and each possessed a micro-electro-mechanical system (MEMS)-based accelerometer and an ambient light sensor.

The sensors recorded the following data: horizontal axis activity acceleration data (Axis X), vertical axis activity acceleration data (Axis Y), and perpendicular axis activity acceleration data (Axis Z).

The sensor outputs were sampled by a 12-bit analog digital converter, with a range between 30 and 100 Hertz (Hz). An increased frequency shortens the battery life; in the current study, the sensors were set at 30 Hz (30 samples per s) as the sampling rate. Once the sensors were attached to the animals, they stored data in the form of raw, non-filtered units of gravity (G). The data were stored on a non-volatile flash drive within the device before downloading.

The sensors were fitted onto a halter 22 mm wide with an adjustable noseband from 25 to 35 cm in length and a head-strap circumference adjustable from 43 to 58 cm, weighing 272 g (The Farmers Mailbox, Whittlesea, Vic. 3757, Australia). For consistency, the sensors were placed on the left side of the face, with the opening facing forward (Fig. 1). Then sensors were attached to the animals 1 day prior to the start of the experiment and were intialised to start recording at 00:00:00 on the day of study.


Fig. 1.  Attachment of the sensor to a halter placed onto a sheep.
Click to zoom

Visual observation and recordings of each behaviour

In the first trial, ewes and lambs were marked (SI-RO-MARK™ Marking Fluid,©Heiniger animal care, Birba Lake, WA, Australia) on both sides of their back to allow visual observations during video recording. Each number was matched with the animal RFID and sensor. An EID reader (Shearwell Australia Company) was used to scan and record the unique RFID tag number assigned to each animal. The animals were released back into the paddock after the sensors were attached. A minimum of 20 m distance was maintained to ensure the observer had minimal impact on ewe behaviour. Sudden movements were avoided to allow the animals to become accustomed to the presence of humans. The visual observations were made by two people to ensure accuracy. Behaviours observed included licking, rumination, grazing, walking and idling, thus any other activities or behaviours were considered as ‘other’. The movement of each ewe was monitored and video recordings were made using a Nikon Cool Pix P600 digital camera (Nikon Australia Pty Ltd). The camera was equipped with atomic server time to track the exact time and date of the observations. The video recordings were performed on 13 separate days for 2–3 h each day; however, not all of the recordings were useable, due to malfunctioning and battery depletion of the sensors. After editing, there was a total of 5 h 30 min of video recording used for the validation of the algorithms.

Determining time of lambing

Visual observations of lambing were used in the first trial to confirm that continuous licking for several hours, starting immediately after lambing, is an accurate indicator of lambing. Several hours of continuous licking was evident only on the day of lambing. Thus, the time of lambing was determined in the second experiment on the basis of the licking signature.

Interpretation of sensor data

After the sensors were removed, the data were downloaded through the ActiLife software (ver. 6.11) and converted to CSV format. Each CSV file was then converted to MAT and read in MATLAB (ver. R2019b).

Two procedures were used to interpret the sensor data, namely, SVM, and a deep learning/neural network approach. For our data, SVM was a good classifier as data were non-linear and thus kernel space embeddings were appropriate. SVM classifications were based on a calculated 5 s epoch. The key idea in this technique is to find an optimal separating curve (usually called a hyperplane) between two regions of similarly labelled data in some kernel space. For instance, to separate 2-day valued regions with the identity kernel transformation, the ‘hyperplane’ would separate the two regions with a line. The above-mentioned separation by hyperplane is found by obtaining the maximum margin between the training examples that are closest to the hyperplane, with some slackness allowing for potential misclassifications. Thus, in nature, SVM is a binary classifier (Knerr et al. 1990; Vapnik 1998). A hyperplane is built to separate the kernel-transformed observations, while trying to maximise the distance of such observations to the separating hyperplane. The hyperplane was thus defined by what is called ‘support vectors’, which could be found by solving a constrained optimisation problem. Although SVM is a binary classifier, multiclass classifiers can also be implemented with some modification of the basic technique (Arun Kumar and Gopal 2011). Different techniques can be used to deal with a multiclass problem in SVM and many of these techniques involve reducing a multiclass problem to multiple binary problems. Some of these techniques include the one-against-all, all-pairs, error-correcting output codes (ECOC) methods. We have implemented the first technique known as one-against-all to create a binary problem for each class against all of the other classes (see the Supplementary material for details).

The SVM evaluated a number of features to determine which of them were the most useful in discriminating between the models. The list of features considered were mean, standard deviation, kurtosis, power signal, peak-to-peak amplitude, autocorrelation, principal components (obtained via a principal component analysis, PCA), and outputs from a spectral analysis (Table 1). Autocorrelation measured the correlation between yt and yt+k, where k = 0, …, K and yt is a stochastic process. The sample autocorrelation is AN21460_IE1.gif, where AN21460_IE2.gif and C0 is the sample variance of the time series (Box et al. 2008). PCA was used to reduce the dimensionality of the dataset, as well as increase interpretability, while minimising information loss, simultaneously (Jolliffe and Cadima 2016). Spectral analysis converts 5 s of motion data (the acceleration) from the time-domain into the primary frequency components in the form of magnitude and frequency. So as to train the classifier, the data were split into a 63% dataset, for training, and a 37% dataset, for validation of the SVM algorithm.


Table 1.  The calculated equations of features. ‘N’ and ‘n’, window size; ‘A’, array of data; ‘i’, index of data in the ‘A’.
T1

A new variable was also created, which was the magnitude of the three axes (x, y and z) combined. Features were extracted from the four-dimensional space. The 1-week blocks of data were further processed via computation of the mean, standard deviation, median, interquartile range and least-squares slope of each of the measured variables to create a set of features from which to predict the time until lambing. In total, 30 predictor variables were generated.

For the deep-learning approach, time series data from 165 ewes were preprocessed. The preprocessing included eliminating ewes that had missing data or corrupted files, so that only ewes with complete records were used in the analysis. This resulted in observations from 121 ewes. Each time series was then segmented into contiguous blocks of 24 × 7 h, where the numbers of minutes spent grazing, idling, licking, walking and ruminating were calculated for each hour and the vector magnitude of the maximum vector magnitude accelerometer measurement within that hour. The number of hours from the latest recorded hour of the block until the first recorded time of licking post-lambing (the time of lambing) was used as the response variable.

Then, a five-layer (three hidden layers) feedforward neural network was trained using the 30 variables as inputs to predict the time until lambing. The network used an architecture of 128 × 64 × 64 rectified linear unit (ReLU) activation functions (Hahnloser and Seung 2001), trained to minimise the mean sum-of-square error loss. Optimisation was conducted using the Nesterov-accelerated adaptive moment estimation (Nadam) algorithm (Dozat 2016). The entire process was conducted using Keras for the R programming environment (Chollet and Allaire 2018).

In order to quantify the accuracy of the predictions from the neural network with respect to the true time until lambing, a simultaneous quantile regression approach was employed, where multiple quantile regressions were conducted simultaneously to infer empirical confidence intervals of the prediction accuracy, conditional on the neural network predictions. The quantile regression was conducted in R using the QuantifQuantile package (Charlier et al. 2015a), which implemented the method of Charlier et al. (2015b).

Statistical analysis

Behavioural data were analysed with SAS University edition (SAS Institute, Cary, NC, USA) and IBM SPSS Statistics 23 software (IBM Corp., Armonk, NY, USA). The observed behaviour was compared with the predicted behaviour from the sensors for the same time using data that were not used to develop the algorithms for the analysis of sensor data. Although the sensors produced 30 records every second, the data were combined into windows of 5 s. The total time compared was 20 015 s. The mean and s.d. were calculated from 1133, 575, 253, 921, 1121 datapoints (5 s interval) for grazing, idling, licking, rumination and walking respectively. Lameness, running and walking were grouped into one category, labelled walking. The accuracy was calculated as the proportion of time periods classified identically by visual observation and by the algorithms used to analyse the sensor data.

A repeated measures model was used to analyse the influence of the time and ewe variables on each of the six behaviours (idling, grazing, ruminating, licking, walking and other). Data were aggregated into hours for the analysis and into days for Fig. 2. The Glimmix procedure in SAS was used with a normal distribution and an autoregressive covariance structure of order 1. The Kenward–Roger (Kenward and Roger 1997) procedure was used to adjust the degrees of freedom. Only 16 of the 32 animals from the initial trial had complete data from the week before to the day after lambing. The analysis included the fixed effect of days from lambing (−6, −5, −4, −3, −2, −1, 0, 1 days) and the random effect of ewes.


Fig. 2.  The number of minutes a day that ewes spent idling, grazing, ruminating, licking, walking, and in other behaviours around the time of lambing. The error bars represent standard error.
Click to zoom

The second analysis used the same 16 animals and examined behaviour in relation to hour of lambing (−12 h pre-lambing to +12 h post-lambing). The dependent variable was minutes per hour spent idling, grazing, ruminating, licking, walking or in other behaviours. The Glimmix procedure in SAS was used with a normal distribution and an autoregressive covariance structure of order 1. The Kenward–Roger procedure was used to adjust the degrees of freedom. The analysis included the fixed effect of days from lambing (−6, −5, −4, −3, −2, −1, 0, 1 days) and the random effect of ewes. Significance was declared if P < 0.05 in both repeated-measures models.


Results

Table 2 presents the concordance percentage between observed and predicted activity. Data are expressed as means (±s.d.). Standard deviation measures the precision of the estimate and indicates the variation among animals in the concordance percentage. The percentage of time that the sensor data agreed with the visual observations ranged from 90% to 96% for grazing, ruminating, idling and walking, but for licking it was only 81%.


Table 2.  Concordance between visual and predicted behaviours.
Click to zoom

Fig. 2 shows the average number of minutes each day that ewes spent idling, grazing, ruminating, licking, and walking from 6 days prior to lambing to 1 day afterwards. All measures of behaviours varied significantly among individual ewes and days. Idling time varied from over 8 h to just under 11 h per day and there were significant differences among ewes and among days. The number of minutes spent idling were in the range of 497–651 min from Days −6 to 1.

The time spent ruminating, 6 days before to 1 day after lambing varied between approximately 5.5 and 7.5 h a day and there were differences among days and ewes. The least-squares mean rumination times on Days −6 to 1 were in the range of 177–260 min. There was a more than 30% reduction in rumination on the day of lambing compared with the peak 2 days before lambing. The least-squares mean grazing times on Days −6 to 1 were in the range of 334–459 min. Ewes spent the least amount of time grazing on Day −1 (the day before lambing). The pattern of rumination was similar to the grazing pattern, peaking 2 days before lambing and recovering on the day after lambing. The time spent grazing 6 days before to 1 day after lambing varied from just under 3 h to nearly 4.5 h a day and there were differences among days and ewes. Rumination time was lowest on the day of lambing (177 ± 18 min/day).

The mean time spent licking on each day varied from just under 3 h to nearly 5.5 h. In contrast to grazing and rumination, the time spent licking was significantly higher on the day of lambing. The mean licking times on Days −6 to 1 were in the range of 128–329 min. There was a more than 250% increase in licking on the day of lambing compared with the minimum 1 day before lambing.

On average, the ewes walked approximately 1 h each day and there were differences among ewes and among days. The mean amounts of time spent walking on Days −6 to 1 were in the range of 48–66 min.

The examination of behaviours in the hours before lambing showed that there were differences among hours in the time spent idling, but no significant differences among ewes. Idling time was stable at about 30 min per hour until lambing, when there was a sharp drop in the time spent idle (Fig. 3a). A gradual recovery occurred after 4 h post-lambing to 21 ± 4 min per hour 12 h after lambing.


Fig. 3.  The time (min/h) that ewes showed each of the following behaviours: (a) grazing, (b) rumination, (c) licking, (d) walking, (e) idling, (f) other. Values are expressed as means ± s.e. *Indicates a significant difference compared with 12 h prior to lambing (P < 0.05).
Click to zoom

Grazing activity of ewes started to drop from 12 h prior to lambing until the hour before lambing (Fig. 3b). Grazing activity then recovered until 12 h after lambing. There were significant differences among hours but not among ewes.

There was a gradual decline in rumination 8 h before lambing to 4 h post-lambing (Fig. 3c). Subsequently, time spent ruminating gradually recovered. There were significant differences among hours but not among ewes.

Time spent licking showed the opposite pattern to time spent ruminating. There were significant differences among hours but not among ewes. Licking activity peaked 4 h after lambing (Fig. 3d), then fell back sharply. Licking activity showed wide variation from 4 min at 7 h before lambing, to 41 min 4 h after lambing.

Walking increased gradually from 2 ± 1 min per hour to 6 ± 1 min per hour, then rapidly plummeted to 1–2 min per hour. There were significant differences among hours but not among ewes.

Predictions from the deep-learning model were generated, and quantile regression results regarding the accuracy of the predictions are plotted in Fig. 4. The quantile regression levels indicate the proportion of values that lie below the lines. The 50% level represents the median value and 5% of values lie below the 5% level. Consequently, the 5% and 95% levels correspond to a 90% confidence level, which can be interpreted as a 90% prediction interval. That is, if the deep learning model predicts a certain time until lambing, then the interval interpreted at the predicted time until lambing contains the true time until lambing 90% of the time.


Fig. 4.  A seven-level simultaneous quantile regression between the predicted time until lambing as obtained via a fitted feedforward neural network (abscissa) and the true time until lambing (ordinate). The colours indicated by the legend correspond to the quantile level of each regression line. Grey data display pairs of predicted and time until birth predictions. The 0.05 level corresponds to the lowest of the lines, whereas the 0.95 level corresponds to the higher of the lines. All of the other levels are ordered accordingly by their numerical values, in-between.
Click to zoom

Fig. 5 displays the 90% prediction intervals obtained from the quantile regressions for each level of predicted time until lambing. The figure shows that the width of the 90% intervals declines as the time to lambing decreases, but remains stable approximately 240 h before lambing. In this period, the widths of the intervals lie between 15 and 20 h. This indicates that the day of lambing can be predicted with reasonable confidence up to 10 days before lambing using sensor information.


Fig. 5.  Displays the 90% prediction intervals obtained from the quantile regressions for each level of predicted time until lambing. In this period, the widths of the intervals lie between 15 and 20 h. This indicates that the day of lambing can be predicted with reasonable confidence up to 10 days before lambing using sensor information.
Click to zoom


Discussion

In this study, sensors were used to examine the behaviour of ewes around parturition. There was a strong relationship between the behaviours predicted by the analysis of sensor data and the behaviours observed in the field. The behaviours varied around the time of lambing, with a decrease in the time spent grazing and ruminating, but an increase in the time spent licking.

Sensor data from the second experiment were then analysed to determine whether changes in behaviour before lambing could be used to predict the time of lambing. For predictions to be useful, they need to be accurate and precise. The accuracy of the predictions was shown by using quantile regression to plot the predicted time of lambing against the actual time of lambing. There were no biases in the predictions, indicating that they were accurate. The precision of the predictions was examined by plotting the 90% prediction intervals determined from quantile regression of predicted time of lambing time against actual time of lambing. These intervals concentrated and stabilised as lambing time approached 10 days before lambing, with widths of about 15–20 h. These estimates were sufficiently precise to be useful predictors. Allowing for time to download and analyse data, the sensors provide data for the prediction of lambing time 1 week in advance.

Fogarty et al. (2020b) monitored the behaviour changes around lambing time using accelerometer sensor data from 27 ewes. They used machine-learning techniques, including SVM, classification trees, and linear discriminant analysis, so as to classify the accelerometer data into three orthogonal sets of behavioural classifications: grazing, lying, standing and walking; active and inactive; upright and prostrate. Using a linear mixed-effects model, the authors established that there were statistically significant relationships between each of the grazing, standing and walking behaviours and time around lambing, at both the daily and hourly temporal resolutions. In the current study, time was treated as a categorical covariate within the regression model, with inter-temporal correlation accounted for via autoregressive covariance structures. Significant relationships were also established between the activity status and posture of the ewes, in a similar manner.

In another study, Fogarty et al. (2020a) combined accelerometer data with GNSS positioning data so as to explore the relationships among spatial variables, such as animal movement speed, distances between animals, and paddock area covered by animals, in relation to the time around birthing, at both the daily and hourly resolutions. A linear mixed-effects model was also used in this scenario, with time treated in the same way as in Fogarty et al. (2020b), and significant relationships were found across the assessed responses. In both studies of Fogarty et al. (2020a, 2020b), statistical models were constructed using time around birthing as the covariate and sensor data as responses. Although they allow for inference regarding the potential relationships between time and sensor data, these modelling configurations unfortunately do not permit the prediction of time of birthing, since the modelled causal relationship treats time as an predictor variable, and the categorical treatment of time does not allow extrapolation between inference regarding one time period and the next.

Smith et al. (2020) showed that time of parturition can be predicted through the changes in activity by computing the distance between distribution of activity across a time period (maximum activity change relative to the baseline) and a corresponding distribution of baseline activity. They found that the algorithms were sufficient to predict the birth time of the majority (84%) of lambs within 12 h of actual birth time, while the predicted and observed times of parturition had an average mean absolute error of 5.33 h. Similar to Fogarty et al. (2020b), we also established relationships between accelerometer-based behaviours and time around lambing. We then extend on these inferential results by constructing a predictive model that treats time until lambing as a response, and which uses machine learning-detected accelerometer-based activities as predictors. This prediction model is constructed with the expressed purpose of providing time of birth predictions, and additional quantile regression determined the statistical confidence. The relationships between spatial behaviours and birthing time, as studied in Fogarty et al. (2020a), may allow for the construction of more accurate prediction algorithms in the future. In contrast, Gurule et al. (2021) did not detect any differences in seven predicted behaviours including feeding, laying, licking lamb, licking salt, contractions, standing, and walking before and after lambing. They implemented random-forest machine-learning technique and proposed that a direct metric calculation from the axis (e.g. x-axis) provides a better indication of lambing than does omplex machine-learning algorithm. Therefore, the implemented machine-learning method in the current study provided with 90% confidence of lambing prediction time is more accurate. This has a major contribution to avoid lamb loss and dyctocia in extensive farming systems.

The current study had some limitations such as loss of sensors from ewes and malfunctioning of the sensors. However, predicting lambing date means that sensors must be attached to ewes when the lambing date is unknown. A proportion of sensors will record behaviours too early or too late to usefully predict the lambing date. Future study with a larger sample size with advanced sensors with extended battery life will enable more refined training algorithms, which can help identify further traits and behaviours with higher precision improved preduction capability.

In conclusion, accelerometer sensors can be used to accurately measure the behaviours of ewes around the time of lambing. The amount of time spent in each behaviour changed as lambing approached. These changes in behaviour can be used to predict the time of lambing. The predictions were shown to be both accurate and sufficiently precise to provide useful advance notice up to 10 days before lambing. Allowing for time to download and analyse data, the sensors could be used to provide advance warning of lambing 1 week beforehand.


Supplementary material

Supplementary material is available online.


Data availability

The data that support this study will be shared upon reasonable request to the corresponding author.


Conflicts of interest

The authors declare that they have no known competing financial interest or personal relationships that could have appeared to influence the work reported in this paper. Markandeya Jois is an Associate Editor of Animal Production Science but was blinded from the peer-review process for this paper.


Declaration of funding

This research did not receive any specific funding.



Acknowledgements

The following staff are acknowledged for data collection: Penny Trompf (JT Agri source, Vic.), Mithlesh Meena (CTI, Vic.), Deniz Heydarian (La Trobe University, Vic.).


References

Abe S (1997) ‘Neural networks and fuzzy systems: theory and applications.’ (Springer US: Imprint: Springer: Boston, MA, USA)

Abe S (2010) ‘Support vector machines for pattern classification.’ Advances in computer vision and pattern recognition. (Springer London: London, UK)
| Crossref |

Alvarenga FAP, Borges I, Palkovič L, Rodina J, Oddy VH, Dobos RC (2016) Using a three-axis accelerometer to identify and classify sheep behaviour at pasture. Applied Animal Behaviour Science 181, 91–99.
Using a three-axis accelerometer to identify and classify sheep behaviour at pasture.Crossref | GoogleScholarGoogle Scholar |

Arun Kumar M, Gopal M (2011) Reduced one-against-all method for multiclass SVM classification. Expert Systems with Applications 38, 14238–14248.
Reduced one-against-all method for multiclass SVM classification.Crossref | GoogleScholarGoogle Scholar |

Barwick J, Lamb DW, Dobos R, Welch M, Trotter M (2018) Categorising sheep activity using a tri-axial accelerometer. Computers and Electronics in Agriculture 145, 289–297.
Categorising sheep activity using a tri-axial accelerometer.Crossref | GoogleScholarGoogle Scholar |

Barwick J, Lamb DW, Dobos R, Welch M, Schneider D, Trotter M (2020) Identifying sheep activity from tri-axial acceleration signals using a moving window classification model. Remote Sensing 12, 646
Identifying sheep activity from tri-axial acceleration signals using a moving window classification model.Crossref | GoogleScholarGoogle Scholar |

Bezdek JC, Keller J, Krisnapuram R, Pal NR (1999) ‘Fuzzy models and algorithms for pattern recognition and image processing.’ Handbooks of fuzzy sets series. (Kluwer Academic Publ.: Boston, MA, USA)

Borchers MR, Chang YM, Proudfoot KL, Wadsworth BA, Stone AE, Bewley JM (2017) Machine-learning-based calving prediction from activity, lying, and ruminating behaviors in dairy cattle. Journal of Dairy Science 100, 5664–5674.
Machine-learning-based calving prediction from activity, lying, and ruminating behaviors in dairy cattle.Crossref | GoogleScholarGoogle Scholar | 28501398PubMed |

Borghart GM, O’Grady LE, Somers JR (2021) Prediction of lameness using automatically recorded activity, behavior and production data in post-parturient Irish dairy cows. Irish Veterinary Journal 74, 4
Prediction of lameness using automatically recorded activity, behavior and production data in post-parturient Irish dairy cows.Crossref | GoogleScholarGoogle Scholar | 33549140PubMed |

Box GEP, Jenkins GM, Reinsel GC (2008) ‘Time series analysis: forecasting and control.’ 4th edn. Wiley series in probability and statistics. (John Wiley: Hoboken, NJ, USA)

Bruce M, Young JM, Masters DG, Refshauge G, Thompson AN, Kenyon PR, Behrendt R, Lockwood A, Miller DW, Jacobson C (2021) The impact of lamb and ewe mortality associated with dystocia on Australian and New Zealand sheep farms: a systematic review, meta-analysis and bio-economic model. Preventive Veterinary Medicine 196, 105478
The impact of lamb and ewe mortality associated with dystocia on Australian and New Zealand sheep farms: a systematic review, meta-analysis and bio-economic model.Crossref | GoogleScholarGoogle Scholar | 34487918PubMed |

Byun H, Lee S-W (2003) A survey on pattern recognition applications of support vector machines. International Journal of Pattern Recognition and Artificial Intelligence 17, 459–486.
A survey on pattern recognition applications of support vector machines.Crossref | GoogleScholarGoogle Scholar |

Charlier I, Paindaveine D, Saracco J (2015a) Quantifquantile: an R package for performing quantile regression through optimal quantization. The R Journal 7, 65–80.
Quantifquantile: an R package for performing quantile regression through optimal quantization.Crossref | GoogleScholarGoogle Scholar |

Charlier I, Paindaveine D, Saracco J (2015b) Conditional quantile estimation through optimal quantization. Journal of Statistical Planning and Inference 156, 14–30.
Conditional quantile estimation through optimal quantization.Crossref | GoogleScholarGoogle Scholar |

Chollet F, Allaire JJ (2018) Deep learning with R.

Dozat T (2016) Incorporating Nesterov Momentum into Adam.

Fogarty ES, Swain DL, Cronin GM, Moraes LE, Bailey DW, Trotter MG (2020a) Potential for autonomous detection of lambing using global navigation satellite system technology. Animal Production Science 60, 1217–1226.
Potential for autonomous detection of lambing using global navigation satellite system technology.Crossref | GoogleScholarGoogle Scholar |

Fogarty ES, Swain DL, Cronin GM, Moraes LE, Trotter M (2020b) Can accelerometer ear tags identify behavioural changes in sheep associated with parturition? Animal Reproduction Science 216, 106345
Can accelerometer ear tags identify behavioural changes in sheep associated with parturition?Crossref | GoogleScholarGoogle Scholar | 32414471PubMed |

Gurule SC, Tobin CT, Bailey DW, Hernandez Gifford JA (2021) Evaluation of the tri-axial accelerometer to identify and predict parturition-related activities of Debouillet ewes in an intensive setting. Applied Animal Behaviour Science 237, 105296
Evaluation of the tri-axial accelerometer to identify and predict parturition-related activities of Debouillet ewes in an intensive setting.Crossref | GoogleScholarGoogle Scholar |

Hahnloser RHR, Seung HS (2001) Permitted and forbidden sets in symmetric threshold-linear networks. In ‘Advances in Neural Information Processing Systems 13 - Proceedings of the 2000 Conference, NIPS 2000 (Advances in Neural Information Processing Systems)’. (Neural Information Processing Systems Foundation)

Hinch GN, Brien F (2014) Lamb survival in Australian flocks: a review. Animal Production Science 54, 656–666.
Lamb survival in Australian flocks: a review.Crossref | GoogleScholarGoogle Scholar |

Ikurior SJ, Pomroy WE, Scott I, Corner-Thomas R, Marquetoux N, Leu ST (2020) Gastrointestinal nematode infection affects overall activity in young sheep monitored with tri-axial accelerometers. Veterinary Parasitology 283, 109188
Gastrointestinal nematode infection affects overall activity in young sheep monitored with tri-axial accelerometers.Crossref | GoogleScholarGoogle Scholar | 32693323PubMed |

Jacobson C, Bruce M, Kenyon PR, Lockwood A, Miller D, Refshauge G, Masters DG (2020) A review of dystocia in sheep. Small Ruminant Research 192, 106209
A review of dystocia in sheep.Crossref | GoogleScholarGoogle Scholar |

Jolliffe IT, Cadima J (2016) Principal component analysis: a review and recent developments. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences 374, 20150202
Principal component analysis: a review and recent developments.Crossref | GoogleScholarGoogle Scholar |

Kamphuis C, DelaRue B, Burke CR, Jago J (2012) Field evaluation of 2 collar-mounted activity meters for detecting cows in estrus on a large pasture-grazed dairy farm. Journal of Dairy Science 95, 3045–3056.
Field evaluation of 2 collar-mounted activity meters for detecting cows in estrus on a large pasture-grazed dairy farm.Crossref | GoogleScholarGoogle Scholar | 22612940PubMed |

Kenward MG, Roger JH (1997) Small sample inference for fixed effects from restricted maximum likelihood. Biometrics 53, 983–997.
Small sample inference for fixed effects from restricted maximum likelihood.Crossref | GoogleScholarGoogle Scholar | 9333350PubMed |

Knerr S, Personnaz L, Dreyfus G (1990) Single-layer learning revisited: a stepwise procedure for building and training a neural network. In ‘Neurocomputing’. (Eds FF Soulié, J Hérault) pp. 41–50. (Springer: Cham, Switzerland)
| Crossref |

Martiskainen P, Järvinen M, Skön J-P, Tiirikainen J, Kolehmainen M, Mononen J (2009) Cow behaviour pattern recognition using a three-dimensional accelerometer and support vector machines. Applied Animal Behaviour Science 119, 32–38.
Cow behaviour pattern recognition using a three-dimensional accelerometer and support vector machines.Crossref | GoogleScholarGoogle Scholar |

National Health and Medical Research Council (2013) ‘Australian code for the care and use of animals for scientific purposes.’ 8th edn. (National Health and Medical Research Council: Canberra)

O’Neill CJ, Bishop-Hurley GJ, Williams PJ, Reid DJ, Swain DL (2014) Using UHF proximity loggers to quantify male–female interactions: a scoping study of estrous activity in cattle. Animal Reproduction Science 151, 1–8.
Using UHF proximity loggers to quantify male–female interactions: a scoping study of estrous activity in cattle.Crossref | GoogleScholarGoogle Scholar | 25449547PubMed |

Smith D, McNally J, Little B, Ingham A, Schmoelzl S (2020) Automatic detection of parturition in pregnant ewes using a three-axis accelerometer. Computers and Electronics in Agriculture 173, 105392
Automatic detection of parturition in pregnant ewes using a three-axis accelerometer.Crossref | GoogleScholarGoogle Scholar |

Sohi R, Trompf J, Marriott H, Bervan A, Godoy BI, Weerasinghe M, Desai A, Jois M (2017) Determination of maternal pedigree and ewe–lamb spatial relationships by application of bluetooth technology in extensive farming systems. Journal of Animal Science 95, 5145–5150.
Determination of maternal pedigree and ewe–lamb spatial relationships by application of bluetooth technology in extensive farming systems.Crossref | GoogleScholarGoogle Scholar | 29293717PubMed |

Vapnik VN (1998) ‘Statistical learning theory, adaptive and learning systems for signal processing, communications, and control.’ (Wiley: New York, NY, USA)

Walton E, Casey C, Mitsch J, Vázquez-Diosdado JA, Yan J, Dottorini T, Ellis KA, Winterlich A, Kaler J (2018) Evaluation of sampling frequency, window size and sensor position for classification of sheep behaviour. Royal Society Open Science 5, 171442
Evaluation of sampling frequency, window size and sensor position for classification of sheep behaviour.Crossref | GoogleScholarGoogle Scholar | 29515862PubMed |

Yang ZR (2004) Biological applications of support vector machines. Briefings in Bioinformatics 5, 328–338.
Biological applications of support vector machines.Crossref | GoogleScholarGoogle Scholar | 15606969PubMed |