A cough detection and data management method and system based on deep learning and mahalanobis distance modeling

By employing deep learning and Mahalanobis distance modeling, this method utilizes a pre-trained Transformer model and a cough Gaussian distribution to calculate the Mahalanobis distance and adaptively adjusts the threshold. This addresses the issues of environmental sensitivity and low data management efficiency in existing technologies, achieving robust cough detection and data management across various environments.

CN121483624BActive Publication Date: 2026-05-19ZHEJIANG NORMAL UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG NORMAL UNIV
Filing Date
2026-01-08
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing cough detection technologies are sensitive to environmental changes, require a large number of negative sample annotations, are difficult to monitor trends over long periods, and lack support for dataset construction, making them unsuitable for cough detection and data management in various environments.

Method used

We employ a deep learning-based approach using Mahalanobis distance modeling. We extract high-dimensional feature vectors using a pre-trained audio spectrogram Transformer model, calculate Mahalanobis distance using a cough Gaussian distribution model, adaptively adjust the threshold, and manage the dataset through an index file to achieve robust cross-environment detection and efficient data management.

Benefits of technology

It reduces the cost of constructing and labeling negative samples, improves the cross-environment adaptability and accuracy of detection, realizes a closed loop of long-term monitoring and dataset construction, reduces deployment and maintenance costs, and improves the scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121483624B_ABST
    Figure CN121483624B_ABST
Patent Text Reader

Abstract

The application discloses a cough detection and data management method and system based on deep learning and Mahalanobis distance modeling, wherein the method comprises collecting continuous audio to be detected and performing pretreatment; then a plurality of sound segments are segmented from the continuous audio and input into an audio spectrogram Transformer model to obtain corresponding high-dimensional feature vectors; the Mahalanobis distance of the high-dimensional feature vector of each sound segment to a cough Gaussian distribution is calculated based on a pre-constructed cough Gaussian distribution model; each Mahalanobis distance is compared with an adaptive threshold value of the current environment, and a cough segment is determined through the comparison result; within a preset long time window, the determined cough segments are counted, and the cough duration is accumulated, and the number of coughs and the total cough duration with a time stamp are output. The method solves the problems in the existing cough detection technology, such as strong dependence on a large number of non-cough samples, sensitivity to environmental changes, difficulty in long-term trend monitoring, and lack of data set construction support.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of digital signal processing, artificial intelligence and medical health monitoring technology, and more specifically to a cough detection and data management method and system based on deep learning and Mahalanobis distance modeling. Background Technology

[0002] Currently, cough is an important symptom of many respiratory diseases. Continuous monitoring of changes in the frequency, intensity, and pattern of cough is of great significance for disease screening, efficacy evaluation, and early warning of disease deterioration. Existing technologies typically employ two types of methods for cough detection.

[0003] Methods based on feature engineering and traditional classifiers often use handcrafted features such as MFCC, formants, and spectral entropy, combined with traditional models like SVM, GMM, and HMM for cough / non-cough classification. These methods are sensitive to changes in noise levels, require manually designed features, and often necessitate extensive data collection and parameter tuning when transferring to new scenarios, resulting in poor robustness.

[0004] Supervised cough detection methods based on deep learning. With the development of deep learning, more and more methods employ convolutional neural networks, recurrent neural networks, or Transformer structures to automatically learn features from raw waveforms or time-frequency graphs to achieve cough detection or disease classification. These methods typically require simultaneously collecting and labeling a large number of cough and non-cough samples, and explicitly learning the discrimination boundary between cough and non-cough samples during the training phase.

[0005] However, in real-world use cases, there are numerous types of non-coughing sounds, including talking, ambient noise, and mechanical noise, making it difficult to cover all of them with a limited training set. Furthermore, once the deployment environment changes (such as replacing equipment or altering ambient noise), the model's threshold and performance can easily degrade, sometimes requiring retraining. At the same time, large-scale manual annotation of cough and non-coughing samples is extremely costly.

[0006] Furthermore, existing technologies suffer from the following shortcomings: Many methods focus only on cough detection results in a single recording, lacking statistical analysis of long-term cough pattern changes, making them difficult to directly apply to chronic disease management or disease trend monitoring; when constructing cough audio datasets, manual labeling of cough intervals from long recordings is usually required, which is inefficient, and tools supporting semi-automatic data cleaning and labeling are lacking; although some solutions propose using a classifier or anomaly detection, they lack a complete system design that combines it with pre-trained audio representations and considers adaptation to the recording environment and minimal user interaction.

[0007] Therefore, how to develop an efficient data system that can adapt to various environments, support long-term monitoring, and simultaneously address cough detection and data management, while relying solely on positive cough samples, is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0008] In view of the above problems, the present invention proposes a cough detection and data management method and system based on deep learning and Mahalanobis distance modeling to overcome or at least partially solve the above problems.

[0009] To achieve the above objectives, the present invention adopts the following technical solution:

[0010] In a first aspect, the present invention provides a cough detection method based on deep learning and Mahalanobis distance modeling, comprising the following steps:

[0011] S1. Acquire the continuous audio to be detected and preprocess the continuous audio;

[0012] S2. By using short-time energy analysis and noise-adaptive hysteresis thresholding, several audio segments are segmented from the preprocessed continuous audio.

[0013] S3. Input several audio segments into the pre-trained audio spectrogram Transformer model to obtain the high-dimensional feature vector corresponding to each audio segment.

[0014] S4. Based on the pre-built cough Gaussian distribution model, calculate the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution.

[0015] S5. Compare the Mahalanobis distance of each audio segment with the adaptive threshold of the current environment. If it is less than or equal to the adaptive threshold, the corresponding audio segment is determined to be a cough segment.

[0016] S6. Within a preset long time window, count the cough segments determined in step S5, accumulate the cough duration, and output the number of coughs and the total cough duration with timestamps.

[0017] Further, in S1, the preprocessing of the continuous audio includes:

[0018] The continuous audio is resampled, mono-ified, clipped to a fixed duration, and normalized in amplitude.

[0019] Furthermore, S2 specifically includes:

[0020] S21. Perform frame segmentation on the preprocessed continuous audio to obtain an audio frame sequence;

[0021] S22. Obtain the root mean square energy of each audio frame in the audio frame sequence, and convert the root mean square energy into a decibel value to obtain a decibel energy sequence;

[0022] S23. Smooth the decibel energy sequence to obtain a smoothed energy curve;

[0023] S24. Based on the smoothed energy curve, calculate its specified quantile as the noise floor threshold.

[0024] S25. Determine the start-up threshold and the stop-down threshold based on the noise floor threshold;

[0025] S26. A state machine is used to scan the smoothed energy curve frame by frame, and the start and end points of the audio segment are detected according to the start threshold and the stop threshold, thereby segmenting out several candidate audio segments.

[0026] S27. The candidate audio segments are integrated to obtain the final audio segments; the integration process includes: deleting candidate audio segments with a continuous frame count lower than the minimum duration threshold; and merging two adjacent candidate audio segments with a frame gap less than or equal to the merging interval threshold.

[0027] Furthermore, S3 specifically includes:

[0028] S31. Normalize the waveform length of each audio segment according to the preset target length;

[0029] S32. After performing a short-time Fourier transform on the normalized sound segment waveform, it is converted into a power Mel spectrum through a Mel filter bank; logarithmic operation is performed on the power Mel spectrum to obtain a logarithmic Mel spectrum feature map.

[0030] S33. Using a patch embedding layer, the log-Mel spectrum feature map is divided into multiple patches according to a preset frequency dimension and a preset time dimension;

[0031] S34. Map each patch to a D-dimensional feature space to obtain the patch sequence matrix corresponding to each patch;

[0032] S35. Input each patch sequence matrix into the Transformer encoder for encoding to obtain the corresponding multiple hidden vectors;

[0033] S36. Perform global average pooling on multiple hidden vectors to obtain the high-dimensional feature vector corresponding to each audio segment.

[0034] Further, in S4, the cough Gaussian distribution model is constructed through the following steps:

[0035] Obtain a set of high-dimensional sample feature vectors extracted from multiple positive cough samples using the audio spectrogram Transformer model;

[0036] Based on the set of high-dimensional sample feature vectors, the mean vector and covariance matrix of the cough class in the feature space are calculated; the covariance matrix is ​​calculated using a shrinkage estimation method.

[0037] Based on the mean vector and covariance matrix, a Mahalanobis distance function is constructed to characterize the Gaussian distribution model of cough.

[0038] The Mahalanobis distance of each positive cough sample is calculated using the Mahalanobis distance function to obtain the Mahalanobis distance distribution of multiple positive cough samples. Based on the Mahalanobis distance distribution of multiple positive cough samples, the distance value corresponding to the preset quantile is obtained as the initial global threshold for cough determination.

[0039] Further, in step S5, the adaptive threshold of the current environment is obtained through the following steps:

[0040] Based on the Mahalanobis distance set of all audible segments in the current continuous audio to be detected, and combined with prior information on the sparse temporal distribution of cough events, the Mahalanobis distance set is divided into an approximate cough cluster and an approximate non-cough cluster using at least one of the following methods: mixed distribution fitting, quantile constraint, or ranking heuristic.

[0041] Based on the approximate cough cluster and the approximate non-cough cluster, the adaptive threshold of the current environment is obtained by searching in the Mahalanobis distance set according to the preset adaptive threshold filtering rule;

[0042] If the search fails, the initial global threshold will be used as the adaptive threshold for the current environment.

[0043] Furthermore, the preset adaptive threshold filtering rule specifically includes:

[0044] Using the constraint that the proportion of the number of vocal segments contained in the approximate cough cluster to the total number of vocal segments is less than or equal to a preset proportion, multiple candidate thresholds are obtained by searching in the Mahalanobis distance set.

[0045] Among the multiple candidate thresholds, the candidate threshold with the smallest total value after weighted summation of the number of false alarm segments and the number of missed detection segments is selected as the adaptive threshold for the current environment.

[0046] Furthermore, it also includes: updating the adaptive threshold for the current environment based on user feedback; including:

[0047] Based on the timestamped number of coughs and total cough duration output by S6, the false positive non-cough segments and missed cough segments reported by users are collected, labeled and then feedback samples are obtained.

[0048] Extract the feature vector sets of falsely reported non-cough samples and missed cough samples from the feedback samples respectively;

[0049] Calculate the Mahalanobis distance from the feature vector of the false positive non-cough segment to the cough Gaussian distribution, and obtain its average deviation relative to the current adaptive threshold. Calculate the Mahalanobis distance from the feature vector of the missed cough fragment to the cough Gaussian distribution, and obtain its average deviation relative to the current adaptive threshold. ;

[0050] Based on average deviation and average deviation Update the adaptive threshold:

[0051]

[0052] in, The updated adaptive threshold; The current adaptive threshold; Average deviation The learning rate coefficient; Average deviation The learning rate coefficient.

[0053] Secondly, this invention provides a cough data management method based on deep learning and Mahalanobis distance modeling, including:

[0054] For all the audio segments that have been tested, the Mahalanobis distance will satisfy the Mahalanobis distance. The audio clips were selected as a high-confidence cough sample set; samples that met the Mahalanobis distance requirement were included. The audio clips were selected into a high-confidence non-coughing sample set; among them, For safety intervals;

[0055] Generate an index file that records the original audio file path, start and end times, Mahalanobis distance value, adaptive environment threshold, and current label for each sample in the high-confidence cough sample set and the high-confidence non-cough sample set;

[0056] The index file is imported into the data annotation and training system to construct or expand the cough audio dataset.

[0057] Thirdly, this invention provides a cough detection and data management system based on deep learning and Mahalanobis distance modeling, comprising:

[0058] An audio acquisition and preprocessing module is used to acquire continuous audio to be detected and to preprocess the continuous audio.

[0059] The audio segmentation module is used to segment several audio segments from preprocessed continuous audio through short-time energy analysis and noise-adaptive hysteresis thresholds.

[0060] The audio feature extraction module is used to input several audio segments into a pre-trained audio spectrogram Transformer model to obtain a high-dimensional feature vector corresponding to each audio segment.

[0061] The Mahalanobis distance calculation module is used to calculate the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution based on a pre-built cough Gaussian distribution model.

[0062] The cough segment detection module is used to compare the Mahalanobis distance of each audio segment with an adaptive threshold of the current environment. If the distance is less than or equal to the adaptive threshold, the corresponding audio segment is identified as a cough segment.

[0063] The window statistics module is used to count the identified cough segments within a preset long time window, accumulate the cough duration, and output the number of coughs and the total cough duration with timestamps.

[0064] The data management module is used to build or expand the cough audio dataset based on the Mahalanobis distance corresponding to all the audio segments that have been detected, as well as the cough label or non-cough label corresponding to each audio segment.

[0065] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a cough detection and data management method and system based on deep learning and Mahalanobis distance modeling, the beneficial effects of which include:

[0066] (1) Based solely on positive cough samples, this invention reduces the cost of constructing and labeling negative samples. In the high-dimensional representation space output by the pre-trained audio spectrogram Transformer model, the feature vectors of positive cough samples are used to estimate the mean vector and covariance matrix of a Gaussian distribution. The Mahalanobis distance is used to quantify the "cough similarity" of any audio segment. This eliminates the need to exhaustively enumerate or collect a large number of diverse non-cough sounds as negative samples in advance, avoiding the problems of difficult-to-define and exhaustive negative sample labels. This significantly reduces the cost of data preparation and model training, while fully utilizing the representational capabilities of the pre-trained model.

[0067] (2) Introducing an environment-adaptive threshold and a sparse cough prior, robust cross-environment detection is achieved with limited user feedback. This invention addresses the problem of significant differences in background noise and acoustic characteristics under different acquisition environments and device conditions. It statistically analyzes the Mahalanobis distance distribution of all audio segments within the same audio segment, and combines this with the prior constraint that "coughing occurs sparsely on the time axis" to adaptively determine the distance decision threshold for that audio segment. It also allows users to simply annotate a very small number of false alarms or missed detection segments, and uses lightweight rules to iteratively update the threshold. Compared to schemes using a fixed global threshold, this invention can adapt to different scenarios without frequent model retraining, reducing deployment and maintenance costs while maintaining high detection accuracy and low false alarm rate over long-term use.

[0068] (3) A data cleaning and dataset construction mode based on the same type of model to achieve detection and data closure. Based on the same set of pre-trained representations and a type of Mahalanobis model, this invention designs a data cleaning and dataset construction mode: performing sound segment detection and Mahalanobis distance calculation on a large number of unlabeled long-term recordings, automatically dividing high-confidence cough samples, high-confidence non-cough samples and uncertain samples through a dual threshold strategy, and writing the file path, start and end time and distance value of high-confidence samples into an index file for manual review and secondary labeling. In this way, a large-scale and high-quality cough audio dataset can be quickly constructed with less human intervention, and further used to train or incrementally update the cough detection model, thereby forming a closed loop of "detection-screening-labeling-retraining", improving the scalability and continuous evolution capability of the system.

[0069] (4) Modular design, easy to deploy and expand. This invention modularizes functions such as audio segmentation, feature extraction, single-class modeling, threshold calibration, long-term statistics and data cleaning, so as to achieve flexible deployment. It can choose to execute pre-trained model inference on the local terminal or in the cloud according to the computing power conditions, and has good engineering implementation and scalability. Attached Figure Description

[0070] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0071] Figure 1 This is a schematic diagram of the cough detection method based on deep learning and Mahalanobis distance modeling provided in an embodiment of the present invention.

[0072] Figure 2 This is a schematic diagram of the audio segment cutting module provided in an embodiment of the present invention.

[0073] Figure 3 This is a schematic diagram of the AST network model structure provided in an embodiment of the present invention.

[0074] Figure 4 This is a schematic diagram of the log-Mel module structure provided in an embodiment of the present invention.

[0075] Figure 5 This is a schematic diagram of the Transformer encoder module structure provided in an embodiment of the present invention.

[0076] Figure 6 This is a schematic diagram of the multi-head attention module structure provided in an embodiment of the present invention.

[0077] Figure 7 This is a flowchart of a cough data management method based on deep learning and Mahalanobis distance modeling provided in an embodiment of the present invention. Detailed Implementation

[0078] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0079] Example 1:

[0080] This invention discloses a cough detection method based on deep learning and Mahalanobis distance modeling, such as... Figure 1 As shown, it includes the following steps:

[0081] S1. Acquire the continuous audio to be detected and preprocess the continuous audio.

[0082] S2. By using short-time energy analysis and noise-adaptive hysteresis thresholding, several audio segments are segmented from the preprocessed continuous audio.

[0083] S3. Input several audio segments into the pre-trained audio spectrogram Transformer model to obtain the high-dimensional feature vector corresponding to each audio segment.

[0084] S4. Based on the pre-built cough Gaussian distribution model, calculate the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution.

[0085] S5. Compare the Mahalanobis distance of each audio segment with the adaptive threshold of the current environment. If it is less than or equal to the adaptive threshold, the corresponding audio segment is determined to be a cough segment.

[0086] S6. Within a preset long time window, count the cough segments determined in step S5, accumulate the cough duration, and output the number of coughs and the total cough duration with timestamps.

[0087] S7. Based on user feedback, update the adaptive threshold for the current environment, and use the updated adaptive threshold for threshold comparison and determination in step S5 for subsequent audio segments.

[0088] in, Figure 1 The return arrow in the text indicates that the adaptive threshold obtained in step S7 will be used for threshold comparison and determination in subsequent steps S5, and does not indicate repeated loop processing of the same audio segment.

[0089] This method can be applied to fields such as digital signal processing, artificial intelligence, and medical health monitoring for cough event detection in continuous audio, long-term cough monitoring, and the construction and cleaning of cough audio datasets. It addresses the problems of existing cough detection technologies, including heavy reliance on large numbers of non-cough samples, sensitivity to environmental changes, difficulty in long-term trend monitoring, and lack of dataset construction support.

[0090] Next, each of the above steps will be explained in detail.

[0091] In step S1 above, the continuous audio to be detected (i.e., Figure 2 The original continuous audio of the multi-channel audio is shown, and the continuous audio is preprocessed, which includes resampling (i.e., sampling rate uniformity), mono conversion (i.e., channel averaging), fixed-duration clipping and amplitude normalization.

[0092] Specifically, in order to better analyze the information in the audio, the acquired continuous audio is represented as a one-dimensional discrete-time signal:

[0093]

[0094] in, T R represents the total number of sampling points; R represents a real number.

[0095] The audio sampling rate is uniformly set to 16000 Hz. The arithmetic mean of the multi-channel audio is taken to obtain a single-channel signal, and amplitude normalization is performed to make: This allows for the acquisition of a single-channel normalized signal.

[0096] In step S2 above, several audio segments are segmented from the preprocessed continuous audio using short-time energy analysis and a noise-adaptive hysteresis threshold; for example... Figure 2 As shown, it specifically includes:

[0097] S21. The single-channel normalized signal obtained in S1 is framed, that is, the preprocessed continuous audio is framed to obtain an audio frame sequence; specifically,

[0098] The normalized audio is divided into frame lengths. frame _ ms and frame shift hop _ ms Frame segmentation is performed based on the audio sampling rate. sr Get the frame length Each sampling point, frame shift Select 1 sampling point frame _ ms =25 ms , hop _ ms =10 ms ; Resulting in the frame sequence: y k ∈ R Lf ,in k Indicates the first k Frame, and k =0,1,..., N f -1; N f The total number of frames into which the entire audio segment is divided, given a frame length and frame shift; R Lf Indicates frame length is L f The real vector space.

[0099] S22. Perform RMS + dB (decibels) calculation on the frame sequence to obtain the frame-level energy of each frame. Specifically: obtain the energy of each audio frame in the audio frame sequence. y k The root mean square energy is calculated and converted into decibel values ​​to obtain a decibel energy sequence; where:

[0100] The root mean square energy is expressed as:

[0101]

[0102] in, RMS [ k ] indicates an audio frame y k The root mean square energy; L f This indicates the number of sampling points per frame, i.e., the frame length; y k [ i ] indicates the first k The first frame iThe normalized audio signal amplitude value at each sampling point, i.e., the time domain waveform;

[0103] The decibel energy sequence is represented as:

[0104]

[0105] in, d [ k [Indicates based on root mean square energy] RMS [ k The converted decibel value; To prevent the logarithm from diverging to a very small positive number, and to ensure that the decibel value is close to the human ear's perception;

[0106] S23. Smooth the decibel energy sequence (i.e.) Figure 2 (The frame-level energy is smoothed using a moving average method, as shown), resulting in the smoothed energy curve. , is represented as:

[0107]

[0108] in, W Indicates the window length, and W =2 r +1; r Indicates the radius of the smoothing window; m Relative to the current index k The offset;

[0109] S24. Based on the smoothed energy curve, calculate its specified quantile as the noise floor threshold (i.e., Figure 2 (The noise quantiles are calculated as shown). The specified quantile of the energy curve is the energy curve itself. of p % quantile;

[0110] Noise floor threshold Represented as:

[0111]

[0112] in, Indicates quantile operations;

[0113] S25. Determine the activation threshold based on the noise floor threshold. and the closing threshold Among them, the activation threshold Above the noise floor threshold , turn off threshold Below the startup threshold ;

[0114]

[0115] in, Indicates that the threshold offset is enabled; Indicates the hysteresis width;

[0116] S26. Use a state machine to scan the smoothed energy curve frame by frame. Based on the start threshold and the closing threshold Detect the start and end points of the audio segment, and segment it into several candidate audio segments; specifically:

[0117] Currently in silent mode and At that time, record the current frame index as the starting frame. k start And enter the sound state; while in the sound state, when continued N tail When the above is true, the record ends at frame number 1. k end = k - N tail ;

[0118] in N tail The number of frames corresponding to the length of the tail silence, and , A threshold for the duration of tail silence is used to suppress premature segment truncation caused by a brief energy drop. hop _ ms For frame shift;

[0119] When the continuous frame rate is insufficient N tail Keep the sound on at all times;

[0120] S27. For several candidate audio segments [ k start , k end The process involves integrating the audio segments to obtain the final audio clips. This integration process includes:

[0121] (1) Short segment discarding: The duration of each candidate audio segment is denoted as . N seg ,and N seg= k end - k start +1, if Below the minimum duration threshold If so, the corresponding candidate audio segment will be deleted;

[0122] (2) Gap merging: Merging two adjacent candidate audio segments with a frame gap less than or equal to the merging interval threshold yields the final frame-level audio segment set; where the merging interval threshold is... gap Represented as:

[0123]

[0124] in, Indicates the first i +1 starting frame index of candidate audio segments; Indicates the first i The end frame index of each candidate audio segment; This represents the maximum silence interval at which two adjacent audio segments can be merged on the timeline.

[0125] S28. Each audio segment obtained after integration processing [ k start , k end Convert to sampling point range ,in,

[0126]

[0127] in, pad s Indicates the number of sampling points for the left margin. pad e This indicates the number of sampling points for the right margin, and , sr Indicates the audio sampling rate; A threshold for the duration of the margin at the segment boundary is used to compensate for segmentation errors at both ends of the segmented audio segment, ensuring that the extracted waveform contains more complete information about the start and end of the event, thus obtaining the audio segment waveform. Where R represents a real number, T m Represents the waveform of an audio segment The length.

[0128] In step S3 above, to better match human ear perception and compress the energy dynamic range, the waveforms of several sound segments obtained in step S2 are input into a pre-trained audio spectrogram Transformer model (pre-trained AST network model). First, log-Mel features are extracted, then Transformer encoding is performed to obtain the high-dimensional feature vector corresponding to each sound segment; the pre-trained AST network model is as follows: Figure 3 As shown, it specifically includes:

[0129] First, the waveform of the audio segment is converted into a Log-Mel spectrogram; then, the Log-Mel spectrogram is divided into several 16×16 Patch blocks of a fixed size, and numbered sequentially as the 1st to the Nth Patch (i.e., 1, 2, 3, ..., N-1, N); each Patch block is input into a linear mapping layer to obtain the corresponding Patch embedding vector E[1], E[2], ..., E[N], and a classification label vector E[CLS] is introduced at the same time; positional encodings P[0], P[1], ..., P[N] are superimposed on the Patch embedding vector and the classification label vector, and input together into the Transformer encoder for context modeling; the output of the Transformer encoder is mapped through the linear layer to obtain the final output feature vector, which is used to characterize the high-dimensional features of the audio segment. Among them, the linear layer and the output are the classification head in the pre-training stage; when the present invention is used for feature extraction, the classification head can be omitted, and the output of the Transformer encoder can be taken and global average pooling can be performed according to step S36 to obtain the high-dimensional feature vector (or the hidden vector corresponding to the classification label can be taken as the feature). Based on the pre-trained AST network model described above, this step specifically includes:

[0130] S31, The duration of a sound segment is... dur Seconds, based on the preset target length, the waveform of each audio segment. The length is normalized; where the preset target length is... L =[16000× dur For example, the duration of each audio segment can be set. dur The preset target length is 4 seconds. L =[16000×4]; Normalization specifically includes:

[0131] When the waveform length of the audio segment T m Greater than or equal to the preset target length L At that time, take the previous one. L Each sampling point; when the waveform length of the audio segment... T m Less than the preset target length L When , pad with zeros at the end to the length. L The normalized waveform of the audio segment is obtained. .

[0132] S32, such as Figure 4 As shown, the normalized waveform of the audio segment Log_mel feature extraction is performed, including: framing / windowing the waveform to obtain a frame sequence; performing a short-time Fourier transform (STFT) on the frame sequence to obtain a linear frequency complex spectrum; performing a modulo operation on the linear frequency complex spectrum to obtain a linear frequency power spectrum; mapping the linear frequency power spectrum through a Mel filter bank to obtain a power Mel spectrum (i.e., Mel spectrum); and finally taking the logarithm of the Mel spectrum to output a log-Mel spectrum feature map. Specifically:

[0133] (1) Complex number spectrum Represented as:

[0134]

[0135] in, The frequency is the result of the short-time Fourier transform. This represents the number of time frames after the short-time Fourier transform. C Represent the space of complex matrices;

[0136] (2) Power Mel spectrum Represented as:

[0137]

[0138] in, F For Mel-band number; R + Represents positive real numbers; This represents the duration within the feature domain;

[0139] (3) Log-Mel spectrum feature map (i.e., log-Mel feature map) is represented as:

[0140]

[0141] in, It is a smoothing constant; R Represent real numbers;

[0142] S33. Using a patch embedding layer, the log-Mel spectrum feature map is generated according to the preset frequency dimension and preset time dimension. Divide into multiple patches; for example, The feature map is divided into patches of size 16 in both the frequency dimension and the time dimension, resulting in... There are 1 patch, each patch is expanded into ;

[0143] S34, through a linear mapping matrix Each patch is mapped to a D-dimensional feature space (768-dimensional feature space) to obtain the corresponding patch sequence matrix:

[0144]

[0145] in, x z For the first z A patch sequence matrix, and ; u z For the first z One patch; b emb The bias vector represents the linear mapping;

[0146] Obtain the patch sequence matrix corresponding to each patch. ;

[0147] S35, convert each patch sequence matrix The input is fed into the Transformer encoder for encoding, resulting in multiple corresponding hidden vectors; for example... Figure 5 As shown, each encoding layer of the Transformer encoder includes a multi-head attention sublayer and a feedforward network sublayer, and an summation and normalization module is set after each sublayer.

[0148] Specifically, the encoding layer takes the input sequence vector as input. First, the input is fed into a multi-head attention sublayer to obtain the attention output. Then, the attention output and the input of this sublayer are summed through a residual connection, and the summation result is normalized to form the first summed and normalized output. This output is then fed into a feedforward network sublayer for nonlinear transformation to obtain the feedforward output. Finally, the feedforward output and the input of the feedforward sublayer are summed through a residual connection, and the summation result is normalized to form the second summed and normalized output, which serves as the output of this encoding layer. Where:

[0149] (1) Multi-head self-attention quantum layer: such as Figure 6 As shown, the multi-head attention mentioned above includes several parallel scaled dot product attention heads. The input vector is passed through a linear transformation layer to obtain the query vector, key vector, and value vector, and this process is executed in parallel on multiple attention heads. For each attention head, the output of the head is calculated using scaled dot product attention. The outputs of multiple attention heads are concatenated along the feature dimension, and the concatenation result is then mapped through a linear layer to obtain the final output of the multi-head attention. Figure 6 The square brackets “N” indicate the number of parallel attention heads; each arrow indicates the data flow direction: the bottom input passes through a linear layer to obtain the query vector / key vector / value vector, then enters the scaled dot product attention, and the output is then concatenated with the linear layer to obtain the final output.

[0150] (2) Feedforward sub-layer: Each output position vector is transformed nonlinearly through two fully connected layers. Activation functions such as ReLU and GELU can be used in between to enhance the model's ability to fit complex nonlinear patterns.

[0151] In this step, the patch sequence matrix is... Enter to include L enc The Transformer encoder in each layer performs encoding, and each layer includes a multi-head self-attention sublayer and a feedforward network sublayer, resulting in multiple corresponding hidden vectors. ; indicates as:

[0152]

[0153] S36. Perform global average pooling on multiple hidden vectors to obtain the high-dimensional feature vector corresponding to each audio segment. ; indicates as:

[0154]

[0155] in, Indicates the first j The hidden vector of each patch; N p Indicates the number of patches; R Represents a real number.

[0156] In step S4 above, based on the pre-built cough Gaussian distribution model, the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution is calculated.

[0157] The cough Gaussian distribution model is constructed through the following steps:

[0158] (1) Cough sample collection and pretreatment:

[0159] From publicly available cough datasets or clinically collected data, confirmed cough segments are selected as positive samples, and a small number of non-cough segments are optionally selected as negative samples. The collected cough samples are preprocessed, including resampling, monophony, fixed-duration cropping, and amplitude normalization.

[0160] (2) Obtain a set of high-dimensional sample feature vectors extracted from multiple positive cough samples using the audio spectrogram Transformer model;

[0161] (3) Based on the set of high-dimensional sample feature vectors, calculate the mean vector and covariance matrix of the cough class in the feature space; the covariance matrix is ​​calculated by the shrinkage estimation method to improve the estimation stability under the conditions of high-dimensional space and finite sample.

[0162] (4) Based on the mean vector and covariance matrix, construct the Mahalanobis distance function to characterize the Gaussian distribution model of cough; expressed as:

[0163]

[0164] in, For any sample feature vector x The corresponding Mahalanobis distance value; It is the mean vector; It is the inverse of the covariance matrix;

[0165] (5) Calculate the Mahalanobis distance of each positive cough sample using the Mahalanobis distance function to obtain the Mahalanobis distance distribution of multiple positive cough samples, and obtain the distance value corresponding to the preset quantile based on the Mahalanobis distance distribution of multiple positive cough samples as the initial global threshold for cough determination; or when there are negative samples in the validation set, search based on the Youden index of the negative cough samples to obtain the global threshold for initialization.

[0166] In step S5 above, the Mahalanobis distance of each audio segment is compared with the adaptive threshold of the current environment. If it is less than or equal to the adaptive threshold, the corresponding audio segment is determined to be a cough segment.

[0167] The adaptive threshold for the current environment is obtained through the following steps:

[0168] (1) Based on the Mahalanobis distance set of all sound segments in the current continuous audio to be detected, and combined with the prior information of the sparse temporal distribution of cough events, the Mahalanobis distance set is divided into an approximate cough cluster and an approximate non-cough cluster by at least one of the following methods: mixed distribution fitting, quantile constraint or ranking heuristic.

[0169] (2) Based on the approximate cough cluster and the approximate non-cough cluster, the adaptive threshold of the current environment is obtained by searching in the Mahalanobis distance set according to the preset adaptive threshold screening rule; wherein, the preset adaptive threshold screening rule specifically includes: taking the proportion of the number of sound segments contained in the approximate cough cluster to the total number of sound segments as a constraint condition, and searching in the Mahalanobis distance set to obtain multiple candidate thresholds; among the multiple candidate thresholds, the candidate threshold with the smallest total value after weighted summation of the number of false alarm segments and the number of missed detection segments is selected as the adaptive threshold of the current environment;

[0170] (3) If the search fails, the initial global threshold will be used as the adaptive threshold for the current environment.

[0171] In the process of comparing the Mahalanobis distance of each audio segment with the adaptive threshold of the current environment, two thresholds can be optionally set to divide the segments into three categories: high-confidence cough, uncertain segment, and high-confidence non-cough, and assign a corresponding confidence score to each segment.

[0172] In step S6 above, within a preset long time window, the cough segments determined in step S5 are counted, the cough duration is accumulated, and the number of coughs and the total cough duration with timestamps are output.

[0173] Specifically, the detection results of multiple audio files are merged, and the number of coughs and duration are counted within each time window. The time series is processed using moving average and exponential smoothing to obtain a long-term cough load curve. When the cough load within a certain window is significantly higher than the individual's historical average and continues to exceed the preset duration, the system generates a risk warning.

[0174] In step S7 above, the adaptive threshold for the current environment is updated based on user feedback; specifically, this includes:

[0175] S71. Based on the timestamped number of coughs and total cough duration output by S6, collect the false positive non-cough segments and missed cough segments reported by users, and after labeling them, obtain feedback samples containing cough labels and non-cough labels.

[0176] S72. Extract the feature vector sets of falsely reported non-cough samples and missed cough samples from the feedback samples respectively; and combine the feature vector set of falsely reported non-cough samples... As a set of background difficult examples, the feature vectors of the missed cough samples are used. The adaptive threshold is updated using supplementary distributed samples; specifically:

[0177] (1) Calculate the Mahalanobis distance from the feature vector of the false positive non-cough segment to the cough Gaussian distribution, and obtain its average deviation relative to the current adaptive threshold. Calculate the Mahalanobis distance from the feature vector of the missed cough fragment to the cough Gaussian distribution, and obtain its average deviation relative to the current adaptive threshold. ;

[0178] (2) Based on the average deviation and average deviation Update the adaptive threshold:

[0179]

[0180] in, The updated adaptive threshold; The current adaptive threshold; Average deviation The learning rate coefficient; Average deviation The learning rate coefficient; the updated adaptive threshold. Used for Mahalanobis distance comparison and determination in subsequent audio segments in step S5.

[0181] Example 2:

[0182] Based on the above embodiment one, the present invention also provides a cough data management method based on deep learning and Mahalanobis distance modeling, such as... Figure 7 As shown, it includes the following steps:

[0183] T1, Recording input and preprocessing not labeled;

[0184] T2 and AST network models feature extraction and Mahalanobis distance acquisition;

[0185] T3, determination of environmental adaptive threshold and dual threshold;

[0186] T4. Generation of index files and metadata manifest;

[0187] T5. Manual review and secondary annotation;

[0188] T6, Incremental update of a cough model;

[0189] T7. Dataset generation and output.

[0190] in, Figure 7 The return arrow indicates that after completing T6 "Incremental update of a type of cough model", the updated model parameters and statistics are used to re-execute T3 "Environmental adaptive threshold and dual threshold" and the subsequent T4 to T6 processes on the newly added continuous audio data to achieve iterative updates of the dataset and model; the return arrow does not indicate infinite loop processing of the same batch of audio data.

[0191] Next, each of the above steps will be explained in detail.

[0192] In step T1 above, recording input and preprocessing are not marked;

[0193] Specifically, the system reads a batch of unlabeled audio files from the storage medium, with each recording lasting from several minutes to several hours. For each recording, the system first executes the audio segment detection process described in Example 1 to obtain the set of audio segments corresponding to the recording, and records the start and end times and file paths of each segment to form a segment index table.

[0194] In step T2 above, the AST network model features are extracted and Mahalanobis distance is obtained;

[0195] The system feeds the audio segments into the audio spectrogram Transformer model to extract the high-dimensional feature vectors of the segments; using a cough Mahalanobis model trained in Example 1, the corresponding Mahalanobis distance is calculated for the feature vector of each segment to obtain the distance set of all segments in the recording, and the distance values ​​and segment indices are cached together.

[0196] In step T3 above, the environmental adaptive threshold and the dual threshold are determined;

[0197] For any recording, based on the distance set obtained in step T2, the system performs statistical analysis on the distance distribution of the current recording according to the environment adaptive threshold calibration method in Example 1. Combining the cough sparsity prior and the global cough distance distribution during the training phase, the system calculates the environment adaptive threshold corresponding to that recording. ;

[0198] Furthermore, a dual-threshold strategy is introduced to determine the first threshold used for data cleaning. Second threshold ; set the first threshold Set the second threshold to the smaller value between the environmental threshold and a certain quantile of the training cough distance distribution. The first threshold is set to a large value between the environmental threshold and the high quantile of the training distribution or the boundary of the background distribution, to ensure that high-confidence cough samples and high-confidence non-cough samples are sufficiently close to or far from the cough class center, respectively; specifically, the first threshold... Second threshold ;in, For safety intervals, and ;

[0199] If the Mahalanobis distance of a certain segment is less than or equal to the first threshold If the segment is high-confidence cough sample, then the segment is marked as a high-confidence cough sample; if the Mahalanobis distance of a segment is greater than or equal to the second threshold... If the distance value of a segment is between [a certain value], then the segment is marked as a high-confidence non-cough sample; if the distance value of a segment is between [a certain value], then the segment is marked as a high-confidence non-cough sample. and If the sample is between these two conditions, it is marked as an uncertain sample and may not be included in the automatically constructed dataset for the time being.

[0200] In step T4 above, the index file and metadata manifest are generated;

[0201] Specifically, for each high-confidence sample, the system reads information such as the original recording file path, segment start and end time, and segment duration from the segment index table, and writes the above information, along with Mahalanobis distance, the set label (cough / non-cough), and sorting priority, into the structured index file.

[0202] In step T5 above, manual review and secondary annotation are performed;

[0203] In this embodiment, the index file can be imported into the corresponding annotation tool interface. The annotation tool prioritizes displaying samples from the high-confidence cough set, and users can quickly review them using a list or waveform view. Users can correct the annotations of individual samples in the interface, such as changing misjudged samples to non-cough or vice versa. The system will synchronize the corrected labels back to the index file, thereby obtaining a batch of higher-quality training samples with confirmed labels.

[0204] In step T6 above, an incremental update of a cough model is performed;

[0205] Specifically, after completing a certain number of manual reviews, this embodiment may optionally use these confirmed high-confidence samples to update a class of Mahalanobis models. The specific steps include:

[0206] T61: Incorporate the feature vectors of newly identified cough samples into the cough training set, and re-estimate or incrementally update the mean vector and covariance matrix to make the model more suitable for the current population and equipment characteristics.

[0207] T62: Use some high-confidence non-cough samples or non-cough segments marked as false alarms by users as background controls to adjust the search range of the environment adaptive threshold or to construct an auxiliary background distribution.

[0208] In step T7 above, the dataset is generated and output.

[0209] After cleaning and manually reviewing a certain batch of audio data, the system can divide the labeled samples into training, validation, and test sets according to task requirements, generate corresponding directory structures and annotation files, and output a cough audio dataset that can be directly used for supervised learning training. The dataset can be used to train new cough detection or disease diagnosis models, or to further expand and optimize the cough Markov model described in this invention, thereby forming a closed loop of data construction and model update.

[0210] Example 3:

[0211] Based on the same inventive concept, embodiments of the present invention also provide a cough detection system based on deep learning and Mahalanobis distance modeling, comprising:

[0212] (1) Audio acquisition and preprocessing module, used to acquire the continuous audio to be detected and preprocess the continuous audio;

[0213] (2) Audio segmentation module, used to segment several audio segments from preprocessed continuous audio through short-time energy analysis and noise-adaptive hysteresis threshold;

[0214] (3) Audio feature extraction module, used to input several audio segments into the pre-trained audio spectrogram Transformer model to obtain the high-dimensional feature vector corresponding to each audio segment;

[0215] (4) Mahalanobis distance calculation module, used to calculate the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution based on the pre-built cough Gaussian distribution model;

[0216] (5) Cough segment detection module, which is used to compare the Mahalanobis distance of each sound segment with the adaptive threshold of the current environment. If it is less than or equal to the adaptive threshold, the corresponding sound segment is determined to be a cough segment.

[0217] (6) Window statistics module, used to count the determined cough segments within a preset long time window, accumulate the cough duration, and output the number of coughs and the total cough duration with timestamps;

[0218] (7) Data management module, used to construct or expand cough audio dataset based on the Mahalanobis distance corresponding to all sound segments that have been detected, and the cough label or non-cough label corresponding to each sound segment.

[0219] Since the principle behind the problem solved by this system is similar to the aforementioned cough detection and data management method based on deep learning and Mahalanobis distance modeling, the specific implementation of this system can be found in the implementation of the aforementioned method, and the repetition will not be repeated.

[0220] In summary, this invention provides a cough detection and data management method and system based on deep learning and Mahalanobis distance modeling. The core ideas are as follows:

[0221] First, this invention does not rely on exhaustively listing all negative samples of non-coughing sounds. Instead, it utilizes the high-dimensional audio representation extracted by the pre-trained audio spectrogram Transformer model. Within this pre-trained representation space, it estimates a class of Gaussian distributions and covariance structures based solely on positive cough samples, and constructs a Mahalanobis distance-based cough model to measure the "cough similarity" of any audio segment. This significantly reduces the cost of negative sample annotation and the difficulty of feature engineering.

[0222] Second, this invention combines the prior assumption that cough events are naturally sparse on the time axis, performs statistical analysis on the Mahalanobis distance distribution of all audio segments within the same audio segment, introduces an environment-adaptive threshold calibration mechanism, and allows users to easily update the threshold through a very small amount of false alarm / missed detection feedback, enabling the system to automatically adjust the decision boundary under different devices, different noise and reverberation conditions, and maintain relatively stable detection performance in large-scale deployment scenarios.

[0223] Third, while utilizing a type of Mahalanobis model to achieve cough detection, this invention also provides a data cleaning and dataset construction mode based on the same model. When faced with a large number of unlabeled long-term recordings, it can automatically filter high-confidence cough segments and non-cough segments through sound segment detection, Mahalanobis distance calculation, and dual threshold division, and export them as index files with file paths and timestamps. After a small amount of manual review, a high-quality cough audio dataset is directly formed, which can be used in reverse to update the parameters of a type of model, forming a closed loop of detection and data construction.

[0224] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0225] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A cough detection method based on deep learning and Mahalanobis distance modeling, characterized in that, Includes the following steps: S1. Acquire the continuous audio to be detected and preprocess the continuous audio; S2. By using short-time energy analysis and noise-adaptive hysteresis thresholding, several audio segments are segmented from the preprocessed continuous audio. S3. Input several audio segments into the pre-trained audio spectrogram Transformer model to obtain the high-dimensional feature vector corresponding to each audio segment. S4. Based on the pre-built cough Gaussian distribution model, calculate the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution. S5. Compare the Mahalanobis distance of each audio segment with the adaptive threshold of the current environment. If it is less than or equal to the adaptive threshold, the corresponding audio segment is determined to be a cough segment. S6. Within a preset long time window, count the cough segments determined in step S5, accumulate the cough duration, and output the number of coughs and the total cough duration with timestamps. In step S4, the cough Gaussian distribution model is constructed through the following steps: Obtain a set of high-dimensional sample feature vectors extracted from multiple positive cough samples using the audio spectrogram Transformer model; Based on the set of high-dimensional sample feature vectors, the mean vector and covariance matrix of the cough class in the feature space are calculated; the covariance matrix is ​​calculated using a shrinkage estimation method. Based on the mean vector and covariance matrix, a Mahalanobis distance function is constructed to characterize the Gaussian distribution model of cough. The Mahalanobis distance of each positive cough sample is calculated using the Mahalanobis distance function to obtain the Mahalanobis distance distribution of multiple positive cough samples. Based on the Mahalanobis distance distribution of multiple positive cough samples, the distance value corresponding to the preset quantile is obtained as the initial global threshold for cough determination. In step S5, the adaptive threshold of the current environment is obtained through the following steps: Based on the Mahalanobis distance set of all audible segments in the current continuous audio to be detected, and combined with prior information on the sparse temporal distribution of cough events, the Mahalanobis distance set is divided into an approximate cough cluster and an approximate non-cough cluster using at least one of the following methods: mixed distribution fitting, quantile constraint, or ranking heuristic. Based on the approximate cough cluster and the approximate non-cough cluster, the adaptive threshold of the current environment is obtained by searching in the Mahalanobis distance set according to the preset adaptive threshold filtering rule; If the search fails, the initial global threshold will be used as the adaptive threshold for the current environment. The preset adaptive threshold filtering rules specifically include: Using the constraint that the proportion of the number of vocal segments contained in the approximate cough cluster to the total number of vocal segments is less than or equal to a preset proportion, multiple candidate thresholds are obtained by searching in the Mahalanobis distance set. Among the multiple candidate thresholds, the candidate threshold with the smallest total value after weighted summation of the number of false alarm segments and the number of missed detection segments is selected as the adaptive threshold for the current environment.

2. The cough detection method based on deep learning and Mahalanobis distance modeling as described in claim 1, characterized in that, In S1, the preprocessing of the continuous audio includes: The continuous audio is resampled, mono-ified, clipped to a fixed duration, and normalized in amplitude.

3. The cough detection method based on deep learning and Mahalanobis distance modeling as described in claim 1, characterized in that, S2 specifically includes: S21. Perform frame segmentation on the preprocessed continuous audio to obtain an audio frame sequence; S22. Obtain the root mean square energy of each audio frame in the audio frame sequence, and convert the root mean square energy into a decibel value to obtain a decibel energy sequence; S23. Smooth the decibel energy sequence to obtain a smoothed energy curve; S24. Based on the smoothed energy curve, calculate its specified quantile as the noise floor threshold. S25. Determine the start-up threshold and the stop-down threshold based on the noise floor threshold; S26. A state machine is used to scan the smoothed energy curve frame by frame, and the start and end points of the audio segment are detected according to the start threshold and the stop threshold, thereby segmenting out several candidate audio segments. S27. The candidate audio segments are integrated to obtain the final audio segments; the integration process includes: deleting candidate audio segments with a continuous frame count lower than the minimum duration threshold; and merging two adjacent candidate audio segments with a frame gap less than or equal to the merging interval threshold.

4. The cough detection method based on deep learning and Mahalanobis distance modeling as described in claim 1, characterized in that, S3 specifically includes: S31. Normalize the waveform length of each audio segment according to the preset target length; S32. After performing a short-time Fourier transform on the normalized sound segment waveform, it is converted into a power Mel spectrum through a Mel filter bank; logarithmic operation is performed on the power Mel spectrum to obtain a logarithmic Mel spectrum feature map. S33. Using a patch embedding layer, the log-Mel spectrum feature map is divided into multiple patches according to a preset frequency dimension and a preset time dimension; S34. Map each patch to a D-dimensional feature space to obtain the patch sequence matrix corresponding to each patch; S35. Input each patch sequence matrix into the Transformer encoder for encoding to obtain the corresponding multiple hidden vectors; S36. Perform global average pooling on multiple hidden vectors to obtain the high-dimensional feature vector corresponding to each audio segment.

5. The cough detection method based on deep learning and Mahalanobis distance modeling as described in claim 1, characterized in that, Also includes: Based on user feedback, the adaptive thresholds for the current environment are updated; including: Based on the timestamped number of coughs and total cough duration output by S6, the false positive non-cough segments and missed cough segments reported by users are collected, labeled and then feedback samples are obtained. Extract the feature vector sets of falsely reported non-cough samples and missed cough samples from the feedback samples respectively; Calculate the Mahalanobis distance from the feature vector of the false positive non-cough segment to the cough Gaussian distribution, and obtain its average deviation relative to the current adaptive threshold. Calculate the Mahalanobis distance from the feature vector of the missed cough fragment to the cough Gaussian distribution, and obtain its average deviation relative to the current adaptive threshold. ; Based on average deviation and average deviation Update the adaptive threshold: in, The updated adaptive threshold; The current adaptive threshold; Average deviation The learning rate coefficient; Average deviation The learning rate coefficient.

6. A cough data management method based on deep learning and Mahalanobis distance modeling, characterized in that, include: For all spoken segments corresponding to the cough detection based on deep learning and Mahalanobis distance modeling as described in any one of claims 1-5, the Mahalanobis distance will satisfy the Mahalanobis distance... The audio clips were selected as a high-confidence cough sample set; samples that met the Mahalanobis distance requirement were included. The audio clips were selected into a high-confidence non-coughing sample set; among them, For safety intervals; Generate an index file that records the original audio file path, start and end times, Mahalanobis distance value, adaptive environment threshold, and current label for each sample in the high-confidence cough sample set and the high-confidence non-cough sample set; The index file is imported into the data annotation and training system to construct or expand the cough audio dataset.

7. A cough detection and data management system based on deep learning and Mahalanobis distance modeling, characterized in that, include: An audio acquisition and preprocessing module is used to acquire continuous audio to be detected and to preprocess the continuous audio. The audio segmentation module is used to segment several audio segments from preprocessed continuous audio through short-time energy analysis and noise-adaptive hysteresis thresholds. The audio feature extraction module is used to input several audio segments into a pre-trained audio spectrogram Transformer model to obtain a high-dimensional feature vector corresponding to each audio segment. The Mahalanobis distance calculation module is used to calculate the Mahalanobis distance from the high-dimensional feature vector of each vocal segment to the cough Gaussian distribution based on a pre-built cough Gaussian distribution model. The cough segment detection module is used to compare the Mahalanobis distance of each audio segment with an adaptive threshold of the current environment. If the distance is less than or equal to the adaptive threshold, the corresponding audio segment is identified as a cough segment. The window statistics module is used to count the identified cough segments within a preset long time window, accumulate the cough duration, and output the number of coughs and the total cough duration with timestamps. The data management module is used to build or expand the cough audio dataset based on the Mahalanobis distance corresponding to all the audio segments that have been detected, as well as the cough label or non-cough label corresponding to each audio segment. In the Mahalanobis distance calculation module, the cough Gaussian distribution model is constructed through the following steps: Obtain a set of high-dimensional sample feature vectors extracted from multiple positive cough samples using the audio spectrogram Transformer model; Based on the set of high-dimensional sample feature vectors, the mean vector and covariance matrix of the cough class in the feature space are calculated; the covariance matrix is ​​calculated using a shrinkage estimation method. Based on the mean vector and covariance matrix, a Mahalanobis distance function is constructed to characterize the Gaussian distribution model of cough. The Mahalanobis distance of each positive cough sample is calculated using the Mahalanobis distance function to obtain the Mahalanobis distance distribution of multiple positive cough samples. Based on the Mahalanobis distance distribution of multiple positive cough samples, the distance value corresponding to the preset quantile is obtained as the initial global threshold for cough determination. In the cough fragment detection module, the adaptive threshold of the current environment is obtained through the following steps: Based on the Mahalanobis distance set of all audible segments in the current continuous audio to be detected, and combined with prior information on the sparse temporal distribution of cough events, the Mahalanobis distance set is divided into an approximate cough cluster and an approximate non-cough cluster using at least one of the following methods: mixed distribution fitting, quantile constraint, or ranking heuristic. Based on the approximate cough cluster and the approximate non-cough cluster, the adaptive threshold of the current environment is obtained by searching in the Mahalanobis distance set according to the preset adaptive threshold filtering rule; If the search fails, the initial global threshold will be used as the adaptive threshold for the current environment. The preset adaptive threshold filtering rules specifically include: Using the constraint that the proportion of the number of vocal segments contained in the approximate cough cluster to the total number of vocal segments is less than or equal to a preset proportion, multiple candidate thresholds are obtained by searching in the Mahalanobis distance set. Among the multiple candidate thresholds, the candidate threshold with the smallest total value after weighted summation of the number of false alarm segments and the number of missed detection segments is selected as the adaptive threshold for the current environment.