Sound classification method and system based on channel attention and multi-scale mel spectrogram
By using adaptive scale audio feature extraction and channel attention model, multi-channel Mel spectrograms are generated, which solves the problems of low accuracy and slow speed in existing cough sound classification methods and achieves high-precision and fast cough sound recognition.
Patent Information
- Application Number
- CN202410125389.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2044-01-30
AI Technical Summary
Existing cough sound classification methods suffer from poor diagnostic accuracy and slow speed. In particular, CNN-based methods lose spatial correlation information when using Mel spectrum as input.
We employ a method based on channel attention and multi-scale Mel spectrograms. We generate multi-channel Mel spectrograms through adaptive scale audio feature extraction and build a convolutional neural network model based on channel attention to extract features from the three-channel Mel spectrograms. We improve classification accuracy by using Mel spectrograms at different scales and the channel attention model.
It achieves low-cost, high-precision, and fast cough sound classification, improving the model's accuracy and robustness, with a recognition accuracy of 90.50%, which is superior to other algorithms.
Smart Images

Figure CN117854546B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and voice recognition, specifically to a voice classification method and system based on channel attention and multi-scale Mel spectrograms. Background Technology
[0002] In clinical practice, specific acoustic indicators (such as the loudness, frequency, and duration of a cough) can assist doctors in diagnosing coughs. For example, a cough resembling a rooster's crow is a typical characteristic of whooping cough, while a cough resembling a dog's bark is a typical characteristic of acute laryngitis. These features can be extracted through signal processing and used to train an artificial intelligence (AI) engine to achieve rapid diagnosis based on cough type.
[0003] In existing technologies, deep learning methods such as CNNs and Recurrent Neural Networks (RNNs) are used for cough detection, and deep learning outperforms traditional methods. Researchers have proposed cough recognition methods based on Mel-spectrograms and CNNs. Some researchers use Mel-spectrograms as input to Support Vector Machines (SVMs) to distinguish cough sounds. Others use time-frequency features and random forests to differentiate cough sounds. Still others use raw waveform features to identify cough and non-cough sounds. Although CNN models have achieved excellent performance in cough sound classification, existing methods still have some problems. First, these CNN-based methods use Mel-spectrograms (grayscale images) as input, rather than RGB images. Second, CNNs are trained on local spaces, which can lead to the loss of spatial correlation information. Finally, although there are many excellent CNN models, no research has yet explored the performance of CNNs in cough classification. In summary, existing cough sound classification methods suffer from poor accuracy and slow speed in sound diagnosis and recognition. Summary of the Invention
[0004] The purpose of this invention is to overcome the above-mentioned shortcomings and propose a low-cost, high-precision, and fast sound classification method and system based on channel attention and multi-scale Mel spectrograms.
[0005] This invention provides a sound classification method and system based on channel attention and multi-scale Mel spectrograms, wherein the method includes the following steps:
[0006] Step 1: Data Acquisition: Acquire cough audio data and perform audio noise reduction processing;
[0007] The cough audio was collected using a high-fidelity microphone to reduce signal distortion.
[0008] The audio noise reduction process uses spectral subtraction.
[0009] Step 2: Cough Event Detection: Perform cough event detection on the long audio and remove silent segments to segment out short audio signals containing cough events; perform unified processing on the short audio signals;
[0010] The short-time audio signal is 1-5 seconds long.
[0011] The short-time audio signal is uniformly processed into an audio signal with a duration of 5 seconds, single channel, bit depth of 16, and sampling rate of 44.1 Hz.
[0012] Step 3: Adaptive Scale Audio Feature Extraction: Adaptive scale audio feature extraction is performed on the uniformly processed short-time audio signal to generate multi-channel Mel-spectrum data of the audio; the specific steps of the adaptive scale audio feature extraction are as follows:
[0013] Step 3.1: Introduce the scaling factor as an adaptive parameter into the audio framing method to automatically generate the frame length and frame shift, as follows:
[0014] ws=γ i *0.025
[0015] hl = ws / 2
[0016] Where ws is the frame length, hl is the frame shift, i is the channel value, and γ is the scale variable;
[0017] In channel 1, the frame length and frame shift are calculated according to the aforementioned generation method, and frames are divided based on the current frame length and frame shift. The frame length is the length of each audio frame, and the frame shift is the non-overlapping portion between adjacent frames. Each frame is windowed using a Hamming window, and then a Fast Fourier Transform is used to generate the audio spectrum. After the above operations, the cough audio signal y(n) is converted into a frequency domain signal X(a,k), and the conversion formula is as follows:
[0018]
[0019] Where a represents the a-th frame of the audio, k represents the k-th spectral line in the frequency domain, N is the number of sampling points for the cough information, and i is the imaginary unit;
[0020] The signal is converted to the frequency domain using the following formula: Step 3.2: Pass the spectrogram through a Mel filter bank to obtain the Mel spectrogram A of the audio. 1 j The conversion formula is as follows:
[0021]
[0022] Where m represents the converted Mel frequency, and f represents the original frequency of the audio.
[0023] Mel spectrum diagram A of channel 1 1 j The dimensions are 128*501;
[0024] Step 3.3: Calculate the frame length and frame shift of channels 2 and 3 according to the generation method in channel 1. After framing, windowing, and Mel filter processing, obtain the Mel spectrograms A of channels 2 and 3. 2 j and A 3 j ;
[0025] Mel spectrum diagrams A of channels 2 and 3 2 j and A 3 j The dimensions are 128*201 and 128*101 respectively.
[0026] A 1 j A 2 j and A 3 j By splicing the data, we obtain the three-channel Mel-frequency spectrogram K of audio j. j Mel spectrograms at different scales ensure that the three channels have different frequency and time information;
[0027] The three-channel Mel-frequency spectrum K j The size has been reset to 128×250;
[0028] Step 3.4: Repeat steps 3.1, 3.2, and 3.3 to obtain the set K of the Mel-spectral feature matrices of the audio, K = {K1, K2, ..., K}. j};
[0029] Step 4: Collect audio data of coughing sounds; collect audio data of actions such as brushing teeth, laughing, snoring, sneezing, and drinking water; process and label the audio data of coughing sounds and actions in a unified manner to form a labeled standard dataset CSC4;
[0030] The audio data of the cough sound and the audio data of the action sound are uniformly processed into an audio with a duration of 5 seconds, single channel, bit depth of 16, and sampling rate of 44.1HZ.
[0031] Step 5: Build a convolutional neural network model based on channel attention and extract features from the three-channel Mel-ray spectrogram. The specific steps are as follows:
[0032] Step 5.1: Build a convolutional neural network model, which includes an input layer, 5 hidden layers, a fully connected layer, a Dropout layer, and an output layer. The hidden layers consist of convolution, normalization, activation function, and max pooling operations, with ReLU as the activation function. The output of the convolutional layer is calculated according to the following formula.
[0033]
[0034] Where, x l j w is the output of the j-th neuron; (l) i,j b is the weight of the j-th neuron in the i-th class of the l-th layer; (l) i is the bias of the i-th class in the l-th layer; * represents the convolution operation; f(·) is the activation function of the model;
[0035] Step 5.2: The channel attention model SENet, whose main operations include squeezing (sq), activation (ex), and dot product scaling, are calculated as follows:
[0036]
[0037] s c =F ex (z c ,W)=σ(W2f(W1z c ))
[0038] X c =F scale (u c s c ) = s c ·u c
[0039] Among them, z c This represents the c-th feature map obtained after global average pooling; s c X represents the weight of each channel in the input feature layer; c F represents the feature matrix output by SENet. sq F ex and F scale These represent the internal transformation operations of SENet; c is the number of channels; H and W are the height and width of the feature map, respectively; u c The c-th feature map is the result of convolution of the input features. The activation function is Sigmoid, and W1 and W2 are the weight matrices of the fully connected layer;
[0040] SENet is inserted into the first hidden layer of the convolutional neural network to form a convolutional neural network model based on channel attention;
[0041] Step 5.3: Divide the CSC4 dataset into 5 equal parts using the five-fold cross-validation method, and merge 4 parts in turn as the training set, with the remaining part as the test set; train and validate the channel attention-based convolutional neural network model on the CSC4 dataset to obtain the feature model M of the three-channel Mel-ray spectrogram. weight To train the model, cross-entropy is used as the loss function, expressed as:
[0042]
[0043] Where L is the loss value; w is the weight; b is the bias value; d is the total number of samples; z is the number of sample classes; 1{y r =c} is an indicator function; it outputs 1 when the value inside the parentheses is true, and 0 otherwise; p c r Let represent the probability that the r-th sample is predicted to be of class c; ln is the natural logarithm.
[0044] Step 6: Use the set K of the Mel-map feature matrices of the audio as M weight The input is used to generate sound classification results.
[0045] A sound classification system based on channel attention and multi-scale Mel spectrograms, wherein: the sound classification method based on channel attention and multi-scale Mel spectrograms described above is applied, including a data acquisition and noise reduction module, a cough event detection module, an adaptive scale audio feature extraction module, and a sound classification module;
[0046] The data acquisition and noise reduction module is used to acquire cough audio data and preprocess the audio data;
[0047] The cough event detection module detects cough events in long audio and removes silent segments, segments out short audio containing cough events, and performs unified processing on the short audio.
[0048] The adaptive scale audio feature extraction module is used to generate multi-channel Mel spectrum data of audio.
[0049] The sound classification module constructs a convolutional neural network model based on channel attention, extracts features from the three-channel Mel spectrogram, builds a feature model of the three-channel Mel spectrogram, inputs the data into the feature model of the three-channel Mel spectrogram, performs sound classification, and outputs the sound classification result.
[0050] Compared with the prior art, the present invention has obvious beneficial effects. As can be seen from the above scheme, adaptive scale audio feature extraction is performed on the uniformly processed short-time audio signal to generate multi-channel Mel-spectrogram data of the audio. This method automatically generates multi-channel Mel-spectrograms (MSMel-spectrogram) with different scales. Different scales ensure that different channels have different information.
[0051] By constructing a convolutional neural network model based on channel attention and extracting features from the three-channel Mel spectrogram, the model's accuracy and robustness can be improved by fully utilizing the information between feature channels.
[0052] The Cough Sound Classification Method Based on Channel Attention and Multi-Scale Mel Spectrograms (CPCSC) includes a CNN-based classification model based on channel attention and an adaptive audio feature extraction algorithm.
[0053] In summary, this invention is characterized by low cost, high precision, and speed.
[0054] The following specific embodiments further illustrate the beneficial effects of the present invention. Attached Figure Description
[0055] Figure 1 This is the overall flowchart of the present invention;
[0056] Figure 2 This is a diagram illustrating the noise reduction effect of the present invention. Detailed Implementation
[0057] The following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, features, and effects of a sound classification method and system based on channel attention and multi-scale Mel spectrograms proposed in accordance with the present invention.
[0058] See Figure 1 The present invention discloses a sound classification method and system based on channel attention and multi-scale Mel spectrograms, wherein the method includes the following steps:
[0059] Step 1: The data acquisition and noise reduction module is used to acquire cough signals and preprocess them. A high-fidelity microphone is typically used to reduce signal distortion. In a home environment, noise sources are mainly chatter and music, making noise reduction crucial for cough classification. This invention uses spectral subtraction to achieve audio noise reduction; the noise reduction effect is shown in [see image]. Figure 2 ;
[0060] Step 2: The cough event detection module detects coughs in long audio segments and removes silent segments, segmenting short audio segments (1-5 seconds) containing coughs; the data is then uniformly processed into audio with a duration of 5 seconds, single channel, bit depth of 16, sampling rate of 44.1Hz, and format of .WAV.
[0061] Step 3: Adaptive scaling audio feature extraction module, used to generate multi-channel Mel spectrum data of audio; Step 3.1: Introduce the scaling scale as an adaptive parameter into the audio framing method to automatically generate frame length and frame shift, the generation method is shown in Formula 1 and Formula 2:
[0062] ws=γ i *0.025 (1)
[0063] hl=ws / 2 (2)
[0064] Where ws is the frame length, hl is the frame shift, i is the channel value, and γ is the scale variable;
[0065] In channel 1, the frame length and frame shift are calculated according to equations (1) and (2), and the audio is divided into frames based on the current frame length and frame shift. The frame length is the length of each audio frame, and the frame shift is the non-overlapping portion between adjacent frames. Each frame is windowed using a Hamming window, and then a fast Fourier transform is used to generate the audio spectrum. After the above operations, the cough signal y(n) is converted into the frequency domain signal X(a,k), and the conversion formula is as follows:
[0066]
[0067] It is converted into a frequency domain signal: where a represents the a-th frame of the audio, k represents the k-th spectral line in the frequency domain, N is the number of sampling points for the cough information, and i is the imaginary unit;
[0068] Step 3.2: Pass the spectrogram through a Mel filter bank to obtain the Mel spectrogram A of the audio. 1 j The conversion formula is shown in formula (4). j represents the j-th audio, and the Mel spectrogram size of channel 1 is 128*501;
[0069]
[0070] In the formula, f represents the original frequency of the audio data, and m represents the converted Mel frequency.
[0071] Step 3.3: Calculate the frame length and frame shift of channel 2 and channel 3 according to formulas 1 and 2. After framing, windowing, and Mel filter processing, obtain the Mel spectrograms A of channel 2 and channel 3. 2 j and A 3 jTheir dimensions are 128*201 and 128*101 respectively;
[0072] A 1 j A 2 j and A 3 j By splicing the data, we obtain the three-channel Mel-frequency spectrogram K of audio j. j Mel spectrograms at different scales ensure that the three channels have different frequency and time information;
[0073] matrix K j The size has been reset to 128×250
[0074] Step 3.4: Repeat steps 3.1, 3.2, and 3.3 to obtain the set K of the Mel-spectral feature matrices of the audio, K = {K1, K2, ..., K...} j};
[0075] Step 4: Collect cough sound data in the home environment; collect sound data of actions such as brushing teeth, laughing, snoring, sneezing, and drinking water;
[0076] Step 4.1: The data was uniformly processed into an audio set with a duration of 5 seconds, single channel, bit depth of 16, sampling rate of 44.1 Hz, and format of .WAV. The disease types of the audio were then labeled to form a labeled standard dataset CSC4; the final dataset contained 400 audio tracks, including 300 cough tracks and 100 non-cough tracks.
[0077] Step 5: Build a channel attention-based convolutional neural network (CNN) model to extract features from the three-channel Mel spectrogram;
[0078] Step 5.1: Construct a Convolutional Neural Network (CNN) model, which includes an input layer, five hidden layers, a fully connected layer, a Dropout layer, and an output layer. The hidden layers consist of operations such as convolution, normalization, activation functions, and max pooling, with ReLU being the activation function. The output of the convolutional layers is calculated according to formula (5).
[0079]
[0080] In the formula, x l j w is the output of the j-th neuron; (l) i,j b is the weight of the j-th neuron in the i-th class of the l-th layer; (l) i is the bias of the i-th class in the l-th layer; * represents the convolution operation; f(·) is the activation function of the model;
[0081] Step 5.2: The channel attention model is SENet, whose main operations include Sequeeze, Excitation, and Scale, calculated as shown in formulas (6), (7), and (8). SENet is inserted into the first hidden layer of the CNN network, and the model structure is as follows: Figure 2 As shown;
[0082]
[0083] s c =F ex (z c ,W)=σ(W2f(W1z c ))
[0084] X c =F scale (u c s c ) = s c ·u c
[0085] Among them, z c This represents the c-th feature map obtained after global average pooling; s c X represents the weight of each channel in the input feature layer; c F represents the feature matrix output by SENet. sq F ex and F scale These represent the internal transformation operations of SENet; c is the number of channels; H and W are the height and width of the feature map, respectively; u c The c-th feature map is the result of convolution of the input features. The activation function is Sigmoid, and W1 and W2 are the weight matrices of the fully connected layer;
[0086] Step 5.3: Divide the CSC4 dataset into 5 equal parts using the five-fold cross-validation method, and merge 4 parts alternately as the training set, with the remaining part as the test set; train and validate the model on the CSC4 dataset to obtain the feature model M. weight To train the model, cross-entropy is used as the loss function, expressed as:
[0087]
[0088] Where: L is the loss value; w is the weight; b is the bias value; d is the total number of samples; z is the number of sample classes; 1{y r =c} is an indicator function; it outputs 1 when the value inside the parentheses is true, and 0 otherwise; p c r Let represent the probability that the r-th sample is predicted to be of class c; ln is the natural logarithm.
[0089] Step 6: Use the set K of the Mel-map feature matrices of the audio as M weight The input is used to generate the recognition result C. real .
[0090] Performance Analysis:
[0091] A. Dataset
[0092] We collected audio recordings of patients with coughs. The diagnosis of cough in the audio was attributed to the audio title, related descriptions, and the doctor's report and diagnosis after examination. Non-cough data was collected at Guizhou University, where we collected five types of sounds from 10 volunteers: brushing teeth, laughing, snoring, sneezing, and drinking water. We used a Sony ICD-UX570F voice recorder for sound recording.
[0093] Before extracting audio features, the audio data needs to be preprocessed. All audio files were uniformly edited into a 5-second, single-channel, 16-bit depth audio set with a sampling rate of 44100Hz. The audio format was uniformly .wav, and the audio categories were labeled using a .csv file.
[0094] The final cough sound classification dataset (Cough Sounds Classification4, CSC4) contains 400 audio recordings. The dataset is classified as follows: 400 cough sounds and 100 non-cough sounds.
[0095] Coswara is a publicly available cough dataset. This dataset was used to diagnose COVID-19 and includes information such as patient age, sex, and health status. This study obtained 468 records, of which 431 were positive for COVID-19 and 37 were negative. To address the data imbalance issue, we added 104 negative samples to the dataset.
[0096] B. Experimental Setup
[0097] The hardware environment for the experiment was as follows: the CPU was an Intel Xeon Gold 218, and the graphics cards were two GV100 servers (32GB of video memory each). The network model was trained and tested on an Ubuntu 20.04 operating system, using PyTorch as the deep learning framework.
[0098] The hyperparameters for the experiment were set as follows: 70 iterations, 32 batch parameters, 0.0001 learning rate, Adam optimizer, and cross-entropy loss function.
[0099] C. Comparison Algorithm
[0100] Six deep learning networks were selected as comparison algorithms for experiments: ResNet50, InceptionV3, ResNeXt50, Mel-CNN, MobileNetV2, and LSTM. ResNet, the 2015 ImageNet competition winner, achieves a model depth of 152 layers through residual modules. ResNet50 outperforms other algorithms in the same series on the cough classification task, therefore, it was chosen as the comparison algorithm. ResNet50 is a 50-layer convolutional neural network. InceptionV3, proposed by Google in 2014, contributes by splitting the network, further increasing its depth to 312 layers, thus improving computational efficiency while reducing parameters. ResNeXt50, proposed in 2017, is an upgraded version of ResNet, fusing ResNet and Inception to improve model efficiency. Mel-CNN is a cough recognition method based on Mel-spectrograms and CNNs. In 2018, Google proposed MobileNetV2, a method that not only improves accuracy but also reduces computational cost and memory usage. LSTM consists of three gates: an input gate, a forget gate, and an output gate. Two LSTM layers with 128 and 256 units are stacked as a comparison algorithm.
[0101] D. Results and Analysis
[0102] Under the premise that the voice of the same person cannot appear in both the training set and the test set at the same time, the dataset is divided into 5 equal parts using the five-fold cross-validation method. Four of the parts are merged in turn as the training set, and the remaining part is used as the test set.
[0103] To investigate the effectiveness of AFAS and CAMC, we extracted audio features using Mel-spectrogram and MSMel-spectrogram, respectively. We tested the performance of CPCSC and other comparative algorithms on CSC4. The statistical results of the performance of each algorithm are shown in Table 1, expressed as mean ± standard deviation. Based on Table 2, the following conclusions can be drawn: 1) All models achieve higher recognition accuracy on MSMel-spectrogram than on Mel-spectrogram. The recognition accuracy of ResNet50 on MSMel-spectrogram is 8.75% higher than that on Mel-spectrogram. This indicates that MSMel-spectrogram is a useful method; 2) In terms of average recognition accuracy, the proposed CPCSC achieves 90.50% and 89.75%, respectively, which are 8.75% and 13% higher than Mel-CNN. Furthermore, CPCSC has the highest accuracy among all algorithms. This demonstrates that the channel attention mechanism is effective.
[0104] Table 17 shows the recognition accuracy (%) of 17 algorithms on different feature sets.
[0105]
[0106]
[0107] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A sound classification method based on channel attention and multi-scale Mel spectrograms, characterized in that: The method includes the following steps: Step 1: Data Acquisition: Acquire cough audio data and perform audio noise reduction processing; Step 2: Cough Event Detection: Perform cough event detection on the long audio and remove silent segments to segment out short audio signals containing cough events; perform unified processing on the short audio signals; Step 3: Adaptive Scale Audio Feature Extraction: Adaptive scale audio feature extraction is performed on the uniformly processed short-time audio signal to generate multi-channel Mel-spectrum data of the audio; the specific steps of the adaptive scale audio feature extraction are as follows: Step 3.1: Introduce the scaling factor as an adaptive parameter into the audio framing method to automatically generate the frame length and frame shift, as follows: ws=c i * 0.025 hl = ws / 2 Where ws is the frame length, hl is the frame shift, i is the channel value, and γ is the scale variable; In channel 1, the frame length and frame shift are calculated according to the generation method described above, and the audio is divided into frames based on the current frame length and frame shift. The frame length is the length of each audio frame, and the frame shift is the non-overlapping portion between adjacent frames. Each frame is windowed using a Hamming window, and then a fast Fourier transform is used to generate the audio spectrum. After the above operations, the cough audio signal y(n) is converted into a frequency domain signal X(a, k), and the conversion formula is as follows: Where a represents the a-th frame of the audio, k represents the k-th spectral line in the frequency domain, N is the number of sampling points for the cough information, and i is the imaginary unit; Step 3.2: Pass the spectrogram through a Mel filter bank to obtain the Mel spectrogram A of the audio. 1 j The conversion formula is as follows: Where m represents the converted Mel frequency, and f represents the original frequency of the audio. Step 3.3: Calculate the frame length and frame shift of channels 2 and 3 according to the generation method in channel 1. After framing, windowing, and Mel filter processing, obtain the Mel spectrograms A of channels 2 and 3. 2 j and A 3 j ; A 1 j A 2 j and A 3 j By splicing the data, we obtain the three-channel Mel-frequency spectrogram K of audio j. j Mel spectrograms at different scales ensure that the three channels have different frequency and time information; Step 3.4: Repeat steps 3.1, 3.2, and 3.3 to obtain the set K of the Mel-spectral feature matrices of the audio, K = {K1, K2, ..., K}. j }; Step 4: Collect audio data of coughing sounds; collect audio data of actions such as brushing teeth, laughing, snoring, sneezing, and drinking water; process and label the audio data of coughing sounds and actions in a unified manner to form a labeled standard dataset CSC4; Step 5: Build a convolutional neural network model based on channel attention and extract features from the three-channel Mel-ray spectrogram. The specific steps are as follows: Step 5.1: Build a convolutional neural network model, which includes an input layer, 5 hidden layers, a fully connected layer, a Dropout layer, and an output layer. The hidden layers consist of convolution, normalization, activation function, and max pooling operations, with ReLU as the activation function. The output of the convolutional layer is calculated according to the following formula. Where, x l j w is the output of the j-th neuron; (l) i,j b is the weight of the j-th neuron in the i-th class of the l-th layer; (l) i is the bias of the i-th class in the l-th layer; * represents the convolution operation; f(·) is the activation function of the model; Step 5.2: The channel attention model SENet, whose main operations include squeezing (sq), activation (ex), and dot product scaling, are calculated as follows: Where, z c This represents the c-th feature map obtained after global average pooling; s c X represents the weight of each channel in the input feature layer; c F represents the feature matrix output by SENet. sq F ex and F scale These represent the internal transformation operations of SENet; c is the number of channels; H and W are the height and width of the feature map, respectively; u c ϭ(·) is the c-th feature map after the input features are convolved; ϭ(·) is the activation function Sigmoid; W1 and W2 are the weight matrices of the fully connected layer. SENet is inserted into the first hidden layer of the convolutional neural network to form a convolutional neural network model based on channel attention; Step 5.3: Divide the CSC4 dataset into 5 equal parts using the five-fold cross-validation method, and merge 4 parts in turn as the training set, with the remaining part as the test set; train and validate the channel attention-based convolutional neural network model on the CSC4 dataset to obtain the feature model M of the three-channel Mel-ray spectrogram. weight To train the model, cross-entropy is used as the loss function, expressed as: Where L is the loss value; w is the weight; b is the bias value; d is the total number of samples; z is the number of sample classes; 1{y r =c} is an indicator function; it outputs 1 when the value inside the parentheses is true, and 0 otherwise. c r Let represent the probability that the r-th sample is predicted to be of class c; ln is the natural logarithm. Step 6: Use the set K of the Mel-map feature matrices of the audio as M weight The input is used to generate sound classification results.
2. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 1, the cough audio is collected using a high-fidelity microphone to reduce signal distortion.
3. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 1, the audio noise reduction process employs spectral subtraction.
4. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 2, the short audio signal is 1-5 seconds long.
5. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 1, the short audio signal is uniformly processed into an audio signal with a duration of 5 seconds, single channel, bit depth of 16, and sampling rate of 44.1 Hz.
6. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 3.2, the Mel spectrum A of channel 1 1 j The dimensions are 128*501.
7. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 3.3, the Mel spectrum A of channels 2 and 3. 2 j A 3 j The dimensions are 128*201 and 128*101 respectively.
8. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 3.3, the three-channel Mel-ray spectrogram K j Size reset .
9. The sound classification method based on channel attention and multi-scale Mel spectrograms as described in claim 1, characterized in that: In step 4, the audio data of the cough sound and the audio data of the action sound are uniformly processed into an audio with a duration of 5 seconds, single channel, bit depth of 16, and sampling rate of 44.1 Hz.
10. A sound classification system based on channel attention and multi-scale Mel spectrograms, characterized in that: The sound classification method based on channel attention and multi-scale Mel spectrograms applied to any one of claims 1-9 includes: a data acquisition and noise reduction module, a cough event detection module, an adaptive scale audio feature extraction module, and a sound classification module; The data acquisition and noise reduction module is used to acquire cough audio data and preprocess the audio data; The cough event detection module detects cough events in long audio and removes silent segments, segments out short audio containing cough events, and performs unified processing on the short audio. The adaptive scale audio feature extraction module is used to generate multi-channel Mel spectrum data of audio. The sound classification module constructs a convolutional neural network model based on channel attention, extracts features from the three-channel Mel spectrogram, builds a feature model of the three-channel Mel spectrogram, inputs the data into the feature model of the three-channel Mel spectrogram, performs sound classification, and outputs the sound classification result.