The invention relates to a circuit system which executes a method for predicting sleep apnea, and particularly to a circuit system that can be able to obtain the number of times of sleep apnea and sleep hypopnea from snoring signals of neural networks.
Both snoring and obstructive sleep apnea (OSA) are resulted from partial airway collapse of the upper airway at sleep. The only difference between snoring and OSA is the severity of the obstruction in the airway. Such problems have influenced at least 4% of population with the effects such as fatigues, tendency to fall asleep, poor memory and depression. Even worse, the problems could cause traffic accidents and illness such as neuropsychiatric disorder, arterial hypertension, cardiovascular disease, stroke and metabolic syndrome. Clinically, polysomnography (PSG) is the main tool for diagnosis of OSA. The PSG requires the patients to sleep at the hospital overnight, including monitoring the sleeping efficiency, number of times of sleep apnea and oxygen saturation. Such inspection process is time-consuming, labor-consuming and expensive. Therefore, it is desired to have a tool for examination and diagnosis of OSA quickly and conveniently and for further monitoring the severity of sleep apnea on a daily basis.
Snoring is the essential symptom of OSA. About 95% of the patients snore during their sleeps. Therefore, self-monitoring of snoring is considered to be a useful tool for them to examine and keep tracking of the condition. On the other hand, snoring analysis has been used to identify pathological respiratory sounds such as wheezes and crackles. However, in the researches, it is difficult to learn the numbers of times of sleep apnea and sleep hypopnea. Therefore, it's aimed to provide a model for classifying the numbers of times of sleep apnea and sleep hypopnea by neural networks.
It is a primary objective of the present invention to provide a circuit system which executes a method for predicting sleep apnea from neural networks that has a model trained for classifying and concluding the number of times of sleep apnea and sleep hypopnea from snoring signals, so as to further decide whether the snoring signals have revealed indications of sleep apnea or sleep hypopnea or not.
In order to achieve the above objectives, the circuit system includes a microphone, an artificial intelligence (AI) device, a development board, and a display. The microphone is used for retrieving an original signal. The microphone and the AI device are electrically connected to the development board. The AI device segments the original signal based on a first threshold value and a second threshold value, utilizes a sliding window to linearly inspect the original signal and calculating a maximum value of the original signal, upon said maximum value being greater than said second threshold value, recognizes a snoring signal and a position thereof, keeps inspecting the original signal toward a right direction and obtains a sum value of an absolute value of the snoring signal, upon the sum value being less than the first threshold value, sets a stop position, keeps inspecting the original signal toward a left direction and obtains a sum value of an absolute value of the snoring signal, upon the sum value being less than the first threshold value, sets a start position, segments the signal fell between said start position and said stop position and recognizes as a snoring signal vector with one dimension, applies a feature extraction algorithm to said snoring signal vector with one-dimension to transform the snoring signal into a feature matrix of two-dimensional vector, and applies a neural network algorithm to said feature matrix of two-dimensional vector for classifying and then provides a result indicating a number of times of sleep apnea and sleep hypopnea within the snoring signal to the display.
Furthermore, the snoring signal segmentation algorithm is performed for segmentation based on a first threshold value and a second threshold value, having a sliding window for linearly inspecting the original signal and calculating a maximum value of the original signal, upon said maximum value being greater than said second threshold value, a snoring signal and a position thereof being recognized, then keeping inspecting the original signal toward a right direction and obtaining a sum value of an absolute value of the snoring signal, upon the sum value being less than the first threshold value, a stop position being set, then keeping inspecting the original signal toward a left direction and obtaining a sum value of an absolute value of the snoring signal, upon the sum value being less than the first threshold value, a start position being set, then the signal fell between said start position and said stop position being segmented and recognized as a snoring signal vector.
The first threshold value is calculated by the following formula:
M=mean(f(Yi>0)),
where M representing the first threshold value, mean representing an average value, f( ) representing a down sampling formula and Yi representing a frame vector of the original signal.
The second threshold value is calculated by the following formula:
X=mean(N)+std(N),
where X representing the second threshold value, mean representing an average value, std representing a standard deviation and N representing a natural number which is calculated by the following formula:
N=sort(abs(
where sort representing a sorting by numerical order, abs representing an absolute value and
In addition, a length of the snoring signal vector is defined to be 25000 frames and the sliding window has window size of 1000.
The feature extraction algorithm has the Mel-Frequency Cepstral Coefficients for the feature extraction process, including procedures of pre-emphasis, framing and windowing, fast Fourier transform, Mel filter bank, nonlinear conversion and discrete cosine transform.
The neural network algorithm is a convolutional neural network algorithm that has a dense convolutional network model as the decision model, and the dense convolutional network model further includes a plurality of dense blocks, a plurality of transition layers and a classification layer. The plurality of transition layers further includes a convolution process and a pooling process and the classification layer is a softmax layer. And the plurality of dense blocks further includes a dense layer, a batch normalization-rectified linear units-convolution layer and a growth rate.
With structures disclosed above, the present invention has the snoring signal segmentation algorithm, the feature extraction algorithm and the neural network algorithm integrated to efficiently process the original signal and to further obtain the number of times of sleep apnea and sleep hypopnea from the snoring signal retrieved from the original signal, so as to decide whether the snoring signal has revealed indications of sleep apnea or sleep hypopnea or not. Such method has overcome the shortcomings of inability to predict or obtain an indication of sleep apnea and sleep hypopnea.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
The patent or application file contains at least one drawing executed in color. Copies of this patent or patent application publication with color drawing (s) will be provided by the Office upon request and payment of the necessary fee.
Referring to
Step a: retrieving an original signal Y. In this embodiment, polysomnography (PSG) has been performed on multiple subjects. The variables include the apnea-hypopnea index (AHI), snoring index and minimum oxygen saturation (MOS). The AHI is the number of times obstructive apnea and hypopnea happened per hour of sleep. Apnea is defined when the inhalation and exhalation stops for at least 10 seconds and hypopnea is defined when the baseline ventilator value is decreased by 50% or more and the oxygen saturation is decreased by 4% or more, and such reduction lasts more than 10 seconds. When performing PSG, the sound of snoring is recorded by a mini-microphone placed on a position above the suprasternal notch. But the present invention is not limited to such application.
Step b: applying a snoring signal segmentation algorithm G1 to the original signal Y to further retrieve at least one snoring signal B for segmentation and output the segmented snoring signals with one-dimensional vector S. Since the original signal Y is the audio file recorded all night, the data has to be processed in advance. The snoring signal segmentation algorithm G1 is applied to automatically sort out and segment the snoring signals from the original signal Y. But the present invention is not limited to such application.
With reference to
In addition, the formula for calculation of the first threshold value M is
M=mean(f(Yi>0)),
where M represents the first threshold value M; mean represents an average value; f( ) represents a downsampling formula; K represents a frame vector Yi of the original signal Y every 2 minutes downsampled to a dimension of 400. The downsampling process has the frame vectors Yi equally segmented to the same dimension and retrieves a maximum value of each segment. The frame vectors Yi are downsampled to a vector of 1*400, thereby producing a more reliable value of the first threshold value M.
The formula for calculation of the second threshold value X is
X=mean(N)+std(N),
where X represents the second threshold value X; mean represents an average value; std represents a standard deviation; N represents a natural number calculated by a formula of
N=sort(abs(
where sort represents a sorting by numerical order; abs represents an absolute value;
Step c: applying a feature extraction algorithm G2 to the snoring signal vector S with one dimension to transform the snoring signal vector S into a feature matrix A of two-dimensional vector. Thereby the original signal Y is segmented into the plurality of single snoring signals S1, S2, S3, S4, S5, S6, S7 for further processing of the feature extraction algorithm G2. The feature extraction algorithm G2 has the Mel-Frequency Cepstral Coefficients (MFCC) for the feature extraction process, including procedures of pre-emphasis G21, framing and windowing G22, fast Fourier transform G23, Mel filter bank G24, nonlinear conversion G25 and discrete cosine transform G26 as illustrated in
The pre-emphasis G21 aims to compensate for the attenuated portion of the single snoring signals S1, S2, S3, S4, S5, S6, S7 by a process defined as:
H
preem(z)=1−αpreemz−1,
where Hpreem represents the result after the pre-emphasis process G21 and αpreem represents the input signal of sounds.
The framing and windowing G22 has the single snoring signals S1, S2, S3, S4, S5, S6, S7 divided into shorter frames, each of which has a length of 20-40 milliseconds. In order to avoid significant changes between two frames, there is an overlapping area of 10 milliseconds between each frames and each frame is multiplied by the Hamming window to enhance the continuity between the borders of the frames. The signals close to the borders of the frames are slowly faded out to avoid the discontinuity and the energy spectrum of noise would be weakened, thereby the peak of the sine wave of the signals would be relatively prominent as well. If there is obvious discontinuity between each frames, there will be other misguiding energy distribution in the next fast Fourier transform process, causing misjudgment of the analysis in the process. Therefore, the signals have to be multiplied by the Hamming window during this step.
The fast Fourier transform G23 is applied to convert the signals from the time domain to the frequency domain, and fast Fourier transform is the fast algorithm of discrete Fourier transform.
The Mel filter bank G24 is a band-pass filter that overlaps with each other. Based on the Mel scale, it is linear under the frequency of 1 Hz and logarithmic thereon. The Mel scaling process is defined as:
where mel represents the result of the Mel filter bank; f represents the input of the filter bank; and the numbers 2595 and 700 are fixed numbers that have been widely used in the filter process in many researches. The energy spectrum is multiplied by a set of 16 triangular band-pass filters and thus we use the Mel Frequency as the spectrum of the 16 filters.
The discrete cosine transform G26 is applied for calculation of the MFCCs in each frame, and the conversion is based on the following equation:
Σk=1N log(y(i))*cos[mx(k−0.5)xπ÷N]
Thereby the snoring signal B can be converted into the MFCCs feature matrix A.
Step d: applying a neural network algorithm G3 to the feature matrix A of two-dimensional vector for classifying and then providing a result indicating a number of times of sleep apnea and sleep hypopnea within the snoring signal B. After the feature extraction process, the snoring signal B is converted into a two-dimensional vector, and, as most image classification process are performed by the neural network algorithm. G3, we can also apply the neural network algorithm G3 for classifying the feature matrix A. But the present invention is not limited to such application.
In this embodiment, the neural network algorithm G3 is a convolutional neural network algorithm which has a dense convolutional network (DN) model as a decision model. As illustrated in
Further referring to
Within the dense blocks D, any two layers are directly connected; therefore, the input of each layer in the network is the output of its previous layer, and the feature map of each layer is also transmitted directly to all the descendent layers. Such approach employs the DN model to make efficient use of all-level features. The transition layers T are designed to reduce the size of the feature matrix. Since the final layer of the output from the dense blocks D, the model can be very large. Therefore, the transition layers T are employed to reduce the amount of the parameters greatly. With such structures, the DN model solves the problem of gradient vanishing occurred when the network architecture is too deep and has the resistance to over-fitting.
Further referring to
Finally, please refer to
In addition, for example, the development board 806 can be a Raspberry Pi 4 development board, wherein an algorithm corresponding to the method shown in
In addition, as shown in
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
108116939 | May 2019 | TW | national |
This application is a continuation-in-part of U.S. application Ser. No. 16/675,494, filed on Nov. 6, 2019. The content of the application is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 16675494 | Nov 2019 | US |
Child | 17901880 | US |