Pose-gait analysis for cetaceans with biologging tags

Biologging tags are a key enabling tool for investigating cetacean behavior and locomotion in their natural habitat. Identifying and then parameterizing gait from movement sensor data is critical for these investigations. But how best to characterize gait from tag data remains an open question. Further, the location and orientation of the tag on an animal in the field are variable and can change multiple times during deployment. As a result, the relative orientation of the tag with respect to (wrt) the animal must be determined before a wide variety of further analyses. Currently, custom scripts that involve specific manual heuristics methods tend to be used in the literature. These methods require a level of knowledge and experience that can affect the reliability and repeatability of the analysis. The authors of this work argue that an animal’s gait is composed of a sequence of body poses observed by the tag, demonstrating a specific spatial pattern in the data that can be utilized for different purposes. This work presents an automated data processing pipeline (and software) that takes advantage of the common characteristics of pose and gait of the animal to 1) Identify time instances associated with occurrences of relative motion between the tag and animal; 2) Identify the relative orientation of tag wrt the animal’s body for a given data segment; and 3) Extract gait parameters that are invariant to pose and tag orientation. The authors included biologging tag data from bottlenose dolphins, humpback whales, and beluga whales in this work to validate and demonstrate the approach. Results show that the average relative orientation error of the tag wrt the dolphin’s body after processing was within 11 degrees in roll, pitch, and yaw directions. The average precision and recall for identifying relative tag motion were 0.87 and 0.89, respectively. Examples of the resulting pose and gait analysis demonstrate the potential of this approach to enhance studies that use tag data to investigate movement and behavior. MATLAB source code and data presented in the paper were made available to the public (https://github.com/ding-z/cetacean-pose-gait-analysis.git), with suggestions related to tag data processing practices provided in this paper. The proposed analysis approach will facilitate the use of biologging tags to study cetacean locomotion and behavior.


31
Biologging tags use a combination of sensors (e.g., accelerometer, magnetometer, 32 gyroscope, speed, pressure sensor, camera, micro/hydrophone) to record data about 33 animal movement, behavior, and the environment. For studies of cetaceans, in 34 particular, many research topics utilize data from biologging tags. For example, tags are 35 commonly used to study the bioacoustics of marine mammals [1][2][3]. In addition, the 36 biomechanics, time budget, and diving behaviors of cetaceans are also often studied 37 using biologging tags [4][5][6][7][8][9][10]. The kinematic data from these tag systems are used to 38 estimate the animal's position in the environment and provide information about 39 animal behavior in the context of habitat usage [11][12][13][14][15][16][17][18]. Machine learning-based 40 approaches have been applied to tag data to infer behavior when direct human 41 observation/interpretation is expensive, time-consuming, or not possible [19][20][21][22]. The 42 key to many of these studies is accurately estimating animal pose (roll, pitch, and yaw, 43 Figure 1). 44 The pose is essential for studies that require an estimated spatial trajectory of the 45 animal or investigate locomotion and gait [4,5,8,[11][12][13][14][15]23]. In the literature, the pose is 46 typically estimated using accelerometer and magnetometer data [1,8]. When gyroscope 47 data is available, methods like [24] can be used to improve the estimated animal pose. an animal's gait, we need a measure wrt the animal's body rather than the earth's 56 horizontal plane. To this end, the measured angular rate from a gyroscope can be 57 integrated to estimate the rotation angle wrt the animal itself. However, this estimation 58 is subject to accumulated sensor error, and gyroscopes are unavailable in some tag 59 platforms. As such, it is essential to develop approaches that can address this in 60 accelerometer-based estimates of orientation. 61 Because many cetacean tags use a suction cup-based attachment method, the 62 location and orientation of the tag wrt the animal can change during field 63 deployments [1,25]. As a result, the relative orientation of the tag wrt the animal must 64 be determined before animal pose calculation [1,8,26]. Further, even with the best Measurement Unit) with an accelerometer, gyroscope, magnetometer, and additional 104 sensors to record temperature and pressure. The board also supports the addition of an 105 external 1-DOF Hall effect sensor, which functions as a flow speed sensor when used in 106 conjunction with a magnetic micro-turbine mounted outside the tag housing [30]. The 107 tags were configured to record the IMU at 50 Hz and all other sensors at 10 Hz. To be 108 minimally invasive and to minimize deployment complexity, the tags are attached to the 109 animals with a set of four silicone rubber suction cups. As a result, deployments can be 110 done within a few seconds.

111
Methods presented in this paper also support other cetacean tag platforms equipped 112 with an accelerometer, magnetometer, and pressure sensor. For example, the DTag 113 platform [1] has been commonly used for wild cetacean deployments (Figure 1-Right). 114 The DTag also attaches to an animal via suction cups and contains an accelerometer, 115 magnetometer, pressure sensor, high-performance hydrophone, but no gyroscope. The 116 presented methods are demonstrated with MTag data from bottlenose dolphins and 117 DTag data from humpback whales and beluga whales. The proposed work uses biologging tag data (from a 3-axis accelerometer, 3-axis 120 magnetometer, and pressure/depth sensor) and the general data patterns associated 121 with a cetacean gait to estimate animal pose. While an accelerometer measures 122 acceleration due to both gravity and motion, we apply a simplified approach in this 123 work and use the low-pass filtered 3-axis accelerometer data as the measurement 124 associated with gravity in the tag coordinate frame (A (tag) ). The magnitude and 125 direction of the gravity force (vertically downwards) are known, and the resulting tag 126 measurement always points vertically upwards in the world coordinates.

127
As the animal changes pose, the amount of the gravitational force measured by each 128 of the component axes of the accelerometer changes in the tag coordinate frame 129 (A (tag) ), but the magnitude of the total signal is constant. We use A (tag) , together with 130 the rate of the depth change, to reveal the pattern associated with the animal's gait, 131 and we refer to the plot as the orientation sphere ( Figure 2, to be distinguished from 132 the "orientation sphere" presented in [31] for animal head movement visualization).

133
Even though the animal could be in any pose at a particular time, common 134 characteristics are assumed about the general gait patterns.

135
In particular, three assumptions are made about the gait of the animal and the 136 associated data pattern under general situations. The first and most important 137 assumption is that cetaceans swim with a neutral roll angle more often than a leftward 138 or a rightward roll. Second, it is assumed that the animal has a positive pitch when 139 ascending and a negative pitch when descending. Third, the pattern of one signal 140 segment is assumed to match another segment for the same animal. In this work, tag 141 shift detection and orientation correction are based on these assumptions. More 142 discussion shall be made about the solidness and influence of these assumptions through 143 the rest of the paper.

144
Nonparametric Tag Shift Detection

145
The third assumption stated above, that the pattern of one signal segment matches 146 another segment for the same animal, will be violated when the relative orientation of 147 the tag to the animal changes, i.e., the tag shifts, Figure 3. Even though significant 148 animal gait changes could also violate the assumption, tag shift detection is achieved by 149 identifying the time instances when signal patterns change. At a higher level, the 150 method focuses on comparing data distributions from different data segments such that 151 'abnormal' segments in the dataset can be located. The comparisons are performed on 152 individual data points without prior/expert knowledge of the specific data distribution. 153 Before solving the entire shift detection problem, we first describe our approach to a 154 more constrained subproblem: how to identify a tag shift, if it exist, within a given 155 signal segment S that contains at most one shift. For this subproblem, we equally 156 divide S into temporally adjacent segments S 1 and S 2 , each has duration D s (e.g. An orientation sphere for a bottlenose dolphin with the biologging tag aligned with the animal's body, (i.e., data in the animal's body coordinates without the need for a correction). Each data point represents the acceleration measurement at one time instance, and is clustered into 'flat,' 'ascend,' or 'descend' depending on its depth speed. The acceleration measurement is dominated by gravity and appears to point vertically up in the world coordinates constantly but changes direction in the animal's body coordinates depending on the pose of the animal at the time. The swimming motion of an animal is composed of a sequence of poses, which corresponds to particular areas of the orientation sphere (e.g., the top 3 poses cover a shallow diving cycle and correspond to the top area of the orientation sphere).
[ Ta    Conceptual illustration of finding tag shift time t 2 in data segment S 2 using data segment S 1 as a template. Both segments share the same duration D s = 10 minutes. Each data point from either S 1 or S 2 can be checked against the template distribution (S 1 ) to decide whether it is an inlier (1) or an outlier (0) of the template. An inlier percentage (InPct) value can be calculated over time, and the tag shift time can be located by finding when InPct drops below an empirically defined threshold. If t 2 does not exist or it is close to the boundary between S 1 and S 2 , another step would be taken to use S 2 as the template to check for a potential shift time t 1 in S 1 .
D s = 10 minutes), knowing that a shift could lie in either S 1 or S 2 , but not both.

158
Without loss of generality, we assume the shift lies in S 2 . S 1 then serves as the template 159 for identifying the time instance t 2 when the shift happens in S 2 . With t 2 , S 2 can be 160 further divided into S

162
The question now is how to locate such t 2 in S 2 , using S 1 as the template. For each 163 data point in S 2 , we find its K (see footnote 1 ) nearest spacial neighbors in S 1 and 164 compute the average distance from the point to its neighbors. If this distance is within 165 an empirically defined threshold, the data point in S 2 is considered an inlier of S 1 ; 166 otherwise, it is classified as an outlier. After this process, all of the points in S 2 are 167 assigned with a value of 1 (inlier) or 0 (outlier). A temporal moving average filter is 168 applied to these 1s and 0s to obtain a local inlier percentage (InP ct) value. As 169 illustrated in Figure 4, the time instance t 2 is found by identifying the first time InP ct 170 drops below a defined threshold. If InP ct never drops below or t 2 is close to the 171 boundary between S 1 and S 2 , this indicates that a shift could be lying in S 1 instead of 172 S 2 . This procedure can then be applied to check S 1 by using S 2 as a template, aiming 173 at finding time instance t 1 in S 1 that corresponds to a shift.

174
With a strategy defined above to find one (or zero) shifting instance within two 175 segments, S 1 and S 2 , an algorithm for finding all tag shifts is presented in Figure 5.

176
Based on the procedures described above, the algorithm starts with adjacent data 177 segments S 1 and S 2 . Both segments share a fixed empirically defined duration D s that 178 reflects the expected tag shift interval (e.g. D s = 10 minutes). If neither segment 179 contains a shift (branch 10), then S 1 remains unchanged, and S 2 moves forward to the 180 following data segment to check for a shift. Once a shift is detected, both segments will 181 be redefined such that S 1 starts from the identified shift and S 2 adjacently follows 182 (branches 6 to 9). Every time S 1 is redefined (i.e. S 1 and S 2 are adjacent), the algorithm searches for a 184 shift to exist in either S 1 or S 2 , starting with S 2 (branch 1). If S 2 does not contain a 185 shift (branch 3), then the algorithm checks S 1 for a shift (branch 5, followed by 186 branches 9 & 10). If S 2 contains a shift instance t 2 (branch 2), and t 2 is not near (see 187 footnote 2 ) S 1 (branch 8), then t 2 is recorded as a shift. However, if t 2 is near S 1 188 (branch 4), the algorithm will also check S 1 to decide whether the shift is lying in S 1 189 but appears to be t 2 initially. Then either t 1 or t 2 will be recorded as the shift,

194
For a given segment of data that contains no tag shift but has an unknown tag-animal 195 configuration, the tag data from the accelerometer and magnetometer (and gyroscope, if 196 equipped) can be rotated (i.e., change of coordinates) to transform the data from tag 197 coordinates to the animal's body coordinates. In this work, such a rotation is found by 198 matching the measured general motion pattern, i.e., orientation sphere, to the assumed 199 one, as discussed in this section. Depth measurement is used to group the tag  x-tag   Firstly, plane-1 (through the origin) is fitted to the most significant distribution in 225 the data, which could be either A (tag) f lat (e.g. Figure 6-Bottom Left, plane-1 is a rolling 226 plane) or A (tag) ascend and A (tag) descend (e.g. Figure 6-Bottom Right, plane-1 is a pitching 227 plane), depending on the animal and environment. Secondly, plane-2 (through the 228 origin) is fitted to the rest of the data under the constraint that it is perpendicular to 229 plane-1. The toolbox can assign the roles of rolling plane and pitching plane to the 230 two planes automatically.

231
The intersection line of the two planes is colinear with d Other 241 data are mapped from tag coordinates to body coordinates using R 1 and R 2 : with A (body) and M (body) being the transformed (animal's body coordinates) data from 243 the accelerometer and magnetometer.

244
Animal Pose Calculation and Gait Characterization 245 Roll, pitch, and yaw are widely used to describe the pose of animals [1,8]. In this work 246 we are computing them in a conventional [1] way using the transformed (animal's body 247 coordinates) data from accelerometer A (body) and magnetometer M (body) . Define 248 R x (α) to be the rotation matrix for rotating the data about the coordinates' x-axis 249 with angle α. And similarly R y (β) about the y-axis with angle β and R z (γ) about the 250 z-axis with angle γ. For time instance t, the 3-axes body coordinates' accelerometer and 251 magnetometer data are represented as A zt ]. Roll, pitch, and yaw are calculated as: [M (2) xt , M yt , M where we note that the body coordinates' x (body) , y (body) , and z (body) axes are defined to 254 be pointing forward, leftward, and upward wrt the animal's body, respectively 255 ( Figure 1).

256
Let a set of moving coordinates {x (move) , y (move) , z (move) } be initially aligned with 257 the earth's inertial coordinates {x (inertial) , y (inertial) , z (inertial) } (see footnote 3 ). Then 258 yaw, pitch, and roll rotate the moving coordinates from the inertial coordinates to the 259 animal's body coordinates in 3 steps: where [1, 0, 0] is an unit vector pointing forward while roll t , pitch t and yaw t are the the inertial coordinates (i.e. x (body) in the earth inertial coordinates).
then maps x (body) from the inertial coordinates to 303 the low frequency body coordinates {x (body) ,ȳ (body) ,z (body) }. 304 The resulting V dp gives the dynamic 3D heading of the animal wrt the animal's 305 current neutral body pose (i.e. the low frequency body pose). Since the fluking motion 306 of cetaceans is happening in thex (body) -z (body) plane (i.e. pitching plane), the 307 resulting V dp would also be swinging in thex (body) -z (body) plane, regardless of the actual 308 orientation of the animal (see footnote 4 ). We further define dynamic pitch (pitch dp ) 309 and dynamic yaw (yaw dp ) to be the angles between V dp and its x-y plane as well as 310 its x-z plane, respectively: 311 pitch dp(t) = arcsin(V dpz(t) /norm(V dp(t) )), yaw dp(t) = arcsin(V dpy(t) /norm(V dp(t) )), with V dp(t) = [V dpx(t) , V dpy(t) , V dpz(t) ] at time t. The dynamic pitch (pitch dp ) and 312 dynamic yaw (yaw dp ) approximate the animal's dynamic angle changes around its 313 y (body) andz (body) axes, respectively. The pitch dp measure for a cetacean is what we 314 desired earlier: 'an angle measurement wrt the animal's own body y (body) axis to 315 describe its gait.'

316
An animal's per-stroke fluking period and amplitude are calculated by automatically 317 locating and processing the positive and negative peaks in pitch dp , which enables a wide 318 variety of further analyses (e.g., investigating the animal's fluking frequency and 319 amplitude when diving speed is greater than 2 m/s). Meanwhile, data segments that do 320 not contain any peak are marked as passive behaviors (e.g., gliding).  As a correctly aligned tag measurement differs from a misaligned tag primarily by a 334 rotation to the data (i.e., a change of coordinates), we injected artificial rotations to the 335 initially aligned data to simulate the effects of tag shifts. For validation purposes, 336 randomly designed rotations were applied to each randomly defined data segment to 337 simulate the effects of a tag shift. More specifically, 18 datasets, with an average 338 duration of 87 (±23) minutes, were included for the validation, and 100 random 339 simulations were conducted for each dataset. The dataset was randomly broken into condition B) were further compared with the poses calculated using a gradient descent 357 based filtering approach [24] (referred to as the Madgwick 's approach after the author's 358 name), which used accelerometer, magnetometer, and gyroscope data (condition C). 359 Further, to assess the sensitivity of the proposed methods (Objective 4), we 360 repeated the computation experiments by injecting simulated tag shifts, with the 361 simulated tag rotations having random directions (same as before) but fixed degrees for 362 each run. Specifically, 50 random runs were made to each dataset for each fixed degree. 363 For each run, k + 1 rotations were injected into the dataset (as before), and each 364 rotation had a random direction with a fixed degree. The average precision and recall of 365 the method in detecting the shifting instances were calculated for each fixed degree over 366 all datasets and random runs. In addition, the absolute angle differences between poses 367 calculated from corrected simulated data segments (condition A) and poses calculated 368 from the original data segments (condition B) were calculated for each fixed angle.

369
The computation experiments were repeated one more time to assess the impact of 370 segment duration D s on the shift detection performance (Objective 5). Different D s 371 choices were evaluated against varying number of injected tag shifts (i.e. k) to explore 372 the relationship between user specified segment duration D s and the expected tag shift 373 interval (determined by k). For each {D s , k} combination, 50 random runs were made 374 over all datasets to calculate the average precision and recall of shift detection.

375
In addition to the bottlenose dolphin datasets, DTag [1] data from a wild humpback 376 whale (22.03 hours) and a beluga whale (2.25 hours) were included to evaluate the 377 method and demonstrate the gait analysis capability (Objective 6).

379
Among all 100 random runs over the 18 datasets (Objective 1), the average precision 380 for shift instance detection is 0.87, the average recall is 0.89 while the average error is   e. A, B, and C). Condition A represents pose calculated from simulated data after the simulated tag shifts have been corrected using the proposed method. Condition B presents pose calculated from the original data (without tag shift). Condition C stands for pose calculated from the original data (without tag shift) using Madgwick's filter [24], which involves the additional use of a gyroscope. The direct difference (e.g., A − B) is used to detect a bias in the difference, while the absolute difference (e.g., |A − B|) returns the magnitude of the difference. Pose angle differences are in degree, and each cell gives a mean ± standard deviation. To assess the sensitivity of the proposed methods (Objective 4), the computation 389 experiments were repeated with virtually injected tag rotations that had random 390 direction and fixed degrees. The average precision and recall for the detection of these 391 injected tag shift instances are shown in Figure 7-Left. With a 10 degrees rotation 392 offset, less than 30% of the injected shifts were detected, while with a 20 degrees offset, 393 ∼54% of the shifts were detected with a detection precision of ∼79%. When the offset 394 reaches 30∼40 deg, the method's performance starts being more reliable with a recall in 395 the 70∼80 percentile and precision being ∼85%. When the offset reaches 50 degrees and 396 above, the method's performance converges to ∼90% precision and recall.  shift (i.e., no relative motion between tag and animal was detected). 422 Figure 10 presents example data segments from one of the bottlenose dolphin (left) 423 and the beluga whale (right) datasets, where the pose of the animal was calculated from 424 the corrected body coordinates' data and the gait of the animal was characterized using 425 the pitch dp (dynamic pitch) of the animal. The mean fluking period of this bottlenose 426 dolphin is 1.0 s with an average amplitude of 14.1 degrees. The mean fluking period of 427 the beluga whale is 1.6 s with an average amplitude of 16.8 degrees. For the humpback 428 whale dataset, the mean fluking period is 6.7 s with an amplitude of 12.2 degrees.  Another reason for missed detections could be that the tag shift was too small to be 451 detected. The method's sensitivity to shifting angles was investigated accordingly and 452 presented in Figure 7. False positives (i.e., detections that did not correspond to a tag 453 shift) were generated when the animals switched from one gait to another (very 454 different) gait. For example, the method could be tricked when the animal changed from 455 a gait without any roll to a sideways swimming gait (i.e., swimming with ∼90 degrees 456 roll). In further developments, the method's performance could be improved by taking 457 into account events associated with high acceleration impacts to the tag, as tag shifts 458 were often caused by physical impact to the tag [1], such as an impact from a conspecific 459 animal in the group. Another aspect to be investigated in future development is the 460 detection and management of consecutive shifts that happened within a period of time 461 that can not be treated as one time instance (see footnote 5 ). It is beyond the scope of 462 this work to tackle the situation where the tag is constantly shifting.

463
To decouple the evaluations of tag shift detection and tag orientation correction, the 464 tag orientation correction method was applied to each of the data segments transformed 465 by a rotation. Poses (roll, pitch, and yaw) of the animal were calculated after orientation 466 correction and then compared with poses computed using the original (un-rotated) data. 467 The average differences between the two were within 11 degrees in all cases (Table 1- Orientation spheres for a bottlenose dolphin (left column), a humpback whale (center column), and a beluga whale (right column). The plot of accelerometer data clustered by depth speed is referred to as orientation sphere. After detecting tag shifts and correcting tag orientation misalignment, the top row of subplots presents the orientation spheres in the animal's body coordinates. The middle row shows the data in the tag coordinates before any correction. The bottom row visualizes the orientation correction method being applied to an uncorrected data segment. The dolphin dataset (left column) contains 4 simulated tag shifts. The humpback whale dataset (center column) has 5 detected tag shifts. While the beluga dataset (right column) has no detected tag shifts (i.e., no relative motion between tag and animal was detected). Example data segments from a bottlenose dolphin (left) and a beluga whale (right) with animal's gait parameterized via dynamic pitch (pitch dp ). When the animal has a big roll angle (e.g., during the time around 240 seconds in the bottlenose dolphin dataset), the fluking 'signature' (i.e., the sinusoidal fluctuations in each signal channel) transfers from pitch to yaw in the orientation estimations. P itch dp is used to have a pose invariant descriptor of the gait of the animal, that is with respect to the animal itself rather than the environment. Inactive swimming periods (e.g., gliding) are automatically identified in pitch dp while fluking frequency and amplitude are calculated from pitch dp , which can be used for further gait analysis.
method can work reliably no matter where the tag was located as long as the given data 470 segment did not contain a tag shift. One thing to note in particular is that the errors 471 associated with pitch are higher than roll and yaw by a few degrees (Table 1- With this 'aligned' tag placement, the animal swimming in a horizontal direction would 476 have a measured pitch centered around negative 6∼7 degrees instead of 0 degrees. In 477 other words, the pitch measure returned after tag orientation correction could be more 478 accurate than that obtained directly from an 'aligned' tag.  Because measurements associated with gravity (a2 & a3) are needed for estimating 498 animal pose, a1 needs to be decoupled from a2 and a3. An accurate decoupling would 499 not be possible using an accelerometer alone. But because these animals' specific 500 accelerations are generally much smaller than gravity, a low-pass filter can be applied to 501 attenuate a1 and a2 to approximately decouple specific acceleration measurement (a1) 502 from gravity (a2 & a3).

503
To better decouple specific acceleration (a1) from gravity (a2 & a3), [33] proposed a 504 magnetometer approach that takes advantage of the fact that a magnetometer is only 505 sensitive to orientation changes, not acceleration. The method assumes that 506 high-frequency body orientation changes are due to the 'pitching' motion of the animal. 507 It relies on this assumption to use the magnetometer to assist in finding a2, with a3 508 obtained via low-pass filtering and a1 the remaining acceleration after subtracting a2 509 and a3. The method works well in decoupling a1 from a2 and a3 for most cases.

510
However, we note that because the method assumes high-frequency body orientation 511 changes in the pitching plane, the process tends to be unstable when the animal does 512 quick back-and-forth rolling or turning. The method is implemented in the toolbox 513 proposed in this work, and we recommend using it for animals with less frequent 514 back-and-forth rolling or turning. For tags that have a gyroscope, together with an 515 accelerometer and magnetometer, a gradient descent-based filtering approach [24] 516 (Madgwick 's approach) can be used to better estimate the tag's orientation wrt the 517 world. The method uses the gyroscope to directly measure a2, thus reducing uncertainty 518 in the measurement. A wrapper of Madgwick's approach is also included in the toolbox, 519 and we recommend using it when gyroscope measurements are available.

520
Even though the relative orientation of the tag was corrected to be aligned with the 521 December 7, 2021 19/23 animal, the actual location of the tag (e.g., back vs. peduncle) could still affect tag 522 measurements and results, particularly the estimated fluking amplitude of the animal. 523 For example, a tag located closer to the fluke will have a higher estimated fluking 524 amplitude than a tag located near the dorsal fin for the same gait. So, the fluking 525 amplitude would be a good indicator of animal gait for fine-scale studies (e.g., 526 comparing an animal's fluking amplitude between descent vs. ascent), but not for global 527 comparisons (e.g., comparing one animal to another, with different tag locations). On 528 the other hand, the fluking frequency and period are not affected by the tag's location 529 and can be used for fine-scale studies and global investigations.

530
The orientation spheres (Figure 9) can also serve as a visualization tool for animal 531 behavior studies. For example, a clear sign of lateralized behavior [34] appears in the 532 orientation sphere of the humpback whale ( Figure 9-Center Column), with an 533 unbalanced right 'wing' corresponding to a dominating left roll of the animal during 534 foraging at the ocean bottom. Also, this humpback whale did not roll much during 535 ascending/descending while the bottlenose dolphin ( Figure 9-Left Column) and beluga 536 whale ( Figure 9-Right Column) rolled more frequently during ascending/descending.

537
Even though the beluga whale rolled frequently, it hardly ever rolled completely upside 538 down, which can be observed from the empty bottom of the orientation sphere. Unlike 539 the beluga, the dolphin data shown in Figure 9 indicate that the animal rolled all the 540 way around during the studied period. In this regard, the presented orientation sphere, 541 to a degree, resembles the m-sphere generated using magnetometer data in [35] as well 542 as the o-sphere for visualizing animal's head orientation in [31]. from bottlenose dolphins, a humpback whale, and a beluga whale were used to validate 552 and demonstrate the approach. Results show that the average relative orientation error 553 of the tag wrt the dolphin's body after processing were within 11 degrees in roll, pitch 554 and yaw directions. In addition, the average precision and recall for identifying relative 555 tag motion were 0.87 and 0.89, respectively. Examples of the resulting pose and gait 556 analysis demonstrate the potential of this approach in gait analysis and animal 557 behavioral studies. The proposed analysis approach and software will facilitate the use 558 of biologging tags to study cetacean locomotion and behavior. The method and 559 software is applicable to cetacean data from any tag platform that uses an 560 accelerometer, magnetometer, and pressure sensor.