Cough sound recognition method based on PSO-GBDT-LR model
Through the PSO-GBDT-LR model combined with Berouti spectrum subtraction and audio event detection, the problem of noise and abnormal characteristics in cough sound recognition is solved, and efficient and accurate cough sound recognition is achieved, with good generalization ability.
Patent Information
- Application Number
- CN202510663428.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-05-22
AI Technical Summary
There are problems with excessive noise characteristics and abnormal characteristics in existing cough sound recognition technologies, resulting in insufficient recognition accuracy and generalization ability.
The cough sound recognition method based on the PSO-GBDT-LR model is adopted, and the noise is denoised by Berouti spectrum subtraction, combined with audio event detection (VAD), the audio samples are segmented, the 7-dimensional time domain and 2-dimensional frequency domain features are extracted, and the GBDT-LR model hyperparameters are adjusted using particle swarm optimization algorithm to achieve the precise distinction between cough and non-cough sounds.
It improves the signal-to-noise ratio and event detection accuracy of the audio signal, reduces the amount of calculation, can accurately identify cough sounds in different environments, has strong generalization ability, and avoids complex feature extraction processes and overfitting problems.
Smart Images

Figure CN120388587A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a cough sound recognition method based on a PSO-GBDT-LR model, belonging to the technical field of signal recognition. Background Art
[0002] Cough is a major symptom of many respiratory diseases, such as upper respiratory tract infection, bronchitis, and lung cancer. At the same time, postoperative cough is also one of the postoperative complications of various thoracic surgeries. Cough frequency, intensity and other indicators are related to the severity of the patient's disease and the patient's physical condition after surgery. Therefore, cough can be used as a potential indicator to measure the disease condition, surgical effect, and patient's postoperative recovery. Traditional cough detection methods usually rely on doctors' auscultation and empirical judgment and cough assessment scales. However, in actual applications, this method relies too much on the patient's subjective feelings. Different individuals may have differences in the perception and description of cough frequency, intensity, duration, and accompanying symptoms, which may lead to subjectivity and inconsistency in the evaluation results.
[0003] In recent years, with the continuous progress of biomedical technology, automatic cough recognition technology has developed rapidly. Especially during the epidemic of respiratory infectious diseases, it has great opportunities for rapid development. A large number of scholars have tried to extract features that can distinguish different signals from these signals based on biomedical signals (such as sound, vibration, acceleration, electrocardiogram, etc.), and use these features to construct an artificial intelligence model to quantify and even classify the occurrence of cough events. This has been very helpful for the development of automatic cough recognition. It has made the cough monitoring method evolve from traditional auscultation to signal processing and machine learning technology.
[0004] Audio signals have the characteristics of stability, accuracy, and non-invasiveness among many signals, and are easy to collect and process, having many advantages in cough detection. Therefore, the recognition of cough audio is a mainstream method that can be widely used. In the cough monitoring method based on audio signal recognition technology, the technical core is to extract acoustic features and construct a feature vector, and then use artificial intelligence methods to classify the features to identify cough sounds. However, audio also faces challenges such as the diversity of audio signals, noise interference, and differences between individuals. To solve the problem of recognizing audio signals, there are many existing mature methods. For example, using Mel-frequency cepstral coefficients (MFCC) features or time-domain and frequency-domain features to achieve audio classification tasks. The accuracy of audio classification highly depends on the feature dimension to seek a balance between the uniqueness and redundancy of features. Too few features often lead to the lack of features that contribute highly to model prediction, while too many features may lead to too many features that do not contribute to model performance. And determining the best features is a complex and time-consuming task.
[0005] Meanwhile, during the process of collecting cough audio signals, it is often carried out in a complex environment. Among them, non-cough sounds include various sounds, such as instrument sounds, speaking sounds, throat-clearing sounds, etc. At the same time, different people will cough with different intensities of energy and different pitches. The above situations will introduce a lot of outliers and noises in the sound sample feature data, reducing the purity of the features. Summary of the Invention
[0006] The present invention aims to achieve the quantification of coughs, solve the problems of excessive noise features and abnormal features in the sound data during the cough sound recognition process, and proposes a cough sound recognition method based on the PSO-GBDT-LR model to quantify coughs by more accurately distinguishing cough sounds from non-cough sounds.
[0007] The technical solution adopted by the present invention is: a cough sound recognition method based on the PSO-GBDT-LR model, including the following steps:
[0008] Step 1: Collect audio signals;
[0009] Step 2: Use the Berouti spectral subtraction method to denoise the audio signals and obtain the denoised audio signals;
[0010] Step 3: Perform audio event detection VAD to segment the parts with sounds in the denoised audio signals to obtain individual audio samples;
[0011] Step 4: For each audio sample segmented in Step 3, extract 7-dimensional time-domain features;
[0012] Step 5: Perform short-time Fourier transform STFT on each audio sample segmented in Step 3 and extract 2-dimensional frequency-domain features from the spectrum;
[0013] Step 6: Combine the 7-dimensional time-domain features extracted in Step 4 and the 2-dimensional frequency-domain features extracted in Step 5 to form a 9-dimensional feature vector combination;
[0014] Step 7: Mark all the audio samples obtained in Step 3, mark the feature vectors of cough audio samples as class 1, and mark the feature vectors of non-cough audio samples as class 0;
[0015] Step 8: Establish a classification model;
[0016] Step 9: Evaluate the GBDT-LR model;
[0017] Step 10: Take 1 - accuracy as the optimization objective, take the number of estimators n_estimators, learning rate learning_rate, maximum depth max_depth, and maximum number of iterations max_iter of the decision tree as the parameters to be optimized for the GBDT - LR model, and use the particle swarm optimization algorithm PSO to adjust the values of the hyperparameters to minimize 1 - accuracy.
[0018] Specifically, in Step 1: Clamp the microphone of the audio acquisition device on the collar to ensure it is within a range of 30 centimeters from the mouth, and save the collected audio signal.
[0019] Specifically, in Step 2:
[0020] Step 2.1: Divide the original audio signal into frames. Assume that the first few frames of the audio signal only contain background noise, then perform short - time Fourier transform STFT on the first few frames, and calculate the average value of the noise spectrum to obtain the average noise spectrum.
[0021] Step 2.2: Perform short - time Fourier transform on each frame of the original audio signal to obtain the signal spectrum Y(ω) of the original audio.
[0022] Step 2.3: Subtract the average noise spectrum from the signal spectrum Y(ω) of the original audio. To obtain the denoised signal spectrum.
[0023] In Step 2.4: By performing Inverse Fourier transform to reconstruct the time - domain signal, and the reconstructed time - domain signal is the denoised audio signal.
[0024] Specifically, in Step 3:
[0025] Step 3.1 Calculate the short - time energy and short - time zero - crossing rate of each frame of the denoised audio signal to obtain discrete values of the short - time zero - crossing rate and short - time energy. These discrete values are smoothed to obtain the envelope curve.
[0026] Step 3.2 Assume that the initial silent segment is clean and stable, multiply the average short - time energy and average short - time zero - crossing rate of the silent segment by empirical coefficients respectively to obtain the short - time energy threshold and short - time zero - crossing rate threshold.
[0027] Step 3.3 Calculate the intersection points of the short - time energy threshold and the envelope curve, determine the region with low values on both sides and high value in the middle, and obtain the rough values of the start and end points of the speech.
[0028] Step 3.4 Search forward from the rough starting point and backward from the rough ending point, calculate the intersection points of the short-time zero-crossing rate envelope and the short-time zero-crossing rate threshold, obtain the accurate starting point and the accurate ending point, and segment the part with obvious sound in the denoised audio signal through the accurate starting point and the accurate ending point.
[0029] The time-domain features extracted in Step 4 are:
[0030] Maximum value: max(s)
[0031] where s is the sequence of sample values of the segmented audio sample signal;
[0032] Energy:
[0033] where s i is the i-th sample value of the segmented audio sample signal, and n is the number of sampling points, the same below;
[0034] Mean value:
[0035] Variance
[0036] where μ is the mean value, the same below;
[0037] Skewness:
[0038] where σ is the standard deviation, the same below;
[0039] Kurtosis:
[0040] Peak factor:
[0041] where mean is the mean value.
[0042] The frequency-domain features extracted in Step 5 are:
[0043] Spectral centroid:
[0044] where f is the frequency and S(f) is the power spectral density at f;
[0045] Spectral flatness:
[0046] where X y is the amplitude of the segmented audio sample signal in the y-th frequency domain, and N is the number of samplings in the frequency domain.
[0047] Step 8 is specifically as follows:
[0048] Step 8.1: Input the combined labeled feature vectors as the training set into the GBDT model;
[0049] GBDT uses the negative gradient of the loss function as an approximation of the residual. When using GBDT for binary classification, the loss function is the log-likelihood function
[0050]
[0051] where y i is the true label (0 or 1) of the i-th sample, is the predicted probability of GBDT for the i-th sample, and the residual is r z,i , which is the negative gradient of the loss function, and the formula is as follows:
[0052]
[0053] where, is the predicted value of GBDT for the sample in the (z - 1)-th iteration. The trained GBDT will generate leaf node indices for the position of each sample on each tree;
[0054] Step 8.2: The leaf node indices generated for each sample are one-hot encoded;
[0055] Step 8.3: The data of each sample after one-hot encoding is combined with the original 9-dimensional feature vector;
[0056] Step 8.4: The combined feature vector is input into the logistic regression LR model for training to obtain the GBDT-LR model;
[0057] In the LR model, ( whose value is between 0 and 1) is a sigmoid function. The sigmoid function is used to represent the probability of binary classification. If exceeds 0.5, the sample is classified as the positive class, otherwise it is classified as the negative class, z = w·x T +b = w1x1 + w2x2 + … + w n x n +b is a linear combination, where is the input feature vector, is the weight vector, and b is the bias. The core idea of this model is to use the gradient descent method to iteratively update w and b to minimize the loss function J(w, b). For binary classification problems, the loss function is defined as:
[0058]
[0059] where y i is the true label (0 or 1) of the i-th sample, and The predicted probability of the LR for the i-th sample, where m is the total number of samples;
[0060] Step 8.5: Use the trained GBDT-LR model to verify the 9-dimensional feature vectors of the test set samples to obtain the accuracy.
[0061] Step 9 is specifically as follows:
[0062] Allocate devices to different subjects for data collection in hospitals, dormitories, and laboratories. This dataset contains approximately 270 cough events and 290 non-cough events. The subjects cough, exhale, clear their throats, and speak randomly during normal work and life. To collect signals as clearly as possible, the microphone is placed within 30 centimeters of the mouth and clipped to the collar.
[0063] To evaluate the performance of the cough recognition model, define "cough samples predicted as cough" as true positive TP, "cough samples predicted as non-cough" as false negative FN, "non-cough samples predicted as non-cough" as true negative TN, "non-cough samples predicted as cough" as false positive FP, and use accuracy, precision, recall, and F1 as evaluation metrics.
[0064]
[0065] Accuracy represents the ability of the model to recognize the total samples and is an overall characterization of the model's performance.
[0066]
[0067] Precision represents the ability of the model to control false positives. In cough monitoring, high accuracy means fewer misjudgments.
[0068]
[0069] Recall represents the proportion of positive samples recognized in the model. In cough monitoring, high sensitivity means fewer missed diagnoses.
[0070]
[0071] The F1 score is the harmonic mean of precision and recall, which reflects the performance of the model in datasets with imbalanced class numbers.
[0072] Use the receiver operating characteristic curve ROC and the area under the curve AUC to evaluate the classification performance of the model. The ROC curve is plotted with the true positive rate TPR as the vertical axis and the false positive rate FPR as the horizontal axis. The value range of AUC is 0 to 1.
[0073] In step 10, the parameters of the PSO algorithm are as follows: w is 0.8, c1 and c2 are 1, and the loop automatically exits after 40 iterations. Here, w is the inertia weight, and c1 and c2 are learning factors, representing individual learning ability and group learning ability respectively.
[0074] The beneficial effects of the present invention are as follows:
[0075] (1) By denoising the audio signal, the present invention significantly improves the signal-to-noise ratio of the audio signal. It not only enhances the signal-to-noise ratio of the audio signal and reduces the interference of noise on feature extraction, but also improves the accuracy of voice activity detection (VAD).
[0076] (2) The present invention only uses a total of 9-dimensional features, 270 cough samples and 290 non-cough samples, which can accurately distinguish coughs from non-cough sounds. At the same time, it avoids the complex parameter adjustment process of MFCC and does not require operations such as pre-emphasis, framing, windowing, and filtering during the extraction of MFCC features. In the entire method process, the advantages of small computational complexity and small sample size can be achieved.
[0077] (3) By fusing GBDT and LR, the present invention combines the advantages of strong feature learning ability of GBDT and greater robustness and less overfitting when dealing with outliers and noisy data in LR. It can not only accurately distinguish the features of coughs and non-cough sounds, but also has strong generalization ability, enabling the model to perform equally well on new data. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 is a flow chart of the present invention;
[0079] Figure 2 is an effect diagram of voice activity detection (VAD);
[0080] Figure 3 is an iterative curve diagram of the error rate;
[0081] Figure 4 is a comparison diagram of the ROC curves of LR, GBDT, and GBDT-LR. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0082] The present invention will be further described below in conjunction with the drawings and specific embodiments.
[0083] Example 1, the detection method process of the present invention is as Figure 1 shown. A cough sound recognition method based on a PSO-GBDT-LR model includes the following steps:
[0084] Step 1: Use an audio acquisition device with the microphone clamped on the collar, ensuring it is within a range of 30 centimeters from the mouth. Save the acquired audio signal.
[0085] Step 2: Use the Berouti spectral subtraction method to denoise the audio signal acquired in Step 1, obtaining the denoised audio signal.
[0086] The principle of the Berouti spectral subtraction method for denoising is as follows:
[0087]
[0088] Where \(Y(\omega)\) is the signal spectrum of the original audio, is the denoised signal spectrum, is the average noise spectrum, and \(\omega\) is the frequency variable. \(\alpha\) (greater than or equal to 1) is a overestimation factor that mainly affects the distortion degree of the speech spectrum. When the signal-to-noise ratio is high, a smaller value can be taken to avoid excessive noise reduction. When the signal-to-noise ratio is low, a larger value is taken to increase the noise reduction effect. \(\beta\) (between 0 and 1) is the lower limit parameter of the spectrum, which can control the size of the residual noise.
[0089] Step 2.1: Divide the original audio signal into frames. Assume that the first few frames of the audio signal only contain background noise, then perform a short-time Fourier transform (STFT) on the first few frames and calculate the average value of the noise spectrum to obtain the average noise spectrum.
[0090] Step 2.2: Perform a short-time Fourier transform on each frame of the original audio signal to obtain the signal spectrum \(Y(\omega)\) of the original audio;
[0091] Step 2.3: Subtract the average noise spectrum from the signal spectrum \(Y(\omega)\) of the original audio. to obtain the denoised signal spectrum.
[0092] Step 2.4: Reconstruct the time-domain signal by performing an inverse Fourier transform on . The reconstructed time-domain signal is the denoised audio signal.
[0093] Step 3: Audio event detection (VAD), segment the parts with sound in the denoised audio signal to obtain individual audio samples.
[0094] Step 3.1 Calculate the short-time energy and short-time zero-crossing rate of each frame of the denoised audio signal to obtain discrete values of the short-time zero-crossing rate and short-time energy. These discrete values are smoothed to obtain the envelope curve;
[0095] Step 3.2 Assume that the initial silent segment is clean and stable, multiply the average short-time energy and average short-time zero-crossing rate of the silent segment by empirical coefficients respectively to obtain the short-time energy threshold and short-time zero-crossing rate threshold;
[0096] Step 3.3 Calculate the intersection points of the short-time energy threshold and the envelope, determine the region with low values on both sides and high value in the middle, and obtain the rough values of the starting and ending points of the speech;
[0097] Step 3.4 Search forward from the rough starting point and backward from the rough ending point, calculate the intersection points of the short-time zero-crossing rate envelope and the short-time zero-crossing rate threshold, and obtain more accurate starting and ending points. Based on the accurate starting and ending points, segment the parts with obvious sounds in the denoised audio. The detection effect is as Figure 2 shown. For the denoised audio, most of the background noises can be filtered out. Even if the amplitude and energy of the audible segment are very small, the starting and ending points of its appearance can be accurately located through the short-time energy and short-time zero-crossing rate thresholds. Among them, the green line is the starting point and the red line is the ending point. Then separate these sounds from the silent segments as samples, and screen out the audio samples that are coughs from these samples through classification methods to achieve the purpose of cough quantification.
[0098] Step 4: For each audio sample segmented in Step 3 (the duration of each audio sample ranges from 0.1 second to 0.8 seconds), extract the following time-domain features.
[0099] Maximum value: max(s)
[0100] where s is the sequence of sample values of the audio sample signal segmented;
[0101] Energy:
[0102] where s i is the i-th sample value of the audio sample signal segmented, and n is the number of sampling points, the same below;
[0103] Mean value:
[0104] Variance:
[0105] where μ is the mean value, the same below;
[0106] Skewness:
[0107] where σ is the standard deviation, the same below;
[0108] Kurtosis:
[0109] Peak factor:
[0110] where mean is the mean value.
[0111] Step 5: Perform short-time Fourier transform (STFT) on each audio sample segmented in Step 3, and extract 2D frequency-domain features from the spectrum:
[0112] Spectrum centroid:
[0113] where f is the frequency, and S(f) is the power spectral density at f;
[0114] Spectrum flatness:
[0115] where X n is the amplitude of the sample in the y-th frequency domain, and N is the number of samples in the frequency domain.
[0116] Step 6: Combine the 7D time-domain features extracted in Step 4 and the 2D frequency-domain features extracted in Step 5 to form a 9D feature vector combination.
[0117] Step 7: Label all the audio samples obtained in Step 3. Label the feature vectors of cough audio samples as class 1, and the feature vectors of non-cough audio samples as class 0.
[0118] Step 8: Establish a classification model
[0119] Step 8.1: Input the labeled feature vector combination as the training set into the GBDT model.
[0120] The core idea of GBDT is to iteratively add new decision trees to fit the residuals of the previous tree. By continuously reducing the residuals, the prediction accuracy of the model can be gradually improved. GBDT uses the negative gradient of the loss function as an approximation of the residuals. When using GBDT for binary classification, the loss function is the logarithmic likelihood function
[0121]
[0122] where y i is the true label (0 or 1) of the i-th sample, is the predicted probability of the GBDT for the i-th sample, and the residual is r z,i , which is the negative gradient of the loss function, and the formula is as follows:
[0123]
[0124] where, is the predicted value of the GBDT for the sample in the (z - 1)-th iteration. The trained GBDT will generate leaf node indices for the position of each sample on each tree.
[0125] Step 8.2: Perform ONE-HOT encoding on the leaf node indices generated for each sample.
[0126] Step 8.3: The data after ONE-HOT encoding for each sample is combined with the original 9-dimensional feature vector.
[0127] Step 8.4: The combined feature vectors are input into a Logistic Regression (LR) model for training to obtain the GBDT-LR model.
[0128] In the LR model, ( whose value ranges between 0 and 1) is a sigmoid function. The sigmoid function is used to represent the probability of binary classification. If exceeds 0.5, the sample is classified as the positive class, otherwise it is classified as the negative class. z = w·x T + b = w1x1 + w2x2 + … + w n x n + b is a linear combination, where is the input feature vector, is the weight vector, and b is the bias. The core idea of this model is to use the gradient descent method to iteratively update w and b to minimize the loss function J(w, b). For a binary classification problem, the loss function is defined as:
[0129]
[0130] where y i is the true label (0 or 1) of the i-th sample, and is the predicted probability of the i-th sample by LR, and m is the total number of samples.
[0131] Step 8.5: The trained GBDT-LR model is used to verify the 9-dimensional feature vector combination of the test set to obtain the accuracy.
[0132] Step 9: Evaluation of the GBDT-LR model
[0133] To verify the effectiveness of the proposed method, in this experiment, devices were allocated to different subjects in hospitals, dormitories, and laboratories for data collection. The dataset contains approximately 270 cough events and 290 non-cough events. The subjects randomly coughed, exhaled, cleared their throats, and spoke during normal work and life. To collect data as clearly as possible, the microphone was placed within a range of 30 centimeters from the mouth and clipped to the collar.
[0134] To evaluate the performance of the cough recognition model, "cough samples predicted as coughs" are defined as true positives (TP), "cough samples predicted as non-coughs" are defined as false negatives (FN), "non-cough samples predicted as non-coughs" are defined as true negatives (TN), "non-cough samples predicted as coughs" are defined as false positives (FP), and accuracy, precision, recall, and F1 are used as evaluation metrics.
[0135]
[0136] Accuracy represents the ability of the model to identify the total samples and is an overall characterization of the model's performance.
[0137]
[0138] Precision represents the ability of the model to control false positives. In cough monitoring, a high precision means fewer misjudgments.
[0139]
[0140] Recall represents the proportion of positive samples identified in the model. In cough monitoring, a high sensitivity means fewer missed diagnoses.
[0141]
[0142] The F1 score is the harmonic mean of precision and recall. It reflects the performance of the model in datasets with imbalanced class numbers.
[0143] The receiver operating characteristic (ROC) curve and the area under the curve (AUC) are used to evaluate the classification performance of the model. The ROC curve is plotted with the true positive rate (TPR) on the vertical axis and the false positive rate (FPR) on the horizontal axis. The value range of AUC is 0 to 1. The closer the AUC is to 1, the better the classification performance of the model.
[0144] Step 10: Take 1 - accuracy as the optimization objective, and consider the decision tree (n_estimators), learning rate (learning_rate), maximum depth (max_depth), and maximum number of iterations (max_iter) as the parameters to be optimized for the GBDT - LR model. Use the Particle Swarm Optimization (PSO) algorithm to adjust the values of the hyperparameters to minimize 1 - accuracy. The parameters of the PSO algorithm are as follows: w is 0.8, c1 and c2 are 1, and the loop automatically exits after 40 iterations. Here, w is the inertia weight, which is used to control the inertia of the particles and prevent them from converging prematurely. c1 and c2 are learning factors, representing individual learning ability and swarm learning ability respectively. As Figure 3 shown, during the iterative process of the PSO algorithm, the error rate (1 - accuracy) of GBDT - LR drops to the lowest value of 0.0604 and stabilizes.
[0145] The confusion matrix of the PSO - GBDT - LR model is shown in Table 1:
[0146] Table 1: Confusion Matrix of PSO - GBDT - LR
[0147]
[0148] Table 2: Classification Results of PSO - GBDT - LR
[0149]
[0150] As shown in Table 2, the PSO - GBDT - LR model performs excellently in the binary classification problem of cough sounds and non - cough sounds, with an accuracy of 93.96%. The precision of cough and non - cough is 94.25% and 93.68% respectively. The recall rate of cough and non - cough is 93.18% and 94.68% respectively. The F1 - scores of cough and non - cough are 93.71% and 94.18% respectively. The AUC value of the PSO - GBDT - LR model during training is 0.972, exceeding 0.968 and 0.950 of LR and GBDT respectively. The results show that this cough detection algorithm has high specificity and sensitivity for both cough signals and non - cough signals.
[0151] The key points of the present invention are as follows:
[0152] (1) The present invention uses a cough audio signal acquisition device to collect cough audio signals of healthy people and patients. The signals are easy to obtain and process. The double - threshold acoustic activity detection method is used to segment the time - series data, and time - domain and frequency - domain features are extracted from each segmented segment as the original features, reducing the computational amount and enabling accurate determination of the position where the cough appears.
[0153] (2) The present invention proposes a hybrid model (PSO-GBDT-LR) based on Particle Swarm Optimization (PSO), Gradient Boosting Decision Tree (GBDT), and Logistic Regression (LR) for more accurately distinguishing cough sounds from non-cough sounds. The model first uses GBDT to extract leaf node index features from the original sound data, then combines these features with the original features and inputs them into LR for cough sound classification. Through the powerful feature extraction ability of GBDT and the strong generalization ability of LR, the problems of excessive noise features and abnormal features in cough recognition are effectively solved.
[0154] (3) Compared with the traditional method of subjectively selecting hyperparameters, the present model uses PSO to select the hyperparameters of GBDT-LR, avoiding the problems of low efficiency and unsatisfactory accuracy, and improving the efficiency and accuracy of the model.
[0155] (4) The present invention only uses 9-dimensional features, avoiding the complex hyperparameter tuning process of MFCC, and does not require operations such as pre-emphasis, framing, windowing, and filtering during the extraction of MFCC features. And with less than 600 samples, the model has a small computational amount, a simple structure, a time-saving training process, and high efficiency.
[0156] The present invention provides a solution. By using the PSO-GBDT-LR classification model, it combines the advantages of GBDT's strong feature learning ability and LR's greater robustness and less susceptibility to overfitting when dealing with outliers and noisy data. It solves the problems of excessive noise features and abnormal features in the process of cough sound recognition, can not only accurately distinguish the features of cough and non-cough sounds, but also has strong generalization ability. This enables the model to perform equally well on new data.
[0157] The specific embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to these descriptions. Within the scope of knowledge possessed by those of ordinary skill in the art, various modifications, substitutions, and improvements can be made without departing from the principle of the present invention.
Claims
1. A cough sound recognition method based on the PSO-GBDT-LR model, characterized in that, It includes the following steps: Step 1: Collect audio signals; Step 2: Use Berouti spectral subtraction to denoise the audio signals to obtain the denoised audio signals; Step 3: Perform voice activity detection (VAD) on the denoised audio signals to segment the parts with sound in the denoised audio signals, obtaining individual audio samples; Step 4: For each audio sample segmented in Step 3, extract 7-dimensional time-domain features; Step 5: Perform short-time Fourier transform (STFT) on each audio sample segmented in Step 3, and extract 2-dimensional frequency-domain features from the spectrum; Step 6: Combine the 7-dimensional time-domain features extracted in Step 4 and the 2-dimensional frequency-domain features extracted in Step 5 to form a 9-dimensional feature vector combination; Step 7: Label all the audio samples obtained in Step 3, label the feature vectors of cough audio samples as class 1, and label the feature vectors of non-cough audio samples as class 0; Step 8: Establish a classification model; Step 9: Evaluate the GBDT-LR model; Step 10: Take 1 - accuracy as the optimization objective, take the decision tree n_estimators, learning rate learning_rate, maximum depth max_depth, and maximum number of iterations max_iter as the parameters to be optimized for the GBDT-LR model, and use the particle swarm optimization algorithm (PSO) to adjust the values of the hyperparameters to minimize 1 - accuracy.
2. The cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, wherein, Specifically, Step 1 is: Clamp the microphone of the audio acquisition device on the collar, ensure it is within a range of 30 centimeters from the mouth, and save the acquired audio signals.
3. A cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, characterized in that, Specifically, Step 2 is: Step 2.1: Frame the original audio signal. Assume that the first few frames of the audio signal only contain background noise. Then perform short-time Fourier transform (STFT) on the first few frames and calculate the average value of the noise spectra to obtain the average noise spectrum. Step 2.2: Perform short-time Fourier transform on each frame of the original audio signal to obtain the signal spectrum Y(ω) of the original audio; Step 2.3: Subtract the average noise spectrum from the signal spectrum Y(ω) of the original audio to obtain the denoised signal spectrum Step 2.4: By performing an inverse Fourier transform on to reconstruct the time-domain signal, the reconstructed time-domain signal is the denoised audio signal.
4. A cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, characterized in that, Specifically, Step 3 is: Step 3.1 Calculate the short-time energy and short-time zero-crossing rate of each frame of the denoised audio signal to obtain the discrete values of the short-time zero-crossing rate and short-time energy. These discrete values are smoothed to obtain the envelope curve; Step 3.2 Assume that the initial silent segment is clean and stable, multiply the average short-time energy and average short-time zero-crossing rate of the silent segment by empirical coefficients respectively to obtain the short-time energy threshold and short-time zero-crossing rate threshold; Step 3.3 Calculate the intersection points of the short-time energy threshold and the envelope line, determine the region with low values on both sides and high value in the middle, and obtain the rough values of the start and end points of the speech; Step 3.4 Search forward from the rough start point and backward from the rough end point, calculate the intersection points of the short-time zero-crossing rate envelope line and the short-time zero-crossing rate threshold to obtain the accurate start point and accurate end point. Through the accurate start point and accurate end point, segment the parts with obvious sound in the denoised audio signal.
5. The cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, wherein The time-domain features extracted in Step 4 are: Maximum value: max(s) where s is the sample value sequence of the audio sample signal segmented; Energy: where s i is the i-th sample value of the segmented audio sample signal, and n is the number of sampling points, the same hereinafter; Mean: Variance: where μ is the mean, the same below; Skewness: where σ is the standard deviation, the same below; Kurtosis: Peak factor: where mean is the mean.
6. The cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, characterized in that, The frequency-domain features extracted in Step 5 are: Spectrum centroid: where f is the frequency, and S(f) is the power spectral density at f; Spectrum flatness: where X y is the amplitude of the segmented audio sample signal in the y-th frequency domain, and N is the number of samples in the frequency domain.
7. A cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, characterized in that Specifically, Step 8 is: Step 8.1: Input the labeled feature vector combination as the training set into the GBDT model; GBDT uses the negative gradient of the loss function as an approximation of the residual. When using GBDT for binary classification, the loss function is the log-likelihood function where y i is the true label (0 or 1) of the i-th sample, is the predicted probability of the GBDT for the i-th sample, and the residual is r z,i , which is the negative gradient of the loss function, and the formula is as follows: Among them, is the predicted value of the sample by GBDT in the (z - 1)-th iteration. The trained GBDT will generate leaf node indices for the positions of each sample on each tree; Step 8.2: The leaf node indexes generated for each sample are one-hot encoded; Step 8.3: The data of each sample after one-hot encoding is combined with the original 9-dimensional feature vector; Step 8.4: The combined feature vector is input into a logistic regression LR model for training to obtain a GBDT-LR model; In the LR model, ( whose value ranges from 0 to 1) is a sigmoid function. The sigmoid function is used to represent the probability of binary classification. If exceeds 0.5, the sample is classified as the positive class; otherwise, it is classified as the negative class. z = w·x T +b = w1x1 + w2x2 + … + w n x n +b is a linear combination, where is the input feature vector, is the weight vector, and b is the bias. The core idea of this model is to use the gradient descent method to iteratively update w and b to minimize the loss function J(w, b). For binary classification problems, the loss function is defined as: where y i is the true label (0 or 1) of the i-th sample, and is the predicted probability of the i-th sample by LR, and m is the total number of samples; Step 8.5: The trained GBDT-LR model is used to verify the 9-dimensional feature vectors of the test set samples to obtain the accuracy.
8. A cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, characterized in that, Step 9 is specifically as follows: Devices are allocated to different subjects in hospitals, dormitories, and laboratories for data collection. This dataset contains approximately 270 cough events and 290 non-cough events. The subjects cough, exhale, clear their throats, and speak randomly during normal work and life. To collect signals as clearly as possible, the microphone is placed within a range of 30 centimeters from the mouth and clipped to the collar; To evaluate the performance of the cough recognition model, "cough samples predicted as coughs" are defined as true positives (TP), "cough samples predicted as non-coughs" are defined as false negatives (FN), "non-cough samples predicted as non-coughs" are defined as true negatives (TN), "non-cough samples predicted as coughs" are defined as false positives (FP), and accuracy, precision, recall, and F1 are used as evaluation metrics; Accuracy represents the ability of the model to identify the total samples and is an overall characterization of the model's performance; Precision represents the model's ability to control false positives. In cough monitoring, high accuracy means fewer misjudgments; Recall represents the proportion of positive samples identified in the model. In cough monitoring, high sensitivity means fewer missed diagnoses; The F1 score is the harmonic mean of precision and recall, which reflects the performance of the model in a dataset with imbalanced class numbers; The receiver operating characteristic curve (ROC) and the area under the curve (AUC) are used to evaluate the classification performance of the model. The ROC curve is plotted with the true positive rate (TPR) as the vertical axis and the false positive rate (FPR) as the horizontal axis. The value range of AUC is 0 to 1.
9. A cough sound recognition method based on the PSO-GBDT-LR model according to claim 1, characterized in that, The parameters of the PSO algorithm in Step 10 are as follows: w is 0.8, c1 and c2 are 1, and the loop automatically exits after 40 iterations. Here, w is the inertia weight, and c1 and c2 are learning factors, representing individual learning ability and swarm learning ability respectively.
Citation Information
Patent Citations
Pig cough sound monitoring and early warning system based on deep learning
CN112164408A
Cough sound recognition method for health monitoring
CN119418728A
Cough sound recognition method and device, and storage medium
WO2019023879A1
Systems and methods for acoustic-based diagnosis
WO2024081343A1
Cited By
Bat sound detection system based on voiceprint recognition
CN121789693A