Abstract
Background
Animal-borne data loggers today often house several sensors recording simultaneously at high frequency. This offers opportunities to gain fine-scale insights into behaviour from individual-sensor as well as integrated multi-sensor data. In the context of behaviour recognition, even though accelerometers have been used extensively, magnetometers have recently been shown to detect specific behaviours that accelerometers miss. The prevalent constraint of limited training data necessitates the importance of identifying behaviours with high robustness to data from new individuals, and may require fusing data from both these sensors. However, no study yet has developed an end-to-end approach to recognise common animal behaviours such as foraging, locomotion, and resting from magnetometer data in a common classification framework capable of accommodating and comparing data from both sensors.
Methods
We address this by first leveraging magnetometers’ similarity to accelerometers to develop biomechanical descriptors of movement: we use the static component given by sensor tilt with respect to Earth’s local magnetic field to estimate posture, and the dynamic component given by change in sensor tilt with time to characterise movement intensity and periodicity. We use these descriptors within an existing hybrid scheme that combines biomechanics and machine learning to recognise behaviour. We showcase the utility of our method on triaxial magnetometer data collected on ten wild Kalahari meerkats (Suricata suricatta), with annotated video recordings of each individual serving as groundtruth. Finally, we compare our results with accelerometer-based behaviour recognition.
Results
The overall recognition accuracy of > 94% obtained with magnetometer data was found to be comparable to that achieved using accelerometer data. Interestingly, higher robustness to inter-individual variability in dynamic behaviour was achieved with the magnetometer, while the accelerometer was better at estimating posture.
Conclusions
Magnetometers were found to accurately identify common behaviours, and were particularly robust to dynamic behaviour recognition. The use of biomechanical considerations to summarise magnetometer data makes the hybrid scheme capable of accommodating data from either or both sensors within the same framework according to each sensor’s strengths. This provides future studies with a method to assess the added benefit of using magnetometers for behaviour recognition.
Electronic supplementary material
The online version of this article (10.1186/s40462-019-0172-6) contains supplementary material, which is available to authorized users.
Keywords: Magnetometer, Behaviour recognition, Biomechanics, Machine learning, Angular velocity, Earth’s magnetic field, Accelerometer, Meerkats
Background
Behaviour is a central component of any animal’s life and the result of important biotic and abiotic interactions. Its accurate description is therefore crucial for a full appreciation of an animal’s biology. Small, light-weight animal-borne data loggers have proved to be indispensable as they bypass the logistical difficulties of directly observing animals and enable data to be collected on an animal as it goes about its daily life in its natural environment [1]. Data loggers today can often house several sensors (e.g. [2, 3]), each measuring different physical quantities such as acceleration, magnetic field intensity, angular velocity, light level, and depth. Simultaneously recorded high-frequency multi-sensor data offer the opportunity to gain fine-scale insights into behaviour by leveraging information not only from individual data streams, but also by fusing data from multiple sensors.
In the context of animal behaviour recognition, triaxial accelerometers [4] and magnetometers [5] have both been used to identify movement patterns in animals. Though accelerometers have by far been used more extensively (e.g. [6–10]), it has recently been shown that magnetometers can better resolve certain low-acceleration behaviours of biological importance, e.g. thermal soaring in Andean condors (Vultur gryphus) [11]. In fact, a recent comparison of accelerometers and magnetometers has demonstrated that there can be quantifiably large differences in recognition capability between the two sensors for certain specific behaviours [5]. Future behaviour recognition algorithms may thus seek to leverage the complementarity of these two sensors by fusing data from both sensors within a single classification framework. However, it is not known how recognition capability differs between the two sensors for the case of common animal behaviours such as foraging, locomotion, and resting.
One of the reasons for the success of accelerometers in recognising animal behaviour may be their ability to measure both static tilt with respect to Earth’s gravity vector as well as dynamic acceleration resulting from animal motion. Despite the numerous advantages of the accelerometer, however, the sensor has some inherent limitations that may render it unsuitable for use in certain situations. Firstly, during dynamic movements, the accelerometer is sensitive to both body segment tilt and dynamic acceleration due to motion. Dynamic acceleration interferes with the change of tilt, and the two cannot be separated. In extreme cases, such as when an animal is ‘pulling g’ [5] or in freefall, the accelerometer cannot be used to measure tilt because the total measured acceleration approaches zero. Secondly, for the same activity, signal magnitudes vary greatly depending upon sensor location on the body [12]. This may be problematic for fine-scale estimation of behavioural parameters. For instance, in human accelerometer-based pedometer applications, the accuracy of step counting changes if the pedometer is attached to any location other than the waist [13]. Thirdly, accelerometers may not be well-suited to detection and characterisation of dynamic behaviours involving slow, especially rotation-based, movement [11].
Magnetometers bear surprising similarities to accelerometers: they can measure a static component through inclination with respect to Earth’s magnetic field as well as a dynamic component corresponding to changes in sensor inclination over time. The static component has been used extensively to obtain animal heading and perform dead-reckoning (e.g. [14–16]). The resulting movement paths have been used to, for instance, quantify differences between straight-line and tortuous-path travel to infer underlying behaviour [17, 18], and understand animals’ sense of orientation [19]. The dynamic component of the magnetometer has been used to extract metrics describing angular velocity for human wearable sensing applications [20, 21]. In spite of these similarities, magnetometers are not prone to the problems highlighted above for accelerometers. Firstly, the magnetometer directly measures sensor tilt. The dynamic component is not mixed with the static component of the signal, and may be obtained by differentiating the signal with respect to time [20]. Note, however, that when the axis of rotation happens to align exactly with the local magnetic field line – an unlikely scenario over extended time – the dynamic component will be zero [5]. The equivalent operation for the accelerometer (i.e. integration with respect to time) does not directly provide velocity because of the need to resolve the constant of integration through knowledge of initial or final velocity from a different source. Secondly, since it is likely that a wild animal’s natural habitat will be far from man-made sources of magnetic field disturbances, the signal magnitude will be the same regardless of activity type or sensor location on the body. Note, however, that the presence of magnetic field disturbances might preclude comparison of signal-derived metrics between different locations. Thirdly, magnetometers have been shown to be capable of resolving behaviours that are not easily discerned using accelerometers, such as thermal soaring in Himalayan griffon vultures (Gyps himalayensis) [5]. Despite the magnetometer’s potential for behaviour telemetry, there is a lack of an end-to-end method for identifying common animal behaviours from magnetometer data.
Here, we demonstrate that biomechanically relevant features describing posture, movement intensity, and periodicity can be derived from static and dynamic components of recorded magnetometer data. These can be combined with an existing framework (based on acceleration data, [10]) that combines biomechanics and machine learning to assign accelerometer signals into behavioural categories. We showcase the application of these principles for data collected on wild meerkats (Suricata suricatta), a social foraging, < 1 kg carnivore inhabiting the Kalahari and Namib deserts of Southern Africa [22], where the classification of their main activities such as vigilance, foraging, resting, and running, is essential for characterising their individual and social behaviour. We provide a comparison of magnetometer-based behaviour recognition performance with the accelerometer-based one, discuss the strengths and weaknesses of the magnetometer as a standalone sensor for behaviour recognition, and discuss possibilities for fusing data from both sensors to achieve more accurate and robust behaviour recognition.
Methods
Deriving biomechanical descriptors of movement using magnetometer data
In a recent study on behaviour recognition using accelerometers [10], posture, movement intensity, and periodicity were used as biomechanical descriptors of static and dynamic behaviours.
Behaviour separation using posture estimated from magnetometer data can be achieved when a given axis of the sensor aligns in two opposite directions along the vertical axis for the two static behaviours to be separated (Fig.1). [10] used the accelerometer’s surge axis, which corresponds to the same direction as that of the magnetometer’s roll axis in the present study, for quantifying posture since values along this axis were least susceptible to changes caused by possible rotations of the collar around the axis of the meerkat’s cylindrical neck. Let be the local magnetic field vector with dip angle δ at the sensor location. During meerkat vigilance (Fig. 1a), in an idealised case, the roll axis would point directly upwards, perpendicular to the horizontal plane (the latter shown as a salmon-pink disk), and the sensor’s roll axis would measure . During curled-up resting (Fig. 1b), on the other hand, the roll axis would point downwards, perpendicular to the horizontal plane, and the sensor’s roll axis would measure . We hypothesised that this polarity (positive and negative value of ) would enable discrimination of the two static behaviours, vigilance and curled-up resting. When the roll axis lies in the horizontal plane (Fig. 1c), however, the measurement along the roll axis of the projection of onto the horizontal plane, , would be affected by the azimuthal orientation of the animal (angle α between the direction faced with respect to magnetic North in the horizontal plane), and the measured value would now be . Since values of α may vary arbitrarily between 0° and 360°, the roll axis would record measurements in the range of [, ] when it lies in the horizontal plane. Thus, static behaviours such as belly-flat resting as well as dynamic behaviours such as foraging and running may be difficult to separate only on the basis of posture, since the sensor’s roll axis can be oriented arbitrarily with respect to the North direction.
In carrying out dynamic activities such as running, the collar sensor would follow in the wake of movements made by the torso and neck as the animal heaves and sways, and rotate around the animal’s neck. Thus, the magnetometer’s axes would continuously change orientation with respect to the local magnetic field lines. The more intense the bodily movement is, the faster the sensor would change orientation with respect to the local field lines. For instance, large oscillations in triaxial magnetometer signals recorded during cheetah (Acinonyx jubatus) running behaviour have previously been reported [2]. If this motion is periodic, the change in sensor orientation will also be periodic. Thus, the magnitude of change in recorded signal values could be used as an indicator for the intensity of movement, and help distinguish between static and dynamic behaviours. Further, the periodicity of the rate of change in recorded signal values could be used to distinguish between the dynamic behaviours: for meerkats, running has been shown to be highly periodic, and foraging to be relatively aperiodic [10]. Measures of both intensity and periodicity may be characterised either by computing the amount of variation in the recorded signal itself, through measures such as standard deviation, or by computing the amount of variation in the time-differentiated signal.
Data collection and groundtruthing
Data from eleven recording sessions of three hours each were collected on ten adult meerkats at the Kalahari Meerkat Project, as described in [10]; one of the individuals was recorded twice. The individuals bore collars equipped with an inertial measurement unit (IMU) (adapted version of Physilog IV, GaitUp SA, Switzerland) containing a triaxial accelerometer (recording at 100 Hz/axis) and triaxial magnetometer [23], the latter recording at a sampling frequency of 50 Hz/axis with a range of ±1000 μT and 16-bit resolution. The size of the collar case (IMU and battery) was 35 mm × 29 mm × 19 mm, and overall weight was < 25 g. The total geomagnetic field intensity at the study site was 27.3 μT, with a declination angle of 17.9° pointing westwards and a dip (or inclination) angle of 65° pointing upwards, according to the International Geomagnetic Reference Field ([24]; values calculated from https://www.ngdc.noaa.gov/geomag/calculators/magcalc.shtml#igrfwmm). Collars were positioned on the animals so that the axes of the magnetometer were oriented as shown in Fig. 2. The magnetometer was calibrated prior to each recording session according to the method by [25]. The software used to read magnetometer data resampled the data to 100 Hz/axis using linear interpolation (with the 'interp1' function in MATLAB R2016b) to match the sampling frequency of the accelerometer also present on board the recording device.
After the captured animal was collared and released, it was filmed using a handheld video camera recording at 25 frames/second that was synchronised with the collar sensor (see Appendix S1, Additional file 1 for more details). All videos were annotated using Solomon Coder (version: beta 17.03.22). This video annotation served as the groundtruthing data for our behaviour recognition scheme. Archetypal behaviours observed across a wide range of species [10] – foraging, running, and resting – were considered for the ethogram. In addition, we also considered vigilance, a behaviour typical for meerkats, where the individual is stationary and lifts its head and torso to survey its surroundings. Biologically significant information may be derived from these four behaviours [10]: (1) general stress or alertness level through vigilance, (2) periods of inactivity, mainly due to fatigue or excessive heat, through resting (3) proxies for body condition through foraging, and (4) high energy expenditure and possible important events such as aggressive interactions with rival groups through running. Any behaviour dependent upon contextual information, such as territory marking or dyadic social interactions, was excluded from the ethogram.
Developing candidate features to quantify biomechanical descriptors of movement
Raw triaxial magnetic field intensity data were calibrated and summarised in the form of features quantifying posture, movement intensity, and periodicity. Feature development followed from previous work done with accelerometers [10]. We computed features on a sliding window w of size two seconds with an overlap of 50% between successive windows. Windows containing data from exactly one video-labelled behaviour were retained, and those containing transitions between different behaviours were excluded. For each biomechanical descriptor, the candidate features (Table 1) were computed on each two-second window w containing N = 200 calibrated triaxial magnetic field intensity values recorded along the roll (mroll), pitch (mpitch), and yaw (myaw) axes.
Table 1.
S.No. | Biomechanical descriptor |
Feature name | Feature description | Computation | |
---|---|---|---|---|---|
1. | Posture | meanRoll | Mean of data from roll axis | (1) | |
2. | Intensity | stdRoll | Standard deviation of data from roll axis | std(mroll, w) | (2) |
3. | meanAbsDiffRoll | Mean of absolute values of time-differentiated roll data | (3) | ||
4. | axMaxMeanAbsDiff | Maximum, across axes, of mean of absolute values of time-differentiated data from each axis | (4) | ||
5. | avgMeanAbsDiff | Mean, across axes, of mean of absolute values of time-differentiated data from each axis | (5) | ||
6. | Periodicity | rollFftPeakPower |
Maximum squared coefficient of Fourier transform of data from roll axis |
(6) | |
7. | avgFftPeakPower | Mean, across axes, of maximum squared coefficient of Fourier transform of data from each axis | (7) | ||
8. | rollDiffFftPeakPower | Maximum squared coefficient of Fourier transform of time-differentiated roll data | (8) | ||
9. | avgDiffFftPeakPower | Mean, across axes, of maximum squared coefficient of Fourier transform of time-differentiated data from each axis | (9) |
Features were computed on each two-second window w containing N = 200 calibrated triaxial magnetic field intensity values recorded along the roll (mroll), pitch (mpitch), and yaw (myaw) axes. Equation numbers are indicated on the right
Posture
We obtained a measure of neck inclination with respect to the local magnetic field vector by computing the mean of calibrated magnetic field intensity data recorded in each window w along the roll axis (meanRoll, equation (1), Table 1).
Intensity
We developed four candidate features (#2 to #5, Table 1) to quantify movement intensity: one (stdRollw, equation (2), Table 1) was aimed at characterising the extent to which mroll varied in window w, whereas the three others aimed to quantify the rate of change of sensor orientation through metrics based on the time-differentiated signal (meanAbsDiffRollw, equation (3); axMaxMeanAbsDiffw, equation (4); avgMeanAbsDiffw, equation (5), Table 1). Since the differentiation operation results in amplification of sensor- and analog-to-digital signal quantization-generated noise at higher frequencies [26], the raw calibrated magnetometer signal was first low-pass filtered using a Butterworth filter of order 4 and cut-off frequency 10 Hz. MATLAB’s (version R2016b) 'diff' function was used to compute differences between successive signal samples, and each resulting difference was multiplied by the sampling frequency (since, in d/dt, dt = 1/sampling frequency for discrete signals) to complete the time differentiation operation. To quantify the amount of rate of change in features computed from the time-differentiated signal (features #3, #4, #5 in Table 1), we took the absolute values of each differentiated sample and then computed the mean.
Periodicity
We quantified movement periodicity through the use of the Fourier transform (FT). As done in [10], for each window w, before computation of the FT, each input signal was filtered with a Butterworth low-pass filter of order 4 and cut-off frequency 10 Hz, normalised, zero-padded to smooth the frequency spectrum [27] by adding 100 zeroes before and after each two-second input signal, and windowed using the Blackman-Harris windowing function. This processed signal was then transformed with a frequency resolution of U = 0.01 Hz (corresponding to FT computation at L = Fs/U = 10,000 frequencies), and the squared magnitude of each Fourier coefficient (, i ∈ 1…L), corresponding to the power of the signal at frequency fi, was computed. Triaxial signals yielded three sets of coefficients, one for each axis: { } in the case of the raw calibrated triaxial signal, and { } in the case of the time-differentiated signal. For a triaxial signal, the resulting FT was averaged across the three axes. From the final FT, the maximum power obtained across all frequencies fi (i ∈ 1…L) was chosen as a measure of the signal periodicity. This FT-based operation was applied to four different input signals in order to develop four candidate features characterising movement periodicity: (1) roll component of the local magnetic field (rollFftPeakPower, equation 6, Table 1), (2) triaxial magnetometer signal (avgFftPeakPower, equation 7, Table 1), (3) time-differentiated roll signal (rollDiffFftPeakPower, equation 8, Table 1), and (4) time-differentiated triaxial signal (avgDiffFftPeakPower, equation 8, Table 1). All feature computation was done using MATLAB R2016b.
Feature selection
To enable direct comparison with the three-feature accelerometer-based model in [10], we selected one feature for each of the three biomechanical descriptors of posture, movement intensity, and periodicity. We tested features quantifying movement intensity (feature # 2 to #5, Table 1) for their efficacy in separating static and dynamic behaviours, and foraging and running. We tested features quantifying movement periodicity (feature #6 to #9, Table 1) for their efficacy in separating foraging and running. We tested five different feature selection methods based on the filter method (using the 'rankfeatures' function in MATLAB R2016b,© 2003–2016 The MathWorks, Inc. See Appendix S3, Additional file 1 for more details) to select one feature to quantify movement intensity, and one to quantify periodicity. meanRoll (feature #1, Table 1), being the only candidate developed to describe posture, was chosen by default.
Behaviour recognition scheme and cross-validation
The behaviour recognition scheme had the same hierarchical tree-like structure and hybrid form as the one found for meerkat behaviour recognition using accelerometers [10]. The scheme consisted of three nodes, each dividing a parent behavioural category (static or dynamic) into two daughter behavioural types (vigilance/resting or foraging/running, respectively). A Support Vector Machine (SVM) was used at each node to obtain optimal feature-value thresholds in a completely automated fashion. At the first node, features encoding information on posture and movement intensity were used to separate static and dynamic behaviours. At the second node, static behaviours were separated into vigilance and resting using postural information. At the third node, dynamic behaviours were separated into foraging and running using information on movement intensity and periodicity. The 'svm' learner in MATLAB R2016b’s 'fitclinear' function (© 2015–2016 The MathWorks, Inc.) was used to train the SVM at each node.
To validate the predictions of the SVM-SVM-SVM hybrid model with the chosen features against groundtruth video-annotated behaviours, two cross-validation methods were tested: (1) stratified ten-fold cross-validation (STRAT), which evaluates model performance when the frequency and duration of different behaviours may be skewed, and (2) leave-one-individual-out cross-validation (LOIO), which evaluates model performance when inter-individual variability is taken into account [10]. We used standard confusion matrix-based metrics to evaluate and compare model performance. These performance statistics included three behaviour-specific metrics (sensitivity, precision, and specificity), and overall model accuracy (see Appendix S2, Additional file 1 for mathematical definitions, computation and interpretation). Custom software was written in MATLAB R2016b to perform cross-validation.
Results
Collected data
A total of 82,550 two-second bouts of video-labelled behaviour were collected for the four behaviours of interest (Table 2). The number of bouts collected per animal was 8255 ± 3229 (mean ± SE). The frequency and duration of different behaviours were skewed: foraging (56.2%) was the most common behaviour while running was the rarest (1%). No resting behaviour was observed during six out of the eleven recording sessions; the number of resting bouts collected during the first recording session (55.7% of all resting bouts) far outnumbered those collected during the other recording sessions. Typical signals recorded for the four behaviours (Fig. 3) were found to be in line with our biomechanical hypotheses: static behaviours (bipedal vigilance and curled-up resting) showed little change (Fig. 3, left), while dynamic behaviours (foraging and running) produced greater change in the signals with large, periodic oscillations during running (Fig. 3, right).
Table 2.
Recording Session Number | Vigilance | Resting | Foraging | Running | Bouts per Recording Session |
---|---|---|---|---|---|
1 | 4594 | 2114 | 1562 | 69 | 8339 |
2 | 3896 | 120 | 5315 | 29 | 9360 |
3 | 1453 | 0 | 6278 | 38 | 7769 |
4 | 5221 | 0 | 2823 | 161 | 8205 |
5 | 1890 | 0 | 6134 | 169 | 8193 |
6 | 1639 | 744 | 4438 | 98 | 6919 |
7 | 4785 | 156 | 3498 | 40 | 8479 |
8 | 71 | 0 | 4841 | 20 | 4932 |
9 | 4283 | 0 | 1713 | 43 | 6039 |
10 | 1906 | 0 | 4407 | 84 | 6397 |
11 | 1782 | 661 | 5398 | 77 | 7918 |
Bouts per Activity | 31,520 | 3795 | 46,407 | 828 |
82,550 (total bouts) |
Table adapted from [10]. Triaxial magnetometer data were collected on ten unique individuals; data from recording session #4 and #7 were collected on the same individual. A bout refers to a two-second window w containing one video-labelled behaviour
Features to quantify biomechanical descriptors from triaxial magnetometer data
Measures of posture (meanRoll, equation 1, Table 1) and movement intensity (meanAbsDiffRoll, equation 3, Table 1) were inputs to the first node to separate static behaviours from dynamic ones (Fig. 4b). Posture (meanRoll) was used to distinguish vigilance from resting in the second node, and finally, movement intensity (meanAbsDiffRoll) and periodicity (avgDiffFftPeakPower, equation 9, Table 1) were used to distinguish foraging from running in the third node (Fig. 4b).
The use of meanRoll to quantify posture produced high separability between bipedal vigilance and curled-up resting (Figs. 3 & 5). During the dynamic behaviours (foraging and running), where the orientation of the animal’s body caused the roll axis of the magnetometer to lie approximately in the horizontal plane, the values recorded along the roll axis (Fig. 3) were in an intermediate range between the extreme positive and extreme negative values recorded during bipedal vigilance (Fig. 1a) and curled-up resting (Fig. 1b), respectively.
Among the features developed to quantify movement intensity, meanAbsDiffRoll outperformed the other three candidates with regard to separating both static from dynamic behaviours (Table S2, Appendix S3, Additional file 1), and foraging from running (Table S3, Appendix S3, Additional file 1). Among the features developed to quantify movement periodicity, avgDiffFftPeakPower outperformed the other three candidates for the separation of foraging from running (Table S4, Appendix S3, Additional file 1).
Performance evaluation, and comparison with accelerometer-based behaviour recognition
Magnetometer-based behaviour recognition performance is presented and compared with that achieved with accelerometer data in [10] for STRAT (Table 3) and LOIO (Table 4), and through visual depiction of feature distributions and resulting decision boundaries (Fig. 5).
Table 3.
Sensor | Vigilance | Resting | Foraging | Running | Overall Accuracy (%) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sen. (%) |
Spec. (%) |
Prec. (%) |
Sen. (%) |
Spec. (%) |
Prec. (%) |
Sen. (%) |
Spec. (%) |
Prec. (%) |
Sen. (%) |
Spec. (%) |
Prec. (%) |
||
Magnetometer | 97 | 98.6 | 97.8 | 84.4 | 99.4 | 87.1 | 98.8 | 97.2 | 97.8 | 83.1 | 99.9 | 93.9 | 97.3 |
Accelerometer | 97.1 | 98.8 | 98.1 | 85 | 99.4 | 87.1 | 99.3 | 97.8 | 98.3 | 85.9 | 99.9 | 92.1 | 97.7 |
The performance of the SVM-SVM-SVM hybrid model with magnetometer data is benchmarked against that obtained with accelerometer data reported in [10]. SVM: Support Vector Machine
Table 4.
Sensor | Vigilance | Resting | Foraging | Running | Overall Accuracy (%) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Sen. (%) |
Spec. (%) |
Prec. (%) |
Sen. (%) |
Spec. (%) |
Prec. (%) |
Sen. (%) |
Spec. (%) |
Prec. (%) |
Sen. (%) |
Spec. (%) |
Prec. (%) |
||
Magnetometer |
95.2 ± 2.4 |
97.9 ± 1.9 |
95.2 ± 6.2 |
65.4 ± 25.9 |
98.9 ± 0.9 |
77.3 ± 31.1 |
98.4 ± 0.9 |
97.0 ± 1.2 |
95.5 ± 0.5 |
86.5 ± 3.7 |
100 ± 0.0 |
96.4 ± 3.4 |
96.0 ± 1.5 |
Accelerometer |
95.8 ± 2.8 |
98.4 ± 1.2 |
96.4 ± 4.5 |
71.4 ± 23.6 |
98.9 ± 1.2 |
81.1 ± 28.0 |
98.8 ± 1.0 |
97.4 ± 1.5 |
95.3 ± 7.0 |
86.3 ± 13.2 |
99.9 ± 0.1 |
89.1 ± 11.1 |
96.5 ± 1.8 |
The performance of the SVM-SVM-SVM hybrid model with magnetometer data is benchmarked against that obtained with accelerometer data reported in [10]. Performance metrics were calculated separately for each test individual, and their mean and standard deviation across test individuals are shown here. SVM: Support Vector Machine
For STRAT, all performance metrics for the most common behaviours (foraging: 56.2% of dataset; vigilance: 38.2% of dataset), and overall model accuracy, were > 95% (Table 3). Good performance was obtained even for the rarer behaviours, resting (4.6% of dataset) and running (1% of dataset), where all behaviour-specific metrics remained > 83%. Further, overall as well as behaviour-wise recognition performance with the magnetometer were similar to that with the accelerometer (Table 3).
For LOIO, data from recording sessions numbers 3, 4, 5, 8, 9 and 10 were discarded since they did not contain any resting behaviour (Table 2). Once again, even when inter-individual variation was taken into account, mean values of all performance metrics for the most common behaviours (foraging and vigilance), and overall model accuracy, were > 95%, and were similar to those obtained with accelerometer-based behaviour recognition (Table 4).
Discussion
We presented an end-to-end framework to identify common animal behaviours from magnetometer data. Using data collected on 10 wild meerkats, we demonstrated that accurate behaviour recognition can be achieved with a magnetometer alone with performance comparable to that with an accelerometer. Our results shed further light on the magnetometer’s strengths and weaknesses in the context of behaviour telemetry, and suggest possibilities for leveraging the complementary merits of accelerometers and magnetometers within a single classification framework for more robust behaviour recognition.
Distinguishing dynamic behaviour using magnetometer-derived angular velocity
Differentiating magnetic field intensity with respect to time corresponds to quantifying changes in angles subtended by the Earth’s magnetic field vector onto the three sensor axes with time, and provides an estimate of angular velocity [20]. To separate behaviours based on movement intensity, quantifying change in magnetometer-derived angular velocity was more effective than quantifying change in magnetic field values. This may be because even when the change in sensor inclination angle is small, the rate at which the angle changes may be high. meanAbsDiffRoll (equation 3, Table 1) was best at separating static and dynamic, and the two dynamic behaviours. The superior class separability of meanAbsDiffRoll implied that using only the roll axis was more effective than when contributions from the other two axes, pitch and yaw, were included. This may have been a consequence of the fact that the roll axis succeeded in capturing both up-and-down, and side-to-side bodily movements made by the meerkat’s neck and torso during dynamic behaviours. The roll axis was also more robust than the other two axes to collar rotations. Magnetic field lines have, in general, a horizontal as well as vertical component – the inclination angle of Earth’s magnetic field at the study site was 65° pointing upwards. The pitch axis would have been insensitive to the up-and-down movements, and the yaw axis insensitive to the side-to-side movements. Further, collar rotations around the meerkat’s cylindrical neck could have confounded class separation through noisy variability in pitch- and yaw-axis contributions for the same activity. Note, however, that the precise choice of the feature describing movement intensity may change when dynamic behaviours of interest involve rotations about the roll axis, such as washing at sea by a Magellanic penguin (Spheniscus magellanicus) [5], or fast turning in cheetahs where the weight of the tag causes the collar to rotate around the neck due to centripetal acceleration [28].
Metrics based on magnetometer-derived angular velocity may be better suited than accelerometry for filtering out signal artefacts caused by sensor impacts. Compared to foraging versus running classification using accelerometer data (a3 in Fig. 5c), with the magnetometer there were fewer foraging bouts with low periodicity and high intensity that crossed the decision boundary m3 (Fig. 5f). While exploring the ground for prospective hunting locations, the meerkat’s collar would often bump against vegetation or the ground. Additionally, while digging, the meerkat’s pectoral muscles would hit against the collar. These impacts produced high, transient translational acceleration that led to a higher estimation of bout intensity with the accelerometer. However, the magnetometer, being insensitive to translational acceleration [5], provided a lower estimate for bout intensity due to relatively slow collar orientation changes. Thus, such bouts were correctly classified as foraging with the magnetometer since their intensity placed them below the decision boundary m3 (Fig. 5f). This led to higher precision in the detection of running (7.3% higher mean precision and similar mean sensitivity with LOIO) with much lesser inter-individual variability in performance (9.5% lower standard deviation for sensitivity and 7.7% lower standard deviation for precision) compared to accelerometer-based classification. This was achieved despite running being the rarest behaviour (outnumbered 1:56 by foraging in terms of number of recorded bouts). In a similar fashion, fewer vigilance bouts yielded high enough magnetometer-based intensity to cross over m1 (Fig. 5d) and get misclassified as dynamic behaviour as compared to when the accelerometer (Fig. 5a) was used (Tables S4 & S5, Appendix S4, Additional file 1).
The stringency of the magnetometer in assigning high intensity to a bout of activity was not without its costs. Comparing aggregate confusion matrices observed with the magnetometer and accelerometer (Tables S4 & S5, respectively, Appendix S4, Additional file 1), we observed a higher number of relatively low-intensity foraging bouts getting misclassified as being static, thereby reducing foraging detection sensitivity as compared to accelerometer-based classification (especially for recording sessions #6, #7 and #11, Table S9 in Appendix S4, Additional file 1). This may have been because the amplitude and rate of body movement-generated change in collar orientation during low-intensity foraging behaviour (for instance, during slow ground scratching while keeping the head and torso in the same orientation) may not have been sufficient to generate a large-enough signal detectable above the noise floor introduced by the differentiation operation [26] during computation of meanAbsDiffRoll.
Finally, it has been reported that a combination of accelerometers and gyroscopes can lead to better activity recognition in human wearable sensor applications than when each sensor is used alone [20]. In animal studies, the magnetometer may be a viable alternative to the gyroscope for obtaining estimates of angular velocity due to the former’s lower power consumption [29]. This could be important for facilitating long-duration recordings on small animals.
Estimating posture using magnetometer data
While it was possible to estimate posture using the magnetometer, the accelerometer-based posture measure was nevertheless found to be better at separating static behaviours. In our observations of static behaviour, a number of bouts of quadrupedal vigilance and belly-flat resting were also recorded apart from bipedal or sitting vigilance (Fig.1a), and curled-up resting (Fig. 1b). In these postures, a significant component of the roll axis lay in the horizontal plane. Possibly arbitrary azimuthal orientation of the animal during these postures (Fig.1c) confounded the distinction between quadrupedal vigilance and belly-flat resting. This additional constraint degraded the accuracy of resting detection compared to that with the accelerometer (6% lower mean sensitivity, 3.8% lower mean precision. See also Fig. 5, middle panel). In static behaviours, where the animal’s body retains similar orientation with respect to the horizontal plane, such as during standing and lying in cows (cf. [30]), the confounding effect of possibly arbitrary azimuthal orientation may be particularly severe. Further, our implicit assumption that the calibration parameters computed at the beginning of each recording would be valid throughout the recording was found to be only partially true (see Appendix S5, Additional file 1).
Magnetometer versus accelerometer: similarity and complementarity
Similar behaviour recognition performance with the two sensors suggests that it may not be necessary to make separate considerations for the choice of ethogram when working with magnetometers when archetypal behaviours such as foraging, fast locomotion, and resting are to be identified.
Our results reveal the selectivity of the magnetometer for bodily movement, and relative immunity to signal artefacts arising due to sensor impacts. This may offer the opportunity to study movement energetics using metrics based on magnetometer-derived angular velocity [5], which would be similar but complementary to the acceleration-based metrics ODBA [31] and VeDBA [32]. One advantage of the magnetometer that could be exploited in future studies is the weaker dependence of signal magnitude on sensor location on the animal’s body. When a body segment rotates about a joint, the magnitude of acceleration is higher for distal compared to proximal parts, and this dependence on the location of accelerometer attachment might be especially important to take into account for larger animals. The magnitude of the magnetometer signal during segment rotation, however, would always be the same along a body segment regardless of body size or sensor placement. The apparent pitfall of the accelerometer in confounding bodily movement-produced signals with artefacts arising from sensor impacts could nevertheless be turned to an advantage for other applications where the detection of specific events is desirable. Impact-generated acceleration characteristics have, for instance, been used in the detection of falls in humans [33].
Combining magnetometer and accelerometer data to identify behaviour has been previously suggested [2]. In this study, we develop this idea further and suggest specific aspects of these two sensors to combine for better behavioural identification. Features derived from data from one or both sensors may be chosen according to their specific strengths as inputs for each node of the hierarchical classification scheme (Fig. 4b). For instance, at the first node tasked with separating static behaviours from dynamic ones, the more reliable accelerometer-based posture measure (meanSurge) [10] may be combined with the more selective magnetometer-based movement intensity measure (meanAbsDiffRoll). Then, meanSurge could be used at the second node tasked with separating vigilance from resting on the basis of posture. At the third node, the magnetometer-based intensity (meanAbsDiffRoll) and periodicity (avgDiffFftPeakPower) metrics may be used for higher-precision distinction between foraging and running. Finally, as has been done for some human movement studies [34], accelerometer and magnetometer data may by combined to give a more accurate and robust three-dimensional estimation of posture in such fused systems than either sensor alone.
Conclusion
Our findings demonstrate that magnetometers can be used alone to achieve accurate and robust animal behaviour recognition. We showed that sensor tilt with respect to Earth’s magnetic field, and metrics based on magnetometer-derived angular velocity may be used to extract biomechanically significant features to describe posture, movement intensity, and periodicity. Through the directed use of these features in a recently developed hybrid hierarchical behaviour recognition framework combining movement biomechanics and machine learning [10], we found that magnetometer-based behaviour recognition (i) produced similar results to those obtained with the accelerometer, (ii) was robust to inter-behaviour differences in duration and frequency of occurrence, and (iii) exceeded the accelerometer’s resilience to inter-individual variability for dynamic behaviours.
Movements performed by free-living animals, broadly speaking, generate both acceleration as well as angular velocity. Our results reveal that, as long as a sensor can measure a static and dynamic component of movement, key biomechanical descriptors of motion can be quantified and used to recognise common animal behaviours with high accuracy. The generality afforded by the usage of biomechanical considerations to direct inertial sensor data processing, and the simple structure and implementation of the hybrid behaviour recognition framework make it possible to accommodate, compare, and leverage data from accelerometers, magnetometers, and gyroscopes within a single behaviour recognition scheme.
Additional file
Acknowledgements
We thank the Northern Cape Conservation Authority for permission to conduct this research, and the Kalahari Research Trust and Tim Clutton-Brock and Marta Manser as directors of the Kalahari Meerkat Project for access to facilities and habituated animals in the Kuruman River Reserve, South Africa. We thank the field managers, collaborators, and assistants for facilitating field work and helping with data collection, and in particular David Gaynor, Tim Vink, Ana Morales González, and Héctor Ruiz Villar. Special thanks to Nino Maag for helping with developing the conceptual framework of the project, definition of meerkat behaviors, and data collection. We thank Selin Ersoy for her painstaking annotation of all videos, Pascal Morel for adapting the Physilog IV for this study, and Hooman Dejnabadi for tips on signal processing. We thank the three anonymous reviewers for their suggestions and comments that helped improve the presentation and roundedness of the manuscript.
Abbreviations
- FT
Fourier Transform
- Hz
Hertz
- IMU
Inertial Measurement Unit
- KMP
Kalahari Meerkat Project
- LOIO
Leave-one-individual-out cross-validation
- ODBA
Overall Dynamic Body Acceleration
- STRAT
Stratified ten-fold cross-validation
- SVM
Support Vector Machine
- VeDBA
Vectorial Dynamic Body Acceleration
- μT
Micro Tesla
Authors’ contributions
KA, PC and MM developed the research idea, and GC and AO contributed to refinements. PC and GC supervised the fieldwork. MM and PC performed data analyses. PC led the writing of the manuscript. All authors contributed critically to the drafts and gave final approval for publication.
Funding
This project was supported by the Swiss National Science Foundation (research grant no. CR32I3_159743). During the period of our project, the long-term research on meerkats was supported by a European Research Council Advanced Grant (No. 294494) to Tim Clutton-Brock and by grants from the University of Zurich to Marta Manser.
Availability of data and materials
Labelled triaxial magnetometer data and feature matrices used to obtain the behaviour recognition results in this study are made available on the Dryad Digital Repository (10.5061/dryad.2fr72sb).
Ethics approval
All necessary permits to handle and tag meerkats were granted to the KMP by the Department of Environment and Nature Conservation of the Northern Cape, South Africa, and the Animal Ethics Committee of the University of Pretoria (permit ‘FAUNA 192/2014’).
Consent for publication
Not applicable.
Competing interests
The authors declare that they have no competing interests.
Footnotes
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Ropert-Coudert Y, Wilson RP. Trends and perspectives in animal-attached remote sensing. Front Ecol Environ. 2005;3(8):437–444. doi: 10.1890/1540-9295(2005)003[0437:TAPIAR]2.0.CO;2. [DOI] [Google Scholar]
- 2.Wilson RP, Shepard EL, Liebsch N. Prying into the intimate details of animal lives: use of a daily diary on animals. Endanger Species Res. 2008;4(1–2):123–137. doi: 10.3354/esr00064. [DOI] [Google Scholar]
- 3.Noda T, Kawabata Y, Arai N, Mitamura H, Watanabe S. Animal-mounted gyroscope/accelerometer/magnetometer: in situ measurement of the movement performance of fast-start behaviour in fish. J Exp Mar Biol Ecol. 2014;451:55–68. doi: 10.1016/j.jembe.2013.10.031. [DOI] [Google Scholar]
- 4.Shepard EL, Wilson RP, Quintana F, Laich AG, Liebsch N, Albareda DA, Halsey LG, Gleiss A, Morgan DT, Myers AE, Newman C. Identification of animal movement patterns using tri-axial accelerometry. Endanger Species Res. 2008;10:47–60. doi: 10.3354/esr00084. [DOI] [Google Scholar]
- 5.Williams HJ, Holton MD, Shepard EL, Largey N, Norman B, Ryan PG, Duriez O, Scantlebury M, Quintana F, Magowan EA, Marks NJ. Identification of animal movement patterns using tri-axial magnetometry. Movement ecology. 2017;5(1):6. doi: 10.1186/s40462-017-0097-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Naito Y, Bornemann H, Takahashi A, McIntyre T, Plötz J. Fine-scale feeding behavior of Weddell seals revealed by a mandible accelerometer. Polar Science. 2010;4(2):309–316. doi: 10.1016/j.polar.2010.05.009. [DOI] [Google Scholar]
- 7.Nathan R, Spiegel O, Fortmann-Roe S, Harel R, Wikelski M, Getz WM. Using tri-axial acceleration data to identify behavioral modes of free-ranging animals: general concepts and tools illustrated for griffon vultures. J Exp Biol. 2012;215(6):986–996. doi: 10.1242/jeb.058602. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Cozzi G, Broekhuis F, McNutt JW, Turnbull LA, Macdonald DW, Schmid B. Fear of the dark or dinner by moonlight? Reduced temporal partitioning among Africa's large carnivores. Ecology. 2012;93(12):2590–2599. doi: 10.1890/12-0017.1. [DOI] [PubMed] [Google Scholar]
- 9.Hammond TT, Springthorpe D, Walsh RE, Berg-Kirkpatrick T. Using accelerometers to remotely and automatically characterize behavior in small animals. J Exp Biol. 2016;219(11):1618–1624. doi: 10.1242/jeb.136135. [DOI] [PubMed] [Google Scholar]
- 10.Chakravarty P, Cozzi G, Ozgul A, Aminian K. A novel biomechanical approach for animal behaviour recognition using accelerometers. Methods Ecol Evol. 2019. [DOI] [PMC free article] [PubMed]
- 11.Williams HJ, Shepard EL, Duriez O, Lambertucci SA. Can accelerometry be used to distinguish between flight types in soaring birds? Animal Biotelemetry. 2015;3(1):45. doi: 10.1186/s40317-015-0077-0. [DOI] [Google Scholar]
- 12.Bouten CV, Sauren AA, Verduin M, Janssen JD. Effects of placement and orientation of body-fixed accelerometers on the assessment of energy expenditure during walking. Med Biol Eng Comput. 1997;35(1):50–56. doi: 10.1007/BF02510392. [DOI] [PubMed] [Google Scholar]
- 13.Amini N, Sarrafzadeh M, Vahdatpour A, Xu W. Accelerometer-based on-body sensor localization for health and medical monitoring applications. Pervasive and mobile computing. 2011;7(6):746–760. doi: 10.1016/j.pmcj.2011.09.002. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Wilson RP. Dead reckoning: a new technique for determining penguin movements at sea. Meeresforsch. 1988. pp. 155–158. [Google Scholar]
- 15.Wilson RP, Wilson MP, Link R, Mempel H, Adams NJ. Determination of movements of African penguins Spheniscus demersus using a compass system: dead reckoning may be an alternative to telemetry. J Exp Biol. 1991;157(1):557–564. [Google Scholar]
- 16.Mitani Y, Sato K, Ito S, Cameron MF, Siniff DB, Naito Y. A method for reconstructing three-dimensional dive profiles of marine mammals using geomagnetic intensity data: results from two lactating Weddell seals. Polar Biol. 2003;26(5):311–317. [Google Scholar]
- 17.Wilson RP. Movements in Adélie penguins foraging for chicks at Ardley Island, Antarctica: circles within spirals, wheels within wheels. Polar Bioscience. 2002;(15):75–87.
- 18.Wilson RP, Liebsch N, Davies IM, Quintana F, Weimerskirch H, Storch S, Lucke K, Siebert U, Zankl S, Müller G, Zimmer I. All at sea with animal tracks; methodological and analytical solutions for the resolution of movement. Deep-Sea Res II Top Stud Oceanogr. 2007;54(3–4):193–210. doi: 10.1016/j.dsr2.2006.11.017. [DOI] [Google Scholar]
- 19.Matsumura M, Watanabe YY, Robinson PW, Miller PJ, Costa DP, Miyazaki N. Underwater and surface behavior of homing juvenile northern elephant seals. J Exp Biol. 2011;214(4):629–636. doi: 10.1242/jeb.048827. [DOI] [PubMed] [Google Scholar]
- 20.Kunze K, Bahle G, Lukowicz P, Partridge K. Can magnetic field sensors replace gyroscopes in wearable sensing applications? In: International symposium on wearable computers (ISWC) 2010: IEEE; 2010. p. 1–4.
- 21.Abdulla UA, Taylor K, Barlow M, Naqshbandi KZ. Measuring walking and running cadence using magnetometers. In2013 12th IEEE international conference on trust, security and privacy in computing and communications, vol. 16: IEEE; 2013. p. 1458–62.
- 22.Clutton-Brock TH, Manser M. Meerkats: cooperative breeding in the Kalahari. Cooperative breeding in vertebrates. 2016. pp. 294–317. [Google Scholar]
- 23.Semiconductor F. Xtrinsic MAG3110 three-Axis, digital magnetometer. MAG3110 datasheet. 2013. [Google Scholar]
- 24.Thébault E, Finlay CC, Beggan CD, Alken P, Aubert J, Barrois O, Bertrand F, Bondar T, Boness A, Brocco L, Canet E. International geomagnetic reference field: the 12th generation. Earth, Planets and Space. 2015;67(1):79. doi: 10.1186/s40623-015-0228-9. [DOI] [Google Scholar]
- 25.Bonnet S, Bassompierre C, Godin C, Lesecq S, Barraud A. Calibration methods for inertial and magnetic sensors. Sensors Actuators A Phys. 2009;156(2):302–311. doi: 10.1016/j.sna.2009.10.008. [DOI] [Google Scholar]
- 26.Usui Shiro, Amidror Itzhak. Digital Low-Pass Differentiation for Biological Signal Processing. IEEE Transactions on Biomedical Engineering. 1982;BME-29(10):686–693. doi: 10.1109/TBME.1982.324861. [DOI] [PubMed] [Google Scholar]
- 27.Zivanovic Miroslav, Carlosena Alfonso. On asymmetric analysis windows for detection of closely spaced signal components. Mechanical Systems and Signal Processing. 2006;20(3):702–717. doi: 10.1016/j.ymssp.2005.04.003. [DOI] [Google Scholar]
- 28.Wilson JW, Mills MG, Wilson RP, Peters G, Mills ME, Speakman JR, Durant SM, Bennett NC, Marks NJ, Scantlebury M. Cheetahs, Acinonyx jubatus, balance turn capacity with pace when chasing prey. Biol Lett. 2013;9(5):20130620. doi: 10.1098/rsbl.2013.0620. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Katevas K, Haddadi H, Tokarchuk L. Sensingkit: Evaluating the sensor power consumption in ios devices. In: 12th international conference on intelligent environments (IE) 2016 Sep 14: IEEE; 2016. p. 222–5.
- 30.Martiskainen P, Järvinen M, Skön JP, Tiirikainen J, Kolehmainen M, Mononen J. Cow behaviour pattern recognition using a three-dimensional accelerometer and support vector machines. Appl Anim Behav Sci. 2009;119(1–2):32–38. doi: 10.1016/j.applanim.2009.03.005. [DOI] [Google Scholar]
- 31.Wilson RP, White CR, Quintana F, Halsey LG, Liebsch N, Martin GR, Butler PJ. Moving towards acceleration for estimates of activity-specific metabolic rate in free-living animals: the case of the cormorant. J Anim Ecol. 2006;75(5):1081–1090. doi: 10.1111/j.1365-2656.2006.01127.x. [DOI] [PubMed] [Google Scholar]
- 32.McGregor SJ, Busa MA, Yaggie JA, Bollt EM. High resolution MEMS accelerometers to estimate VO2 and compare running mechanics between highly trained inter-collegiate and untrained runners. PLoS One. 2009;4(10):e7355. doi: 10.1371/journal.pone.0007355. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Bourke AK, O’brien JV, Lyons GM. Evaluation of a threshold-based tri-axial accelerometer fall detection algorithm. Gait & posture. 2007;26(2):194–199. doi: 10.1016/j.gaitpost.2006.09.012. [DOI] [PubMed] [Google Scholar]
- 34.Kemp B, Janssen AJ, Van Der Kamp B. Body position can be monitored in 3D using miniature accelerometers and earth-magnetic field sensors. Electroencephalography and Clinical Neurophysiology/Electromyography and Motor Control. 1998;109(6):484–488. doi: 10.1016/S0924-980X(98)00053-8. [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
Labelled triaxial magnetometer data and feature matrices used to obtain the behaviour recognition results in this study are made available on the Dryad Digital Repository (10.5061/dryad.2fr72sb).