Dynamic parameter feature extraction and heartbeat anomaly classification method based on neural network
By employing SVM-based dynamic parameter feature extraction and multi-layer fully connected neural network methods, the accuracy and adaptability issues of electrocardiogram signals under noise interference were resolved, enabling efficient automated classification and real-time monitoring of cardiac abnormalities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-04-14
AI Technical Summary
Existing ECG signal monitoring methods are easily affected by various noise sources such as baseline drift, electromyography interference, power frequency noise, and motion artifacts in long-term dynamic monitoring and daily life scenarios, resulting in a decrease in signal-to-noise ratio, difficulty in adapting to drastic heart rate fluctuations and arrhythmias, and lack of real-time automated classification and intelligent early warning capabilities.
A dynamic parameter feature extraction method based on SVM is adopted, combined with a multi-layer fully connected neural network. Noise is removed by Butterworth low-pass filtering, IIR notch filtering and wavelet decomposition. The comprehensive decision value is dynamically calculated to extract QRS feature values, and a multi-dimensional dynamic feature input neural network is constructed for heartbeat abnormality classification.
It improves the accuracy of ECG signal prediction and judgment, enhances adaptability to heart rate fluctuations, reduces R wave missed detection and false detection rates, and improves the robustness and reliability of detection. It is suitable for long-term dynamic real-time monitoring of portable and wearable devices.
Smart Images

Figure CN121845598A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent medical and health monitoring technology, and relates to a method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks. Background Technology
[0002] Electrocardiography (ECG), as a direct physiological signal reflecting cardiac electrical activity, is an important tool for clinical diagnosis, long-term monitoring, and early warning. In recent years, the rapid development of portable and wearable monitoring devices has led to higher public demands for ECG monitoring that is "real-time, low-power, highly accurate, and user-friendly." However, in practical applications, especially in long-term dynamic monitoring and everyday life scenarios, ECG signals are often affected by various noise sources such as baseline drift, electromyography (EMG) interference, power line noise, and motion artifacts, resulting in a significant decrease in the signal-to-noise ratio and posing challenges to reliable feature detection and disease early warning.
[0003] Currently, most classic methods widely used in clinical and engineering fields are based on time-domain features and threshold detection. Traditional QRS detection methods, represented by the Pan-Tompkins algorithm, are widely embedded in devices and clinical systems due to their clear principles, low computational cost, and mature implementation. These methods typically achieve QRS complex and R-wave localization through preprocessing filtering, differentiation, squaring, and moving integral steps, thereby calculating basic parameters such as heart rate, RR interval, and QT interval. However, this type of detection strategy based on fixed filters and fixed thresholds has several limitations: First, it has poor adaptability to dynamic changes such as drastic heart rate fluctuations, ectopic rhythms, or arrhythmias, easily leading to missed or false detections; second, a single time-domain indicator cannot fully characterize the nonlinear and non-stationary characteristics of ECG signals and individual physiological differences, limiting the ability to identify complex pathological changes; third, many existing systems still rely on manual interpretation or simple threshold alarms, lacking real-time automated classification and intelligent early warning capabilities for multiple disease categories.
[0004] Therefore, in the face of wearable real-time monitoring application scenarios and the practical needs of multi-source noise interference, there is an urgent need to propose a comprehensive method that combines signal processing and intelligent algorithms. This method utilizes machine learning or deep learning models to achieve multi-dimensional feature extraction and dynamic classification of electrocardiogram signals, thereby improving the accuracy of disease identification and the system's adaptive capabilities, and providing technical support for personalized medicine and proactive health management. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a dynamic parameter feature extraction and heartbeat abnormality classification method based on SVM, which can effectively improve the accuracy of prediction and judgment while maintaining the good feature extraction performance of traditional electrocardiogram signal feature extraction algorithms, and provide a reference for medical testing.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A method for dynamic parameter feature extraction and heartbeat abnormality classification based on SVM includes the following steps: S1: Input ECG signal data and preprocess it using software (Matlab) to obtain clean data; S2: Dynamically calculate the comprehensive decision value for clean data, and extract the QRS feature value for each heartbeat based on the comprehensive decision value; S3: Calculate the dynamic characteristics of each heartbeat based on the QRS eigenvalues. 、 、 、 、 、 、 、 、 ), and standardize dynamic features; S4: Input the standardized dynamic features into a trained binary classification model based on a multilayer fully connected neural network (FCNN) to obtain the prediction result for each heartbeat.
[0007] Furthermore, in step S1, the electrocardiogram signal is processed in software (Matlab) to obtain clean data, specifically including the following steps: S11: Preprocessing of the ECG signal requires prioritizing the reduction of EMG interference. A Butterworth-type low-pass filter is used to filter components outside the target frequency band of the ECG signal, i.e., to filter the EMG signal. The cutoff angular frequencies of the passband and stopband are pre-defined based on the signal characteristics. and The passband and stopband attenuation indices are respectively and The filter order is determined by a function. :
[0008] Obtaining the zeros of the normalized Butterworth analog filter ,pole and gain Furthermore, based on the target cutoff frequency, a low-pass filter that meets the requirements is obtained:
[0009] in, Represents the response function. The number of zeros The number of poles For input; Finally, the analog filter is converted into a digital filter using a bilinear transform:
[0010] in, Represents the response function. To represent a complex variable, Indicates the sampling period, if the sampling frequency is ,but 。; The output of the input ECG signal after digital filtering is:
[0011] in, Represents the response sequence. Forward coefficients, For feedback coefficients, and These are the feedforward and feedback coefficients, respectively. This represents the electrocardiogram signal, where S is the number of sample points. S12: After suppressing interfering components in the electromyography (EMG) signal, further filtering of the power frequency component is required. The EMG signal is then filtered to remove the power frequency signal, with a designed center frequency of [missing information]. Quality factor is The IIR notch filter, whose center angular frequency is normalized by the sampling rate is corresponding bandwidth The system transfer function is constructed as follows:
[0012] in, This is the stopband cutoff frequency; This filter can effectively filter out 50 / 60Hz power frequency interference.
[0013] S13: Finally, the electrocardiogram signal, from which electromyography and power frequency signals have been filtered out, is decomposed using wavelet decomposition to remove baseline drift.
[0014] Furthermore, in step S13, wavelet decomposition is used to remove baseline drift, specifically including: decomposing the signal into... L Layer, calculate wavelet coefficients:
[0015] in, Represents the scaling factor. For Daubechies wavelet basis functions, L Indicates the number of wavelet functions; Using the reconstruction results of the low-frequency components, the baseline drift component in the signal is extracted:
[0016] in, Indicates the baseline. Represents the scaling function. Indicates the translation (displacement) index; Finally, the corrected electrocardiogram signal was obtained:
[0017] in, This indicates clean data.
[0018] Furthermore, step S2 specifically includes the following steps: S21: Assume the denoised single-lead ECG signal is a discrete sequence. The sampling frequency is .
[0019] For each sampling point Construct four scoring components: amplitude scoring Slope scoring Acceleration score Time score The comprehensive judgment amount is defined as:
[0020] S22: When a certain point satisfies At that point, it is considered that the point is highly likely to correspond to the peak value of the R wave, thus completing the first round of R wave candidate detection.
[0021] S23: At the sampling point where the candidate R wave is located Subsequently, in its neighboring region A local traversal search is performed within the range, and the sampling point with the largest amplitude is selected as the final R-wave position, denoted as . Subscript Indicates the first Heartbeats.
[0022] S24: At the finally determined R-wave peak position, the Q-wave initiation and S-wave termination are determined by local extrema and slope, as follows: Define a first-order difference sequence Around the first Secondary R wave position ,by s is used as the search window to determine the Q wave initiation and S wave termination.
[0023] In the interval Within this context, let the sampling points corresponding to the local maximum value before the Q wave and the Q wave trough be respectively... The corresponding slope is defined as
[0024] Then the Q wave origin It is given by the following formula, where To find the index corresponding to the minimum value:
[0025] In the interval Let the local maximum value before the S-wave trough and the sampling point corresponding to the S-wave trough be respectively... The corresponding slope is:
[0026] Then the S-wave endpoint Defined as, where To find the index corresponding to the minimum value:
[0027] Furthermore, in step S21, in order to construct Four reference thresholds that can be updated over time are introduced: Amplitude Reference Take the average of the "maximum amplitude" of each heartbeat waveform within the last 10 seconds. times; Slope Reference Take the average of the "maximum slope" of each heartbeat waveform within the last 10 seconds. times; Acceleration Reference Take the average of the "maximum acceleration" of each heartbeat waveform within the last 10 seconds. times; Time reference Take the average of the most recent 5 RR intervals times; The magnitude is scored. for:
[0028] Let the first-order difference be... If the instantaneous slope is approximated, then the slope is scored. for:
[0029] Redefining the second-order difference
[0030] Considered as "acceleration", it is scored as follows: :
[0031] Time scoring needs to consider the interval between the current sampling point and the previous heartbeat. Let's denote the time from the previous R-wave to the sampling point. The time is
[0032] Time score
[0033]
[0034] For the first For each confirmed heartbeat, the following statistics are extracted within its QRS interval: The maximum amplitude of this heartbeat: ; Maximum slope of this heartbeat: ; The maximum acceleration of this heartbeat: ; The current RR interval (time interval between adjacent R peaks): .
[0035] The threshold is updated using an exponential smoothing method:
[0036] Furthermore, step S3 specifically includes: calculating the following dynamic features in each heartbeat. QRS interval The above calculations are used for subsequent neural network classification. Let the sampling period be...
[0037] Calculate dynamic features This feature is the QRS duration of one heartbeat:
[0038] Definition of the first The RR interval of one heartbeat is
[0039] before Based on the number of heartbeats, the average RR interval
[0040] Calculate dynamic features This characteristic is the relative deviation of the RR interval:
[0041] With the most recent Calculate the mean of the RR intervals:
[0042] Calculate dynamic features This characteristic is the variance of the RR interval:
[0043] Let the first The peak amplitude of the R wave is
[0044] The average amplitude of the most recent six R peaks is
[0045] Calculate dynamic features This characteristic is the relative deviation of the R peak:
[0046] Calculate dynamic features This characteristic is the variance of the R peak:
[0047] Define the difference between adjacent RR intervals
[0048] Take the nearest Each heartbeat calculates dynamic characteristics. This feature is the first RMSSD characteristics of the RR interval of the last heartbeat:
[0049] Let the denoised signal be . No. The start and end times of the QRS time window for each heartbeat are respectively Indexed by time Indicates the "energy" characteristic at the sampling time. Defined as:
[0050] In implementation, it is often transcribed into discrete sampling point index form: Let They are time points The corresponding sampling point number, then
[0051]
[0052] in, Indicates the first The sampling point number where the QRS window for each heartbeat begins. This indicates the sampling point number where the end of the same QRS window is located.
[0053] remember This is a dynamic characteristic, representing the "energy" of a single heartbeat:
[0054] Let the first During each heartbeat, the amplitude of the R peak is The amplitude of the S-wave trough of the same heartbeat is Introducing a very small constant To avoid the denominator being zero, the R / S ratio is defined as follows:
[0055] And recorded as Dynamic feature, which is the R / S amplitude ratio during a single heartbeat.
[0056] The time integral of the absolute value of the denoised ECG signal within the QRS interval is defined as the QRS area.
[0057] Represented in discrete form, denoted as
[0058] in This is the sampling time interval (the time difference between two adjacent sampling points).
[0059] remember This feature is the time integral of the absolute value of the denoised ECG signal within the QRS interval during a single heartbeat.
[0060] In summary, this method uses a comprehensive decision-making approach. R-wave detection and Q / S localization were completed, and multiple thresholds were updated in real time using an exponential smoothing strategy; based on this, a model was constructed for each heartbeat.
[0061] A set of dynamic parameter features (QRS duration, RR interval statistics, R peak statistics, RMSSD, QRS energy, R / S amplitude ratio, and QRS area, etc.) are input into the subsequent neural network model to achieve automatic classification of heart rhythm abnormalities.
[0062] Further step S4 specifically includes the following steps: S41: Assuming there is an existing dataset ,in, for 3D feature vectors These are category labels, where 0 represents a normal heartbeat and 1 represents an abnormal heartbeat. S The number of sample points; S42: Design a multi-layer fully connected neural network with the following structure:
[0063] in, This represents the output after the first-level linear transformation and ReLU nonlinearity; Indicates in The output is obtained by applying a second layer of linear and ReLU operations, followed by Dropout. Indicates in The output is obtained by applying a third layer of linear and ReLU, followed by Dropout. This means mapping the input features from 9 dimensions to 64-dimensional hidden units. This means mapping the first layer of hidden states from 64 dimensions to 32 dimensions. This means mapping the second-level hidden state from 32 dimensions to 16 dimensions. This means mapping the third hidden state from 16 dimensions to a 2-dimensional output (corresponding to scores for 2 categories). , , , Do not represent the intercept of each layer. This is the unnormalized class score (logits) vector obtained from the linear transformation of the output layer. It has a dimension of 2 and corresponds to the scores of the two classes. The feature vector (features of a single heartbeat) is input into the neural network.
[0064] The final result passes through the output layer. SoftMax The function mapping to class probabilities is expressed mathematically as follows:
[0065] in, Represented as the predicted probability vector after SoftMax normalization, its i-th Each component This indicates that the sample was judged as the first The probability of a class satisfies , and Representing vectors The two components represent the unnormalized score / log odds for the corresponding two classes, respectively. It is represented as the unnormalized class score (logits) vector obtained by the linear transformation of the output layer.
[0066] In the Dropout layer, with probability Randomly discard a portion of the neuron's output, as shown in the following formula:
[0067] in, This is represented as a sparse activation vector after Dropout, where some components are set to zero for subsequent calculations; This is represented as a sparse activation vector after Dropout, where some components are set to zero for subsequent calculations; Represented as with Random mask vectors of the same dimension, each dimension independently following Bernoulli The distribution is represented by a component of 1, where a component of 1 indicates that the neuron is retained in the current training iteration; and a component of 0 indicates that the neuron is discarded in the current training iteration. Represented as the Hadamard product (element-by-element multiplication) operator, i.e. .
[0068] S43: The model uses the cross-entropy loss function as the optimization objective to measure the difference between the predicted distribution and the true label distribution, which is defined as:
[0069] in, Indicates sample Predicted as category The probability, For indicator functions, , where are the model parameters to be learned; S44: The model uses the Adam adaptive optimization algorithm for parameter updates, and the update rule is as follows:
[0070] in, For the first The exponentially weighted moving average of the first moment (mean) of the gradient at each iteration can be regarded as the momentum term; To The first-order moment estimate obtained after bias correction; For the first The exponentially weighted moving average of the second moment (squared) of the gradient at each iteration is used to characterize the magnitude of the gradient variance. For the first The model parameter vector at the next iteration Let be the exponential decay coefficient hyperparameters of the first and second moments, respectively. For the current gradient, t This represents the number of iterations.
[0071] S45: Set the maximum number of iterations and batch size during training, and perform performance monitoring on the validation set after each iteration to prevent overfitting.
[0072] The beneficial effects of this invention are as follows: This invention improves upon traditional differential thresholding and dynamic thresholding methods by employing dynamic parameter adaptation, multiple threshold determination, and a local traversal search strategy, thereby enhancing feature extraction capabilities under heart rate fluctuation conditions. This strategy can improve the stability and accuracy of R-wave localization, avoid peak shifts or misidentifications caused by non-pathological heart rate acceleration, effectively reduce false negative and false positive rates, and improve the overall robustness and reliability of the detection. Specifically, this is reflected in the following: 1) This invention abandons the traditional fixed threshold detection method and innovatively proposes a differential comprehensive decision method based on dynamic parameters. By fusing features from four dimensions—slope, amplitude, acceleration, and time interval—and combining historical data from the previous 10 seconds for real-time dynamic adjustment, the algorithm can adaptively adapt to drastic fluctuations in the subject's heart rate (such as tachycardia or bradycardia). Furthermore, by performing a ±40ms traversal search at the initial localization point, it effectively solves the problem of peak shift caused by non-pathological heart rate acceleration or signal jitter, significantly reducing the false negative and false positive rates of the R wave.
[0073] 2) This invention does not rely solely on a single heart rate value, but extracts a variety of dynamic features. These features encompass time-domain statistics, morphological features, and nonlinear changes, enabling a more comprehensive and nuanced capture of subtle abnormalities in cardiac electrophysiological activity, providing high-quality input data for subsequent cardiac disease identification.
[0074] 3) This invention designs a binary classification model based on a multilayer fully connected neural network (FCNN), combined with Dropout regularization and the Adam adaptive optimization algorithm, effectively preventing overfitting and enhancing the model's generalization ability. By learning from the extracted standardized dynamic features, the model can automatically and quickly identify abnormal heartbeats. Experimental data show that this method performs excellently in terms of accuracy, F1 score, and AUC, outperforming traditional single-threshold judgment methods, and can assist doctors in making more efficient diagnoses.
[0075] 4) This invention constructs a full-link preprocessing scheme that includes Butterworth low-pass filtering (for EMG removal), IIR notch filtering (for power frequency interference removal), and wavelet decomposition (for baseline drift removal). This scheme can effectively filter out environmental noise and artifacts caused by human movement, ensuring that subsequent feature extraction steps are based on high-quality "clean data," thereby guaranteeing the stability of the overall system.
[0076] 5) The algorithm of this invention has a compact design, the feature extraction algorithm has a moderate computational load, and the neural network model is designed to be adaptable to lightweight deployment. This makes the method not only suitable for professional hospital equipment, but also highly suitable for deployment in portable ECG acquisition devices or wearable devices, enabling long-term, dynamic, real-time monitoring of the subject's cardiac health status.
[0077] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0078] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein: Figure 1 This is a flowchart of the method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to the present invention; Figure 2 For MIT-BIH sample number 100, 1 min Schematic diagram of ECG signal data and data after removing electromyography signals; Figure 3 For MIT-BIH sample number 100, 1 min Schematic diagram of ECG data after baseline drift removal; Figure 4 For MIT-BIH sample number 100, 1 min A schematic diagram of ECG data after removing the power frequency signal; Figure 5 For MIT-BIH sample number 100, 1 min Spectrum image after ECG processing; Figure 6 For MIT-BIH sample number 100, 1 min ECG amplitude-frequency response of notch filter when processing 60Hz power frequency signal; Figure 7 For MIT-BIH sample number 100, 1 min Schematic diagram of ECG feature extraction; Figure 8 The ROC curve is obtained by training a neural network classifier using a wide neural network. Figure 9 The confusion matrix diagram obtained by training a neural network classifier using a wide neural network; Figure 10 This is a comparison of different algorithms. Detailed Implementation
[0079] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0080] Please see Figures 1-10 This invention provides a method for dynamic parameter feature extraction and heartbeat abnormality classification based on SVM, specifically including the following steps: S1: Input ECG signal data and then process the obtained data using Matlab to obtain clean data. Specifically, this includes the following steps: S11: Preprocessing of the ECG signal requires prioritizing the reduction of EMG interference. A Butterworth-type low-pass filter is used to filter components outside the target frequency band of the ECG signal, i.e., to filter the EMG signal. The cutoff angular frequencies of the passband and stopband are pre-defined based on the signal characteristics. and The passband and stopband attenuation indices are respectively and The filter order is determined by a function. :
[0081] in, , , The passband cutoff frequency, This is the stopband cutoff frequency.
[0082] Obtaining the zeros of the normalized Butterworth analog filter ,pole and gain Furthermore, based on the target cutoff frequency, a low-pass filter that meets the requirements is obtained:
[0083] in, Represents the response function. The number of zeros The number of poles For input; Finally, the analog filter is converted into a digital filter using a bilinear transform:
[0084] in, Represents the response function. To represent a complex variable, Indicates the sampling period, if the sampling frequency is ,but .
[0085] The output of the input ECG signal after digital filtering is:
[0086] in, Represents the response sequence. Forward coefficients, For feedback coefficients, and These are the feedforward and feedback coefficients, respectively. Indicates electrocardiogram (ECG) signal. S The number of sample points; S12: After suppressing interfering components in the electromyography (EMG) signal, further filtering of the power frequency component is required. The EMG signal is then filtered to remove the power frequency signal, with a designed center frequency of [missing information]. Quality factor is The IIR notch filter, whose center angular frequency is normalized by the sampling rate is corresponding bandwidth The system transfer function is constructed as follows:
[0087] in, This is the stopband cutoff frequency; This filter can effectively filter out 50 / 60Hz power frequency interference.
[0088] S13: Finally, the electrocardiogram signal, from which electromyography and power frequency signals have been filtered out, is decomposed using wavelet decomposition to remove baseline drift.
[0089] Decompose the signal into L Layer, calculate wavelet coefficients:
[0090] in, Represents the scaling factor. For Daubechies wavelet basis functions, L Indicates the number of wavelet functions; Using the reconstruction results of the low-frequency components, the baseline drift component in the signal is extracted:
[0091] in, Indicates the baseline. Represents the scaling function. Indicates the translation (displacement) index; Finally, the corrected electrocardiogram signal was obtained:
[0092] in, This indicates clean data.
[0093] In this scheme, signal processing completes multi-level processing of electromyographic interference, power frequency noise and baseline drift, so that the input data reaches a stable state that can be used for subsequent feature extraction and anomaly detection.
[0094] S2: Dynamically calculate the comprehensive decision value for clean data, and then extract the QRS feature value for each heartbeat based on the comprehensive decision value. This includes the following steps: S21: Assume the denoised single-lead ECG signal is a discrete sequence. The sampling frequency is .
[0095] For each sampling point Construct four scoring components: amplitude scoring Slope scoring Acceleration score Time score The comprehensive judgment amount is defined as:
[0096] S22: When a certain point satisfies At that point, it is considered that the point is highly likely to correspond to the peak value of the R wave, thus completing the first round of R wave candidate detection.
[0097] S23: At the sampling point where the candidate R wave is located Subsequently, in its neighboring region A local traversal search is performed within the range, and the sampling point with the largest amplitude is selected as the final R-wave position, denoted as . Subscript Indicates the first Heartbeats.
[0098] S24: At the finally determined R-wave peak position, the Q-wave initiation and S-wave termination are determined by local extrema and slope, as follows: Define a first-order difference sequence Around the first Secondary R wave position ,by s is used as the search window to determine the Q wave initiation and S wave termination.
[0099] In the interval Within this context, let the sampling points corresponding to the local maximum value before the Q wave and the Q wave trough be respectively... The corresponding slope is defined as
[0100] Then the Q wave origin It is given by the following formula, where To find the index corresponding to the minimum value:
[0101] In the interval Let the local maximum value before the S-wave trough and the sampling point corresponding to the S-wave trough be respectively... The corresponding slope is:
[0102] Then the S-wave endpoint Defined as, where To find the index corresponding to the minimum value:
[0103] In step S21, for the construction Four reference thresholds that can be updated over time are introduced: Amplitude Reference Take the average of the "maximum amplitude" of each heartbeat waveform within the last 10 seconds. times; Slope Reference Take the average of the "maximum slope" of each heartbeat waveform within the last 10 seconds. times; Acceleration Reference Take the average of the "maximum acceleration" of each heartbeat waveform within the last 10 seconds. times; Time reference Take the average of the most recent 5 RR intervals times; The magnitude is scored. :
[0104] Let the first-order difference be... If the instantaneous slope is approximated, then the slope is scored. :
[0105] Redefining the second-order difference
[0106] Considered as "acceleration", it is scored as follows: :
[0107] Time scoring needs to consider the interval between the current sampling point and the previous heartbeat. Let's denote the time from the previous R-wave to the sampling point. The time is
[0108] Time score
[0109]
[0110] For the first For each confirmed heartbeat, the following statistics are extracted within its QRS interval: The maximum amplitude of this heartbeat: ; Maximum slope of this heartbeat: ; The maximum acceleration of this heartbeat: ; The current RR interval (time interval between adjacent R peaks): .
[0111] The threshold is updated using an exponential smoothing method:
[0112] S3: Calculate the dynamic features for each heartbeat based on the extracted QRS features. Specifically, this includes calculating the following dynamic features for each heartbeat. QRS interval The above calculations are used for subsequent neural network classification. Let the sampling period be...
[0113] Calculate dynamic features This feature is the QRS duration of one heartbeat:
[0114] Definition of the first The RR interval of one heartbeat is
[0115] before Based on the number of heartbeats, the average RR interval
[0116] Calculate dynamic features This characteristic is the relative deviation of the RR interval:
[0117] With the most recent Calculate the mean of the RR intervals:
[0118] Calculate dynamic features This characteristic is the variance of the RR interval:
[0119] Let the first The peak amplitude of the R wave is
[0120] The average amplitude of the most recent six R peaks is
[0121] Calculate dynamic features This characteristic is the relative deviation of the R peak:
[0122] Calculate dynamic features This characteristic is the variance of the R peak:
[0123] Define the difference between adjacent RR intervals
[0124] Take the nearest Each heartbeat calculates dynamic characteristics. This feature is the first RMSSD characteristics of the RR interval of the last heartbeat:
[0125] Let the denoised signal be . No. The start and end times of the QRS time window for each heartbeat are respectively Indexed by time Indicates the "energy" characteristic at the sampling time. Defined as:
[0126] In implementation, it is often transcribed into discrete sampling point index form: Let They are time points The corresponding sampling point number, then
[0127]
[0128] in, Indicates the first The sampling point number where the QRS window for each heartbeat begins. This indicates the sampling point number where the end of the same QRS window is located.
[0129] remember This is a dynamic characteristic, representing the "energy" of a single heartbeat:
[0130] Let the first During each heartbeat, the amplitude of the R peak is The amplitude of the S-wave trough of the same heartbeat is Introducing a very small constant To avoid the denominator being zero, the R / S ratio is defined as follows:
[0131] And recorded as Dynamic feature, which is the R / S amplitude ratio during a single heartbeat.
[0132] The time integral of the absolute value of the denoised ECG signal within the QRS interval is defined as the QRS area.
[0133] Represented in discrete form, denoted as
[0134] in, This is the sampling time interval (the time difference between two adjacent sampling points).
[0135] remember This feature is the time integral of the absolute value of the denoised ECG signal within the QRS interval during a single heartbeat.
[0136] In summary, this method uses a comprehensive decision-making approach. R-wave detection and Q / S localization were completed, and multiple thresholds were updated in real time using an exponential smoothing strategy; based on this, a model was constructed for each heartbeat.
[0137] A set of dynamic parameter features (QRS duration, RR interval statistics, R peak statistics, RMSSD, QRS energy, R / S amplitude ratio, and QRS area, etc.) are input into the subsequent neural network model to achieve automatic classification of heart rhythm abnormalities.
[0138] S4: Input the standardized dynamic features into a trained binary classification model based on a multilayer fully connected neural network (FCNN) to obtain the prediction results for each heartbeat.
[0139] The neural network model training data in this embodiment comes from the MIT-BIH Arrhythmia Database. This dataset collects 48.5-hour continuous ECG records from 47 subjects in the United States, recording various arrhythmias. Currently, this data is widely used in cardiac rhythm analysis research and the evaluation of arrhythmia detectors. This invention uses this data and common neural network training methods in Matlab to obtain a neural network model targeting the dynamic characteristics of ECG signals, thereby determining whether each heartbeat is normal.
[0140] To achieve effective classification of electrocardiogram (ECG) signal features, this invention constructs a binary classification model based on a fully connected neural network (FCNN). This model takes the extracted multidimensional ECG feature vectors as input, learns discriminative features for different categories through multi-layer nonlinear transformations, and finally outputs the probability that a sample belongs to either "normal" or "abnormal" class. The specific steps are as follows: S41: Assuming there is an existing dataset ,in, for 3D feature vectors These are category labels, where 0 represents a normal heartbeat and 1 represents an abnormal heartbeat. S The number of sample points; Before training, all feature values are normalized using a standardization transformation:
[0141] in, and The first The mean and standard deviation of each feature on the training set. This step aims to avoid the adverse effects of scale differences between features of different dimensions on model training.
[0142] S42: Design a multi-layer fully connected neural network with the following structure:
[0143] in, This represents the output after the first-level linear transformation and ReLU nonlinearity; Indicates in The output is obtained by applying a second layer of linear and ReLU operations, followed by Dropout. Indicates in The output is obtained by applying a third layer of linear and ReLU, followed by Dropout. This means mapping the input features from 9 dimensions to 64-dimensional hidden units. This means mapping the first layer of hidden states from 64 dimensions to 32 dimensions. This means mapping the second-level hidden state from 32 dimensions to 16 dimensions. This means mapping the third hidden state from 16 dimensions to a 2-dimensional output (corresponding to scores for 2 categories). , , , Do not represent the intercept of each layer. This is the unnormalized class score (logits) vector obtained from the linear transformation of the output layer. It has a dimension of 2 and corresponds to the scores of the two classes. The feature vector (features of a single heartbeat) is input into the neural network.
[0144] The final result passes through the output layer. SoftMax The function mapping to class probabilities is expressed mathematically as follows:
[0145] in, Represented as the predicted probability vector after SoftMax normalization, its i-th Each component This indicates that the sample was judged as the first The probability of a class satisfies , and Representing vectors The two components represent the unnormalized score / log odds for the corresponding two classes, respectively. It is represented as the unnormalized class score (logits) vector obtained by the linear transformation of the output layer.
[0146] In the Dropout layer, with probability Randomly discarding a portion of a neuron's output aims to reduce the model's dependence on specific neurons and prevent overfitting. The formula is as follows:
[0147] in, This is represented as a sparse activation vector after Dropout, where some components are set to zero for subsequent calculations; This is represented as a sparse activation vector after Dropout, where some components are set to zero for subsequent calculations; Represented as with Random mask vectors of the same dimension, each dimension independently following Bernoulli The distribution is represented by a component of 1, where a component of 1 indicates that the neuron is retained in the current training iteration; and a component of 0 indicates that the neuron is discarded in the current training iteration. Represented as the Hadamard product (element-by-element multiplication) operator, i.e. .
[0148] S43: The model uses the Cross-Entropy Loss function as the optimization objective to measure the difference between the predicted distribution and the true label distribution, which is defined as:
[0149] in, Indicates sample Predicted as category The probability, For indicator functions, , where represents the model parameters to be learned.
[0150] S44: The model uses the Adam adaptive optimization algorithm for parameter updates, and the update rule is as follows:
[0151] in, For the first The exponentially weighted moving average of the first moment (mean) of the gradient at each iteration can be regarded as the momentum term; To The first-order moment estimate obtained after bias correction; For the first The exponentially weighted moving average of the second moment (squared) of the gradient at each iteration is used to characterize the magnitude of the gradient variance. For the first The model parameter vector at the next iteration Let be the exponential decay coefficient hyperparameters of the first and second moments, respectively. For the current gradient, t The number of iterations is denoted by ___._ The learning rate is ___._ , , , .
[0152] S45: During training, set the maximum number of iterations (epochs) to 100 and the batch size to 32, and perform performance monitoring on the validation set after each iteration to prevent overfitting.
[0153] S5: The level of the abnormal signal is obtained by the ratio of abnormal heartbeats to normal heartbeats in all heartbeats.
[0154] Its characteristics The specific description is as follows:
[0155] Among them, mild abnormalities may be occasional, asymptomatic premature beats (such as ventricular premature beats, atrial premature beats) or transient arrhythmias, which are mostly related to lifestyle; mild abnormalities may indicate the presence of structural heart disease (such as cardiomyopathy, heart failure) or pathological arrhythmias (such as atrial fibrillation, ventricular tachycardia), and need to be combined with a 12-lead electrocardiogram to clarify the waveform characteristics; severe abnormalities may indicate serious arrhythmias (such as sustained ventricular tachycardia, ventricular fibrillation, high-degree atrioventricular block) or potential fatal risks (such as QT interval prolongation syndrome, electrolyte disturbances).
[0156] Experimental verification: This experiment uses two verification methods: the MIT-BIH Arrhythmia Database dataset and real collected data to verify the algorithm. The experimental parameters are set as shown in Table 1.
[0157] Table 1 Experimental Parameter Settings
[0158] The MIT-BIH Arrhythmia Database dataset contains 48.5-hour resident ECG records from 47 subjects in the United States, documenting various cardiac arrhythmias. This data is currently widely used in cardiac rhythm analysis research and the evaluation of arrhythmia detectors.
[0159] In this experiment, publicly available data from 47 subjects and collected data from 3 subjects were processed sequentially through filtering, feature extraction, and other operations to obtain 5 feature values and 1 response variable.
[0160] The MIT-BIH dataset includes annotations of heart rate beats, so the publicly available data of 47 subjects were combined with the annotations as a standard for judging whether the heartbeat was normal. This part of the data was used as the training set.
[0161] 10% of the training set and 3 subjects min The test set is obtained by combining real electrocardiogram signal data.
[0162] Due to space limitations, data from subject number "100" is not included. min After signal processing, ECG signal data is as follows: Figures 2-7 As shown, where Figure 7 The locations of the R-wave peak, Q-wave initiation point, and S-wave end point were accurately marked without any misjudgments, verifying the accuracy of the feature extraction algorithm in this invention. Furthermore, we also plotted the spectrum and amplitude-frequency response diagrams, such as... Figures 5-6 As shown in the image, the filter we designed has achieved the expected results.
[0163] Machine learning classification was performed using neural networks and bagging tree methods, and the relevant test parameters are shown in Table 2.
[0164] Table 2 Model Validation Parameters
[0165] This experiment also plotted the confusion matrix and ROC curve, showing that the model has a high validation rate, consistent with the experimental expectations of this invention. Furthermore, this experiment compared the differences in heart rate detection between different machine learning algorithms, finding that the ensemble learning algorithm had the highest accuracy. This demonstrates the innovation and advancement of this invention's use of neural network methods. Figures 8-10 As shown.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks, characterized in that, The method specifically includes the following steps: S1: Input ECG signal data, and preprocess it using software to obtain clean data; S2: Dynamically calculate the comprehensive decision value for clean data, and extract the QRS feature value for each heartbeat based on the comprehensive decision value; S3: Calculate the dynamic characteristics of each heartbeat based on the QRS eigenvalues and standardize the dynamic characteristics; S4: Input the standardized dynamic features into the trained binary classification model based on a multi-layer fully connected neural network to obtain the prediction results for each heartbeat.
2. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to claim 1, characterized in that, In step S1, the ECG signal is processed in the software to obtain clean data, specifically including the following steps: S11: Employs a Butterworth-type low-pass structure to filter components outside the target frequency band of the ECG signal, i.e., filter the EMG signal; the cutoff angular frequencies of the passband and stopband are pre-defined based on the signal characteristics. and The passband and stopband attenuation indices are respectively and The filter order is determined by a function. : Obtaining the zeros of the normalized Butterworth analog filter ,pole and gain Furthermore, based on the target cutoff frequency, a low-pass filter that meets the requirements is obtained: in, Represents the response function. The number of zeros The number of poles For input; Finally, the analog filter is converted into a digital filter using a bilinear transform: in, Represents the response function. To represent a complex variable, Indicates the sampling period, if the sampling frequency is ,but ; The output of the input ECG signal after digital filtering is: in, Represents the response sequence. Forward coefficients, For feedback coefficients, and These are the feedforward and feedback coefficients, respectively. Indicates electrocardiogram (ECG) signal. ; S12: Filter the electrocardiogram (ECG) signal (excluding electromyography) signal to remove the power frequency signal, with a designed center frequency of... Quality factor is The IIR notch filter, whose center angular frequency is normalized by the sampling rate is corresponding bandwidth The system transfer function is constructed as follows: in, This is the stopband cutoff frequency; S13: Wavelet decomposition is used to remove baseline drift from the electrocardiogram signal after filtering out electromyographic and power frequency signals.
3. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to claim 2, characterized in that, In step S13, wavelet decomposition is used to remove baseline drift, specifically including: decomposing the signal into... L Layer, calculate wavelet coefficients: in, Represents the scaling factor. For Daubechies wavelet basis functions, L Indicates the number of wavelet functions; Using the reconstruction results of the low-frequency components, the baseline drift component in the signal is extracted: in, Indicates the baseline. Represents the scaling function. Indicates a translation index; Finally, the corrected electrocardiogram signal was obtained: in, This indicates clean data.
4. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to claim 1, characterized in that, Step S2 specifically includes the following steps: S21: Assume the denoised single-lead ECG signal is a discrete sequence. The sampling frequency is ; For each sampling point Construct four scoring components: amplitude scoring Slope scoring Acceleration score Time score The comprehensive judgment amount is defined as: S22: When a certain point satisfies At that point, it is considered that the point is highly likely to correspond to the peak value of the R-wave, thus completing the first round of R-wave candidate detection; S23: At the sampling point where the candidate R wave is located Subsequently, in its neighboring region A local traversal search is performed within the range, and the sampling point with the largest amplitude is selected as the final R-wave position, denoted as . subscript Indicates the first Heartbeats; S24: At the finally determined R-wave peak position, the Q-wave initiation and S-wave termination are determined by local extrema and slope, as follows: Define a first-order difference sequence Around the first Secondary R wave position ,by s is used to determine the Q wave onset and S wave end point within the search window; In the interval Within this context, let the sampling points corresponding to the local maximum value before the Q wave and the Q wave trough be respectively... The corresponding slope Defined as: Then the Q wave origin It is given by the following formula, where To find the index corresponding to the minimum value: In the interval Let the local maximum value before the S-wave trough and the sampling point corresponding to the S-wave trough be respectively... The corresponding slope is: Then the S-wave endpoint Defined as: in, To find the index corresponding to the minimum value.
5. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to claim 4, characterized in that, In step S21, the amplitude of the construction is scored. Slope scoring Acceleration score Time score Four reference thresholds that can be updated over time are introduced: Amplitude Reference Take the average of the "maximum amplitude" of each heartbeat waveform within the last 10 seconds. times; Slope Reference Take the average of the "maximum slope" of each heartbeat waveform within the last 10 seconds. times; Acceleration Reference Take the average of the "maximum acceleration" of each heartbeat waveform within the last 10 seconds. times; Time reference Take the average of the most recent 5 RR intervals times; Among them, the magnitude score : Let the first-order difference be... If the instantaneous slope is approximated, then the slope is scored. : Redefining the second-order difference for: Considered as "acceleration", it is scored as follows: : Time scoring needs to consider the interval between the current sampling point and the previous heartbeat; the time from the previous R wave to the sampling point is recorded. Time for: Then time score For the first For each confirmed heartbeat, the following statistics are extracted within its QRS interval: The maximum amplitude of this heartbeat: ; Maximum slope of this heartbeat: ; The maximum acceleration of this heartbeat: ; The RR interval for this time: ; The threshold is updated using an exponential smoothing method: , , , 。 6. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to claim 4, characterized in that, Step S3 specifically includes: calculating the following dynamic characteristics in each heartbeat. QRS interval The above calculation is used for subsequent neural network classification; let the sampling period be... Calculate dynamic features This feature is the QRS duration of one heartbeat: Definition of the first RR interval per heartbeat for: before Based on the number of heartbeats, the average RR interval for: Calculate dynamic features This characteristic is the relative deviation of the RR interval: With the most recent Calculate the mean of the RR intervals. for: Calculate dynamic features This characteristic is the variance of the RR interval: Let the first Peak amplitude of R wavelet count for Average amplitude of the last six R peaks for: Calculate dynamic features This characteristic is the relative deviation of the R peak: Calculate dynamic features This characteristic is the variance of the R peak: Define the difference between adjacent RR intervals for: Take the nearest Each heartbeat calculates dynamic characteristics. This feature is the first RMSSD characteristics of the RR interval of the last heartbeat: Let the denoised signal be ;No. The start and end times of the QRS time window for each heartbeat are respectively Indexed by time Indicates the "energy" characteristic at the sampling time. Defined as: In implementation, it is often transcribed into discrete sampling point index form: Let They are time points The corresponding sampling point number, then in, Indicates the first The sampling point number where the QRS window for each heartbeat begins. Indicates the sampling point number where the end of the same QRS window is located; remember This is a dynamic characteristic, representing the "energy" of a single heartbeat: Let the first During each heartbeat, the amplitude of the R peak is The amplitude of the S-wave trough of the same heartbeat is Introduce a constant To avoid the denominator being zero, the R / S ratio is... Defined as: And recorded as Dynamic feature, which is the R / S amplitude ratio during a single heartbeat: The time integral of the absolute value of the denoised ECG signal within the QRS interval is defined as the QRS area. : Represented in discrete form, denoted as in, The sampling time interval; remember This feature is the time integral of the absolute value of the denoised ECG signal within the QRS interval during a single heartbeat; In summary, based on the comprehensive judgment... R-wave detection and Q / S localization were completed, and multiple thresholds were updated in real time using an exponential smoothing strategy; based on this, a model was constructed for each heartbeat. .
7. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on neural networks according to claim 1, characterized in that, Step S4 specifically includes the following steps: S41: Assuming there is an existing dataset ,in, for 3D feature vectors These are category labels, where 0 represents a normal heartbeat and 1 represents an abnormal heartbeat. S The number of sample points; S42: Design a multi-layer fully connected neural network with the following structure: in, This represents the output after the first-level linear transformation and ReLU nonlinearity; Indicates in The output is obtained by applying a second layer of linear and ReLU operations, followed by Dropout. Indicates in The output is obtained by applying a third layer of linear and ReLU algorithms, followed by Dropout. This means mapping the input features from 9 dimensions to 64-dimensional hidden units. This means mapping the first layer of hidden states from 64 dimensions to 32 dimensions. This means mapping the second-level hidden state from 32 dimensions to 16 dimensions. This means mapping the third hidden state from 16 dimensions to a 2-dimensional output. , , , Each represents the intercept of a layer; The unnormalized class scoring vector obtained from the linear transformation of the output layer has a dimension of 2 and corresponds to the scores of the two classes. The feature vector input to the neural network is the feature of a single heartbeat. The final result passes through the output layer. SoftMax The function mapping to class probabilities is expressed mathematically as follows: in, Represented as the predicted probability vector after SoftMax normalization, its i-th Each component This indicates that the sample was judged as the first The probability of a class satisfies , and Representing vectors The two components represent the unnormalized score and log odds for the corresponding two classes, respectively. In the Dropout layer, with probability Randomly discard a portion of the neuron's output, as shown in the following formula: in, This is the sparse activation vector after Dropout; This is the sparse activation vector after Dropout; To and Random mask vectors of the same dimension, each dimension independently following Bernoulli The distribution is represented by a component of 1, where a component of 1 indicates that the neuron is retained in the current training iteration; and a component of 0 indicates that the neuron is discarded in the current training iteration. Represented as the Hadamard product operator; S43: The model uses the cross-entropy loss function as the optimization objective to measure the difference between the predicted distribution and the true label distribution, which is defined as: in, Indicates sample Predicted as category The probability, For indicator functions, , where are the model parameters to be learned; S44: The model uses the Adam adaptive optimization algorithm for parameter updates, and the update rule is as follows: in, For the first The exponentially weighted moving average of the first moment of the gradient at each iteration; To The first-order moment estimate obtained after bias correction. For the first The exponentially weighted moving average of the second moment of the gradient at the next iteration; For the first The model parameter vector at the next iteration Let be the exponential decay coefficient hyperparameters of the first and second moments, respectively. For the current gradient, t This represents the number of iterations. S45: Set the maximum number of iterations and batch size during training, and perform performance monitoring on the validation set after each iteration to prevent overfitting.