Electrocardiogram analysis method, device and medium based on deep learning model
Through the preprocessing and feature fusion technology of the deep learning model, the noise robustness and information integration problems in electrocardiogram analysis are solved, and efficient and accurate electrocardiogram automated analysis is achieved.
Patent Information
- Application Number
- CN202510398056.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-04-01
AI Technical Summary
Traditional electrocardiogram analysis relies on doctors' visual interpretation, which is subject to variability. Complex cases are prone to misdiagnosis and missed diagnoses, and low-quality signals are easily affected by noise. Existing algorithms have poor robustness and are difficult to integrate clinical information.
A method based on a deep learning model is used to suppress noise through preprocessing, extract the temporal and spatial features of the ECG signal, combine cross-modal feature fusion, perform multiple anomaly detection tasks, and integrate clinical information to correct the results.
It improves the availability of low-quality ECG signals, enhances the ability to recognize complex pathological patterns, reduces misjudgments, realizes end-to-end automated analysis, and improves diagnostic efficiency and consistency.
Smart Images

Figure CN120241091B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of deep learning, and specifically to electrocardiogram analysis methods, devices, and media based on deep learning models. Background Art
[0002] Traditionally, ECG analysis relies primarily on the physician's visual interpretation of the waveform and empirical judgment. For example, abnormalities such as ST segment changes and T wave inversions may indicate myocardial ischemia or electrolyte imbalance. However, interpretation of the same ECG by different physicians can vary, which not only takes a long time but can also lead to misdiagnosis or missed diagnosis in complex or atypical cases.
[0003] Based on this, with the development of computer vision and machine learning technologies, they have been gradually introduced into electrocardiogram analysis, aiming to improve the level of automation and diagnostic efficiency.
[0004] However, it still has the following problems:
[0005] 1. ECG signals are susceptible to noise such as myoelectric interference and baseline drift. Existing algorithms have poor robustness in low-quality signals (such as ECG collected by wearable devices), which can easily produce false positive or false negative results.
[0006] 2. Insufficient recognition of complex pathological patterns and difficulty in integrating clinical information such as patient history and physical signs may still lead to misjudgment. Summary of the Invention
[0007] To solve the above problems, this application proposes an electrocardiogram analysis method based on a deep learning model, including:
[0008] Obtaining an electrocardiogram corresponding to the patient, and preprocessing the electrocardiogram to suppress noise to obtain an electrocardiogram signal;
[0009] Inputting the ECG signal into a pre-trained deep learning model, extracting temporal features and spatial features corresponding to the ECG signal through the deep learning model, and performing cross-modal feature fusion;
[0010] Based on the fusion features, multiple anomaly detection tasks and time series prediction tasks are executed simultaneously to obtain the corresponding anomaly detection results and time series prediction results respectively;
[0011] Acquire clinical information corresponding to the patient, and modify the abnormal detection result according to the clinical information and the time series prediction result;
[0012] According to the corrected abnormality detection result, the analysis result corresponding to the electrocardiogram is output.
[0013] In one example, preprocessing the electrocardiogram to suppress noise to obtain an electrocardiogram signal specifically includes:
[0014] Performing a fast Fourier transform on the electrocardiogram to extract corresponding spectral features, and performing noise type detection based on the state of the corresponding frequency in the spectral features; and extracting morphological features based on the electrocardiogram, and performing noise type detection based on the morphological features;
[0015] Based on the identified noise type, the corresponding preprocessing method is used to suppress the noise and obtain the ECG signal.
[0016] In one example, based on the identified noise type, a corresponding preprocessing method is used to suppress the noise and obtain an ECG signal, specifically including:
[0017] For baseline drift, fluctuations are eliminated by dynamically fitting the signal trend line; and / or, for power frequency interference, phase distortion is eliminated by zero-phase filtering; and / or, for electromyographic interference, high-frequency noise is separated by wavelet transform; and / or, for electrode contact interference, impaired signals are reconstructed by temporal and spatial correlation between leads;
[0018] According to the preset quality evaluation index, it is determined that the ECG signal after noise suppression meets the quality requirements.
[0019] In one example, the model architecture of the deep learning model includes: an input layer, a spatiotemporal joint encoder, a feature pyramid, and an output layer;
[0020] The input layer is used to input the electrocardiogram signal;
[0021] The spatiotemporal joint encoder includes a temporal channel branch, a spatial channel branch, and a cross-modal attention fusion layer;
[0022] Wherein, the time channel branch includes a bidirectional LSTM structure to extract time features;
[0023] The spatial channel branch includes a 3D-CNN structure to extract spatial features;
[0024] The cross-modal attention fusion layer fuses the temporal features and the spatial features through a cross-modal attention mechanism to obtain a fused feature;
[0025] The feature pyramid includes a one-dimensional convolution layer, a batch normalization layer, and an activation function layer;
[0026] The output layer includes multiple anomaly classification heads and a single time series prediction head;
[0027] The multiple anomaly classification heads are independent branches, each outputting a corresponding anomaly detection result;
[0028] The time series prediction head includes a causal convolution layer and a self-attention layer, and outputs the time series prediction results.
[0029] In one example, the training process of the deep learning model includes: training the spatiotemporal joint encoder, the anomaly classification head, and the time series prediction head in stages;
[0030] In the first stage, the spatiotemporal joint encoder is trained using a symmetric encoder-decoder structure and adversarial masking training by randomly masking segments of the ECG signal.
[0031] In the second stage, the anomaly classification head is trained. During the training process, the parameters of the spatiotemporal joint encoder are frozen, and anomaly judgment training is performed by gradually unfreezing the feature pyramid and setting dynamic sample weights.
[0032] The third stage is to train the time series prediction head. During the training process, the time series is decoupled and trained, and uncertainty calibration is introduced to train the prediction ability.
[0033] The fourth stage is to perform adversarial adjustments on the deep learning model. During the training process, adversarial samples are generated, defense strategies are set, and dynamic stability evaluation is performed. The model parameters of the deep learning model are fine-tuned based on the evaluation results.
[0034] The second stage and the third stage perform a double-stage cycle training.
[0035] In one example, obtaining clinical information corresponding to the patient and correcting the abnormal detection result based on the clinical information and the time series prediction result specifically includes:
[0036] A correction rule library pre-established based on a clinical knowledge graph; the correction rule library includes multiple correction rules, each of which includes a trigger condition, a correction action, and a corresponding weight;
[0037] Acquire clinical information corresponding to the patient, generate corresponding structured features based on information of each dimension in the clinical information, and generate a risk index corresponding to the patient based on the structured features;
[0038] Determine the hit designated correction rule based on the structured feature, the anomaly detection result, and the trigger condition in the correction rule, and determine the designated dimension information and the designated anomaly detection result corresponding to the designated correction rule;
[0039] Determine, based on historical clinical information, a likelihood ratio corresponding to the specified dimension information, and, using a Bayesian formula, correct the initial abnormal probability of the specified abnormal detection result based on the likelihood ratio to obtain a corrected abnormal probability;
[0040] According to the risk index, the confidence threshold corresponding to the specified anomaly detection result is adjusted, and according to the corrected anomaly probability and the adjusted confidence threshold, the anomaly detection result is corrected.
[0041] In one example, the method further includes:
[0042] Determining a prediction anomaly probability in the time series prediction result;
[0043] If the predicted abnormality probability is consistent with the abnormality detection result, outputting a corrected abnormality detection result;
[0044] If the predicted abnormality probability does not match the abnormality detection result, determining the difference between the predicted abnormality probability and the corrected abnormality probability;
[0045] If the difference is lower than the preset difference, the predicted abnormal probability and the corrected abnormal probability are weighted and summed to obtain a final abnormal probability, and the abnormal detection result is corrected according to the final abnormal probability and the adjusted confidence threshold;
[0046] If the difference is higher than the preset difference, a manual review alarm is performed.
[0047] In one example, outputting analysis results corresponding to the electrocardiogram based on the corrected abnormality detection results specifically includes:
[0048] Determining other dimensional information, except the designated dimensional information, in each dimensional information of the clinical information;
[0049] Encrypting the other dimensional information to obtain encrypted dimensional information;
[0050] According to the encrypted dimension information, the designated dimension information, and the corrected abnormality detection result, the analysis result corresponding to the electrocardiogram is output.
[0051] On the other hand, this application also proposes an electrocardiogram analysis device based on a deep learning model, comprising:
[0052] at least one processor; and,
[0053] a memory communicatively connected to the at least one processor; wherein,
[0054] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: the electrocardiogram analysis method based on the deep learning model described in any of the above examples.
[0055] On the other hand, the present application also proposes a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as: an electrocardiogram analysis method based on a deep learning model as described in any of the above examples.
[0056] The electrocardiogram analysis method based on the deep learning model proposed in this application can bring the following beneficial effects:
[0057] 1. The pre-processing module suppresses noise such as electromyographic interference and baseline drift, which can improve signal quality, enhance the usability of low-quality ECG signals (for example, data collected by wearable devices), and reduce the probability of false positives and false negatives caused by noise.
[0058] 2. Through the deep learning model, the temporal dynamic characteristics and spatial distribution characteristics of the ECG signal are simultaneously extracted. Combined with cross-modal fusion technology, the ability to represent complex pathological patterns such as ST segment changes and T wave inversion is improved, and the pathology recognition ability is enhanced.
[0059] 3. Simultaneously execute multiple anomaly detection tasks and time series prediction tasks, use the correlation between tasks to constrain model learning, avoid local feature deviations caused by a single task, improve the coverage of atypical cases, and collaboratively optimize the comprehensiveness of diagnosis.
[0060] 4. By integrating clinical prior knowledge such as patient medical history and physical signs, and combining it with time series prediction results, the anomaly detection results of the deep learning model are dynamically calibrated to reduce misjudgments caused by lack of contextual information.
[0061] 5. A complete closed loop is formed from signal processing to feature extraction, multi-task analysis, and result correction, which reduces manual intervention, significantly shortens ECG analysis time, ensures result consistency, and achieves end-to-end automation to improve efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0063] Figure 1 Schematic diagram of the process of the electrocardiogram analysis method based on the deep learning model in an embodiment of the present application;
[0064] Figure 2In one embodiment of the present application, an electrocardiogram including a baseline drift is provided;
[0065] Figure 3 This is an electrocardiogram containing power frequency interference in one case in the embodiment of the present application;
[0066] Figure 4 This is an electrocardiogram with several interferences under one scenario in the embodiment of the present application;
[0067] Figure 5 This is a schematic diagram of the architecture of a deep learning model in one scenario in an embodiment of the present application;
[0068] Figure 6 This is a schematic diagram of the architecture of a spatiotemporal joint encoder in one scenario in an embodiment of the present application;
[0069] Figure 7 This is a schematic diagram of data flow of a timing prediction header in one scenario in an embodiment of the present application;
[0070] Figure 8 A schematic diagram of a process for correcting abnormality detection results in one embodiment of the present application;
[0071] Figure 9 This is a schematic diagram of an electrocardiogram analysis device based on a deep learning model in an embodiment of the present application. DETAILED DESCRIPTION
[0072] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0073] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.
[0074] like Figure 1 As shown, the embodiment of the present application provides an electrocardiogram analysis method based on a deep learning model, including:
[0075] S101: Acquire an electrocardiogram corresponding to a patient, and pre-process the electrocardiogram to suppress noise to obtain an electrocardiogram signal.
[0076] Here, users who undergo electrocardiograms are referred to as patients. Some users do not have any underlying health conditions, but undergo electrocardiograms as part of regular checkups. For ease of description, we refer to them all as patients.
[0077] The ECG can be obtained by connecting to a corresponding medical system and using the medical system's interface. The ECG acquisition process must ensure patient consent and privacy. For example, ECG analysis must be performed in a trusted environment, such as a trusted device or network, and only authorized doctors or operators are allowed to observe the ECG.
[0078] Generally speaking, the electrocardiogram obtained directly may contain noise due to equipment reasons, the patient's own condition, etc., so noise suppression is required before the electrocardiogram signal for analysis can be obtained.
[0079] Generally speaking, there may be many reasons for the generation of noise, so it is necessary to first analyze and determine the type of noise generated, and then adopt corresponding methods to eliminate the noise.
[0080] S102: Input the ECG signal into a pre-trained deep learning model, extract the temporal features and spatial features corresponding to the ECG signal through the deep learning model, and perform cross-modal feature fusion.
[0081] Deep learning models perform machine learning based on deep neural networks (DNNs), which include two or more hidden layers. They can learn complex features in data and use these features to make predictions and classifications.
[0082] The deep learning model can extract features based on ECG signals. In order to extract the features of ECG signals more accurately, the time features and spatial features can be extracted simultaneously through the time dimension and space dimension, and then the features can be fused to facilitate subsequent analysis of the ECG signals.
[0083] S103: Based on the fusion features, multiple anomaly detection tasks and time series prediction tasks are executed synchronously to obtain corresponding anomaly detection results and time series prediction results respectively.
[0084] The anomaly detection task refers to detecting whether there are abnormalities in multiple directions based on the patient's ECG signal. Multiple anomaly detection tasks may include: arrhythmia classification task (which includes five classification results: normal, atrial fibrillation, ventricular tachycardia, conduction block, and other), ST-T segment anomaly detection task (which is a binary classification, including normal and abnormal), QRS wave morphology anomaly detection task (which is a binary classification, including normal and abnormal), heart rate variability analysis task, etc.
[0085] The time series prediction task refers to predicting the ECG signal within a certain period of time in the future based on the trend of the current ECG signal, so as to provide early warning and correct abnormal detection results based on the prediction.
[0086] S104: Acquire clinical information corresponding to the patient, and modify the abnormal detection result according to the clinical information and the time series prediction result.
[0087] If the final judgment is based solely on the anomaly detection results of the deep learning model, too few dimensions are considered, making it difficult to adapt to the different physical conditions of different patients. By combining clinical information and time series prediction results, personalized corrections can be made for each patient, making the final anomaly detection result more closely aligned with the patient's individual condition.
[0088] S105: Outputting the analysis result corresponding to the electrocardiogram according to the corrected abnormality detection result.
[0089] After the abnormality detection results are obtained, they may include: the abnormality probability corresponding to each abnormality detection task, the judgment result (whether an abnormality exists), etc. After combining these contents, the analysis results corresponding to the electrocardiogram are obtained.
[0090] The ECG analysis results can be used directly to judge the patient's condition, or they can be sent to the patient's attending physician as an auxiliary judgment result. The physician will make a judgment and analysis based on the analysis results combined with manual experience to obtain the final confirmation result of the patient's condition.
[0091] 1. The pre-processing module suppresses noise such as electromyographic interference and baseline drift, which can improve signal quality, enhance the usability of low-quality ECG signals (for example, data collected by wearable devices), and reduce the probability of false positives and false negatives caused by noise.
[0092] 2. Through the deep learning model, the temporal dynamic characteristics and spatial distribution characteristics of the ECG signal are simultaneously extracted. Combined with cross-modal fusion technology, the ability to represent complex pathological patterns such as ST segment changes and T wave inversion is improved, and the pathology recognition ability is enhanced.
[0093] 3. Simultaneously execute multiple anomaly detection tasks and time series prediction tasks, use the correlation between tasks to constrain model learning, avoid local feature deviations caused by a single task, improve the coverage of atypical cases, and collaboratively optimize the comprehensiveness of diagnosis.
[0094] 4. By integrating clinical prior knowledge such as patient medical history and physical signs, and combining it with time series prediction results, the anomaly detection results of the deep learning model are dynamically calibrated to reduce misjudgments caused by lack of contextual information.
[0095] 5. A complete closed loop is formed from signal processing to feature extraction, multi-task analysis, and result correction, which reduces manual intervention, significantly shortens ECG analysis time, ensures result consistency, and achieves end-to-end automation to improve efficiency.
[0096] In one embodiment, when performing noise suppression and determining the noise type, the noise type can be determined based on two dimensions: spectral characteristics and morphological characteristics. Noise types include baseline drift, power frequency interference, myoelectric interference, electrode contact interference, and the like.
[0097] Perform fast Fourier transform on the electrocardiogram to extract the corresponding spectral features, and perform noise type detection based on the state of the corresponding frequency in the spectral features; and perform morphological feature extraction based on the electrocardiogram, and perform noise type detection based on the morphological features.
[0098] For baseline drift, its main manifestation is excessive energy in the low-frequency band (usually less than 2Hz), while for power frequency interference, it can be determined by detecting peaks near 50Hz and 60Hz. Therefore, both can be judged by spectral characteristics.
[0099] Specifically, the sources of low-frequency components in baseline drift include respiratory movement, electrode motion, and the skin electrolytic effect. Respiratory movement refers to changes in the electrode-skin contact impedance caused by chest movement (typically corresponding to 0.1 Hz to 0.5 Hz); electrode motion refers to slow drift caused by changes in patient position (typically less than 1 Hz); and the skin electrolytic effect refers to slow potential changes caused by drying of the conductive paste (typically corresponding to 0.05 Hz to 0.2 Hz).
[0100] like Figure 2 As shown, an exemplary electrocardiogram with baseline drift is given, and its spectral characteristics may include: a wide energy band appears in the range of 0Hz~2Hz, and energy concentration appears in the low-frequency band; the QRS wave (full name: Q wave-R wave-S wave group) has its main energy concentrated in 5-15Hz, has no overlap with the baseline drift frequency, and appears separated from the QRS wave.
[0101] At this point, a quantitative judgment can be made. When the energy in the low-frequency band (0Hz~2Hz) accounts for 30% of the total energy, it can be determined that there is significant baseline drift.
[0102] Regarding power frequency interference, the operating frequency of the AC power supply (in different regions, its operating frequency may correspond to 50Hz or 60Hz) will generate an electromagnetic field, which is coupled into the ECG signal through the electrode wire.
[0103] like Figure 3The figure shows an example of an electrocardiogram with power frequency interference. Its spectral characteristics may include: a sharp peak centered at 50Hz or 60Hz, resulting in a narrowband spike; this peak may be accompanied by harmonic interference, such as the second harmonic at 100Hz or 120Hz, or the third harmonic at 150Hz or 180Hz; and when the power supply is unstable, the spike may spread to the surrounding areas, resulting in a widened bandwidth. For example, 50Hz may spread to the surrounding 49Hz to 51Hz.
[0104] At this point, you can identify sharp peaks to determine whether there is power frequency interference.
[0105] For myoelectric interference, the myoelectric noise density can be identified by calculating the number of local slope mutation points.
[0106] like Figure 4 As shown, an exemplary electrocardiogram with electromyographic interference is given, and its manifestations in morphological features (also called time domain features) may include: dense irregular spikes superimposed on the equipotential lines, and the appearance of high-frequency burrs; unlike the regularity of the QRS wave, the electromyographic noise appears randomly and has no periodicity.
[0107] At this point, local slope and density statistics can be used to determine whether EMG interference exists. For example, for local slope statistics, several sampling points are set, and the differential value of each sampling point is calculated to obtain the corresponding slope. If the absolute value of the slope of multiple consecutive sampling points exceeds the threshold, it is considered that EMG interference exists. For density statistics, the density of sampling points whose absolute slope value exceeds the threshold per unit time can be calculated. If the density is high (for example, over 20%), it is determined to be severe EMG noise.
[0108] Electrode contact interference primarily refers to interference caused by prolonged signal loss. Morphological manifestations include: a sudden flattening of the lead for a sustained period (e.g., longer than 1 second), signal loss; a rapid signal excursion exceeding a certain value (e.g., 2 mV) within a few seconds; and a loss of spatial correlation between the affected lead and other leads, resulting in inter-lead inconsistency.
[0109] To check for lead consistency, the correlation coefficient of the QRS wave occurrence time of each lead can be calculated. A value above 0.9 is considered normal, while the correlation coefficient of abnormal leads typically drops below 0.3. To detect sudden amplitude changes, the amplitude of the change within a certain period of time (e.g., 100ms) can be measured. If the change exceeds 1mV, poor contact is determined.
[0110] In this way, the detection of each noise type is completed through the corresponding method. Then, according to the detected noise type, the corresponding pre-processing method is adopted to perform noise suppression.
[0111] Specifically, for baseline drift, fluctuations are eliminated by dynamically fitting the signal trend line; for power frequency interference, phase distortion is eliminated by zero-phase filtering; for electromyographic interference, high-frequency noise is separated by wavelet transform; for electrode contact interference, the damaged signal is reconstructed by the spatiotemporal correlation between leads.
[0112] To elaborate, baseline drift can be suppressed by using a high-pass filter with a fixed cutoff frequency; however, this method can easily distort the ST segment morphology.
[0113] Based on this, adaptive window segmentation can be used to dynamically adjust the window length based on heart rate. The faster the heart rate, the shorter the window. Then, within each window, a polynomial fitting method is used (for example, a polynomial of order 3 to 5 can be used; order 3 is used for gentle drift to avoid overfitting physiological fluctuations, order 5 can be used for sharp mutations to better fit rapidly changing nonlinear trends, and order 4 is used for other types to balance flexibility and stability) to approximate the baseline trend. The optimal coefficients are found using the least squares method to minimize the sum of the squared residuals between the fitted curve and the original signal, thus generating the corresponding fitting curve.
[0114] The polynomial fitting curve is subtracted from the original ECG signal to achieve noise suppression. Of course, during this process, physiological fluctuation protection can also be performed, detecting fluctuations synchronized with the chest impedance signal, identifying them as respiratory-related fluctuations, and preserving these physiological oscillations.
[0115] Experimental verification shows that this noise suppression method can reduce the maximum ST segment offset error to less than 0.05mV, meeting clinical diagnostic requirements. Furthermore, the processing time is less than 10ms per lead, ensuring real-time performance.
[0116] For power frequency interference, a filter can be used for filtering. However, it is easy to introduce phase offset, resulting in QRS wave width measurement deviation. In addition, the fixed center frequency is difficult to adapt to power grid fluctuations.
[0117] Based on this, zero-phase filtering is used. Bidirectional filtering (forward + reverse filtering) makes the filtering operation symmetrical on the time axis, thereby canceling out phase shifts. Forward filtering passes the original signal through the filter sequentially in chronological order. At this point, the signal is filtered, but a phase delay is introduced, causing the waveform to shift to the right. The result of the forward filtering is then reversed on the time axis, and reverse filtering is performed, before passing the signal through the filter again. This creates a reverse phase delay, which cancels out the phase delay from the forward filtering, resulting in a total phase delay of zero. Multiplying the amplitude-frequency responses of the two filters doubles the stopband attenuation and makes the transition band steeper.
[0118] The corresponding mathematical expression can be: y = fftshift( filtfilt(b, a, x) ), where y is the ECG signal after noise suppression, b is the filter numerator coefficient vector, a is the filter denominator coefficient vector, filtfilt is forward filtering, and fftshift is reverse filtering.
[0119] It also uses adaptive tracking to monitor the energy peak of the 50Hz~60Hz frequency band in real time, dynamically adjust the notch center frequency, and automatically shrink the bandwidth. For example, when the interference is weak, the bandwidth is 2Hz, and when the interference is strong, it expands to 5Hz.
[0120] Experimental verification has shown that this noise suppression method can reduce the QRS wave width measurement error from ±8ms to ±2ms, and increase the T wave amplitude retention rate to over 98%, thus avoiding misdiagnosis of hypokalemia.
[0121] For myoelectric interference, the db4 wavelet (Daubechies 4th-order wavelet) has a short time domain range and is suitable for capturing the transient characteristics of ECG signals. The 2nd-order vanishing moment can effectively represent the local polynomial trend of the signal, which contrasts with the random spikes of myoelectric noise and is close to the steep rising edge of the QRS wave. This is conducive to distinguishing true ECG features from noise. Therefore, the db4 wavelet is selected and layered processing is performed using the db4 wavelet.
[0122] For example, assuming the ECG signal sampling rate is 500Hz, its effective frequency range is 0Hz~250Hz, divided into layers D1~D5 and A5. The frequency range and main components corresponding to each layer are shown in Table 1 below:
[0123] Table 1 Wavelet decomposition level table
[0124]
[0125] Based on this, the high-frequency layer (D1~D2), where the electromyographic noise energy is concentrated, needs to be strongly suppressed. The mid-frequency layer (D3) needs to be fine-tuned to take into account both residual noise and physiological details. The low-frequency layer (D4~A5) needs to retain the main components of the electrocardiogram to avoid excessive smoothing.
[0126] Then layered noise suppression is performed, with different thresholds applied at different levels.
[0127] The threshold function formula is: ;in, It is a nonlinear filtering function used to screen the coefficients after wavelet decomposition. It determines which wavelet coefficients are considered as noise and need to be suppressed, and which are considered as real signals and need to be retained. c is the wavelet coefficient, which represents the detail component of the signal in a certain frequency band. T is the threshold used to control the intensity of noise suppression. It is generally believed that large coefficients correspond to real signals and small coefficients correspond to noise. The coefficients below T are reset to zero or reduced, thereby suppressing noise while retaining important signal features. sign(c) is used to retain the positive and negative signs of the coefficients. Used to shrink coefficients exceeding the threshold. Compared to the hard threshold, which directly cuts off coefficients below the threshold, it retains mutations but may introduce artifacts. Compared to the soft threshold, which linearly attenuates coefficients above the threshold, it is smooth but may weaken the signal. This compromise solution is used to strike a balance between preserving signal features and suppressing noise by adjusting the "hardness" of the threshold shrinkage.
[0128] The adaptive calculation formula of the threshold T is: ;in, is the threshold corresponding to the jth layer, is the noise standard deviation of the j-th layer wavelet coefficient, which is used to reflect the noise intensity. N is the signal length (that is, the number of sampling points), which compensates for the impact of the data volume on the extreme value. lnN is used to control the rate at which the threshold increases with the data volume.
[0129] In this way, the greater the noise, the higher the threshold, achieving noise intensity compensation. Moreover, the longer the signal, the higher the probability of extreme noise values, and the threshold needs to be increased to avoid misjudgment and achieve data volume compensation.
[0130] Then, the estimation formula of the noise standard deviation is: ;in, is the median absolute deviation of the detail coefficients at the jth layer, and 0.6745 is the quantile scaling factor of the standard normal distribution, which converts the MAD into a standard deviation estimate.
[0131] Among them, due to The layer corresponds to the highest frequency band, which mainly contains noise and high-frequency harmonics of the QRS wave. In most ECG signals, the noise in the high-frequency band dominates the real signal, so The MAD of the layer can be approximated as the noise intensity. In this case, select The noise standard deviation is calculated by the layer. The process mainly includes: calculating Absolute value of layer coefficient , find the median ,calculate , scaling to get the noise standard deviation .
[0132] Experimental verification shows that this noise suppression method can improve the myoelectric noise signal-to-noise ratio by about 15dB and increase the P-wave detection rate from 70% to 92%.
[0133] To address electrode contact interference, motion artifact processing can be used for morphological restoration.
[0134] Its repair strategies mainly include space repair and time repair.
[0135] For spatial restoration, the ECG signal is essentially a projection of cardiac electrical activity at different locations on the body surface, and there is a spatial vector relationship between the 12 leads. If a lead is damaged due to motion artifact or electrode detachment, the spatial correlation of other leads can be used for restoration.
[0136] The conversion relationship between leads is established using historical data. This conversion relationship is a multivariate linear regression function. By solving the coefficients in the function, the functional relationship between different leads is established. The coefficients can be updated regularly.
[0137] In this way, when an abnormality is detected in one of the lead signals, the corresponding lead signal can be obtained by solving the functional relationship.
[0138] For time restoration, the temporal autocorrelation of the ECG signal is exploited to predict the current signal using historical data. When the actual signal deviates significantly from the predicted value, the predicted value is used to replace the abnormal segment.
[0139] The corresponding LSTM network can be pre-trained, which includes an input layer, a hidden layer, and an output layer. The input layer is used to input ECG segments within a certain period of time in the past (for example, 200ms). The hidden layer includes two layers of LSTM modules, each layer includes 64 units, and the output layer is used to output the voltage prediction value at the current moment.
[0140] When the actual signal deviates from the predicted value to a certain extent, the actual signal can be replaced by the predicted value.
[0141] Experimental verification has shown that this noise suppression method can reduce the misdiagnosis rate of false ventricular tachycardia caused by motion artifacts by 65%, and maintain the diagnostic completeness rate above 80% when the lead is off.
[0142] Based on this, after noise suppression is performed, it can also be determined whether the noise-suppressed electrocardiogram meets quality requirements based on preset quality evaluation indicators.
[0143] Among them, quality assessment can include signal-to-noise ratio (SNR) and waveform integrity. Quality requirements may include: the signal-to-noise ratio needs to be higher than 20dB, the QRS wave loss rate in waveform integrity is lower than 0.1%, and the correlation between ST segment distortion and the original signal is higher than 0.98.
[0144] In one embodiment, Figure 5 As shown in the figure, the model architecture of the deep learning model includes: input layer, spatiotemporal joint encoder, feature pyramid, and output layer.
[0145] The input layer is used to input the ECG signal, which is then subjected to noise suppression before being fed into the input layer. Alternatively, a noise suppression processing module can be added to the deep learning model. The unnoised ECG is fed into the input layer, and the processing module performs noise suppression on the ECG before generating the ECG signal. This signal is then fed into the spatiotemporal joint encoder.
[0146] Generally speaking, the sampling rate of ECG signals can be set to 100 Hz.
[0147] like Figure 6 As shown in Figure 3, the spatiotemporal joint encoder includes a temporal channel branch, a spatial channel branch, and a cross-modal attention fusion layer.
[0148] The time channel branch includes a bidirectional LSTM structure to extract time features.
[0149] Specifically, the time channel branch uses a Bi-directional Long Short-Term Memory (BiLSTM) channel, consisting of three bidirectional LSTM layers and one temporal attention layer, to output temporal features. The input dimensions are set to [Batch × 3000 (time sampling points) × 12 (leads)]. Each bidirectional LSTM layer has 256 hidden units to process the temporal evolution of the entire ECG sequence.
[0150] A regularization (Dropout) layer is provided after the first and second bidirectional LSTM layers. The Dropout rate can be set to 0.3 to prevent overfitting. The third bidirectional LSTM layer is connected to a multi-head temporal attention layer. For example, an 8-head self-attention layer is set to automatically focus on key time nodes (such as the R-wave peak position) to output temporal features.
[0151] The spatial channel branch includes a 3D-CNN structure to extract spatial features.
[0152] Specifically, the spatial channel branch includes a 3D convolutional layer, a pooling layer, and a depthwise separable convolutional layer to output spatial features. The input dimension is reshaped into a three-dimensional tensor of [Batch (batch) × 3000 (time sampling points) × 12 (leads) × 1 (channel)], and the output dimension is aligned with the temporal channel branch.
[0153] In the 3D convolutional layer, the convolution kernel is set to 3×5×3, and a batch normalization layer (BN layer) and an activation function layer (ReLU layer) are used. The pooling layer uses a maximum pooling layer (MaxPool layer), with a pooling unit size of 1×2×1. In the depthwiseConv3D separable convolutional layer, the convolution kernel is set to 3×3×3, and a batch normalization layer (BN layer), an activation function layer (ReLU layer), and a spatial depth conversion layer (SpaceToDepth layer) are used. The channel attention weighting layer performs channel attention calculations. The dimension alignment layer includes a 1×1 convolution layer and an interpolation alignment layer. The number of channels is expanded to 512 through 1×1 convolution. The temporal dimension is interpolated to 3000 points to align with the temporal channel branch.
[0154] The cross-modal attention fusion layer fuses temporal features and spatial features through the cross-modal attention mechanism to obtain fused features.
[0155] Specifically, the cross-modal attention fusion layer uses cross-attention to achieve spatial and temporal feature interaction. The temporal features output by the temporal branch serve as the query vector (Query, abbreviated as Q), and the spatial features output by the spatial branch serve as key-value pairs (consisting of a key vector Key and a value vector Value, abbreviated as K and V, respectively). After calculating attention weights, these weighted combinations are used to generate fused features. Finally, a residual connection is used to retain the original temporal features, forming a joint feature vector of dimension 512.
[0156] The feature pyramid includes a one-dimensional convolution layer, a batch normalization layer, and an activation function layer.
[0157] The dimension of the fused features of the feature pyramid input is [Batch×3000×512]. Its structure includes P5 to P3 layers. Each layer contains a one-dimensional convolution layer (Conv1D), a batch normalization layer (BN layer), and an activation function layer (ReLU layer). Layer-by-layer downsampling is performed to reduce the 3000 dimension to 1500, 750, and 375, and the number of 512 channels to 256, 128, and 64, respectively. Maximum pooling units of different sizes are used in parallel in each layer of P5 to P3 for maximum pooling processing.
[0158] The generated hierarchical features include: [Batch×1500×256], [Batch×750×128], and [Batch×375×64]. 1500 points correspond to high-level features that capture the overall ECG rhythm pattern, 750 points correspond to mid-level features that identify local morphological changes such as ST segments and T waves, and 375 points correspond to low-level features that analyze the fine structure of the QRS complex.
[0159] Among them, a one-dimensional dilated convolution layer (DilatedConv1D layer) can be added to the P3 layer, and its dilation rate (dilation rate) is set to 4 to capture long-range dependencies.
[0160] A feature enhancement path is set up. High-level features are upsampled using bilinear interpolation and then concatenated with the next-level features. A 3×1 convolution is used to fuse global semantics and local details, achieving top-down propagation. Each level retains the mid-level features of the original spatial channel branches, which are then added to the hierarchical features after dimensional alignment using 1×1 convolutions to achieve horizontal connection.
[0161] The output layer includes multiple anomaly classification heads and a single time series prediction head, and each output head is in parallel.
[0162] Specifically, multiple anomaly classification heads are independent branches that each output their own corresponding anomaly detection results. For example, there are four types of anomaly detection tasks, including: arrhythmia classification task (which includes five classification results: normal, atrial fibrillation, ventricular tachycardia, conduction block, and other), ST-T segment anomaly detection task (which is a binary classification task, including normal and abnormal), QRS wave morphology anomaly detection task (which is a binary classification task, including normal and abnormal), and heart rate variability analysis task (which can be set as a regression task). Each anomaly classification head is used to perform the corresponding anomaly detection task.
[0163] For the arrhythmia classification task, we used Global Average Pooling (GAP) with Softmax as the activation function and Categorical Focal Loss as the loss function during training. Based on the features corresponding to the top 1500 points, we used GAP to obtain an overall representation. After a 128-dimensional fully connected layer, we output a probability distribution for five categories. We focused on global features such as missing P waves and irregular RR intervals.
[0164] For the ST-T segment anomaly detection task, global average pooling (GlobalAveragePool) is adopted, Sigmoid is used as the activation function, and the loss function is set to binary focal loss (Binary Focal Loss) during training. The features corresponding to the 750 points in the middle layer are selected, and the features of the ST segment area (80ms~120ms after the J point) are extracted in the time dimension sliding window. After spatial attention weighting, it is determined whether the ST segment of each lead is elevated or depressed.
[0165] For the task of detecting QRS morphological abnormalities, global average pooling (GlobalAveragePool) is adopted, Sigmoid is used as the activation function, and the weighted binary cross entropy loss (Weighted BCE Loss) is set as the loss function during training. The high temporal resolution of the features corresponding to the bottom 375 points is used to locate the starting and ending points of the QRS wave. Morphological template matching is combined to detect abnormalities such as bundle branch block.
[0166] For the heart rate variability analysis task, global average pooling (GlobalAveragePool) is adopted, the activation function uses Linear, and the loss function is set to Huber Loss during training. Time domain (SDNN) and frequency domain (LF, HF power) features are jointly extracted from the original RR interval sequence and LSTM hidden state, and the HRV index is predicted through a regression network.
[0167] The time series prediction head includes a causal convolution layer and a self-attention layer, and outputs the time series prediction results.
[0168] like Figure 7 As shown, its input includes the bottom features of the feature pyramid (features of the P3 layer), patient state memory (dynamic memory units maintained by time channel branches, recording the feature evolution over a period of time in the past, which is a hidden state dimension of 128), patient metadata (encoding the patient's age, gender, medical history, etc. into a 32-dimensional vector), and timestamp encoding (mapping the predicted time point into a 16-dimensional sinusoidal position encoding).
[0169] The above input features are concatenated and dimensionally upgraded. The merged dimension is Dense(256) and normalized by LayerNorm.
[0170] Establish four layers of causal convolution with increasing dilation rates, with dilations of 1, 2, 4, and 8, respectively. Each layer consists of a causal one-dimensional convolution layer (CausalConv1D), a batch normalization layer (BatchNorm), an activation function layer (ReLU), and a regularization layer (Dropout). The kernel size of the causal one-dimensional convolution layer is set to 5 (kernel_size=5), and the spacing between each point in the convolution kernel is 1 unit (dilation_rate=2). The dropout rate of the regularization layer is set to 0.2.
[0171] A self-attention mechanism is set up to process 256-dimensional temporal features through 4-head attention. The attention mask is used to ensure that only historical information is focused on. The output is expanded to 512 dimensions through the feedforward network.
[0172] In the prediction output layer, multiple time points are predicted in parallel, and the prediction target time is divided into multiple windows (for example, one window every 30 minutes), and each window is processed independently.
[0173] In one embodiment, when training a deep learning model, it can be set to train the spatiotemporal joint encoder, the anomaly classification head, and the time series prediction head in stages.
[0174] Specifically, the first stage trains the spatiotemporal joint encoder. During the training process, a symmetric encoder-decoder structure is used, and adversarial masking training is performed by randomly masking segments of the ECG signal.
[0175] The data source can be obtained from the clinical database, and after preprocessing, it is resampled to 300 Hz and normalized at the lead level.
[0176] Set a masking strategy, for example, mask 3 to 5 segments for each sample, with each segment length of 200 ms to 500 ms, and enhance masking of key areas. For example, increase the additional masking probability of the QRS complex area by 30%.
[0177] At this time, only the spatiotemporal joint encoder is trained. The optimizer parameters are set to learning rate lr = 5e-4, decay rate betas = (0.9, 0.98), decay weight weight_decay = 0.05, batch size is 128, and the learning rate strategy is to linearly warm up to 1e-3 in the first 5 rounds, and adjust the learning rate through cosine annealing decay (epoch = 50 rounds), with a minimum learning rate of 1e-6.
[0178] During training, the masking pattern is dynamically generated online for each batch. The weighted multi-feature mean absolute error loss function is used to set weights for the features corresponding to each lead, and the loss is calculated by weighted summation of the mean absolute errors of each feature.
[0179] In the second stage, the anomaly classification head is trained. During the training process, the parameters of the spatiotemporal joint encoder are frozen, and anomaly judgment training is performed by gradually unfreezing the feature pyramid and setting dynamic sample weights.
[0180] The ratio of the training set to the validation set is set to 8:1. In the training set, the number of each category must exceed a certain value.
[0181] By setting the enhancement strategy, you can collect noise templates from real devices used to generate ECGs and perform dynamic noise introduction. You can also perform lead permutation by randomly swapping the aVR and aVL leads.
[0182] During training, the underlying parameters of the feature pyramid are unfrozen, and the optimizer parameters are set to a learning rate of 3e-4, a decay rate betas=(0.95, 0.99), a minimum value eps=1e-6, and a Lookahead (k=5) optimization strategy with a step size parameter k=5 and a batch size of 64 to ensure that at least a certain number of anomaly types are included.
[0183] Regularization methods include label smoothing, setting smoothing = 0.1, and layer-wise dropout, setting parameters to 0.1 for the input layer and 0.3 for the intermediate layer.
[0184] Set dynamic sample weights to automatically allocate training attention based on the task's historical performance. After each or every two rounds of training, determine historical performance based on the validation set, and tasks with good historical performance will receive higher weights in the next round of training. Also set the maximum and minimum weights, for example, to 2.0 and 0.5, respectively.
[0185] During training, set up a main task and auxiliary tasks. The main task can be arrhythmia classification. Set weights for each abnormality classification head, with the abnormality classification head corresponding to the main task receiving a higher weight. Set a weighted sum loss function for the output of each abnormality classification head and set early stopping conditions. These conditions can include the main task verifying that the F1 parameter has not improved for multiple consecutive rounds, or that the auxiliary task's loss fluctuations exceed a certain value for multiple consecutive rounds.
[0186] The third stage trains the time series prediction head. During the training process, the time series is decoupled and trained, and uncertainty calibration is introduced to train the prediction ability.
[0187] The input sequence can be a continuous ECG signal of a certain duration (e.g., 6 hours), with a sliding window step size (e.g., 10 minutes). Positive sample enhancement is performed, extending the context of samples that are about to become abnormal by a certain length of time (e.g., 3 hours), and oversampling rare events (e.g., precursors to ventricular fibrillation) by 500%.
[0188] Set the thawing strategy to gradually thaw the encoder during training, gradually increasing the thawing ratio in each training round. The initial thawing ratio can be set to 20%, and the thawing ratio increases by 1.6% with each additional round. The total number of training rounds can be set to 50, and the upper limit of the thawing ratio is set to 100%.
[0189] In each round, the corresponding parameters are selected for gradient calculation according to the thawing ratio.
[0190] Set the optimizer parameters to a learning rate of 1e-4 and schedule_decay=0.004.
[0191] Among them, the second and third stages perform two-stage cyclic training. For example, every morning, the diagnostic mode training is carried out, the time series prediction head is frozen, and only the parameters of the abnormal classification head are updated. In the afternoon, the prediction mode training is carried out, the abnormal classification head is frozen, and only the parameters of the time series prediction head are updated.
[0192] The fourth stage is to perform adversarial adjustments on the deep learning model. During the training process, adversarial samples are generated, defense strategies are set, and dynamic stability evaluation is performed. The model parameters of the deep learning model are fine-tuned based on the evaluation results.
[0193] The attack strategy is set to Projected Gradient Descent (PGD) attack, where the parameters can be set as follows: maximum norm constraint eps is 0.08, step size alpha of each iteration is 0.02, number of iteration steps is 7, Boolean value targeted is set to False, indicating untargeted attack, and lead weights are set, for example, to [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 1.5, 1.5, 1.0, 1.0, 1.0]. The higher the weight, the more attention it receives, and the focus of the attack is on leads V1 to V3, which are sensitive to ST segment changes.
[0194] In the defense training strategy, each batch contains 50% clean samples and 50% adversarial samples, and the labels of the adversarial samples remain the original values. A gradient penalty loss is set with the hyperparameter λ set to 10 and is calculated only on the adversarial samples.
[0195] Stability monitoring was performed by randomly marking one to three leads during the lead-loss test to check for prediction fluctuations. The tolerance for fluctuation was set to a decrease in the AUROC below 0.05. For temporal consistency checks, predictions for adjacent 10-minute segments of the same patient should differ by less than 15%.
[0196] In the fine-tuning parameters, the learning rate is set to 1e-6 to stabilize the model with an extremely low learning rate. The number of training rounds is set to 15 rounds. In the regularization reinforcement, the weight decay is set to 0.1, and the probability of all Dropout layers is increased by 0.1.
[0197] In one embodiment, Figure 8 As shown, when correcting the abnormal detection results, a correction rule base pre-established based on clinical information and clinical knowledge graph can be determined; the correction rule base includes multiple correction rules, and the correction rules include trigger conditions, correction actions, and corresponding weights.
[0198] Among them, the clinical knowledge graph can be established through corresponding medical dictionaries, expert experience, medical journals, etc. The connection process can be to collect corresponding data from the above sources, then input it into the big model, and output the clinical knowledge graph through the big model.
[0199] The clinical knowledge graph stores nodes and edges. Nodes represent different knowledge, for example, clinical information of various dimensions, electrocardiogram information, etc. Edges represent the influence relationship between nodes.
[0200] The correction rule base selects nodes and edges related to ECG signals from the clinical knowledge graph, and further combines expert experience and large models to form corresponding correction rules. For example, if the clinical knowledge graph reveals the following knowledge: people over 65 are predicted to be at high risk for atrial fibrillation; digoxin use may lead to false positive ST segment abnormalities, etc., then the trigger conditions can include: age over 65, the probability of atrial fibrillation being positive in the current abnormality judgment result, and the patient's use of beta blockers, and the abnormality judgment result shows a widened QRS complex.
[0201] At the same time, corresponding correction actions are set. These correction actions may include: changing the abnormality judgment threshold, modifying the abnormality judgment probability, adding or reducing abnormality judgment conditions, etc. For example, for "elderly people over 65 years old are predicted to be at high risk for atrial fibrillation", the correction action may be: lowering the atrial fibrillation positive judgment threshold by 20%; for "digoxin use may lead to false positive ST segment abnormalities", the correction action may be: adding the judgment condition of HR less than 50 for ventricular tachycardia judgment.
[0202] The corresponding weight can be determined based on the evidence level of the knowledge. The evidence level is mainly divided into five levels, from high to low: Level I, Level II, Level III, Level IV and Level V. The higher the level, the higher the reliability of the knowledge. The way to judge the reliability can be based on expert experience, large model judgment, probability distribution judgment in historical records, etc., or a combination of multiple methods. The higher the evidence level, the more reliable the correction rule. For example, based on comprehensive judgment, the corresponding weight of "elderly people over 65 years old are predicted to be at high risk for atrial fibrillation" is set to 0.9, and the corresponding weight of "digoxin use may lead to false positive ST segment abnormalities" is set to 0.7.
[0203] Based on this, each rule is assigned a corresponding ID, resulting in a correction rule consisting of the rule ID, trigger condition, correction action, and corresponding weight. For example, based on the knowledge that "people over 65 are predicted to be at high risk for atrial fibrillation," a correction rule with the rule ID R001 is generated. In this correction rule, the trigger condition is: age over 65, and the probability of atrial fibrillation in the current abnormal judgment result increases; the correction action is to lower the atrial fibrillation judgment threshold by 20%, corresponding to a weight of 0.9.
[0204] In addition, clinical knowledge graphs and correction rule bases can be updated regularly to adapt to the latest research and developments in medicine.
[0205] Obtain the patient's corresponding clinical information, generate corresponding structured features based on the dimensional information in the clinical information, and generate the patient's corresponding risk index based on the structured features.
[0206] Clinical information includes multiple dimensions of information, such as age, gender, medical history, medications taken, etc. Here, each dimension of information is quantified and encoded, and then converted into a corresponding label vector to generate corresponding structured features for subsequent analysis.
[0207] Among them, the types of quantitative coding can include continuous data binning, categorical data coding, and feature engineering quantization. Continuous data binning corresponds to dimensions that can be directly quantified. For example, for the age dimension, it is segmented into segments, 20 to 30 years old is youth, 31 to 50 years old is middle-aged, and 51 years old and above is elderly. Categorical data coding corresponds to dimensions that are difficult to quantify directly. For example, for the gender dimension, males are classified and coded as 1, and females are classified and coded as 0. Feature engineering quantification converts abstract features into computable indicators. For example, for medical history, medication, etc., corresponding levels are set according to the degree of impact of each medical history and medication on the electrocardiogram, thereby performing corresponding quantification.
[0208] The risk index can be set using pre-set rules, with several conditions pre-set and weights assigned to each condition. The weighted sum is then calculated based on the conditions the patient meets. For example, a weighted sum can be calculated based on age (+1 point per 10 years), diabetes (+2 points), coronary heart disease (+1.5 points), etc.
[0209] Based on the structured features, anomaly detection results, and the trigger conditions in the correction rules, the matching correction rule is determined, along with the corresponding designated dimension information and anomaly detection results. For ease of description, if a dimension matches the trigger conditions of a correction rule, the dimension and correction rule are referred to as the designated dimension information and the designated correction rule, and the corresponding anomaly detection result in the designated correction rule is referred to as the designated anomaly detection result.
[0210] Based on historical clinical information, the likelihood ratio corresponding to the specified dimension information is determined, and the initial abnormal probability of the specified abnormal detection result is corrected according to the likelihood ratio through the Bayesian formula to obtain the corrected abnormal probability.
[0211] The likelihood ratio (LR) is a composite indicator that reflects both sensitivity and specificity and is used to assess the authenticity of a diagnostic test. In this application, it is primarily used to verify the authenticity of trigger conditions. For example, for patients over 65 years old, based on historical clinical data from the hospital, the frequency ratio of their occurrence in the abnormal group to the normal group is calculated. Assuming that the probability of elderly patients in the positive group for atrial fibrillation is 2.3 times that in the negative group, the likelihood ratio (LR) is 2.3.
[0212] Bayesian formulas can include: ,in, To correct the abnormal probability, is the initial abnormal probability, is the total likelihood ratio, obtained by multiplying the likelihood ratios of all specified correction conditions in the hit.
[0213] In this way, the abnormal probability output by the deep learning model can be personalized and corrected based on the patient's clinical information. For example, suppose the patient meets the trigger conditions of the following two correction rules at the same time: the patient is older than 65 years old, and the probability of atrial fibrillation in the current abnormal judgment result is determined; the patient uses beta blockers, and the QRS wave is widened in the abnormal judgment result. And the corresponding likelihood ratios LR are calculated to be 2.3 and 0.8 respectively, then the total likelihood ratio can be calculated. =2.3*0.8=1.84. Assuming that the deep learning model outputs an initial abnormal probability of 72% for this patient's positive atrial fibrillation, the corrected abnormal probability = (0.72*1.84) / (1+0.72*(1.84-1)) =81.3%.
[0214] At the same time, the confidence threshold corresponding to the specified anomaly detection result is adjusted based on the risk index, and the anomaly detection result is corrected based on the corrected anomaly probability and the adjusted confidence threshold. The confidence threshold refers to the confidence threshold at which an anomaly is considered to exist when the anomaly probability determined by the deep learning model is higher than the confidence threshold.
[0215] For high-risk patients, their characteristics usually include multiple underlying diseases, frequent use of corresponding medications, poor physiological reserves, etc., and there is a greater probability of false positives. Therefore, a higher confidence threshold can be set for them to improve specificity.
[0216] The confidence threshold adjustment formula is set as: ;in, is the adjusted confidence threshold, is the confidence threshold before adjustment, is the risk index. Assuming this patient's age and hypertension result in a calculated risk index of 6.8, and assuming the original confidence threshold is 0.5, the adjusted confidence threshold is 0.5 * (1 + 0.05 * 6.8) = 0.67. Since the adjusted abnormal probability calculated above is 81.3%, which is higher than the adjusted confidence threshold of 0.67, the patient can be judged as abnormal and positive for atrial fibrillation.
[0217] Furthermore, after obtaining the anomaly detection results, the predicted anomaly probability in the time series prediction results can also be determined. This predicted anomaly probability is usually the predicted anomaly probability for a certain period of time in the future. The highest point or average value within a period of time can be used as the predicted anomaly probability.
[0218] If the predicted abnormality probability matches the abnormality detection result, the revised abnormality detection result is output. For example, if the predicted abnormality probability is 80%, which is higher than the adjusted confidence threshold of 0.67, and meets the revised abnormality probability for a positive diagnosis of atrial fibrillation, the judgment remains unchanged.
[0219] If the predicted abnormal probability does not match the abnormality detection result, the difference between the predicted abnormal probability and the adjusted abnormal probability is determined. For example, if the predicted abnormal probability is 65%, which is lower than the adjusted confidence threshold of 0.67 and does not meet the judgment of atrial fibrillation positive, the difference between the predicted abnormal probability and the adjusted abnormal probability is calculated to be 16.3%.
[0220] If the difference is lower than the preset difference, the predicted abnormal probability and the corrected abnormal probability are weighted and summed to obtain the final abnormal probability. The abnormality detection result is then corrected based on the final abnormal probability and the adjusted confidence threshold. For example, if the preset difference is set to 30%, and the difference is 16.3%, which is lower than the preset difference, the two are weighted, with the corrected abnormal probability weighted at 0.7 and the predicted abnormal probability weighted at 0.3. The final abnormality probability is calculated as 0.7 * 81.3% + 0.3 * 65% = 76.41%. This final abnormality probability is still higher than the adjusted confidence threshold of 0.67, so the final abnormality detection result is still positive for atrial fibrillation.
[0221] If the difference is higher than the preset difference, it is considered that the difference is large, and a manual review alarm is triggered, forcing manual review and additional inspection to prevent missed diagnosis and misdiagnosis.
[0222] In one embodiment, when outputting the analysis results corresponding to the patient's electrocardiogram, in order to protect the user's privacy, other dimensional information except the specified dimensional information in each dimensional information of the clinical information can be determined, and the other dimensional information can be encrypted to obtain encrypted dimensional information.
[0223] According to the encrypted dimension information, the specified dimension information, and the corrected abnormality detection result, the analysis result corresponding to the electrocardiogram is output.
[0224] The encryption method may adopt a symmetric encryption algorithm, such as the Data Encryption Standard (DES) algorithm, which can be encrypted and decrypted using a secret key.
[0225] The designated dimension information is not encrypted so that if manual review by a doctor is still required, a quick review can be performed using the designated dimension information.
[0226] Of course, encryption can be selectively performed based on the output target. For example, if the output target is the patient's attending physician, encryption is not required. If it is someone else, encryption is required to protect the patient's privacy. If others have the corresponding permissions and the key, they can also decrypt the encrypted dimension information to obtain the corresponding information.
[0227] like Figure 9 As shown, the embodiment of the present application also provides an electrocardiogram analysis device based on a deep learning model, including:
[0228] at least one processor; and,
[0229] a memory communicatively connected to the at least one processor; wherein,
[0230] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: the electrocardiogram analysis method based on the deep learning model described in any of the above embodiments.
[0231] An embodiment of the present application also provides a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as: the electrocardiogram analysis method based on the deep learning model described in any of the above embodiments.
[0232] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device and medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant portions, refer to the descriptions of the method embodiments.
[0233] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects to their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0234] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. An electrocardiogram analysis method based on a deep learning model, characterized in that: include: Obtaining an electrocardiogram corresponding to the patient, and preprocessing the electrocardiogram to suppress noise to obtain an electrocardiogram signal; Inputting the ECG signal into a pre-trained deep learning model, extracting temporal features and spatial features corresponding to the ECG signal through the deep learning model, and performing cross-modal feature fusion; Based on the fusion features, multiple anomaly detection tasks and time series prediction tasks are executed simultaneously to obtain the corresponding anomaly detection results and time series prediction results respectively; Acquire clinical information corresponding to the patient, and modify the abnormal detection result according to the clinical information and the time series prediction result; Outputting the analysis result corresponding to the electrocardiogram according to the corrected abnormality detection result; The model architecture of the deep learning model includes: an input layer, a spatiotemporal joint encoder, a feature pyramid, and an output layer; the spatiotemporal joint encoder includes a time channel branch, a spatial channel branch, and a cross-modal attention fusion layer; the output layer includes multiple anomaly classification heads and a single time series prediction head; The training process of the deep learning model includes: training the spatiotemporal joint encoder, the anomaly classification head, and the time series prediction head in stages; In the first stage, the spatiotemporal joint encoder is trained using a symmetric encoder-decoder structure and adversarial masking training by randomly masking segments of the ECG signal. In the second stage, the anomaly classification head is trained. During the training process, the parameters of the spatiotemporal joint encoder are frozen, and anomaly judgment training is performed by gradually unfreezing the feature pyramid and setting dynamic sample weights. The third stage is to train the time series prediction head. During the training process, the time series is decoupled and trained, and uncertainty calibration is introduced to train the prediction ability. The fourth stage is to perform adversarial adjustments on the deep learning model. During the training process, adversarial samples are generated, defense strategies are set, and dynamic stability evaluation is performed. The model parameters of the deep learning model are fine-tuned based on the evaluation results. The second stage and the third stage perform a double-stage cycle training.
2. The electrocardiogram analysis method based on the deep learning model according to claim 1, characterized in that Preprocessing the electrocardiogram to suppress noise and obtain an electrocardiogram signal specifically includes: Performing a fast Fourier transform on the electrocardiogram to extract corresponding spectral features, and performing noise type detection based on the state of the corresponding frequency in the spectral features; and extracting morphological features based on the electrocardiogram, and performing noise type detection based on the morphological features; Based on the identified noise type, the corresponding preprocessing method is used to suppress the noise and obtain the ECG signal.
3. The electrocardiogram analysis method based on the deep learning model according to claim 2, characterized in that: Based on the identified noise type, the corresponding preprocessing method is used to suppress the noise and obtain the ECG signal, including: For baseline drift, fluctuations are eliminated by dynamically fitting the signal trend line; and / or, for power frequency interference, phase distortion is eliminated by zero-phase filtering; and / or, for electromyographic interference, high-frequency noise is separated by wavelet transform; and / or, for electrode contact interference, impaired signals are reconstructed by temporal and spatial correlation between leads; According to the preset quality evaluation index, it is determined that the ECG signal after noise suppression meets the quality requirements.
4. The electrocardiogram analysis method based on a deep learning model according to claim 1, characterized in that The input layer is used to input the electrocardiogram signal; The time channel branch includes a bidirectional LSTM structure to extract time features; The spatial channel branch includes a 3D-CNN structure to extract spatial features; The cross-modal attention fusion layer fuses the temporal features and the spatial features through a cross-modal attention mechanism to obtain a fused feature; The feature pyramid includes a one-dimensional convolution layer, a batch normalization layer, and an activation function layer; The multiple anomaly classification heads are independent branches, each outputting a corresponding anomaly detection result; The time series prediction head includes a causal convolution layer and a self-attention layer, and outputs the time series prediction results.
5. The electrocardiogram analysis method based on a deep learning model according to claim 1, characterized in that: Acquiring clinical information corresponding to the patient, and correcting the abnormal detection result based on the clinical information and the time series prediction result, specifically including: A correction rule library pre-established based on a clinical knowledge graph; the correction rule library includes multiple correction rules, each of which includes a trigger condition, a correction action, and a corresponding weight; Acquire clinical information corresponding to the patient, generate corresponding structured features based on information of each dimension in the clinical information, and generate a risk index corresponding to the patient based on the structured features; Determine the hit designated correction rule based on the structured feature, the anomaly detection result, and the trigger condition in the correction rule, and determine the designated dimension information and the designated anomaly detection result corresponding to the designated correction rule; Determine, based on historical clinical information, a likelihood ratio corresponding to the specified dimension information, and, using a Bayesian formula, correct the initial abnormal probability of the specified abnormal detection result based on the likelihood ratio to obtain a corrected abnormal probability; According to the risk index, the confidence threshold corresponding to the specified anomaly detection result is adjusted, and according to the corrected anomaly probability and the adjusted confidence threshold, the anomaly detection result is corrected.
6. The electrocardiogram analysis method based on a deep learning model according to claim 5, characterized in that: The method further includes: Determining a prediction anomaly probability in the time series prediction result; If the predicted abnormality probability is consistent with the abnormality detection result, outputting a corrected abnormality detection result; If the predicted abnormality probability does not match the abnormality detection result, determining the difference between the predicted abnormality probability and the corrected abnormality probability; If the difference is lower than the preset difference, the predicted abnormal probability and the corrected abnormal probability are weighted and summed to obtain a final abnormal probability, and the abnormal detection result is corrected according to the final abnormal probability and the adjusted confidence threshold; If the difference is higher than the preset difference, a manual review alarm is performed.
7. The electrocardiogram analysis method based on a deep learning model according to claim 5, characterized in that: Outputting the analysis results corresponding to the electrocardiogram according to the corrected abnormality detection results, specifically including: Determining other dimensional information, except the designated dimensional information, in each dimensional information of the clinical information; Encrypting the other dimensional information to obtain encrypted dimensional information; According to the encrypted dimension information, the designated dimension information, and the corrected abnormality detection result, the analysis result corresponding to the electrocardiogram is output.
8. An electrocardiogram analysis device based on a deep learning model, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: the electrocardiogram analysis method based on the deep learning model as described in any one of claims 1 to 7.
9. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are set to: the electrocardiogram analysis method based on the deep learning model according to any one of claims 1 to 7.
Citation Information
Patent Citations
Arrhythmia classification algorithm of C-LSTM for physiological parameter monitoring
CN113397555A
Multi-modal fusion algorithm for electrocardiosignal anomaly detection
CN118520279A