Sleep breathing disorder detection method based on target detection

By combining a YOLO model-based sleep apnea detection method with contextual anchor attention mechanism and amplitude waveform processing, the problem of insufficient accuracy and robustness in existing sleep apnea detection technologies is solved, and efficient detection and statistics of snoring and sleep apnea events are achieved.

CN121570127APending Publication Date: 2026-02-27SICHUAN UNIV JINCHENG INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511741009.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing technologies lack accuracy and robustness in detecting sleep apnea, are difficult to adapt to physiological differences between individuals, and ignore temporal information, making it difficult to efficiently detect the number, frequency, and duration of snoring and sleep apnea.

Method used

A sleep apnea detection method based on object detection is adopted. The YOLO model is combined with the context anchor attention mechanism to realize end-to-end event detection and statistics by processing and rendering audio data into amplitude waveforms.

Benefits of technology

It achieves high-precision detection of snoring and sleep apnea events, and can count the number, frequency and duration of events in real time, assisting medical diagnosis and improving detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121570127A_ABST
    Figure CN121570127A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of voice processing and image recognition, and discloses a target detection-based automatic detection method for snore and apnea events in a human sleep process, which comprises the following steps of: collecting continuous audio data of a sleep scene of a patient; performing de-noising processing on the collected original audio data by using Fourier transform to obtain an effective audio number; dividing the audio data by using the sliding windows, and obtaining the audio data of each sliding window; processing the audio data of each sliding window by using an enhancement algorithm, and improving the amplitude of the audio data in a specific frequency range; converting the enhanced signal into an amplitude oscillogram; training a target detection YOLO model added with a context anchor attention mechanism by using the amplitude oscillogram data set; the model can detect snoring or apnea events and count the number of times, frequency and duration of the events. According to the invention, the sleep breathing disorder condition of the human body can be detected in real time with high precision.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of speech processing and image recognition, and particularly relates to a sleep disordered breathing detection method based on target detection. BACKGROUND

[0002] In the sleep disordered breathing (SDB) monitoring task, the traditional method mainly relies on the combination of manual feature engineering and shallow machine learning model. Researchers usually extract statistical features such as waveform amplitude, frequency, period, peak interval, respiratory cycle variability, etc. from physiological signals, and then use support vector machine, random forest or K nearest neighbor classifier for identification and classification. Although these methods have achieved preliminary results in some controlled environments, they have significant limitations, such as strong dependence on prior knowledge, poor generalization ability, limited ability to capture complex patterns, and neglect of time series information, which makes it difficult to adapt to physiological differences between different individuals. The accuracy and robustness in actual clinical application still have a lot of room for improvement.

[0003] In recent years, with the development of deep learning technology, especially the successful application in the field of computer vision and speech signal processing, it has shown great potential in medical signal analysis tasks. Convolutional neural network is widely used in automatic analysis of physiological signals due to its strong local feature extraction ability. YOLO model has shown a good balance between speed and accuracy in image target positioning tasks with its "single-stage, end-to-end" detection framework. The core idea of this model is to divide the image into grid units and use the anchor box mechanism to jointly predict the position and category of the target. This feature provides key inspiration for introducing target detection technology into the waveform graph analysis field. The waveform graph is regarded as a special "two-dimensional image", where each time point corresponds to the height of the image, and the amplitude corresponds to the width and certain features (such as snoring or apnea). Through the feature pyramid structure, YOLO fuses the high-resolution short-term fluctuation features (such as snoring oscillation) extracted by the shallow network and the deep semantic features (such as the long interval silent period of apnea), so that the model can not only capture the snoring changes in the 0-1000Hz frequency band, but also identify apnea events lasting more than 5-10 seconds, effectively solving the representation imbalance problem of traditional single-scale CNN in processing multi-time span events.

[0004] In summary, the current sleep disordered breathing detection algorithm needs to improve the accuracy and robustness while also counting the number, frequency and duration of snoring and apnea. In view of this problem, how to realize signal event detection in physiological signals while ensuring high detection accuracy makes it more suitable for sleep disordered breathing detection application scenarios, which is a direction worthy of further research. SUMMARY

[0005] In view of the deficiencies of the prior art, the present application provides a sleep breathing disorder detection method, device and storage medium based on target detection, which can detect snoring and apnea events in real time and with high precision in continuous sound signals, and count the occurrence frequency and duration of the two events, thereby assisting medical diagnosis and improving diagnosis and treatment efficiency and accuracy.

[0006] The sleep breathing disorder detection method based on target detection comprises the following steps:

[0007] Step 1: collecting continuous audio data of a patient's sleep scene;

[0008] Step 2: performing denoising processing on the collected original audio data to obtain effective audio data;

[0009] Step 3: dividing the audio data using a sliding window to obtain audio data of each sliding window;

[0010] Step 4: processing the audio data of each sliding window using an enhancement algorithm to improve the amplitude of a specific frequency range thereof;

[0011] Step 5: converting the enhanced audio data into an amplitude waveform graph;

[0012] Step 6: training a target detection YOLO model added with a context anchor point attention mechanism using an amplitude waveform graph data set;

[0013] Step 7: collecting continuous audio data of a patient's real-time sleep scene, performing denoising processing thereon, using a sliding window to intercept the audio data, performing enhancement processing on the audio data, rendering the audio data into an amplitude waveform graph, and then inputting the amplitude waveform graph into the trained target detection YOLO model added with the context anchor point attention mechanism to detect snoring or apnea events and count the occurrence frequency and duration of the two types of events.

[0014] Further, step 1 specifically comprises:

[0015] An audio data collection instrument is worn by the patient to collect audio data of the patient from a pre-sleep awake state to a complete sleep state until the patient naturally wakes up; the sampling rate of the collected environmental current noise or discontinuous external noise is 48 kHz; after the collection is started, the PCM format sound signal is automatically stored as a WAV audio data file at a preset time interval, and saved to a storage device; and the file name uses the start time of the corresponding time period.

[0016] Further, step 2 specifically comprises:

[0017] Each audio data file is read in sequence, the audio data is first framed, then Fourier transform is performed on each frame to convert the data from time domain to frequency domain and obtain spectral data; then the spectrum is analyzed, noise components are identified, and threshold filtering method is applied to zero low-intensity frequency noise; the spectrum without noise is converted back to time domain through inverse Fourier transform, and finally the audio data after noise reduction is obtained.

[0018] Further, in step 3, the sliding window is a window with a fixed length of 60 seconds, which slides along the time axis on the time domain sequence with a step size of 40 seconds, and the adjacent windows are overlapped by 20 seconds to ensure the continuity of the audio data.

[0019] Starting from the beginning of the audio data, the sliding window cyclically intercepts the audio segments with a step size, and the last insufficient part is filled with zero value processing. Finally, multiple window audio data are generated for each video data file.

[0020] Further, step 4 is specifically:

[0021] Considering that the collection equipment of some patients is far away from the sound source, the amplitude of the collected audio data is not high; therefore, the amplitude of the window audio data in the low-frequency snoring sound frequency range of the human body is detected, and when the highest amplitude is lower than the threshold, the amplitude of the data in the frequency range is enhanced.

[0022] Further, step 5 is specifically:

[0023] The window audio data is rendered into a two-dimensional waveform graph, in which the horizontal axis corresponds to time and the vertical axis corresponds to amplitude; the waveform graph omits the coordinate axes and the frame and only retains the waveform curve itself; finally, each window audio data will generate an amplitude waveform graph and be saved to a storage device, and the image file name is the starting point time of the sliding window, and the format is year-month-day-hour-minute-second.

[0024] Further, in step 6, the target detection YOLO model added with the context anchor point attention mechanism includes a main network, a context anchor point attention mechanism CAA module, a bidirectional fusion network and a detection head connected in sequence;

[0025] The main network is used to extract multi-scale features of the input image, and the input image is compressed into a high-dimensional feature map with high semantic information through step-by-step downsampling, and then sent to the bidirectional fusion network;

[0026] The main network is mainly composed of a multi-layer convolutional neural network, the core structure adopts a cross-stage local structure, the calculation redundancy is reduced through a segmentation-fusion strategy, and a residual connection is introduced to avoid gradient disappearance, and finally a multi-scale pooling layer SPPF is used for serial repeated small kernel pooling to reduce the calculation amount and enhance the scale invariance;

[0027] The convolutional layer comprises a convolution operation, batch normalization and an activation function, and is used for extracting image features.

[0028] Further, a context anchor attention mechanism (CAA) module is added after the SPPF layer in the backbone network, and the attention mechanism module comprises an average pooling layer, two 1x1 convolutional layers, two depth separable convolutional layers and a nonlinear activation function; local features are obtained through average pooling and 1x1 convolution; then the receptive field is expanded through horizontal and vertical depth separable convolution to capture long-distance context information; finally, the attention feature map is generated through 1x1 convolution and nonlinear activation function, and then multiplied by the original image to enhance the attention of the network to the key region in the original image.

[0029] The bidirectional fusion network is used for fusing the multi-scale features output by the backbone network, and enhancing semantic and position information.

[0030] The bidirectional fusion network comprises four convolutional group modules, two up-sampling layers, two down-sampling layers and four splicing operations; the small-scale deep features output by the backbone network are up-sampled, added to the medium-scale features, and then the feature map f1 is obtained; the feature map f1 is up-sampled again, then added to the large-scale shallow features, and the fused feature map is f2; the feature map f2 is down-sampled, added to the feature map f1, and then the feature map f3 is obtained; the feature map f3 is down-sampled, then added to the small-scale shallow features, and the feature map f4 is obtained; the feature maps f2, f3 and f4 all fuse the features of different scales, realize the complementation of the features, and are used for improving the detection accuracy and robustness of the model.

[0031] The detection head structure comprises three detection heads, i.e., a large target detection head, a medium target detection head and a small target detection head, which are used for predicting the fused multi-scale features, and outputting target position information and categories.

[0032] The small target detection head reads the vector values of each feature point of the feature map f2, and detects the sleep respiratory disorder event.

[0033] The medium target detection head reads the vector values of each feature point of the feature map f3, and detects the sleep respiratory disorder event.

[0034] The large target detection head reads the vector values of each feature point of the feature map f4, and detects the sleep respiratory disorder event.

[0035] In the feature maps f2, f3 and f4, the first four vector values with a length of 16 of each feature point vector value represent the starting position, ending position and highest value and lowest value distribution of the detected sleep respiratory disorder event in the window; the fifth value is the probability of the target event being a snoring event, and the sixth value is the probability of the target event being an apnea event.

[0036] Further, the loss function of the target detection YOLO model trained with the context anchor attention mechanism is composed of a positioning loss and a classification loss, and the positioning loss is composed of a CIoU loss and a distribution focus DFL loss, as shown in formula (1):

[0037] (1)

[0038] For the classification loss, a cross-entropy loss function is used to calculate the difference between the target event and the real event category;

[0039] For the complete intersection ratio loss, as shown in formula (2):

[0040] (2)

[0041] In the formula, IoU represents the intersection ratio, which is used to calculate the overlap degree of the predicted event box and the real event box, d represents the Euclidean distance between the centers of the predicted event box and the real event box, c represents the diagonal length of the smallest enclosing rectangle containing the predicted event box and the real event box, is a weight function, is the width of the real event box, is the height of the real event box, is the width of the predicted event box, is the height of the predicted event box.

[0042] Further, the distribution focus loss is used to measure the difference between the position distribution of the predicted event box and the position distribution of the real event box, and focuses on the two target probabilities and in the interval containing the real coordinate y,

[0043] so that the model focuses on learning the probability distribution of the two key positions near the real coordinate, especially when the predicted probability is low (apnea) event gives greater weight;

[0044] (3)

[0045] In the formula, represents the distance from y to , represents the distance from y to , and the predicted value closer to the real coordinate y has a higher probability.

[0046] Furthermore, in step 7, a sliding window with a length of 60 seconds and a step size of 40 seconds is used to extract audio data. Then, the extracted audio data is enhanced and rendered into an amplitude waveform with a resolution of 640x640. Finally, it is input into the trained object detection YOLO model with added context anchor attention mechanism, and the model outputs the detection results.

[0047] The detection results include the start position of the target event in the amplitude waveform. End position Maximum amplitude value Minimum amplitude value and its category ; through formula and The start time of the target event can be obtained. and end time ,in The start time of the window corresponding to this amplitude waveform can be obtained from the amplitude waveform file name. The amplitude waveform has a width of 640. The sliding window duration is 60 seconds; when When =0, it indicates that the target event is a snoring event. =1 indicates that the target event is a sleep apnea event;

[0048] The time intersection ratio (OCR) between the (i-1)th target event and the ith target event of the same category is calculated using the following formula. The start time of the (i-1)th target event is... The end time is The start time of the i-th target event is The end time is The (i-1)th target event must occur before the ith target event, i.e. > As shown in formula (4):

[0049] (4)

[0050] When the time intersection of two target events is compared If the two target events are the same event, the time span is retained. For long target events, save them to the detection results database and discard other target events; among them, The threshold for time intersection-union comparison;

[0051] Access the detection result database, and traverse all target events in a specified time range, so that the number, frequency of snoring events, and the number and duration of each apnea event in the time range can be counted.

[0052] Compared with the prior art, the present application has the following advantages:

[0053] 1. The sleep disordered breathing detection method based on the YOLO model is used, and an end-to-end model is used to realize high-precision snoring and apnea event detection.

[0054] 2. The audio data processing and rendering process is designed, the audio sequence data is converted into a two-dimensional amplitude waveform graph, the collected audio data is first framed, and Fourier transform is used to convert each frame of time domain audio data into frequency spectrum data, then low-intensity noise frequency is filtered out through threshold filtering method, and then inverse Fourier transform is used to convert the denoised frequency spectrum data back to time domain data; then a sliding window with a length of 60 seconds is used to slide on the time domain data with a step length of 40 seconds, and window audio data is cyclically obtained, and there is 20 seconds of overlap between adjacent window data; finally, each window audio data is rendered into a two-dimensional amplitude waveform graph with time on the horizontal axis and amplitude on the vertical axis.

[0055] 3. The audio event detection method is provided, the audio data is processed and rendered into a two-dimensional amplitude waveform graph, and a target detection YOLO model with added context anchor attention mechanism is used to detect snoring and apnea events in the amplitude waveform graph; the number, frequency of snoring events, and the number and duration of each apnea event can be counted according to the model detection result, and when the duration and number of apnea events exceed the threshold, an alarm is given to assist medical diagnosis. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1 The method flowchart of the present application;

[0057] Figure 2 The target detection model network structure diagram for the implementation of the present application;

[0058] Figure 3 The context anchor attention mechanism network structure diagram of the present application;

[0059] Figure 4 The snoring event detection result graph of the present application;

[0060] Figure 5 The apnea event detection result graph of the present application. DETAILED DESCRIPTION

[0061] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below, obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the present application.

[0062] Figure 1 A target detection-based sleep respiratory disorder detection method is shown, including the following steps:

[0063] Step 1, collecting continuous audio data of a patient's sleep scene, specifically implemented as:

[0064] The audio data acquisition instrument is worn by the patient, and audio data from the pre-sleep wake-up state to complete sleep, and until the natural sleep wake-up period is collected. The sampling rate is 48kHz. After starting to collect, the PCM format sound signal is automatically stored as a WAV audio data file at a preset time interval of 40 minutes, saved to a storage device, and the file name uses the start time corresponding to the time period.

[0065] Step 2, denoising the collected original audio data to obtain effective audio data, specifically implemented as:

[0066] Each audio data file is read in turn, the audio data is first framed, and then each frame is subjected to Fourier transform to convert the data from the time domain to the frequency domain to obtain the spectrum data. Then analyze the spectrum, identify the noise component, and apply threshold filtering method to zero the low-intensity frequency noise. The spectrum without noise is converted back to the time domain through inverse Fourier transform, and finally the denoised audio data is obtained.

[0067] Step 3, dividing the audio data using a sliding window to obtain audio data of each sliding window, specifically implemented as:

[0068] A sliding window with a fixed length of 60 seconds is used, and the time axis is slid along the time axis with a step size of 40 seconds on the time domain sequence, and the adjacent windows are overlapped by 20 seconds to ensure the continuity of the audio data. Starting from the beginning of the audio data, the sliding window cycles to intercept the audio segment with a step size, and the end part is filled with zero value processing, and finally each video data file generates multiple window audio data.

[0069] Step 4, processing the audio data of each sliding window using an enhancement algorithm, detecting the amplitude of the window audio data in the human low-frequency snoring frequency band, and when the highest amplitude is lower than the threshold, the data in the frequency band range is processed to enhance the amplitude.

[0070] Step 5, the enhanced audio data is converted into an amplitude waveform graph, which is implemented as follows:

[0071] The windowed time-domain audio data is rendered into a two-dimensional waveform graph, with the horizontal axis corresponding to time and the vertical axis corresponding to amplitude. The waveform graph omits the coordinate axes and the frame, and only retains the waveform curve itself. Finally, each windowed audio data generates an amplitude waveform graph and is saved to a storage device, with the image file name being the starting point time of the sliding window, and the format being year-month-day-hour-minute-second.

[0072] Using the methods of steps 1 to 5, 10 patients' continuous audio data of sleep scenes are collected, 16 pieces of 40-minute audio data files are obtained for each patient, and a total of 9600 amplitude waveform graphs are finally obtained. In this embodiment, the LabelImg software is used to label the images, and the snoring and apnea event boxes in the images are obtained to obtain the sleep breathing disorder detection data set.

[0073] Step 6, the target detection YOLO model with the added context anchor attention mechanism is trained using the amplitude waveform graph data set. The structure of the YOLO model includes a main network, a bidirectional fusion network and a detection head connected in sequence, as shown in Figure 2 .

[0074] The main network is used to extract multi-scale features of the input image, which is compressed into a high-dimensional feature map with high semantic information through step-by-step downsampling, and then sent to the bidirectional fusion network.

[0075] The main network is mainly composed of a multi-layer convolutional neural network, the core structure adopts a cross-stage local structure, the calculation redundancy is reduced through a segmentation-fusion strategy, and residual connection is introduced to avoid gradient disappearance, and finally a multi-scale pooling layer SPPF is used for serial repeated small kernel pooling to reduce the calculation amount and enhance the scale invariance. Among them, the convolutional layer includes convolution operation, batch normalization and activation function, which is used to extract image features.

[0076] Further, a context anchor attention mechanism module is added after the multi-scale pooling layer in the main network. The attention mechanism module is composed of an average pooling layer, two 1x1 convolutional layers, two depth separable convolutional layers and a nonlinear activation function. First, local features are obtained through average pooling and 1x1 convolution; then the receptive field is expanded through horizontal depth separable convolution with a convolution kernel size of 1x11 and vertical depth separable convolution with a convolution kernel size of 11x1 to capture long-distance context information; finally, the attention feature map is generated through 1x1 convolution and nonlinear activation function, and then multiplied by the original image to enhance the network's attention to the key regions in the original image.

[0077] The bidirectional fusion network includes four convolution group modules, two up-sampling layers, two down-sampling layers and four splicing operations. The small-scale deep layer features output by the backbone network are up-sampled, added to the medium-scale features, and the feature map f1 is obtained. The feature map f1 is up-sampled again, then added to the large-scale shallow layer features, and the fused feature map is f2. The feature map f2 is down-sampled, added to the feature map f1, and the feature map f3 is obtained. The feature map f3 is down-sampled, then added to the small-scale shallow layer features, and the feature map f4 is obtained. The feature maps f2, f3 and f4 all fuse the features of different scales, realize the complementation of the features, and are used to improve the detection accuracy and robustness of the model.

[0078] The detection head structure includes three detection heads, i.e. a large target detection head, a medium target detection head and a small target detection head, which are used to predict the fused multi-scale features and output target position information and categories.

[0079] The small target detection head reads the vector values of each feature point of the feature map f2, and detects the sleep respiratory disorder event.

[0080] The medium target detection head reads the vector values of each feature point of the feature map f3, and detects the sleep respiratory disorder event.

[0081] The large target detection head reads the vector values of each feature point of the feature map f4, and detects the sleep respiratory disorder event.

[0082] In the feature maps f2, f3 and f4, the first 4 vector values with a length of 16 of each feature point vector value represent the starting position, ending position and amplitude maximum value, minimum value distribution of the detected sleep respiratory disorder event in the window. The 5th value is the probability that the target event is a snoring event, and the 6th value is the probability that the target event is an apnea event.

[0083] In this embodiment, when training the target detection YOLO model with the added context anchor point attention mechanism, the resolution of the training set images is unified to 640x640, the initial learning rate is 0.001, the cosine annealing method is used to dynamically adjust the learning rate, the iteration batch is 32, and the training rounds are 100.

[0084] The loss function used when training the model is composed of a positioning loss and a classification loss, and the positioning loss is composed of a CIoU loss and a distribution focus DFL loss, and the formula is as follows:

[0085]

[0086] For the classification loss, a cross-entropy loss function is used to calculate the difference between the target event and the real event category.

[0087] For complete intersection-over-union loss, the formula is as follows:

[0088]

[0089] In the formula, IoU represents the intersection-over-union, which is used to calculate the degree of overlap between the predicted event box and the real event box, d represents the Euclidean distance between the centers of the predicted event box and the real event box, c represents the diagonal length of the minimum enclosing rectangle containing the predicted event box and the real event box, is the weight function, is the width of the real event box, is the height of the real event box, is the width of the predicted event box, is the height of the predicted event box.

[0090] Further, the distribution focus loss is used to measure the difference between the position distribution of the predicted event box and the position distribution of the real event box, and focuses on the two target probabilities and in the interval of the real coordinate y, so that the model focuses on learning the probability distribution of distinguishing the two key positions near the real coordinate, especially giving greater weight when the predicted probability is low (apnea) event.

[0091] is the distribution focus loss, and the formula is as follows:

[0092]

[0093] In the formula, represents the distance from y to , represents the distance from y to , and the predicted value closer to the real coordinate y has a higher probability.

[0094] Step 7, collect real-time sleep scene continuous audio data of the patient, after noise removal, use a sliding window with a length of 60 seconds and a step of 40 seconds to intercept the audio data, then render the intercepted audio data into an amplitude waveform graph with a resolution of 640x640, and finally input the target detection YOLO model with the added context anchor attention mechanism, the model outputs the detection result.

[0095] The detection result includes the start position , end position , maximum amplitude value , minimum amplitude value , and category of the target event in the amplitude waveform graph. Through the formulas and The start time and the end time of the target event can be obtained wherein is the start point time of the corresponding window of the amplitude waveform diagram, which can be obtained from the amplitude waveform diagram file name, is the width of the amplitude waveform diagram 640, is the length of the sliding window 60 seconds. When = 0, it indicates that the target event is a snoring event, and when = 1, it indicates that the target event is an apnea event.

[0096] The time intersection ratio of the i-1th target event and the i th target event in the same category is calculated using the following formula . Wherein the start time of the i-1th target event is , and the end time is . The start time of the i th target event is , and the end time is . The i-1th target event must occur before the i th target event, that is .

[0097]

[0098] When the time intersection ratio of two target events , then the two target events are determined to be the same event, the target event with a time span is retained, which is saved to the detection result database, and the other target event is discarded. Wherein, is the time intersection ratio threshold.

[0099] Accessing the detection result database, all target events within a specified time range are traversed, and then the number of snoring events, the frequency of snoring events, and the number of apnea events and the duration of each apnea within the time range can be counted.

[0100] In order to verify the performance of the target detection YOLO model added with the context anchor attention mechanism, the embodiment selects the precision, recall and mean average precision (mAP) commonly used in the target detection task to evaluate the model performance, and the related index formula is:

[0101]

[0102]

[0103]

[0104] ​​Wherein, TP is the number of events correctly detected by the model, FP is the number of events misdetected by the model, FN is the number of events missed by the model, n is the number of event categories to be detected, and AP is the average precision of each category.

[0105] In this embodiment, the performance of the target detection YOLO model added with the context anchor point attention mechanism is evaluated using the validation set of the sleep respiratory disorder detection data set, and the results are shown in the following table.

[0106] Table 1: Model performance indicators

[0107]

[0108] As can be seen from Table 1, compared with the attention mechanism or the C2PSA attention mechanism of YOLOv11, the technical scheme of the present application has higher precision on YOLOv11 models of n, s, m and l of different magnitudes, and the YOLOv11l model added with the context anchor point attention mechanism has the highest precision.

[0109] Figure 4 and Figure 5 is an example of test results using the YOLOv11l model added with the context anchor point attention mechanism. Among them, Figure 4 (a) is an original waveform graph of the patient's snoring audio, Figure 4 (b) is the detection result graph of the YOLO model added with the context anchor point attention mechanism after inputting the original graph, and it can be seen that the snoring event can be correctly detected. Figure 5 (a) is an original waveform graph of the patient's apnea audio, Figure 5 (b) is the detection result graph of the YOLO model added with the context anchor point attention mechanism after inputting the original graph, and it can be seen that the apnea event can be correctly detected.

[0110] It should be noted that in this paper, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or equipment.

[0111] The above merely provide preferred embodiments of the present application, and are not intended to limit the present application in any manner. Although embodiments of the present application have been shown and described, it would be appreciated by those skilled in the art that changes, modifications, substitutions and variations can be made thereto without departing from the principles and spirit of the present application, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for detecting sleep-disordered breathing based on target detection, characterized in that, The method includes the following steps: Step 1: Collect continuous audio data of the patient's sleep scenarios; Step 2: Denoise the collected raw audio data to obtain valid audio data; Step 3: Use a sliding window to divide the audio data and obtain the audio data for each sliding window; Step 4: Use an enhancement algorithm to process the audio data of each sliding window, increasing the amplitude of its specific frequency range; Step 5: Convert the enhanced audio data into an amplitude waveform. Step 6: Train a YOLO object detection model with added context anchor attention mechanism using the amplitude waveform dataset; Step 7: Collect continuous audio data of the patient's real-time sleep scene. After denoising, use a sliding window to capture the audio data. After enhancing the audio data, render it into an amplitude waveform. Then, feed it into a trained YOLO target detection model with added context anchor attention mechanism to detect snoring or sleep apnea events and count the number, frequency and duration of the two types of events.

2. The sleep apnea detection method based on target detection according to claim 1, characterized in that, Step 1 is as follows: The patient wears an audio data acquisition device to collect audio data from the patient's awake state before falling asleep to when they fall asleep completely and until they wake up naturally. The acquisition environment may have occasional electrical noise or discontinuous external noise, and the sampling rate is 48kHz. After the acquisition starts, the PCM format sound signal is automatically stored as a WAV audio data file at preset time intervals and saved to the storage device. The file name is based on the start time of the corresponding time period.

3. The sleep apnea detection method based on target detection according to claim 1, characterized in that, Step 2 is as follows: Each audio data file is read sequentially. The audio data is first divided into frames, and then a Fourier transform is performed on each frame to convert the data from the time domain to the frequency domain, obtaining the spectrum data. Then, the spectrum is analyzed to identify noise components, and a threshold filtering method is applied to reduce low-intensity frequency noise to zero. The spectrum after noise removal is then converted back to the time domain through an inverse Fourier transform, finally obtaining the noise-reduced audio data.

4. The sleep apnea detection method based on target detection according to claim 1, characterized in that, In step 3, the sliding window is a window with a fixed length of 60 seconds, which slides along the time axis in the time domain sequence with a step size of 40 seconds, and adjacent windows retain a 20-second overlap to ensure the continuity of audio data. Starting from the beginning of the audio data, a sliding window is used to cyclically extract audio segments in steps, and any insufficient parts at the end are filled with zero values. In the end, each video data file generates multiple window audio data.

5. The sleep apnea detection method based on target detection according to claim 1, characterized in that, Step 4 specifically involves: Considering that the acquisition device for some patients is far from the sound source, the amplitude of the acquired audio data is not high; therefore, the amplitude of the window audio data in the low-frequency snoring range of the human body is detected, and when the highest amplitude is lower than the threshold, the data in that frequency range is processed to enhance the amplitude.

6. The sleep apnea detection method based on target detection according to claim 1, characterized in that, Step 5 specifically involves: The audio data of the window is rendered into a two-dimensional waveform graph, with the horizontal axis corresponding to time and the vertical axis corresponding to amplitude. The waveform graph omits the coordinate axes and borders, retaining only the waveform curve itself. Finally, each window's audio data will generate an amplitude waveform graph and save it to the storage device. The image file name is the starting time of the sliding window, in the format of year-month-day-hour-minute-second.

7. The sleep apnea detection method based on target detection according to claim 1, characterized in that, In step 6, the YOLO target detection model with added context anchor attention mechanism includes a backbone network, a context anchor attention mechanism (CAA) module, a bidirectional fusion network, and a detection head connected in sequence. The backbone network is used to extract multi-scale features of the input image, compress the input image into a high-dimensional feature map with high semantic information through stepwise downsampling, and then send it into the bidirectional fusion network; The backbone network is mainly composed of multi-layer convolutional neural networks. The core structure adopts a cross-stage local structure, reduces computational redundancy through a segmentation-fusion strategy, introduces residual connections to avoid gradient vanishing, and finally reduces computational load and enhances scale invariance through serial repeating of small kernel pooling by multi-scale pooling layers SPPF. The convolutional layer includes convolution operations, batch normalization, and activation functions for extracting image features.

8. The sleep apnea detection method based on target detection according to claim 1, characterized in that, A Context Anchor Attention (CAA) module is added after the SPPF layer in the backbone network. The attention mechanism module consists of an average pooling layer, two 1x1 convolutional layers, two depthwise separable convolutional layers, and a non-linear activation function. First, local features are obtained through average pooling and 1x1 convolution. Then, the receptive field is expanded through depthwise separable convolution in the horizontal and vertical directions to capture long-range contextual information. Finally, an attention feature map is generated through 1x1 convolution and non-linear activation function, and then multiplied with the original image to enhance the network's attention to key regions in the original image. The bidirectional fusion network is used to fuse multi-scale features output by the backbone network to enhance semantic and location information; The bidirectional fusion network consists of four convolutional modules, two upsampling layers, two downsampling layers, and four concatenation operations. The small-scale deep features output from the backbone network are upsampled and added to medium-scale features to obtain feature map f1. Feature map f1 is upsampled again and then added to large-scale shallow features, resulting in feature map f2. Feature map f2 is downsampled and added to feature map f1 to obtain feature map f3. Feature map f3 is downsampled and then added to small-scale shallow features to obtain feature map f4. Feature maps f2, f3, and f4 all fuse features of different scales (large, medium, and small), achieving feature complementarity and improving the model's detection accuracy and robustness. The detection head structure includes three detection heads: a large target detection head, a medium target detection head, and a small target detection head. These are used to predict the fused multi-scale features and output target location information and category. The small target detection head reads the vector value of each feature point in feature map f2 to detect sleep apnea events. The target detection head reads the vector value of each feature point in feature map f3 to detect sleep apnea events; The large target detection head reads the vector value of each feature point in feature map f4 to detect sleep apnea events. In the feature maps f2, f3, and f4, the first four vector values ​​of each feature point vector, each with a length of 16, represent the distribution of the start and end positions, as well as the highest and lowest amplitude values ​​of the detected sleep apnea event within the window. The fifth value is the probability that the target event is a snoring event, and the sixth value is the probability that the target event is a sleep apnea event.

9. The sleep apnea detection method based on target detection according to claim 1, characterized in that, The loss function for training a YOLO object detection model with added context anchor attention mechanism consists of localization loss and classification loss. The localization loss is composed of CIoU loss and distribution focus DFL loss, as shown in formula (1): (1) For classification loss, the cross-entropy loss function is used to calculate the difference between the target event and the true event category; The loss for a perfect intersection-union is shown in Equation (2): (2) In the formula, IoU represents the intersection-union ratio, used to calculate the degree of overlap between the predicted event box and the ground truth event box; d represents the Euclidean distance between the center points of the predicted event box and the ground truth event box; and c represents the diagonal length of the smallest bounding rectangle containing both the predicted and ground truth event boxes. For the weight function, The width of the actual event box. The height of the actual event box. To predict the width of the event box, To predict the height of the event box.

10. The sleep apnea detection method based on target detection according to claim 1, characterized in that, Distribution focus loss is used to measure the difference between the predicted event box location distribution and the actual event box location distribution, focusing specifically on the interval containing the actual y-coordinate. The two target probabilities and This allows the model to focus on learning to distinguish the probability assignments of these two key locations near the true coordinates, especially giving greater weight to events with low predicted probability of sleep apnea. The distribution focus loss is shown in formula (3): (3) In the formula, Indicates y to distance, Indicates y to The closer the predicted value is to the true coordinate y, the higher its probability.

11. The sleep apnea detection method based on target detection according to claim 1, characterized in that, In step 7, a sliding window with a length of 60 seconds and a step size of 40 seconds is used to extract audio data. Then, the extracted audio data is enhanced and rendered into an amplitude waveform with a resolution of 640x640. Finally, the trained object detection YOLO model with added context anchor attention mechanism is input, and the model outputs the detection results. The detection results include the start position of the target event in the amplitude waveform. End position Maximum amplitude value Minimum amplitude value and its category ; through formula and The start time of the target event can be obtained. and end time ,in The start time of the window corresponding to this amplitude waveform can be obtained from the amplitude waveform file name. The amplitude waveform has a width of 640. The sliding window duration is 60 seconds; when When =0, it indicates that the target event is a snoring event. =1 indicates that the target event is a sleep apnea event; The time intersection ratio (OCR) between the (i-1)th target event and the ith target event of the same category is calculated using the following formula. ; The start time of the (i-1)th target event is The end time is The start time of the i-th target event is The end time is The (i-1)th target event must occur before the ith target event, i.e. > ; As shown in formula (4): (4) When the time intersection of two target events is compared If the two target events are the same event, the time span is retained. For long target events, save them to the detection results database and discard other target events; among them, The threshold for time intersection-union comparison; By accessing the detection results database and traversing all target events within a specified time range, the number and frequency of snoring events, as well as the number and duration of apnea events within that time range, can be statistically analyzed.