Snore detection method and apparatus based on multi-model superimposition
Through the multi-model superposition method, combining the background sound multi-classification model and the snoring two-classification model, combined with the autoencoder denoising process, the problem of high false detection rate of snoring detection in the existing technology is solved, and the accuracy of snoring detection is significantly improved.
Patent Information
- Application Number
- PCT/CN2024/080764
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-10
- Filing Date
- 2024-03-08
- Publication Date
- 2024-09-19
AI Technical Summary
Among existing snoring detection methods, it is difficult for a single detection model to effectively distinguish between background sound and snoring, resulting in a high false detection rate. Especially when the background sound is music or human voices, the detection accuracy is low.
Using a multi-model superposition method, the background sound type is first detected through the background sound multi-classification model. If it is silence, the snoring is then detected through the snoring two-classification model. The autoencoder model is combined with the autoencoder model to encode, decode and denoise the MFCC features to determine the current frame audio. Whether the data contains snoring sounds.
Through the detection of background sound multi-classification model and the verification of snoring two-classification model, false detection due to background sound is reduced and the detection accuracy is improved. The accuracy of feature extraction is enhanced through autoencoder denoising processing, which significantly improves the accuracy of detection. Accuracy of snoring detection.
Smart Images

Figure CN2024080764_19092024_PF_FP_ABST
Abstract
Description
A snoring detection method and device based on multi-model superposition Technical Field
[0001] The present application relates to the technical field of snoring detection, and in particular to a snoring detection method and device based on multi-model superposition. Background Art
[0002] Obstructive sleep apnea-hypopnea syndrome (OSAHS) is a common condition that is often overlooked. It is primarily caused by sleep apnea, hypoventilation, or no ventilation, which can cause daytime sleepiness and recurring apnea episodes. The most notable symptom is snoring during sleep, so snoring recognition can effectively detect possible OSAHS.
[0003] The existing technology generally uses a single detection model for snoring recognition. Comparative Document 1, "A snoring monitoring method and system based on deep learning algorithm and a corresponding electric bed control method and system" (Application No. 202110803746.6), discloses the use of a pre-trained deep learning model for deep feature extraction and classification to classify each audio segment into audio slices containing snoring and audio slices that do not contain snoring. Comparative Document 1 directly judges the MFCC feature data through a neural network without identifying and processing the background sound. Comparative Document 2, "A snoring signal recognition method" (Application No. 201910834050.2), discloses the use of a k-means clustering algorithm to identify snoring and non-snoring. Both Comparative Document 1 and Comparative Document 2 have a certain false detection rate.
[0004] Summary of the Invention
[0005] In order to solve the above technical problems, the present invention provides a snoring detection method and device based on multi-model superposition, which only detects snoring after detecting that the background sound is silence, thereby reducing false detection caused by background sound such as music or human voice, and improving the detection accuracy.
[0006] The present invention adopts the following technical solutions:
[0007] In one aspect, a snoring detection method based on multi-model superposition includes:
[0008] Acquire audio data including a current frame and a preset frame before the current frame as background sound audio data;
[0009] Extract MFCC features of background sound audio data;
[0010] Input the MFCC features into the trained background sound multi-classification model for detection to obtain the detection results;
[0011] If the detection result is silence, the MFCC features are input into a trained snoring binary classification model to detect whether the current frame audio data includes snoring.
[0012] Preferably, obtaining audio data of a current frame and a preset frame before the current frame as background sound audio data specifically includes:
[0013] Get the current frame audio data;
[0014] Splicing the current frame audio data with the audio data in the frame buffer queue and inserting the resultant into the frame buffer queue; the frame buffer queue adopts a first-in-first-out principle and is capable of storing the audio data of the first preset frame;
[0015] It is determined whether the buffer queue includes audio data of the first preset frame. If so, the audio data in the buffer queue is used as background sound audio data.
[0016] Preferably, if it is detected that the current frame of audio data includes snoring, the method further includes:
[0017] Calculate the decibel value of the current frame audio data;
[0018] Calculate the time interval between the current frame and the previous frame that was judged to be snoring;
[0019] Update the information of the current storage list; the information includes a timestamp and a decibel value;
[0020] It is determined whether the decibel value is within a preset decibel range, and whether the time interval is within a preset time range. If both conditions are met, it is prompted that snoring is detected.
[0021] Preferably, before inputting the MFCC features into the trained snoring binary classification model, the method further includes:
[0022] Input the MFCC features into the trained autoencoder model to encode and decode the features to obtain reconstructed MFCC features;
[0023] The MFCC features are input into the trained snoring binary classification model to detect whether the current frame of audio data contains snoring, specifically including:
[0024] The reconstructed MFCC features are input into the trained snoring binary classification model to detect whether the current frame audio data contains snoring.
[0025] Preferably, the autoencoder model is a neural network model comprising an input layer, an encoder layer, a decoder layer and an output layer;
[0026] The autoencoder model uses the average Euclidean distance metric loss as follows:
[0027] Among them, x j Represents the raw data of the model input, Represents the prediction result output by the model.
[0028] Preferably, the encoder layer includes several connected convolutional layers and pooling layers, and the decoder layer includes several connected convolutional layers and upsampling layers.
[0029] Preferably, the background sound multi-classification model adopts the AudioLiteNet neural network model, which includes several connected blocks; the blocks are connected by direct connection or skip-layer connection; the direct connection is to use the operators defined in advance in the block to perform data pipeline streaming calculations; the skip-layer connection is to add features.
[0030] Preferably, the background sound multi-classification model uses five frames of audio data as background sound audio data, the input of the background sound multi-classification model is the extracted MFCC features, and the output of the background sound multi-classification model is the confidence of music, human voice and silence, and the class with the largest confidence is taken as the detection result.
[0031] Preferably, the snoring binary classification model adopts the AudioLiteNet neural network model, which includes several connected blocks; the blocks are connected by direct connection or skip-layer connection; the direct connection is to use pre-defined operators in the block to perform data pipeline streaming calculations; the skip-layer connection is to add features.
[0032] Preferably, the input of the snoring binary classification model is the extracted MFCC features, the output of the snoring binary classification model is the confidence of snoring and non-snoring, and the class with the largest confidence is taken as the detection result.
[0033] Preferably, the background sound multi-classification model and the snoring binary classification model both use a binary cross entropy loss function, as follows:
[0034] Among them, N represents the total number of nodes that need to be measured, that is, the total number of categories, y i Indicates the true labeled value of the i-th node, that is, the correct classification. Represents the classification value of the i-th node predicted by the neural network.
[0035] In another aspect, a snoring detection device based on multi-model superposition includes:
[0036] A background sound audio data acquisition module is used to acquire audio data including a current frame and a preset frame before the current frame as background sound audio data;
[0037] MFCC feature extraction module, used to extract MFCC features of background sound audio data;
[0038] A background sound multi-classification model detection and acquisition module is used to input the MFCC features into the trained background sound multi-classification model for detection and obtain detection results;
[0039] The snoring detection module is used to input the MFCC features into a trained snoring binary classification model to detect whether the current frame audio data includes snoring when the detection result is silence.
[0040] The present invention has the following beneficial effects:
[0041] (1) The present invention detects the type of background sound through a background sound multi-classification model. After detecting that the background sound is silence, a snoring binary classification model is used to detect snoring or non-snoring. This can reduce false detections caused by background sound being music or human voice, thereby improving the detection accuracy.
[0042] (2) After detecting that the background sound is silence, the present invention uses an autoencoder model to encode and decode the MFCC feature map, focusing on the feature map information associated with snoring and removing irrelevant features as noise, which can achieve the effect of feature encoding on the feature map and removing a certain amount of noise;
[0043] (3) The background sound audio data used by the present invention to detect background sound is longer than the audio data used to detect snoring, which can further increase the detection accuracy;
[0044] (4) After the present invention detects snoring using a two-class snoring classification model, it further determines the range of the decibel value of the current frame audio data and whether the time interval between the current frame and the previous frame determined to be snoring is within a preset time range. If both conditions are met, it prompts that snoring has been detected, thereby increasing the detection accuracy.
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] FIG1 is a flow chart of a snoring detection method based on multi-model superposition according to an embodiment of the present invention;
[0047] FIG2 is a schematic diagram of audio data collection of a snoring binary classification model according to an embodiment of the present invention;
[0048] FIG3 is a schematic structural diagram of a feature extraction layer of a snoring binary classification model according to an embodiment of the present invention;
[0049] FIG4 is a schematic diagram of the structure of the output layer of the snoring binary classification model according to an embodiment of the present invention;
[0050] FIG5 is a schematic diagram of the overall structure of a snoring binary classification model according to an embodiment of the present invention;
[0051] FIG6 is a schematic diagram showing the connection relationship between two blocks of a snoring binary classification model according to an embodiment of the present invention;
[0052] FIG7 is a schematic diagram of audio data collection of a background sound multi-classification model according to an embodiment of the present invention;
[0053] FIG8 is a schematic diagram of the overall structure of a background sound multi-classification model according to an embodiment of the present invention;
[0054] FIG9 is a schematic diagram of the overall structure of an autoencoder model according to an embodiment of the present invention;
[0055] FIG10 is a schematic diagram of filling an autoencoder model according to an embodiment of the present invention;
[0056] FIG11 is a schematic diagram of the structure of MFCC-AENet according to an embodiment of the present invention;
[0057] FIG12 is a diagram of the downsampling process of MFCC-AENet according to an embodiment of the present invention;
[0058] FIG13 is a diagram of the upsampling process of MFCC-AENet according to an embodiment of the present invention;
[0059] FIG14 is a detailed flowchart of single-frame snoring detection according to an embodiment of the present invention;
[0060] FIG15 is a structural block diagram of a snoring detection device based on multi-model superposition according to an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention; it is obvious that the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0062] In the description of the present invention, it should be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0063] In the description of the present invention, it should be noted that the terms “first” and “second” are only used for descriptive purposes and should not be understood as indicating or implying relative importance.
[0064] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, step identifiers S101, S102, S103, etc. are only used for convenient expression and do not represent the execution order. The corresponding execution order can be adjusted.
[0065] As shown in FIG1 , the present invention provides a snoring detection method based on multi-model superposition, including:
[0066] S101, obtaining audio data including a current frame and a preset frame before the current frame as background sound audio data;
[0067] S102, extracting MFCC features of background sound audio data;
[0068] S103, inputting the MFCC features into the trained background sound multi-classification model for detection to obtain a detection result;
[0069] S104: If the detection result is silence, the MFCC features are input into a trained snoring binary classification model to detect whether the current frame of audio data includes snoring.
[0070] S101 to S104 of the multi-model superposition-based snoring detection method described in this embodiment can be implemented using a snoring prevention pillow device and / or a smart terminal device, as long as these devices have sound collection capabilities (such as a microphone) and / or processor capabilities (such as a microcontroller). Specifically, one terminal can be responsible for sound collection (such as the snoring prevention pillow) and another terminal can be responsible for sound processing (such as a mobile phone), or both collection and processing can be performed by a single terminal, without any specific limitation in this embodiment. Furthermore, the smart terminal device can be a mobile phone, tablet computer, wearable device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. This embodiment does not impose any restrictions on the specific type of terminal device.
[0071] In this embodiment, it is first necessary to train a snoring binary classification model, a background sound multi-classification model, and an autoencoder model.
[0072] (1) Training of snoring binary classification model.
[0073] (1.1) Training data collection.
[0074] The microphone on the device is used to collect sleep audio from people or subjects suspected of having OSAHS characteristics. The audio is manually segmented and cropped to filter out audio data with snoring and non-snoring sounds. The audio is then cropped into 1-second units and stored in batch files to form a dataset for snoring audio classification.
[0075] In this embodiment, a 16kHz PCM mono signal source of 1 second is collected each time, and the signal in this format is defined as "one frame", that is, one frame is equal to 1 second of audio data signal, and similarly five frames are 5 seconds of audio data signal.
[0076] Specifically, as shown in Figure 2, the snoring binary classification model uses a one-second input. Therefore, all data in the dataset is segmented into one-second segments, with no gaps in the segmentation pattern. For example, a 30-second audio segment can be segmented into 30 one-second segments. The collected audio data format is a 16kHz single-channel PCM signal, which can be viewed as a signal of 16,000 Int16s per second. The array length of 16,000 is used as the 1-second audio window length. The above operations generate a batch of one-second audio files as the dataset for the snoring binary classification model.
[0077] (1.2) Training data calibration.
[0078] After the dataset is acquired, the audio files need to be annotated. Specifically, the annotation method is to manually listen to the sound played by the audio files and classify and calibrate the content heard.
[0079] The calibration targets are as follows:
[0080] Snoring sounds during sleep (including snoring or breathing sounds from the nasal cavity, throat, etc.);
[0081] Non-snoring sounds (including all sounds except snoring, such as human voices, talking sounds, event sounds, and noises).
[0082] The manually screened and calibrated snore audio classification dataset was divided into training, validation, and test sets in an 8:1:1 ratio (depending on the specific needs). The validation set is used during the training process to iterate and continuously verify the training process, while the test set is used to test the accuracy of the model after training.
[0083] (1.3) Design of a binary classification model for snoring
[0084] Build the AudioLiteNet neural network model and feed the snoring classification dataset divided in (1.2) into the neural network model for iterative training. A trained snoring binary classification algorithm model with 1 second as input can be obtained.
[0085] In this embodiment, the network structure of the AudioLiteNet neural network model includes a large number of stacked convolutional layers (such as 16 block layers) of channel splitting and channel fusion. The purpose is to reduce the amount of computation and allow the model to be implemented on smart terminal devices while ensuring accuracy and improving the speed of inference.
[0086] As shown in Figure 3, the feature extraction layers of the network structure are composed of blocks composed of deep-wise convolution, point-wise convolution and residual modules, and are combined in a stacked form. Before performing deep convolution, a 1x1 convolution kernel is required to increase the dimension of the feature channel to achieve the effect of channel expansion.
[0087] The final output layer of the network structure uses a 1x1 convolutional layer for channel mapping and dimensionality reduction. After flattening, the result is regressed using a fully connected layer, and finally the Softmax activation function is used to map the classification confidence. n is the number of output nodes, i.e., the number of classifications, and x is the number of classifications. i Input value for the i-th node, the denominator Represents the accumulation of all classification mapping results, the molecular part Represents the classification mapping result of the current i-th node. The classification result can be mapped to the interval [0-1] through this formula, and the sum is 1, which is more consistent with the probability distribution. The Softmax activation function is as follows:
[0088] After combination, the schematic diagram of the output layer is shown in Figure 4.
[0089] The input of the snoring binary classification model AudioLiteNet is the MFCC feature map, and the final output result is the binary classification confidence. The overall network combination is shown in Figure 5.
[0090] The AudioLiteNet network structure consists of blocks, with two main methods for connecting blocks: direct connections and skip-layer connections. Direct connections utilize predefined operators (operators, ops) within the blocks to perform pipeline-like computations. Data flows through adjacent layers, resulting in a result. Figure 6 shows the connection between blocks 4 and 5 in the overall network structure. Analysis of Block 5 reveals that the direct connection operator changes the number of feature channels in the original data. Skip-layer connections essentially add features, so ensuring the dimensionality of the two connected data remains consistent. Therefore, in the direct connection operator, a Pointwise operator is used to perform convolution on the changed data channels, returning the data to the same dimensionality as before, thus enabling skip-layer connections. Skip-layer connections are an identity transformation mode. When implementing this method in a model with a large number of layers, it ensures feature reuse and mitigates the vanishing gradient problem during backpropagation during training.
[0091] The loss function used to calculate the error between the binary classification training results and the true results during training is the Binary Cross-Entropy Loss Function, as follows:
[0092] Among them, N represents the total number of nodes that need to be measured, that is, the total number of categories, y i Indicates the true labeled value of the i-th node, that is, the correct classification. Represents the classification value of the i-th node predicted by the neural network.
[0093] After 150 rounds of iterative training, the snoring binary classification model was able to achieve a higher accuracy rate when tested using pre-divided tests.
[0094] (2) Background sound multi-classification model training.
[0095] (2.1) Training data collection.
[0096] A large number of data sets that meet the needs of sleep scenarios are collected and segmented by manual operation, so as to screen out audio classification data sets with three scenes of music, speech, and silence. The audio is then cut into units of 5 seconds and stored in the form of batch files to form a background sound classification data set.
[0097] In this embodiment, a 16kHz PCM mono signal source of 1 second is collected each time, and the signal in this format is defined as "one frame", that is, one frame is equal to 1 second of audio data signal, and similarly five frames are 5 seconds of audio data signal.
[0098] Specifically, as shown in Figure 7, the background sound multi-classification model uses 5 seconds of input. The background sound data requires intercepting a longer voice information feature algorithm to achieve a certain accuracy rate. To ensure the reusability and data volume of the data, the segmentation mode does not adopt a continuous segmentation method. Instead, a sliding window is used to cross-segment the array storing the PCM signal. The length of the sliding window is 16000*5 samples, that is, a data length of 5 seconds, and the sliding step size is 16000*2.5, that is, a data length of 2.5 seconds for data interception. The above-described operation can obtain a batch of 5-second audio files as the data set of the background sound multi-classification model.
[0099] (2.2) Training data calibration.
[0100] After the dataset is acquired, the audio files need to be annotated. Specifically, the annotation method is to manually listen to the sound played by the audio files and classify and calibrate the content heard.
[0101] The calibration targets are as follows:
[0102] Music (external music, opera, pop music, rock music, sleep music and other music-related audio);
[0103] Human voice (including speaking, reading, discussion, telephone, etc.);
[0104] Silence (the sound of a quiet scene, or the sound of a scene below a certain decibel value).
[0105] The manually screened and calibrated background sound classification dataset was divided into training, validation, and test sets in a ratio of 9:0.5:0.5 (depending on the specific needs). The validation set is used during the training process to iterate and continuously verify the training process, while the test set is used to test the accuracy of the model after training.
[0106] (2.3) Background sound multi-classification model design
[0107] Build an AudioLiteNet neural network model and feed the background sound audio classification dataset divided in (2.2) into the neural network model for iterative training. A trained background sound multi-classification model with 5 seconds as input can be obtained.
[0108] In this embodiment, the background sound multi-classification model is consistent with the snoring binary classification model in (1). Both use AudioLiteNet to build a neural network model for training. Unlike the snoring binary classification model, the background sound multi-classification model uses a 5-second background sound dataset as input. Therefore, the input of the network structure needs to extract and convert the audio signal value using 500x39 MFCC features, and the output of the network structure outputs 3 neurons as classification confidence. The classification confidence mapping function is softmax. The network structure of the background sound multi-classification model is shown in Figure 8.
[0109] After 200 rounds of iterative training, the background sound multi-classification model was tested using a pre-divided test set and was able to achieve a high accuracy rate.
[0110] (3) Autoencoder model training.
[0111] As shown in FIG9 , in this embodiment, an autoencoder model MFCC-AENet is also built to reconstruct the MFCC features of snoring and perform denoising.
[0112] MFCC-AENet is based on an unsupervised neural network with a data dimension encoding and decoding structure. It uses a large amount of snoring audio to extract MFCC feature maps and then trains the model to be able to reconstruct the encoding and decoding features of the feature maps. The goal is to focus the model's attention on the feature map information associated with snoring and treat irrelevant features as noise for removal. This can achieve the effect of encoding features on the feature map and removing a certain amount of noise. Specifically, it includes the following steps:
[0113] (3.1) Build the autoencoder model and define the input, encoder / decoder, and output layers of the neural network. Since the MFCC feature map information is relatively concise, the hidden layer neural network structure of the encoder and decoder does not need to be too deep. The encoder contains a downsampling calculation unit of the EBlock block composed of three convolutional layers and a pooling layer, and the decoder contains a DBlock upsampling layer calculation unit composed of three convolutional layers and a sampling layer.
[0114] In order to ensure that the input and output data shapes of the autoencoder structure are consistent, it is necessary to define the data size of the input layer as a 1:1 ratio of width to height. The MFCC feature map of the above-mentioned two-category snoring classification has a shape of 39*100. Therefore, before using the network, the data needs to be padded with 0 values. By padding the width of the dimension 39 to 100, a square data shape of 100*100 is formed.
[0115] In the output layer, the output data dimension is defined to be consistent with the shape of the padded MFCC data of the input layer. Then, the slicing method (Split) is used to padded the data from 39 width to 100 dimension and cut it starting from the data with index 40, thereby restoring the 39*100 encoded data. The filling diagram is shown in Figure 10.
[0116] This embodiment builds a neural network model with consistent input and output to form a neural network that can be encoded and decoded. The placeholder parameters stored in each combination block in the network serve as learnable parameters that can be automatically adjusted by the training script during subsequent training. They are used to automatically update the parameters through conventional training methods such as gradient descent and back propagation. By feeding a certain amount of data, the network tries to find the optimal solution parameters during the training process, and ultimately achieves input audio - feature encoding and decoding - output restored and denoised audio.
[0117] FIG11 shows a schematic diagram of the structure of MFCC-AENet according to an embodiment of the present invention. In the Encode module, the convolutional layer is mainly used for feature extraction while the pooling layer is used for downsampling processing. This enriches the feature channel information while compressing the length and width dimensions of the feature map, thereby retaining the feature information while removing redundant information, and compressing the number of parameters. The pooling layer used in this structure is the local maximum pooling (Max-Pool), which takes the maximum value in the sliding window as the parameter of the downsampling result. The characteristic of this pooling is that it can filter out more useless information to make the processed features more distinct. The downsampling process is shown in FIG12.
[0118] In the Decode module, similar to the Encode module, while using the convolution layer, the pooling layer is replaced by the upsampling layer. Its purpose is to expand the length and width dimensions of the feature map using interpolation, so that it gradually approaches the information dimension of the original input, thereby restoring the padded MFCC feature matrix of the original input. The upsampling process is shown in Figure 13.
[0119] (3.2) After the input data x is calculated by the model, the corresponding relationship of the output data y^ is as follows: y^-x≈0
[0120] That is, the input data approaches the output data, that is, the input data needs to be reconstructed into data consistent with the input after calculation by the model; the error function for measuring the two sets of data is measured by the average Euclidean distance, as follows:
[0121] Among them, x j Represents the raw data of the model input, Represents the prediction result output by the model.
[0122] (3.3) Using mostly noise-free snoring data with clean background sound for training, a high accuracy can be achieved after 30 training iterations.
[0123] In this embodiment, after completing the training of the above-mentioned snoring binary classification model, background sound multi-classification model, and autoencoder model, a program pipeline flow (Pipeline) is further established to connect the three models. In addition to calling the algorithm model itself, some business logic functions are also added to connect the calls of each model. Because this embodiment uses a sound receiving device to continuously record the audio of the sleep scene in real time, the audio is streamed through the device to request the algorithm for real-time business processing. The business processing specifically involves slicing the audio stream into "frames" and standardizing the data flow with the device. The algorithm service will receive 1 second of a 16kHz PCM mono signal source each time and define the signal in this format as "one frame". One frame is equal to 1 second of audio signal, and similarly, five frames are 5 seconds.
[0124] As shown in Figure 14, the smallest cross-section of the algorithm process is the execution process of processing one frame of data. The specific process is as follows:
[0125] (9.1) Grab a frame of the current audio data stream from the device. The data format is consistent with the fixed format of the device.
[0126] (9.2) Add the data of the current frame to the cache queue. The total length of the queue is the length of storing 5 seconds of data.
[0127] (9.3) Determine whether the data length of the cache queue is greater than or equal to 5 seconds. If so, proceed to the next step. If not, prepare to end the task of the current frame and proceed to the processing of the next frame.
[0128] (9.4) If the data length meets the requirements, the MFCC feature coefficients of the data are extracted and a feature matrix is formed for the next data calculation;
[0129] (9.5) Call the background sound multi-classification model, input MFCC features for detection, and obtain the background sound classification results;
[0130] (9.6) Based on the classification results, determine whether the background sound of the current audio is quiet, which is consistent with the sleep scene. If it is, proceed to the next step. If it is noisy, prepare to end the task of the current frame and proceed to the next frame;
[0131] (9.7) Use the autoencoder model to autoencode the snoring sound based on the currently selected MFCC features that match the scene. The reconstructed features can make the snoring sound more prominent.
[0132] (9.8) Call the snoring binary classification model, pass in the reconstructed MFCC features for calculation, and obtain the snoring binary classification results;
[0133] (9.9) Determine whether the current audio is snoring based on the snoring binary classification results. If it is snoring, proceed to the next step. If it is not snoring, end the task of the current frame and move on to the next frame.
[0134] (9.10) Calculate the decibel value of the audio segment as a basis for determining whether it is snoring loudness;
[0135] (9.11) Calculate the time interval between the audio segment and the previous frame judged as snoring, and use it as a basis for determining whether it is snoring;
[0136] (9.12) Update the information of the current storage list, including timestamp and decibel value, which will be used as the basis for judgment in subsequent frames;
[0137] (9.13) Determine whether the snoring sound meets the snoring criteria in terms of loudness and time interval. The judgment criteria are to determine whether the snoring sound loudness and the time interval between the last snoring sound are within a preset range. If so, proceed to the next step. If not, prepare to end the task of the current frame and proceed to the next frame. The snoring sound loudness range and the time interval between the last snoring sound can be manually adjusted or set to a default value based on the user's sleeping habits. The default loudness range is 48 to 78 decibels; the time interval range is 2 to 6 seconds.
[0138] (9.14) If the audio of the current frame is judged to be snoring and meets the above judgment conditions, a message indicating that snoring has been detected is sent to the smart terminal device through the interface transmission, and the snoring judgment node can be terminated;
[0139] (9.15) Dequeue the head data of the queue to make room for the next frame of data to enter the queue.
[0140] As shown in FIG15 , this embodiment further discloses a snoring detection device based on multi-model superposition, comprising:
[0141] The background sound audio data acquisition module 1501 is used to acquire audio data including the current frame and the previous preset frame of the current frame as background sound audio data;
[0142] MFCC feature extraction module 1502, used to extract MFCC features of background sound audio data;
[0143] The background sound multi-classification model detection and acquisition module 1503 is used to input the MFCC features into the trained background sound multi-classification model for detection and obtain detection results;
[0144] The snoring detection module 1504 is configured to input the MFCC features into a trained snoring binary classification model to detect whether the current frame of audio data includes snoring when the detection result is silence.
[0145] Furthermore, the apparatus further includes a snoring confirmation module, which is specifically configured to perform the following processing after the snoring detection module 1504 detects that the current frame of audio data includes snoring:
[0146] Calculate the decibel value of the current frame audio data;
[0147] Calculate the time interval between the current frame and the previous frame that was judged to be snoring;
[0148] Update the information of the current storage list; the information includes a timestamp and a decibel value;
[0149] It is determined whether the decibel value is within a preset decibel range, and whether the time interval is within a preset time range. If both conditions are met, it is prompted that snoring is detected.
[0150] Furthermore, the device also includes an MFCC feature reconstruction module, which is specifically used to input the MFCC features into a trained autoencoder model to encode and decode the features to obtain reconstructed MFCC features.
[0151] Correspondingly, the MFCC features are input into the trained snoring binary classification model to detect whether the current frame of audio data contains snoring, specifically including:
[0152] The reconstructed MFCC features are input into the trained snoring binary classification model to detect whether the current frame audio data contains snoring.
[0153] Other Specific Implementations of a Snoring Detection Device Based on Multi-Model Superposition The same snoring detection method based on multi-model superposition is not described again in this embodiment.
[0154] This embodiment also includes a smart terminal device, which is provided with a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, steps S101 to S104 of the embodiment of the snoring detection method based on multi-model superposition and the specific technical solutions in the embodiment are implemented.
[0155] The terminal device may be a smart terminal device, such as a mobile phone, tablet computer, wearable device, laptop computer, ultra-mobile personal computer, netbook, personal digital assistant, etc. The smart terminal device may include, but is not limited to, a processor and a memory.
[0156] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0157] In some embodiments, the memory may be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device. In other embodiments, the memory may also be an external storage device of the terminal device, such as a plug-in hard disk equipped on the terminal device, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Furthermore, the memory may include both an internal storage unit of the terminal device and an external storage device. The memory is used to store an operating system, an application program, a boot loader, data, and other programs, such as the program code of the computer program. The memory may also be used to temporarily store data that has been output or is to be output.
[0158] The above description is merely a preferred embodiment of the present invention; however, the scope of protection of the present invention is not limited thereto. Any person skilled in the art who, within the technical scope disclosed by the present invention, makes equivalent substitutions or modifications based on the technical solutions and improved concepts of the present invention shall be covered by the scope of protection of the present invention. Industrial Applicability
[0159] The present invention provides a snoring detection method and device based on multi-model superposition. Snoring detection is performed only after the background sound is detected to be silence, thereby reducing false detection caused by the background sound being music or human voice, improving the detection accuracy, and having strong practicality.
Claims
1. A snoring detection method based on multi-model superposition, characterized in that: include: Acquire audio data including a current frame and a preset frame before the current frame as background sound audio data; Extract MFCC features of background sound audio data; Input the MFCC features into the trained background sound multi-classification model for detection to obtain the detection result; If the detection result is silence, the MFCC features are input into a trained snoring binary classification model to detect whether the current frame audio data includes snoring.
2. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: Acquiring audio data including the current frame and the previous preset frame of the current frame as background sound audio data, specifically including: Get the current frame audio data; Splicing the current frame audio data with the audio data in the frame buffer queue and inserting them into the frame buffer queue; the frame buffer queue adopts the first-in-first-out principle and can store the audio data of the first preset frame; It is determined whether the cache queue includes audio data of the first preset frame. If so, the audio data in the cache queue is used as background sound audio data.
3. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: If it is detected that the current frame audio data includes snoring, the method further includes: Calculate the decibel value of the current frame audio data; Calculate the time interval between the current frame and the previous frame that was judged as snoring; Update the information of the current storage list; the information includes a timestamp and a decibel value; It is determined whether the decibel value is within a preset decibel range, and it is determined whether the time interval is within a preset time range. If both conditions are met, it is indicated that snoring is detected.
4. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: Before inputting the MFCC features into the trained snoring binary classification model, the method further includes: Input the MFCC features into the trained autoencoder model to encode and decode the features to obtain reconstructed MFCC features; The MFCC features are input into the trained snoring binary classification model to detect whether the current frame audio data includes snoring, specifically including: The reconstructed MFCC features are input into the trained snoring binary classification model to detect the current frame audio Whether the data includes snoring.
5. The snoring detection method based on multi-model superposition according to claim 4, characterized in that: The autoencoder model is a neural network model including an input layer, an encoder layer, a decoder layer and an output layer; The autoencoder model uses the average Euclidean distance metric loss as follows: Among them, x j Represents the raw data of the model input, Represents the prediction result of the model output.
6. The snoring detection method based on multi-model superposition according to claim 5, characterized in that: The encoder layer includes a plurality of connected convolutional layers and pooling layers, and the decoder layer includes a plurality of connected convolutional layers and upsampling layers.
7. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: The background sound multi-classification model adopts the AudioLiteNet neural network model, which includes several connected blocks; the blocks are connected by direct connection or skip-layer connection; the direct connection is to use the operators defined in advance in the block to perform data pipeline streaming calculations; the skip-layer connection is to add features.
8. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: The background sound multi-classification model uses five frames of audio data as background sound audio data. The input of the background sound multi-classification model is the extracted MFCC features. The output of the background sound multi-classification model is the confidence of music, human voice and silence. The class with the largest confidence is taken as the detection result.
9. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: The snoring binary classification model adopts the AudioLiteNet neural network model, which includes several connected blocks; the blocks are connected by direct connection or skip-layer connection; the direct connection is to use the pre-defined operators in the block to perform data pipeline streaming calculation; the skip-layer connection is to add features.
10. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: The input of the snoring binary classification model is the extracted MFCC features, and the output of the snoring binary classification model is the confidence of snoring and non-snoring, and the class with the largest confidence is taken as the detection result.
11. The snoring detection method based on multi-model superposition according to claim 1, characterized in that: The background sound multi-classification model and the snoring sound binary classification model both use a binary cross entropy loss function, as follows: Among them, N represents the total number of nodes that need to be measured, that is, the total number of categories, y i Indicates that the i-th node is true The marked value is the correct classification. Represents the classification value of the i-th node predicted by the neural network.
12. A snoring detection device based on multi-model superposition, characterized in that: include: A background sound audio data acquisition module, used to acquire audio data including a current frame and a preset frame before the current frame as background sound audio data; MFCC feature extraction module, used to extract MFCC features of background sound audio data; A background sound multi-classification model detection acquisition module, used to input the MFCC features into a trained background sound multi-classification model for detection and obtain a detection result; The snoring detection module is used to input the MFCC features into a trained snoring binary classification model to detect whether the current frame audio data includes snoring when the detection result is silence.
13. The snoring detection device based on multi-model superposition according to claim 12, characterized in that: The snoring sound confirmation module is further included, which is specifically used to perform the following processing after the snoring sound detection module detects that the current frame audio data includes snoring sound: Calculate the decibel value of the current frame audio data; Calculate the time interval between the current frame and the previous frame that was judged as snoring; Update the information of the current storage list; the information includes a timestamp and a decibel value; It is determined whether the decibel value is within a preset decibel range, and it is determined whether the time interval is within a preset time range. If both conditions are met, it is indicated that snoring is detected.
14. The snoring detection device based on multi-model superposition according to claim 13, characterized in that: It also includes an MFCC feature reconstruction module, which is specifically used to input the MFCC features into a trained autoencoder model to encode and decode the features to obtain reconstructed MFCC features; Correspondingly, the MFCC features are input into the trained snoring binary classification model to detect whether the current frame audio data includes snoring, specifically including: The reconstructed MFCC features are input into the trained snoring binary classification model to detect whether the current frame audio data includes snoring.
Citation Information
Patent Citations
Air volume automatic adjusting method, device and equipment of kitchen ventilator and storage medium
CN109631104A
Apnea judgment method and device and electronic equipment
CN113314143A
Snore monitoring method and system based on deep learning algorithm and corresponding electric bed control method and system
CN113599052A
Command word speech recognition-based easy-to-confuse word anti-error recognition method
CN115206299A
Snore detection method and device based on multi-model superposition
CN116312634A
Cited By
Snore detection method and system based on intelligent bed
CN119867667A
