Detecting and measuring respiratory events in horses during exercise with a microphone: deep learning vs. standard signal processing Authors: Jeanne I. M. Parmentier, Rhana M. Aarts, Elin Hernlund, Marie Rhodin, Berend Jan van der Zwaag Published: 2026 ABSTRACT BackgroundMonitoring respiration parameters such as respiratory rate could be beneficial to understand the impact of training on equine health and performance and ultimately improve equine welfare. In this work, we compare deep learning-based methods to an adapted signal processing method to automatically detect cyclic respiratory events and extract the dynamic respiratory rate from microphone recordings during high-intensity exercise in Standardbred trotters.ResultsOur deep learning models are able to detect exhalation sounds (median F1 score of 0.94) in noisy microphone signals and show promising results on unlabelled signals at lower exercise intensity, where the exhalation sounds are less recognisable. Temporal convolutional networks were better at detecting exhalation events and estimating dynamic respiratory rates (median F1: 0.94, Mean Absolute Error (MAE) ± Confidence Intervals (CI): 1.44 ± 1.04 bpm, Limits Of Agreements (LOA): 0.63 ± 7.06 bpm) than long short-term memory networks (median F1: 0.90, MAE ± CI: 3.11 ± 1.58 bpm) and signal processing methods (MAE ± CI: 2.36 ± 1.11 bpm).ConclusionThis work is the first to automatically detect equine respiratory sounds and automatically compute dynamic respiratory rates in exercising horses. In the future, our models will be validated on lower exercise intensity sounds and different microphone placements will be evaluated in order to find the best combination for regular monitoring.Supplementary InformationThe online version contains supplementary material available at https://doi.org/10.1186/s12917-026-05614-5. Background Respiration parameters, including breathing patterns, respiratory rate (RR), inhalation-exhalation ratio, respiratory sounds and locomotor-respiratory coupling represent critical physiological aspects in exercising horses. Quantitative and qualitative analyses of these parameters during exercise may contribute to a better understanding of performance mechanisms and respiratory function in horses [1]. Horses are obligate nose breathers meaning that they cannot switch to oronasal breathing like humans. The equine upper respiratory tract (URT) includes the nostrils, nasal passages, pharynx, and larynx and is essential for moving air in and out during respiration, with inspiratory and expiratory airway flows reaching 65–75 L/s and 60–80 L/s respectively during exercise [2]. In comparison, human literature reported maximum nasal airflows of about 3.5 L/s during the inspiratory phase and 4.8 L/s during the expiratory phase [3]. Resulting peak tracheal pressures in horses were reported as −18 mmHg to −37 mmHg during inhalation and 6 mmHg to 20 mmHg during exhalation for normal horses during maximal exercise [2]. Any airway disorder can become performance limiting and also a relevant welfare problem as horses may experience breathlessness [4]. Upper respiratory tract disorders are common in horses and may be associated with abnormal respiratory sounds during exercise [5]. For example, noises like high-frequency “whistling” or “roaring” during inspiration are described for horses with laryngeal dysfunction [6, 7] while low-frequency expiratory noises are described for horses with dorsal displacement of the soft palate [6]. Other described respiration abnormalities are tachypnoea (abnormally high respiratory rate), coughing, frequent swallowing [8], breath holding, or abnormal breathing patterns [5]. The current gold standard for URT disorder diagnosis is via an upper airway endoscopy, either at rest or during exercise. This technique provides medical images of the URT yet requires veterinary intervention and interpretation. Moreover, endoscopic analysis is a (minimally) invasive procedure with risks of discomfort for the animal and of damaging the mucosal membranes during the insertion of the endoscope through the nasal cavity. Specialised equine face masks were also developed to quantify airflow and other respiratory parameters during exercise [9–11] but they restrict ventilation [12], are often impractical and can therefore be considered invasive too. Digital stethoscopes with radio-transmission were developed [13] and used in different studies to characterise respiratory sounds [14], locomotor-respiratory coupling [15] or response to exercise [16]. The quality of the recorded sounds using stethoscopes is highly dependent on the placement and the absence of friction with the hair or skin during locomotion. In the past decades, several studies have explored the use of microphones to study respiratory sounds and characterised sounds and patterns relative to pathologies, showing promising perspectives to detect upper-airway disorders in horses [17–19]. These first steps motivate further exploration of microphone data for monitoring equine respiration during training. Most studies using microphones were conducted on treadmills with Thoroughbred horses (gallop racing) or Standardbred horses (racing trotters). While these controlled conditions are valuable, they do not fully reflect field conditions [20], especially not for harness trotters which are trained and raced with a sulky. Few studies implemented microphone measurements during field trials, but their analyses of the respiratory rate were limited by the segmentation of respiratory sounds. These were manually counted to extract an average respiratory rate [1, 21], overlooking fluctuations over time. These fluctuations can be especially interesting in trotting animals for which, contrary to cantering or galloping animals, the respiratory cycle is not always coupled to the locomotor cycle [15, 22]. In the equine field and as far as the authors know, only a single recent explorative work has shown that microphone data can be automatically labelled with exhalation events [23] (F1 scores above 85%), but this study had looked at only one deep learning model type and had not yet explored automatic computation of relevant physiological indicators. The human field is a length ahead as several studies were published in which microphone data were used to monitor various aspects of respiration. Most of these are focused on the detection of specific sound types in lung, tracheal or nasal sound recordings in a controlled environment [24], or during low intensity tasks where the respiration sounds are usually relatively quiet and subsequent respiratory rate is low [25, 26]. In recent years, some studies in the human literature combined the advances in smartphone technology and in wearables or small portable microphones to monitor respiratory sounds and extract respiratory rates during higher intensity exercises such as running or general exercising, using either simple signal processing methods [27, 28] or exploiting deep learning models such as recurrent networks and convolutional networks [29] for more advanced and complex tasks. The strength of these models lies in their ability to either learn temporal characteristics of the signals or automatically extract local features relevant for the given task and apply learnt concepts on new, unseen data, making them good candidates for respiratory sounds detection. These models can be used to process audio features, spectrograms or even raw signals, enabling the further exploration of the potential of the recorded sounds. This study aims at automatically 1) detecting cyclic respiratory events in recordings obtained with a simple off-the-shelf omni-directional stereo microphone attached to the nose of harness trotters and 2) computing respiratory rates using detected events. To this end, we trained two types of sequence-to-sequence deep learning (DL) classifiers with manually labelled signals of different sources (microphone channels) and sampling frequencies recorded at high-speed trot. From the outputs of our models, we computed dynamic respiratory rates. In parallel, we also adapted a simple signal processing (SP) method published in the human literature [28] to dynamically estimate the respiratory rates from our microphone signals. Finally, we apply our models and the signal processing method to unlabelled audio recordings obtained at lower speed with less respiratory intensity. Materials and methods Horse population Fifteen privately-owned Standardbred trotters in full training were included in this study (5 mares, 5 geldings, 5 stallions, age: 3.0 ± 1.1 years old). All but two horses were kept at the same training stables, with the same trainer overseeing their training program. The other two were stabled in a nearby location with comparable housing conditions, and their own trainer. All horses were considered fit to work by their trainer when included in the study and did not have any known respiratory issues at the time of the study or prior to it. Horses did not show any clinical signs of respiratory illness, such as coughing and nasal discharge, during the study. Horses were provided with daily pasture turnout (6 to 8 h per day) and stabled overnight. They had ad-libitum access to fresh water and received roughage two times per day with additional concentrated fibrous feed four times a day, according to individual needs. Data collection Data collection took place at two different time points (April 2022 and June 2022), on the same track and similar weather conditions (sunny and dry, occasional clouds, and temperatures around 15–20 °C). During the data collection, no respiratory adverse conditions were noted (i.e., no pollen, strong winds, or large amounts of dust). Each horse was equipped with an omni-directional stereo microphone sampled at 44,100 Hz (ECM-LV1, Sony Group Corporation, Tokyo, Japan), and a voice recorder (ICD-Px470, Sony Group Corporation, Tokyo, Japan). The microphone was taped with adhesive foam bandage (Animal Polster, Snögg®, Orkla Health Norge, Oslo, Norway) between the two nostrils, with one channel in the middle (channel 1, c1) and one channel closer to the left nostril (channel 2, c2). The voice recorder was fixed to the cheek piece of the bridle and cables were secured with tape (Fig. 1). Horses were also equipped with 9 inertial measurement unit sensors recording 3D accelerations and 3D rotation speeds at 200 Hz (ProMove-mini, Inertia Technology B.V., Enschede, The Netherlands). One of the sensors was also equipped with a Global Navigation Satellite System (GNSS) chip which was used to record speed (1 Hz). The other sensors were not used for this study.Fig. 1Left: Horse equipped with data collection equipment and performing the standard exercise test. Right: close-up image of the microphone showing channel 1 (left arrow), channel 2 (right arrow) and voice recorder (ellipse) setup. Copyright: Rhana M. Aarts, Utrecht University Left: Horse equipped with data collection equipment and performing the standard exercise test. Right: close-up image of the microphone showing channel 1 (left arrow), channel 2 (right arrow) and voice recorder (ellipse) setup. Copyright: Rhana M. Aarts, Utrecht University All horses were individually driven by their usual driver (3 different drivers in total) and underwent a standardised exercise test for harness trotters on the same oval track (sand surface with particle size: 0–4 mm), with incrementally increasing trotting speeds (for the protocol, see Dubreucq et al. [30], Couroucé et al. [31] and Table 1). Drivers were instructed to aim at a predefined target speed for each segment to ensure uniformity across horses except for the high-speed trot segment (Table 1). For this segment, drivers were asked to aim for the target speed considering each horse’s individual capacity. Speed was monitored by the driver during the SET using a handheld stopwatch (TimerGPS Plus 2, Timer GPS Europe Oy, Oulunsalo, Finland). The two horses measured in April performed a similar SET but without the trot 2 and trot 3 and performed the high-speed segment on a shorter distance (Table 1).Table 1Overview of target and averaged speeds with covered distance for each segment during the SETTarget speedGNSS speedDistancekm/hkm/hmJog-start2019.41800Trot 12525.11000Trot 23029.61000Trot 33534.21000High-speed4037.9800* or 500**Jog-end2018.71800Jog-start, Trot 1, High-speed trot and Jog-end are based on N = 15 horses while Trot 2 and Trot 3 are based on N = 13, as H1 and H2 did not perform those speedsGNSS Global Navigation Satellite System*horses measured in April, and **horses measured in June Table 1Overview of target and averaged speeds with covered distance for each segment during the SETTarget speedGNSS speedDistancekm/hkm/hmJog-start2019.41800Trot 12525.11000Trot 23029.61000Trot 33534.21000High-speed4037.9800* or 500**Jog-end2018.71800Jog-start, Trot 1, High-speed trot and Jog-end are based on N = 15 horses while Trot 2 and Trot 3 are based on N = 13, as H1 and H2 did not perform those speedsGNSS Global Navigation Satellite System*horses measured in April, and **horses measured in June Overview of target and averaged speeds with covered distance for each segment during the SET Jog-start, Trot 1, High-speed trot and Jog-end are based on N = 15 horses while Trot 2 and Trot 3 are based on N = 13, as H1 and H2 did not perform those speeds GNSS Global Navigation Satellite System *horses measured in April, and **horses measured in June The last segment of high-speed trot, where horses were running 500 or 800 m and reached an average speed of 37.9 ± 1.5 km/h, was used to train the different models in this study. Respiration sounds were more distinguishable (louder with higher signal amplitudes) at higher compared to lower speeds, thus enabling manual labelling of the respiration events. Moreover, high-speed trot is a condition under which the respiratory system of the trotters is under pressure, further motivating this choice. Data processing Data labelling was conducted in Audacity® 3.4.2. [32], other data processing and models training were conducted in MATLAB R2024a (MathWorks, Natick, Massachusetts, USA). Data segmentation Data were segmented in speed bouts as defined earlier in Table 1, using measurement notes of the timestamps. Data labelling First, the audio recordings from segments of high-speed trot were displayed in Audacity® with both channels in stereo mode. Their respective Mel spectrograms (Scale 1–20,000 Hz, Hann window of 2048 samples, zero padding factor 2, gain of 20 dB and range of 80 dB) were also displayed. One author (J.I.M.P.) identified and labelled the exhalation sounds and patterns in the microphone data, using a slower playback speed if needed. Segments in which the horse was neighing were considered as “noise” and not further analysed. Labelled events were checked together with another author (R.M.A.). In case of doubts regarding an event, consensus was reached between the users by listening and visualising the surrounding events. Subsequently, .txt files with event timestamps were exported to MATLAB for further analysis. For each audio file, an associated label timeseries was created with 0 when there was no exhalation event and 1 when there was an exhalation event (see Fig. 2 for an illustration).Fig. 2Example of microphone signal of one horse (channel 2, blue) and associated manual labelling (green) Example of microphone signal of one horse (channel 2, blue) and associated manual labelling (green) Signals downsampling Because near-real-time applications require lower data rates, we also evaluated the effect of sampling frequency (Fs) on the automated detection of exhalation events. We downsampled the signals to 4410 Hz, 2100 Hz, 1050 Hz and 490 Hz. The MATLAB function downsample without offset was used with downsampling factors of 10, 21, 42 and 90 respectively. An example of downsampled signals is shown in Fig. 3.Fig. 3Example of downsampled signals for channel 1 for different sampling frequencies, compared to the initial sampling frequency (44100 Hz) Example of downsampled signals for channel 1 for different sampling frequencies, compared to the initial sampling frequency (44100 Hz) Respiratory events detection Architecture of the models For this work, we aimed at sequence-to-sequence classification (from microphone signals to “No Exhalation” (0) and “Exhalation” (1)) and compared two deep-learning model architectures: Long Short-Term Memory Network (LSTM) [33] and Temporal Convolutional Network (TCN) [34]. These two models were specifically chosen as their architecture focuses on learning sequential dependencies (LSTM) or extract local features (TCN) related to the output. Moreover, they already proved to be particularly well suited for event detection in biomedical signals [23, 35]. With the goal of reducing the complexity of the models while obtaining good detections, we also compared the performance of the models when trained with both stacked microphone channels as an input, or only channel 1 or only channel 2. For both LSTM and TCN, the data were first passed into a sequence input layer with a rescale-symmetric normalisation and the networks ended with a full connected layer, a softmax layer and a classification layer, with a cross-entropy loss function. Different depths of LSTM and TCN were evaluated, as described below. All models and depths were trained with the adam optimiser [36], a MiniBatch size of 8, an initial learning rate of 0.001, a validation patience of 10 epochs and a maximum of 100 training epochs. For each Leave-One-Out (LOO) iteration (see the Training and performance evaluation section), the best model, based on the lowest validation loss, was kept for further evaluation. LSTM Three depths of LSTM were tested in this work: 1, 2 and 4 blocks. Each block included a bilateral LSTM layer with 50 hidden units and a dropout layer as presented in Fig. 4.Fig. 4Building block of a Long Short-Term Memory model Building block of a Long Short-Term Memory model TCN Three depths of TCN were tested in this work: 4, 8 and 12 blocks. Each block is constituted of a 1D convolution network, a normalisation layer, a spatial dropout layer, another convolution network, another normalisation layer, a reLU layer and a spatial dropout layer as presented in Fig. 5.Fig. 5Building block of a Temporal Convolutional Network model Building block of a Temporal Convolutional Network model Training and performance evaluation Across all horses, 947 s of high-speed trot audio data were labelled. A total of 36 TCN detectors ((3 input types) x (4 sampling frequencies) x (3 building block depths)) and 36 LSTM detectors ((3 input types) x (4 sampling frequencies) x (3 building block depths)) were trained and tested (see Table 2). To train and evaluate our detectors, we used the Leave-One-Out method, meaning that each model architecture was trained and evaluated 15 times with a different train-validation-test set. Each horse was kept unseen once for the test set, one horse was randomly selected to form the validation set and the remaining horses were used for training. For each testing iteration, a confusion matrix was built and the precision, recall and subsequently F1 score were computed. If an F1 score could not be computed (i.e., recall and precision equal to 0), a score of 0 was attributed. The best models were the ones with higher median F1 score and narrower interquartile range (IQR).Table 2Summary of the input data and model types and depthsParametersUsed valuesInputchannel 1, channel 2 or both channelsSampling frequency490, 1050, 2100 or 4410 HzModelLSTM or TCNDepth LSTM1 block, 2 blocks or 4 blocksDepth TCN4 blocks, 8 blocks or 12 blocksLSTM Long Short-Term Memory, TCN Temporal Convolutional Network Table 2Summary of the input data and model types and depthsParametersUsed valuesInputchannel 1, channel 2 or both channelsSampling frequency490, 1050, 2100 or 4410 HzModelLSTM or TCNDepth LSTM1 block, 2 blocks or 4 blocksDepth TCN4 blocks, 8 blocks or 12 blocksLSTM Long Short-Term Memory, TCN Temporal Convolutional Network Summary of the input data and model types and depths LSTM Long Short-Term Memory, TCN Temporal Convolutional Network Application to unlabelled data Unlabelled downsampled data (4410 Hz and 2100 Hz) from segments of lower intensity (Trot 1 in Table 1, average speed of 25.11 ± 2.33 km/h) were used as input in the TCN and LSTM models. Time needed to compute the outputs of the models was quantified using the tic toc function of MATLAB and was expressed as a percentage of the duration of the input data. Respiratory rate estimation When studying respiratory rate patterns in exercising horses, published works focused on single RR values computed over one window of 20.48 s [1, 21]. As shown in a previously published work by Aarts et al. [37] and described in the Noise and respiratory sounds section, horses can dynamically change their respiratory patterns during high-intensity exercise. Therefore, computing a dynamic respiratory rate might be more relevant to monitor performance and health, as well as and better understand equine response to exercise. To capture dynamic changes in respiratory rates, expressed in breath per minute (bpm), we opted for analysis sliding windows of 10 s with an overlap of 5 s. This enables to quantify trends in RR dynamicity while disregarding minor changes. Reference The manually labelled events were used as the reference method. For each subwindow w of 10 s, the duration of the N respiratory cycles (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${T}^{w}\left(n\right)$$\end{document}) was computed (Eq. 1) and used to calculate the average respiratory rate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm{RR}_\mathrm{Reference}\left(w\right)$$\end{document} (Eq. 2) such as: 1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${T}^{w}\left(n\right)={t}_\mathrm{event}\left(n+1\right)-{t}_\mathrm{event}\left(n\right)$$\end{document} 2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm{RR}_\mathrm{Reference}\left(w\right)=\frac{60}{N}{\sum}_{n=1}^{N}\frac{1}{{T}_{n}^{w}}$$\end{document} An example is shown in Fig. 6, top panel, where the green line represents the reference signal and the black diamonds the reference respiratory events.Fig. 6Comparison of the respiratory event obtention for the reference method (manual labelling of the Exhalation events, top panel), the deep learning method (automated labelling of the Exhalation events, middle panel) and the signal processing method (bottom panel). This example is obtained with the channel 2 microphone output (blue lines), downsampled at 4410 Hz. The signals used for respiratory events obtention are shown with the green lines, the respiratory events used to compute the duration of the respiratory cycles (Tw(n)) are highlighted by black diamonds. Ref: Reference, DL: deep learning, SP: signal processing, c2: channel 2, Resp. Signal: respiratory signal, Resp. Event: respiratory event Comparison of the respiratory event obtention for the reference method (manual labelling of the Exhalation events, top panel), the deep learning method (automated labelling of the Exhalation events, middle panel) and the signal processing method (bottom panel). This example is obtained with the channel 2 microphone output (blue lines), downsampled at 4410 Hz. The signals used for respiratory events obtention are shown with the green lines, the respiratory events used to compute the duration of the respiratory cycles (Tw(n)) are highlighted by black diamonds. Ref: Reference, DL: deep learning, SP: signal processing, c2: channel 2, Resp. Signal: respiratory signal, Resp. Event: respiratory event Deep learning method The output of each DL model (LSTM, TCN) was post-processed for each subwindow of 10 s before RR estimation, in order to remove exhalation events that were detected erroneously. The following steps were followed, with threshold values chosen based on previous investigations:Computation of the moving average (0.10 s) to smooth the output (MvAvg)Thresholding of the MvAvg amplitude: ≥ 0.10 is Exhalation, < 0.10 is No ExhalationComputation of the moving variance (0.10 s) of the absolute microphone signal used (if both channels, the average of channel 1 and channel 2 is used) (MvVar)For each exhalation detected, if the MvVar amplitude is below 0.80 then the Exhalation event is discarded. Computation of the moving average (0.10 s) to smooth the output (MvAvg) Computation of the moving average (0.10 s) to smooth the output (MvAvg) Thresholding of the MvAvg amplitude: ≥ 0.10 is Exhalation, < 0.10 is No Exhalation Thresholding of the MvAvg amplitude: ≥ 0.10 is Exhalation, < 0.10 is No Exhalation Computation of the moving variance (0.10 s) of the absolute microphone signal used (if both channels, the average of channel 1 and channel 2 is used) (MvVar) Computation of the moving variance (0.10 s) of the absolute microphone signal used (if both channels, the average of channel 1 and channel 2 is used) (MvVar) For each exhalation detected, if the MvVar amplitude is below 0.80 then the Exhalation event is discarded. For each exhalation detected, if the MvVar amplitude is below 0.80 then the Exhalation event is discarded. The respiratory events were defined as the beginning of the detected exhalation events. For each subwindow, the envelope of the microphone signal was extracted, detrended using the detrend function in MATLAB and peaks were detected with a minimum distance of 0.30 s [37]. If no peak was present within a respiratory event, it was considered as erroneous detection and was discarded. The duration of the respiratory events and the average RR over each window was computed as described in equations (Eq. 1) and (Eq. 2) respectively. Events with a distance below 0.30 s [37] were discarded. An example is shown in Fig. 6, middle panel, where the green line represents a post-processed DL output signal and the black diamonds the obtained respiratory events. Signal processing method A signal processing (SP) method was also applied to the microphone signals (channel 1 or channel 2), based on the method described by Romano et al. [28] (differences are indicated by *). For the whole segment of high-speed data, the following steps were followed:Removal of the mean of the microphone signalFiltering of the signal:for the signals downsampled at 2100 Hz and 4410 Hz: bandpass filter with cutting frequencies of [200, 800] Hzfor the signals downsampled at 1050 Hz and 490 Hz: high-pass filter with cutting frequency of 200 HzComputation of the absolute of the Hilbert transform of the signal, and subsequent smoothing with a moving average filter (0.1 s)Down or upsampling of the resulting output to 1000 HzBandpass filter with cutting frequencies of [0.01, 3] * Hz Removal of the mean of the microphone signal Removal of the mean of the microphone signal Filtering of the signal:for the signals downsampled at 2100 Hz and 4410 Hz: bandpass filter with cutting frequencies of [200, 800] Hzfor the signals downsampled at 1050 Hz and 490 Hz: high-pass filter with cutting frequency of 200 Hz Filtering of the signal:for the signals downsampled at 2100 Hz and 4410 Hz: bandpass filter with cutting frequencies of [200, 800] Hzfor the signals downsampled at 1050 Hz and 490 Hz: high-pass filter with cutting frequency of 200 Hz for the signals downsampled at 2100 Hz and 4410 Hz: bandpass filter with cutting frequencies of [200, 800] Hz for the signals downsampled at 2100 Hz and 4410 Hz: bandpass filter with cutting frequencies of [200, 800] Hz for the signals downsampled at 1050 Hz and 490 Hz: high-pass filter with cutting frequency of 200 Hz for the signals downsampled at 1050 Hz and 490 Hz: high-pass filter with cutting frequency of 200 Hz Computation of the absolute of the Hilbert transform of the signal, and subsequent smoothing with a moving average filter (0.1 s) Computation of the absolute of the Hilbert transform of the signal, and subsequent smoothing with a moving average filter (0.1 s) Down or upsampling of the resulting output to 1000 Hz Down or upsampling of the resulting output to 1000 Hz Bandpass filter with cutting frequencies of [0.01, 3] * Hz Bandpass filter with cutting frequencies of [0.01, 3] * Hz Then, for each subwindow of 10 s**, the cyclic respiration events were obtained by:Detrending of the windowed signal, using the detrend function in MATLAB***Finding peaks with a minimum distance of 0.30**** seconds and a minimum height of 2% of the maximum peak height in the subwindow w of interestComputation of the respiratory events duration, where an event is a previously found peak, and subsequent computation of the average RR (equations (Eq. 1) and (Eq. 2) respectively) Detrending of the windowed signal, using the detrend function in MATLAB*** Detrending of the windowed signal, using the detrend function in MATLAB*** Finding peaks with a minimum distance of 0.30**** seconds and a minimum height of 2% of the maximum peak height in the subwindow w of interest Finding peaks with a minimum distance of 0.30**** seconds and a minimum height of 2% of the maximum peak height in the subwindow w of interest Computation of the respiratory events duration, where an event is a previously found peak, and subsequent computation of the average RR (equations (Eq. 1) and (Eq. 2) respectively) Computation of the respiratory events duration, where an event is a previously found peak, and subsequent computation of the average RR (equations (Eq. 1) and (Eq. 2) respectively) The main differences with the study from Romano et al. [28] were: * the cutting frequencies of the bandpass filters ([0.01, 2] in their study) which were too low for the equine respiration rate of our dataset; ** the window of analysis used to find the cyclic respiration events (30 s in their study). As our horses breathe faster than what was described for humans, dynamic RR changes can occur at a higher rate than every 30 s, and we therefore decided to compute our RR values on shorter windows of time; *** Roman et al. [28] did not describe a signal detrending step; **** in their study, Romano et al. [28] assumed that the minimum distance between two peaks was 0.70 s, which proved to be too high for our dataset [37]. An example is shown in Fig. 6 bottom panel, where the green line represents the final SP output signal and the black diamonds the obtained respiratory events as previously described. Reference, DL and SP comparison To compare the DL and SP methods to the reference RR, the mean absolute error (MAE) of each testing iteration n was computed such as: 3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{array}{ll}\mathrm{MAE}_\mathrm{Method}\left(n\right)=\frac{1}{W}{\sum}_{w=1}^{W}\\|\mathrm{RR}_\mathrm{Reference}\left(w\right)-\mathrm{RR}_\mathrm{Method}\left(w\right)|\end{array}$$\end{document} where W is the number of subwindows in the n th testing iteration. Subsequently the overall average, standard deviation (s.d.) and confidence intervals (CI) of the MAE for each method were computed such as: 4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\text{mean MAE}_\mathrm{Method}=\frac{1}{N}{\sum}_{n=1}^{N}\mathrm{MAE}_\mathrm{Method}(n)$$\end{document} 5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned}&\text{s.d. MAE}_\mathrm{Method}=\\&\sqrt{\frac{1}{N-1}{\sum}_{n=1}^{N}{\left(\mathrm{MAE}_\mathrm{Method}\left(n\right)-\text{mean MAE}_\mathrm{Method}\right)}^{2}}\end{aligned}$$\end{document} 6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\text{CI MAE}_\mathrm{Method}=1.96\times \frac{\text{s.d. MAE}_\mathrm{Method}}{\sqrt{N}}$$\end{document} where N is the number of testing iterations, i.e. one for each test horse. Additionally, means of differences (MOD) and 95% limits of agreements (LOA) between the reference and the DL and SP methods were computed and used to obtain Bland-Altman plots [38]. MOD and LOA were computed such as: 7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm{MOD}_\mathrm{Method}=\frac{1}{M}{\sum}_{m=1}^{M}\mathrm{RR}_\mathrm{Reference}\left(m\right)-\mathrm{RR}_\mathrm{Method}(m)$$\end{document} 8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm{LOA}_\mathrm{Method}=\pm 1.96\times \mathrm{s.d.}(\mathrm{RR}_\mathrm{Reference}-\mathrm{RR}_\mathrm{Method})$$\end{document} where M is the number of RRs extracted for each method. Statistical analysis In addition to the Bland-Altman analysis, we evaluated the distribution of the RR estimation errors. We also estimated the effect sizes for each RR estimation model. Finally, for the ten best performing models, we evaluated whether the estimated RRs were significantly different than the reference RRs. The exact methodologies and the results are available in the Supplementary Material 2. Application to unlabelled data The outputs from the DL models and the unlabelled data described in the Signals downsampling section were post-processed following the steps in the Training and performance evaluation section and average respiratory rates were computed for each subsegment. Similarly, the raw microphone signals of unlabelled data were computed with the SP method as described in the Application to unlabelled data section to obtain RR values. Results Noise and respiratory sounds The audio files did not only reveal respiratory sounds. Other types of sound and noise like jangling of the tack, hoof beats on the ground and talking of the drivers, together with environmental sounds such as the chirping of birds and the wind could be identified. Neighing of the horses was easily detected and showed to saturate the microphone sensors. Of the respiratory sounds, the exhalation events were the most recognizable and thus reliable to label at faster speeds (i.e., “normal trot” and “fast trot” compared to lower speeds as during the warming-up or cooling-down). Regardless of the speed, inhalation sounds were harder to detect, especially in shallow breathing horses. Respiratory events detection Labelled data The detector performances are shown in Fig. 7 and Table 3.Fig. 7Performance of the different Long Short-Term Memory (LSTM) and Temporal Convolutional Network (TCN) detectors expressed as F1 score for each sampling frequency (490, 1050, 2100 and 4410 Hz). The columns represent the depth of the LSTM or TCN (1 block/4 blocks are the shallowest detectors, 4 blocks/12 blocks are the deepest respectively). Each row corresponds to the input microphone data (channel 1, channel 2, both channels). Dots represent classification outliers, full red lines represent the F1 score of 0.9 (target), dotted red lines represent the F1 score of 0.5 (random detector)Table 3Results of the best 10 (before double-line) and worst 2 exhalation detectors (after double-line), based on the median and IQR values of the F1 scoresRankModelDepthInputFsF1 scoreF1 score(Hz)MedianIQR1TCN8both10500.9440.0222TCN8both44100.9410.0383TCN8both21000.9400.0264TCN12c244100.9390.0285TCN8c244100.9390.0466TCN12both44100.9370.0347TCN12c210500.9370.0348TCN12both21000.9370.0349TCN8c210500.9370.03710TCN12both10500.9360.036LSTM2c144100.7740.147LSTM4c144100.7640.353IQR Interquartile range, TCN Temporal Convolutional Network, LSTM Long Short-Term Memory, Fs Sampling frequency, c1 Channel 1, c2 Channel 2, both Both channels Performance of the different Long Short-Term Memory (LSTM) and Temporal Convolutional Network (TCN) detectors expressed as F1 score for each sampling frequency (490, 1050, 2100 and 4410 Hz). The columns represent the depth of the LSTM or TCN (1 block/4 blocks are the shallowest detectors, 4 blocks/12 blocks are the deepest respectively). Each row corresponds to the input microphone data (channel 1, channel 2, both channels). Dots represent classification outliers, full red lines represent the F1 score of 0.9 (target), dotted red lines represent the F1 score of 0.5 (random detector) Table 3Results of the best 10 (before double-line) and worst 2 exhalation detectors (after double-line), based on the median and IQR values of the F1 scoresRankModelDepthInputFsF1 scoreF1 score(Hz)MedianIQR1TCN8both10500.9440.0222TCN8both44100.9410.0383TCN8both21000.9400.0264TCN12c244100.9390.0285TCN8c244100.9390.0466TCN12both44100.9370.0347TCN12c210500.9370.0348TCN12both21000.9370.0349TCN8c210500.9370.03710TCN12both10500.9360.036LSTM2c144100.7740.147LSTM4c144100.7640.353IQR Interquartile range, TCN Temporal Convolutional Network, LSTM Long Short-Term Memory, Fs Sampling frequency, c1 Channel 1, c2 Channel 2, both Both channels Results of the best 10 (before double-line) and worst 2 exhalation detectors (after double-line), based on the median and IQR values of the F1 scores IQR Interquartile range, TCN Temporal Convolutional Network, LSTM Long Short-Term Memory, Fs Sampling frequency, c1 Channel 1, c2 Channel 2, both Both channels The best performing models were the TCN with 8 blocks, trained with both channels sampled at 1050, 4410 or 2100 Hz (median F1 score: 0.944, 0.941 and 0.940 and IQR: 0.022, 0.038 and 0.026 respectively), followed by TCN models of 12 blocks and 8 blocks trained with channel 2 sampled at 4410 Hz (median F1 score: 0.939 and IQR: 0.028 and 0.046 respectively). Similar results are obtained with TCN 8 and 12 blocks, trained with both channels sampled at 4410 and 1050 Hz respectively. Overall, LSTM models showed lower median F1 scores and larger IQR values than TCN, especially when trained with channel 1. Better results were obtained with both channels or with channel 2, compared to channel 1. The best detection results of channel 1 were obtained with signals sampled at 2100 Hz and the TCN 8 blocks (F1 median 0.913 IQR 0.071). LSTMs trained with channel 1 data showed larger IQR values, regardless of the depth or the sampling frequency. For the LSTMs of 2 and 4 blocks trained with channel 1 signals, increasing the sampling frequency decreased the detection performance. Long Short-Term Memory models with a depth of 2 blocks and trained with both channels showed a slight increase of performance with higher sampling frequencies, especially with narrower IQR values (F1 median 0.842 IQR 0.121 at 490 Hz and F1 median 0.881 IQR 0.051 at 4410 Hz). Temporal Convolution Networks were less sensitive to the downsampled frequency when trained with channel 2 and both channels. When trained with channel 1, increasing the sampling frequency slightly increased the median F1 score and reduced the IQR values. Shallower LSTMs with a depth of 1 block showed a worse performance compared to deeper models but doubling the depth from 2 to 4 blocks did not radically increase the exhalation detection performance. Similarly, increasing the depth of the TCN slightly increased the performance when trained with data from channel 1 but there were no remarkable differences for models trained with channel 2 or both channels. The optimum combination was the TCN 8 blocks trained with both channels, with sampling frequencies above 490 Hz. Unlabelled data Due to the lack of reference labels, F1 scores were not computed for the unlabelled data. However, visual comparison of the outputs of the models and the signals showed that the models were able to detect exhalation events. These events were used to compute RR values, further presented in the Respiratory events detection section. Examples of promising and unfavourable raw outputs are presented in Supplementary Fig. 16A and B (Supplementary Material 1) respectively. The computation durations needed for each DL model per input and sampling frequencies are shown in Fig. 8. Temporal Convolutional Networks were much faster than LSTM models regardless of the input data or the sampling frequency used. For example, TCN of 4 blocks required 3.89% of the segment duration to label the data of both channels sampled at 4410 Hz while LSTM required 5.58% of the segment duration. Downsampling the signals from 4410 to 2100 Hz generally decreased the computation duration of the models by almost half, regardless of the model type or the input data. There were no differences in computation durations between the TCN models of same depth using different input of data of the same sampling frequency. However, the computation durations of LSTMs were more sensitive to the input data used. Durations were always shorter when using both channels with LSTM of depth 1 block or when using channel 1 with LSTM of depth 2 and 4 blocks.Fig. 8Boxplots of the exhalation events labelling computation duration expressed as percentage of the total segment duration, per model type and depth, sampling frequency and input data. Dotted lines serve as indicators for the 5% and 10% marks. LSTM: long short-term memory, TCN: temporal convolutional network Boxplots of the exhalation events labelling computation duration expressed as percentage of the total segment duration, per model type and depth, sampling frequency and input data. Dotted lines serve as indicators for the 5% and 10% marks. LSTM: long short-term memory, TCN: temporal convolutional network Model sizes ranged from 90 KB (LSTM 1 block) to 2005 KB (TCN 12 blocks). There were no differences in model size between models trained with data sampled at 4410 or 2100 Hz and a difference of 1.2–1.6 KB between the models trained with one or both channels. Respiratory rate estimation Labelled data Respiratory rate results are shown in Table 4 and Fig. 9, 10, 11 and in Fig. 12 for each horse. Deep learning models that could not detect exhalation events for at least one testing iteration were disregarded for this section as no RRs could be computed reliably (n = 1/36 LSTM models). All SP and TCN models were able to compute RRs, regardless of the input data or the downsampling rate used.Table 4Results of the best 10 respiratory rate estimators, based on the MAE and CI rangesRankModelDepthInputFsMAE ± CIMODLOA(Hz)(bpm)(bpm)(bpm)1TCN8both44101.44 ± 1.040.637.062TCN12both44101.67 ± 1.190.487.703TCN8both21001.76 ± 1.300.369.274TCN12both21002.25 ± 1.31−0.189.485TCN12c244102.42 ± 1.69−0.9912.506TCN8c244102.43 ± 1.33−0.5610.337TCN12c144102.47 ± 1.110.7311.358SPn.ac244102.48 ± 1.480.3110.509TCN12c221002.67 ± 1.60−0.9013.4310TCN8both4902.64 ± 1.69−0.5110.49Fs Sampling frequency, MAE Mean absolute error, CI Confidence intervals, MOD Mean of differences, LOA Limits of agreement, bpm Breaths per minute, TCN Temporal convolutional network, SP Signal processing, c1 Channel 1, c2 Channel 2, both Both channelsFig. 9Mean absolute errors and associated confidence intervals for respiratory rates computation per input data, model and model depths. RR: respiratory rate; MAE: mean absolute error; CI: confidence intervals; LSTM 1, 2, 4: long short-term memory network of depth 1, 2 or 4 blocks; TCN 4, 8, 12: temporal convolutional network of depth 4, 8 or 12 blocks; SP: signal processingFig. 10Bland-Altman plots comparing the respiratory rates obtained with the best 8 methods to those obtained with the reference method (manual selection). Each dot represents the average respiratory rate computed over a subwindow of 10 s. Full lines represent the MOD; dotted lines represent MOD ± LOA. SP: signal processing, TCN: temporal convolutional network, LSTM: long short-term memory, c1: channel 1, c2: channel 2, Ref: reference, Est: estimated, MOD: mean of differences, LOA: limits of agreement, bpm: breaths per minuteFig. 11Corresponding correlation plots. Black lines represent perfect linear relationship between the two methods. Red lines represent the fitted linear regression model between the two methods. R2 values show the fitness of the linear regression model. Each dot represents the average respiratory rate computed over a subwindow of 10 s. SP: signal processing, TCN: temporal convolutional network, LSTM: long short-term memory, bpm: breaths per minuteFig. 12Mean and confidence intervals values of reference and estimated respiratory rates across all extracted subwindows per horse (top panels) obtained with the outputs of TCN 8 blocks, using both channels sampled at 4410 Hz (left) or with the SP method applied to channel 2 sampled at 4410 Hz (right). RR: respiratory rate, TCN: temporal convolutional network, LSTM: long short-term memory, SP: signal processing, bpm: breaths per minute Table 4Results of the best 10 respiratory rate estimators, based on the MAE and CI rangesRankModelDepthInputFsMAE ± CIMODLOA(Hz)(bpm)(bpm)(bpm)1TCN8both44101.44 ± 1.040.637.062TCN12both44101.67 ± 1.190.487.703TCN8both21001.76 ± 1.300.369.274TCN12both21002.25 ± 1.31−0.189.485TCN12c244102.42 ± 1.69−0.9912.506TCN8c244102.43 ± 1.33−0.5610.337TCN12c144102.47 ± 1.110.7311.358SPn.ac244102.48 ± 1.480.3110.509TCN12c221002.67 ± 1.60−0.9013.4310TCN8both4902.64 ± 1.69−0.5110.49Fs Sampling frequency, MAE Mean absolute error, CI Confidence intervals, MOD Mean of differences, LOA Limits of agreement, bpm Breaths per minute, TCN Temporal convolutional network, SP Signal processing, c1 Channel 1, c2 Channel 2, both Both channels Results of the best 10 respiratory rate estimators, based on the MAE and CI ranges Fs Sampling frequency, MAE Mean absolute error, CI Confidence intervals, MOD Mean of differences, LOA Limits of agreement, bpm Breaths per minute, TCN Temporal convolutional network, SP Signal processing, c1 Channel 1, c2 Channel 2, both Both channels Mean absolute errors and associated confidence intervals for respiratory rates computation per input data, model and model depths. RR: respiratory rate; MAE: mean absolute error; CI: confidence intervals; LSTM 1, 2, 4: long short-term memory network of depth 1, 2 or 4 blocks; TCN 4, 8, 12: temporal convolutional network of depth 4, 8 or 12 blocks; SP: signal processing Bland-Altman plots comparing the respiratory rates obtained with the best 8 methods to those obtained with the reference method (manual selection). Each dot represents the average respiratory rate computed over a subwindow of 10 s. Full lines represent the MOD; dotted lines represent MOD ± LOA. SP: signal processing, TCN: temporal convolutional network, LSTM: long short-term memory, c1: channel 1, c2: channel 2, Ref: reference, Est: estimated, MOD: mean of differences, LOA: limits of agreement, bpm: breaths per minute Corresponding correlation plots. Black lines represent perfect linear relationship between the two methods. Red lines represent the fitted linear regression model between the two methods. R2 values show the fitness of the linear regression model. Each dot represents the average respiratory rate computed over a subwindow of 10 s. SP: signal processing, TCN: temporal convolutional network, LSTM: long short-term memory, bpm: breaths per minute Mean and confidence intervals values of reference and estimated respiratory rates across all extracted subwindows per horse (top panels) obtained with the outputs of TCN 8 blocks, using both channels sampled at 4410 Hz (left) or with the SP method applied to channel 2 sampled at 4410 Hz (right). RR: respiratory rate, TCN: temporal convolutional network, LSTM: long short-term memory, SP: signal processing, bpm: breaths per minute Overall, TCN models performed better with smaller MAE and CI values, narrower LOA (Table 4), and good correlations and agreements with the reference RR values obtained with the manual labels (Figs. 10 and 11). Using lower sampling frequencies slightly decreased the estimation performance when using both channels or channel 2 (TCN 8 blocks, both channels: MAE ± CI 1.44 ± 1.04 bpm and 1.76 ± 1.30 bpm, LOA: 7.06 bpm and 9.27 bpm, at 4410 and 2100 Hz respectively) but better estimations were obtained at 490 Hz compared to 1050 Hz for TCN 8 blocks, with both channels or channel 2 (Fig. 12). The best TCN model presented a MOD of 0.63, meaning a slight overall underestimation of the RR values. This is especially observable for H5 and H9 in Fig. 12. In comparison, LSTM models’ outputs were not as good to compute RR values and presented larger LOA. Best LSTM results were obtained with a depth of 4 blocks and with both channels sampled at 4410 Hz (MAE ± CI: 3.52 ± 3.11 bpm, LOA: 14.03 bpm), or sampled at 2100 Hz with 1 or 4 blocks (MAE ± CI: 4.61 ± 5.70 bpm and 4.90 ± 5.91 bpm, LOA: 21.08 bpm and 18.23 bpm respectively). Overall, SP methods adapted from Romano et al. [28] using channel 2 performed well with MAE and CI values below 4 bpm and LOA below 13 bpm. The best SP results were obtained with channel 2 sampled at 4410 Hz (Table 4); these displayed good correlations and agreements with the RR obtained with the manual labels. Using lower sampling frequencies decreased the RR estimation performance for the SP method regardless of the input data used (Fig. 9). While using channel 1 led globally to the worst results for the DL models with MAE values above 10 bpm and LOA above 35 bpm, TCN models of 12 blocks and SP methods were still able to estimate RR values using channel 1 sampled at 4410 Hz (MAE ± CI: 2.47 ± 1.11 bpm and 3.27 ± 1.89 bpm, LOA: 11.35 bpm and 14.28 bpm). Unlabelled data Results for the unlabelled signals are presented in Figs. 13 and 14, as well as in Table 5. Overall, our average RR values are below the ones reported in Cotrel et al. [1]. In their work, reported speeds were higher (minimum 30 km/h) compared to the speeds of the segment of unlabelled data used for in this study (average 25.11 km/h).Fig. 13Boxplots of the average respiratory rates computed with channel 1, channel 2 or both channels and different depths of LSTM and TCN models, and with the SP method for each horse over a whole segment of unlabelled data at a lower intensity. LSTM: long short-term memory, TCN: temporal convolutional network, SP: signal processing, #1, #2, #3: LSTM or TCN depth, such as #1: 1 block (LSTM) or 4 blocks (TCN); #2: 2 blocks (LSTM) or 8 blocks (TCN); #3: 4 blocks (LSTM) or 12 blocks (TCN), bpm: breaths per minuteFig. 14Respiratory rates computed with channel 1, channel 2 or both channels for each horse over a whole segment of unlabelled data at a lower intensity. bpm: breaths per minute; TCN: temporal convolutional network; LSTM: long short-term memory, SP: signal processingTable 5Mean, standard deviation and confidence interval values of the respiratory rates obtained on unlabelled data. Results are compared to the maximum and minimum values reported in Cotrel et al. [1]ModelDepthInputMean RRs.d. RRCI(bpm)(bpm)(bpm)LSTM1c168.0524.5412.42LSTM1c284.1018.199.21LSTM1both72.6117.268.73LSTM2c166.7624.1512.22LSTM2c282.4220.1210.18LSTM2both72.6216.898.55LSTM4c168.4324.5012.40LSTM4c283.9118.709.46LSTM4both70.4517.799.00TCN4c172.2324.9512.63TCN4c285.2416.878.54TCN4both73.2317.748.98TCN8c169.6224.0812.19TCN8c282.7518.419.32TCN8both71.9818.449.33TCN12c176.5622.8811.58TCN12c286.1317.138.67TCN12both73.9317.638.92SPn.ac187.4318.099.15SPn.ac288.4619.429.83Cotrel et al. (max)n.an.a112.8019.80n.aCotrel et al. (min)n.an.a87.6017.40n.aRR Respiratory rate, s.d. Standard deviation, CI Confidence intervals, LSTM Long short-term memory, TCN Temporal convolutional network, SP Signal processing, c1 Channel 1, c2 Channel 2, both Both channels, bpm Breaths per minute Boxplots of the average respiratory rates computed with channel 1, channel 2 or both channels and different depths of LSTM and TCN models, and with the SP method for each horse over a whole segment of unlabelled data at a lower intensity. LSTM: long short-term memory, TCN: temporal convolutional network, SP: signal processing, #1, #2, #3: LSTM or TCN depth, such as #1: 1 block (LSTM) or 4 blocks (TCN); #2: 2 blocks (LSTM) or 8 blocks (TCN); #3: 4 blocks (LSTM) or 12 blocks (TCN), bpm: breaths per minute Respiratory rates computed with channel 1, channel 2 or both channels for each horse over a whole segment of unlabelled data at a lower intensity. bpm: breaths per minute; TCN: temporal convolutional network; LSTM: long short-term memory, SP: signal processing Table 5Mean, standard deviation and confidence interval values of the respiratory rates obtained on unlabelled data. Results are compared to the maximum and minimum values reported in Cotrel et al. [1]ModelDepthInputMean RRs.d. RRCI(bpm)(bpm)(bpm)LSTM1c168.0524.5412.42LSTM1c284.1018.199.21LSTM1both72.6117.268.73LSTM2c166.7624.1512.22LSTM2c282.4220.1210.18LSTM2both72.6216.898.55LSTM4c168.4324.5012.40LSTM4c283.9118.709.46LSTM4both70.4517.799.00TCN4c172.2324.9512.63TCN4c285.2416.878.54TCN4both73.2317.748.98TCN8c169.6224.0812.19TCN8c282.7518.419.32TCN8both71.9818.449.33TCN12c176.5622.8811.58TCN12c286.1317.138.67TCN12both73.9317.638.92SPn.ac187.4318.099.15SPn.ac288.4619.429.83Cotrel et al. (max)n.an.a112.8019.80n.aCotrel et al. (min)n.an.a87.6017.40n.aRR Respiratory rate, s.d. Standard deviation, CI Confidence intervals, LSTM Long short-term memory, TCN Temporal convolutional network, SP Signal processing, c1 Channel 1, c2 Channel 2, both Both channels, bpm Breaths per minute Mean, standard deviation and confidence interval values of the respiratory rates obtained on unlabelled data. Results are compared to the maximum and minimum values reported in Cotrel et al. [1] RR Respiratory rate, s.d. Standard deviation, CI Confidence intervals, LSTM Long short-term memory, TCN Temporal convolutional network, SP Signal processing, c1 Channel 1, c2 Channel 2, both Both channels, bpm Breaths per minute With the DL models, average RR values increased depending on the input used. They were lowest when computed with channel 1 and highest when computed with channel 2. This difference can be explained by the fact that the signal-to-noise ratio was much lower at low-intensity exercising, especially in channel 1, compared to higher-intensity segments used to train the models. Moreover, the DL output post-processing steps used a threshold value applied to the microphone signal(s) of interest. Channel 1 is the channel further away from the nostrils compared to channel 2, and some peaks might have been removed during the post-processing steps, as the amplitude of the respiratory sounds captured by channel 1 may be too low. Likewise, RR obtained with both channels are also lower than those from channel 2 only, as an average of the two signals was used. This is especially visible in Fig. 14 for horses H2, H8, H10 or H15, suggesting that the sounds could not be properly detected by our proposed methods with both channels. All methods detected low RR values for H7 (< 50 bpm), regardless of the input data. Upon checking, we manually counted about 21 exhalation sounds for 30 s of recording, which led to a respiratory rate of 42 bpm. On the other hand, for H15, we counted about 49 exhalation sounds for 30 s of recording leading to a RR of 98 bpm. The SP model estimated this RR value correctly using channel 2 but the DL models underestimated this value. Discussion This work is the first to demonstrate the feasibility of automated exhalation events detection from downsampled respiratory recordings, and subsequent respiratory rate computation, during high-intensity exercising of harness trotters. We showed that using deep learning models, exhalation events could automatically and accurately be detected without extensive signal processing, and that near-real-time respiratory rates could be computed from said events. Finally, we showed that our results outperformed a previously published signal processing method from the human literature that we adapted for our application to equine data. Respiratory events detection Detecting respiratory events during exercise is important to monitor changes in breathing patterns and associated physiological parameters. In this work, we focused on the detection of the exhalation events as they were the most prominent sounds in our audio recordings. Regardless of the speed, inhalation sounds were harder to detect, especially in shallow breathing horses. One of the proposed reasons is that environmental noises drown the inhalation sounds at lower speeds, since less air is transported during breathing, when compared to higher speeds which require more effort and thus more strenuous breathing. Interestingly, different respiration patterns were heard between horses in terms of frequency, consistency and type of sound. Some horses appeared to be very constant in their breathing pattern (inhalation-exhalation-inhalation), whereas others skipped a breath, possibly due to swallowing, or appeared to show two small in- or exhalation bouts instead of one long breath (inhalation-inhalation-exhalation). The types of sounds varied from clean respiration with no additional or unexpected noises, to respiration with “floppy nostrils” (otherwise described as “high blower” by Attenburrow [14]) or respiration with roaring sounds. Examples of different respiration sounds and patterns are available in the Supplementary Materials. The intra- and inter-horses variations in our dataset confirmed that the use of a LOO method to test our models was a relevant choice. Our models trained with both channels performed better than when trained with channel 2 only, and the worst performances were obtained when training with channel 1 only. This is in accordance with our previously published results for TCN models [23]. Channel 2 was the closest to the source of the sound of interest, presented a higher signal-to-noise ratio and would even be able to capture lower amplitude sounds at lower intensity. Moreover, as performances generally increased when including channel 1 to channel 2 in our models, our results suggest that the simultaneous recording of the surrounding noise helps the models to better identify the target sounds by potentially cancelling out the noises present in the signals from channel 2, similarly to standard noise cancellation signal processing methods [39]. Our TCN models performed better than our LSTM models, which is in accordance with empirical results obtained by Bai et al. [34]. Furthermore, TCN models are less computationally costly and the run time to train this kind of model is much lower than the one required by LSTM models, making them interesting candidates for tasks involving large and complex biological signals. They also presented lower computational durations than LSTM models when predicting or classifying input data, which is also useful for (near) real-time applications (Fig. 8). However, TCN model files were larger than LSTM ones, which might have been accounted for when designing a system for near real-time respiratory rate monitoring. Labelling respiratory sounds at lower speed is especially challenging in noisy environments like equine exercising sessions. With the DL models, we found some increased RR values depending on the input data used. This difference can be explained by the fact that the signal-to-noise ratio was much lower at low-intensity exercising, especially in channel 1, compared to higher-intensity segments used to train the models. Moreover, the DL output post-processing steps used a threshold value applied to the microphone signal(s) of interest. Channel 1 is the channel further away from the nostrils compared to channel 2, and some peaks might have been removed during the post-processing steps, as the amplitude of the respiratory sounds captured by channel 1 may be too low. In the absence of ground truth methodology such as a flowmeter mask, the labelling process relies on the hearing of the respiratory sounds and visualisation of the signals and their spectrograms. Supplementary Fig. 15 A and B show examples of respiratory signals from horses at lower speed and higher speed respectively where the differences in signal amplitude and Mel spectrogram are appreciable. Despite these differences, our models could detect exhalation events in data from a new condition with a lower signal-to-noise ratio and where the respiratory sounds had a lower amplitude compared to higher speed recordings. To confirm these first results, further labelling of our microphone signals will be necessary. Respiratory rate estimation Respiratory rate is an important physiological aspect of equine health and performance that has been quantified until now by the manual counting of respiratory events in video recordings (endoscope), radio-stethoscope recordings or audio signals (microphone) of 20.48 s and more [1, 14, 16, 21]. In this work, we showed for the first time that equine RR could be automatically estimated from microphone signals in a fine-grained manner in high-intensity exercising horses. Our methods accurately detected RR values ranging from 60 to 160 bpm in windows of 10 s using standard signal processing methods (MAE ± CI: 2.48 ± 1.48 bpm, MOD: 0.31 bpm, LOA: 10.50 bpm) or by using the outputs of our exhalation events detectors (MAE ± CI: 1.44 ± 1.04 bpm, MOD: 0.63 bpm, LOA: 7.06 bpm). In our work, most good performing DL models slightly underestimated the RR values (positive means of differences), which was due to a slightly early detection of the exhalation event, while other DL models slightly overestimated RR values (negative means of differences), which can be due to a confusion between exhalation events and other types of sound from the microphone signals. Extra pre-processing steps to clean the microphone signals or the models’ outputs could be helpful to improve detection and consequently respiratory rate estimation. This is also supported by the fact that by adapting a signal processing-based method published in the human literature [28], RR could also accurately be estimated from respiratory sounds at high-speed. Using the SP method, we obtained slightly larger LOA values than the ones at the running highest running speed reported by Romano et al. [28] (10.5 bpm vs 8.93 bpm) but lower MAE and MOD (MAE: 2.48 bpm vs 3.8 bpm and MOD: 0.31 bpm vs −0.01 bpm). Considering that our range of respiratory rate is larger (around 60–160 bpm vs around 25–45 bpm), we can conclude that we successfully adapted their method to a highly noisy, dynamic and diverse new application. The TCN models and the SP method were more robust to the microphone location than the LSTM models. While better results were obtained with channel 2 than with channel 1 with the SP method, the differences were marginal (best results: MAE 2.36 bpm, LOA 10.43 bpm with channel 2, MAE 3.36 bpm and LOA 14.36 bpm with channel 1). The best DL results for channel 1 were obtained with TCN 12 blocks, which performed slightly worse compared to when using channel 2 only (MAE: 2.47 and 2.42 bpm, LOA: 11.35 and 15.50 bpm, respectively). This is encouraging for testing microphone placements further away from the nostrils to a more practical location which would allow for an easier use. Regardless of the method employed, better results were obtained at higher sampling frequencies. For a standalone performance monitoring system, lower sampling rates are preferred as they would lead to lower computational costs and lower battery consumption [40], ultimately providing a wearable solution with low maintenance needs for the users. However, for clinical monitoring or to support diagnosis of URT pathologies, sampling frequencies as high as 8–9 kHz are desired as abnormal sounds were occasionally described in the 2–4 kHz band in roarers, at around 3.8 kHz in horses with induced laryngeal hemiplegia or in the 1.1–2.7 kHz range for horses with dynamic laryngeal collapse [17–19]. In our previously published study, we showed that excellent exhalation events detection performances were obtained with signals downsampled to 8820 Hz [23], representing a good trade-off between clinical functionality (signals bearing the clinical information) and user-friendliness (longer battery life, lower computational costs), which could therefore be used for clinical applications in the future. Limitations Amount of data Our study is limited by the low number of horses and exercising intensities included in the analysis which could lead to overfitting from the deep learning models, despite the high between- and within-individuals variations in the respiratory sounds and respiratory rates. To take this into account, we implemented safeguarding steps to avoid overfitting in our deep learning models such as dropout layers and early stopping based on validation loss. In the future, adding more labelled data should improve the performance and robustness of our models. Optimal models and labels While we conducted a hyperparameter search, we focused on a limited range of possible hyperparameters. More optimal DL models might exist outside of the ones defined in this study, especially regarding the LSTM architecture. As LSTM models were more computationally demanding, we did not explore further this architecture in the context of this study. Moreover, only two users labelled the data and the final labels, mainly from one user, were used after consensus. Due to the high sampling rate of the microphone signals and due to the nature of audio signals, identifying the exact beginning and end of the exhalation events was complex, which can lead to uncertainty and noise in our final labels. Noisy labels can have an impact on deep learning models performance, which has been described in image analysis [41]. To mitigate the effects of noisy labels on the performance of events detection in audio signals, noise-robust loss functions were proposed and could be implemented and evaluated in our future works [42]. Health status We did not consider the cardiorespiratory health of the population from this study, which could affect the results of our models and of the signal processing method. For example, studies have shown that horses with dynamic laryngeal collapse present high frequency noise during inhalation [19], which could be detected by our models or by the signal processing method as an event and therefore artificially increase the estimated respiratory rate. Microphone placement The final limitation is the microphone placement. The microphone was taped to the nose of the horses, which can be impractical in everyday practice. In the future, we will collect respiratory data with different microphone placements and consequently fine-tune and re-evaluate our models accordingly. Conclusion In conclusion, this study showed that relevant equine respiratory sounds during high-intensity exercising can be captured with a cheap off-the-shelf microphone, and respiratory events can be automatically detected and labelled by deep learning models from the audio signals. Respiratory rates at high-speed trot can be obtained through signal processing methods or through deep learning by using the previously detected events. At lower speed, both deep learning and signal processing methods seem to be able to estimate respiratory rates but fine-tuning and validation will be required especially for microphone placements further away from the sound source. These results are promising for different applications such as regular monitoring of health and performance of sport horses but also early detection of abnormal respiratory sounds or monitoring of vocalisation related to the emotional valence [43] during training without the need for more invasive and expensive methods. In the future, other physiological parameters can be estimated such as the inhalation-exhalation ratio to further assess the temporal precision of our models. Additionally, synchronising microphone signals to motion sensor signals will allow for a more holistic health and performance monitoring and will allow further exploration of equine respiratory mechanisms. Supplementary Information Supplementary Material 1. Supplementary Material 2. Supplementary Material 1. Supplementary Material 2.