A supervised machine-learning model trained on digital stethoscope recordings collected from pre-weaned dairy calves in Canada, Italy, and Sweden accurately distinguished normal respiratory acoustics from abnormal lung sounds with an overall classification accuracy of 0.816 and a receiver operating characteristic area under the curve of 0.930 on an independent held-out internal test set. The multicenter proof-of-concept investigation, published in Frontiers in Animal Science, evaluated tree-based algorithmic architectures applied to classical acoustic descriptors while enforcing an animal-linked, group-aware validation partition designed to prevent optimistic performance inflation caused by data leakage. While clinical examination routinely incorporates thoracic auscultation to detect pathological changes within pulmonary airways, conventional acoustic assessment has long been constrained by subjective human interpretation, variable inter-observer diagnostic agreement, and ambient farm noise that obscures respiratory signals in commercial calf barns.
To establish an objective and computationally reproducible framework for respiratory acoustic assessment, an international team of researchers assembled a multicenter bioacoustic repository of 1,360 digital thoracic recordings gathered between January 2025 and April 2026 across commercial dairy farms and institutional research facilities. Canadian acoustic recordings were obtained from a previously characterized dairy calf cohort, Italian data were prospectively acquired from commercial dairy operations in Lombardy via mobile veterinary clinic units and a calf-rearing facility in Sicily, and Swedish recordings were collected from rearing units and the Swedish University of Agricultural Sciences research dairy farm at Lövsta. Digital auscultation was conducted bilaterally over the mid-thoracic region of both hemithoraces using a standardized handheld digital stethoscope connected wirelessly to an electronic mobile interface. The instrumentation operated exclusively in dedicated pulmonary auscultation mode at minimum amplification to preserve acoustic consistency across international collection sites, recording fifteen-second mono audio signals at a digital sampling frequency of 4,000 hertz while calves were gently restrained under routine barn conditions.
Every recording was independently reviewed by two veterinary observers and categorized according to standardized bovine lung-sound nomenclature into one of five mutually exclusive acoustic categories: Normal sounds, Crackles, Wheezes, Increased Breath Sounds, and Increased Bronchial Sounds. Initial diagnostic agreement between the primary observers reached 98.9 percent across 1,345 of the 1,360 total recordings, while the fifteen discrepant acoustic profiles were resolved through structured joint consensus re-examination incorporating dual-observer listening and auditory spectrogram inspection. Before any predictive modeling commenced, the acoustic dataset underwent stringent, predefined quality filtration that evaluated the presence of interfering cardiac rhythms, vocalizations, environmental barn machinery, and hair-friction artifacts. Only 424 recordings, representing 31.2 percent of the initial collection, satisfied predefined acoustic quality scores requiring either isolated lung sounds or breath sounds accompanied by minor hair-friction noise occupying less than one-third of the acoustic duration, resulting in the exclusion of 936 suboptimal recordings.
The curated audio collection was further refined by excluding 39 recordings that failed predefined acoustic inclusion criteria due to ambiguous or isolated transient events, expiratory crackles occurring with inspiratory wheezes, or complex mixed acoustic patterns, predominantly combinations of increased breath sounds with fine crackles where fewer than thirty eligible examples existed across the study. Furthermore, an algorithmic duplicate audit identified five redundant pairs of identical audio files, leading to the removal of five duplicate entries and yielding a final analytical dataset of 380 unique audio files representing 230 distinct animal ear-tag grouping identifiers. In recordings retaining minor hair friction, contaminated segments were visually identified on audio spectrograms and excised prior to automated feature computation. Technical quality evaluations verified that all 380 retained files loaded correctly at 4,000 hertz without near-silent amplitudes below the defined threshold or digital clipping exceeding normalized full-scale limits, exhibiting an overall mean duration of 13.02 seconds and a mean root-mean-square amplitude level of minus 48.90 decibels.
To investigate which acoustic characteristics best support algorithmic discrimination, the investigators extracted 107 numerical descriptors from each unsegmented, unnormalized mono audio file, computing time-domain amplitude measures, zero-crossing rates, spectral centroid, spectral bandwidth, spectral roll-off at an 85 percent cumulative energy threshold, and 20 mel-frequency cepstral coefficients using a frame window of 512 samples with a hop step of 256 samples. Summary statistics across time frames provided recording-level means, standard deviations, minima, and maxima. The research team formulated three prespecified feature subsets to evaluate model dependency on signal amplitude and technical recording duration: the full 107-feature all-numeric set, a 94-feature non-amplitude set that eliminated amplitude summaries, root-mean-square metrics, and the first mel-frequency cepstral coefficient to mitigate variations in recording energy, and a 92-feature core-acoustic set that further removed recording duration and total sample counts, thereby evaluating purely spectral and envelope-based acoustic properties.
Data partitioning and validation protocols were specifically engineered to avoid information leakage between experimental stages. Because multiple recordings obtained from the same calf inevitably share animal-specific acoustic resonances, anatomical chest wall dimensions, or baseline microphone positioning traits, distributing recordings from an identical animal across training and test subsets could artificially inflate classification performance. To eliminate this confounding factor, the researchers implemented a stratified, animal-linked five-fold grouping procedure that constrained all recordings sharing a common ear-tag identifier entirely to either the training partition or the held-out test partition. This yielded a training partition containing 304 recordings across 185 unique calf identifiers and an untouched, held-out internal evaluation partition of 76 recordings across 45 unique calf identifiers, while precisely preserving the proportional representation of all five lung-sound classes across both partitions without examining test outcomes during algorithmic development.
Within the 304-recording training partition, four distinct tree-based supervised machine-learning algorithms—Random Forest, Extra Trees, Gradient Boosting, and Histogram-based Gradient Boosting—were systematically evaluated across eight prespecified hyperparameter configurations per algorithm under five-fold stratified group-aware cross-validation using class-balanced sample weighting. Across 288 candidate configurations involving 1,440 individual model fits, candidate architectures were ranked by mean validation macro-averaged F1 score, applying lower cross-validation standard deviation and higher weighted F1 score as sequential tiebreakers. For the primary binary objective of discriminating normal from abnormal lung sounds, an Extra Trees classifier utilizing the 94-feature non-amplitude subset achieved the top ranking with a cross-validation macro-F1 score of 0.843, an accuracy of 0.862, and a weighted-F1 score of 0.860, closely matching an equivalent 92-feature core-acoustic Extra Trees configuration that demonstrated a macro-F1 of 0.842.
Following cross-validation selection, the winning binary model was fitted once to the entire 304-recording training set and subsequently deployed onto the 76-recording held-out internal test cohort using an uncalibrated classification decision threshold of 0.50. On this independent test set, which comprised 26 normal recordings and 50 abnormal recordings, the Extra Trees classifier demonstrated balanced accuracy of 0.814, macro-F1 of 0.802, weighted-F1 of 0.819, and an average precision of 0.963. Group-aware non-parametric bootstrap resampling over 5,000 iterations yielded 95 percent confidence intervals spanning 0.71 to 0.90 for accuracy, 0.697 to 0.918 for abnormal class sensitivity, and 0.625 to 0.947 for normal class specificity. In absolute recording counts, the algorithm correctly identified 41 of 50 abnormal lung recordings while misclassifying nine as normal, and accurately classified 21 of 26 normal acoustic samples while misidentifying five as abnormal, producing a positive predictive value of 0.891 and a negative predictive value of 0.700 under the observed 65.8 percent abnormal test prevalence.
Analysis of Gini impurity-based feature importance revealed that mel-frequency cepstral coefficients provided the primary predictive signal for distinguishing normal from abnormal calf respiratory acoustics, representing the dominant contributors among top-ranked individual variables and accounting for 60.6 percent of total model importance within the twenty highest-ranked features. The three most influential predictors were the temporal mean values of the second, fourth, and fifth mel-frequency cepstral coefficients, exhibiting individual relative importances of 0.135, 0.100, and 0.061, respectively. When evaluated as mean importance per variable within feature families, zero-crossing rate descriptors ranked highest, followed by spectral bandwidth and cepstral coefficients, while recording duration and sample count collectively accounted for just 0.92 percent of overall importance. This finding confirms that binary diagnostic classification was driven by fundamental spectral envelope distributions rather than incidental file length differences between recording sessions.
In contrast to the robust discrimination observed in binary classification, performance declined markedly when machine-learning models were tasked with fine-grained multiclass categorization. An exploratory three-class task grouping sounds into Normal, Adventitious (crackles and wheezes), and Increased sounds (increased breath and bronchial sounds) selected a Gradient Boosting model with 92 core-acoustic features that achieved an internal test macro-F1 of 0.607 and an accuracy of 0.618. A five-class model trained to isolate each discrete acoustic category achieved an internal test macro-F1 of only 0.470 and an accuracy of 0.566. Normal sounds retained high class-specific sensitivity of 0.846 in multiclass evaluation, but sensitivity dropped sharply for pathological subclasses, falling to 0.522 for increased breath sounds, 0.455 for increased bronchial sounds, 0.375 for crackles, and 0.125 for wheezes, reflecting acoustic overlap, brief intermittent crackle duration, and lower representation of adventitious sounds in the training repository.
The study authors emphasize several vital methodological and clinical boundaries governing the interpretation of these findings, noting that the analytical dataset retained only 27.9 percent of originally gathered barn audio files and excluded complex mixed adventitious patterns, meaning the current model does not yet address the full spectrum of acoustic noise and biological heterogeneity present under commercial dairy farm conditions. Because validation was conducted internally within partition-separated calves from the same contributing research sites, the authors conclude that automated digital auscultation represents a promising first-level screening aid rather than an autonomous diagnostic replacement for veterinary clinical examination, necessitating extensive external validation across broader cattle breeds, housing environments, and clinical respiratory stages.
Subject of Research: Supervised machine learning classification of digital lung-sound recordings in pre-weaned dairy calves
Article Title: Leakage-aware supervised machine-learning classification of normal and abnormal calf lung-sound recordings: a proof-of-concept study
Article References: Ferraro, S., Tardiolo, G., Rubino, F., Gazzola, E., Cravana, C., Buczinski, S., & Boccardo, A. (2026). Leakage-aware supervised machine-learning classification of normal and abnormal calf lung-sound recordings: a proof-of-concept study. Frontiers in Animal Science, 7, Article 1966658. https://doi.org/10.3389/fanim.2026.1966658
Image Credits: AI Generated
DOI: 10.3389/fanim.2026.1966658
Keywords: bovine respiratory disease, digital auscultation, machine learning, dairy calves, veterinary medicine, bioacoustics, Extra Trees classifier, precision livestock farming, acoustic feature extraction, mel-frequency cepstral coefficients, respiratory acoustics, diagnostic technology, multicenter study, data leakage prevention, veterinary diagnostics, pulmonary sounds, group-aware validation
News Source: Teresa Odom. (November 18, 2026). Machine Learning Accurately Identifies Abnormal Lung Sounds in Pre-Weaned Dairy Calves. Scienmag.



