SVM-based dynamic parameter feature extraction and heartbeat anomaly classification method
By using SVM-based dynamic parameter feature extraction and heartbeat abnormality classification methods, the problem of signal-to-noise ratio decline caused by noise interference in ECG monitoring is solved, and high-precision heartbeat abnormality detection and early warning are achieved under dynamic monitoring conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV
- Filing Date
- 2025-12-08
- Publication Date
- 2026-04-17
AI Technical Summary
Existing ECG monitoring technologies are easily affected by various noise sources such as baseline drift, electromyography interference, power frequency noise, and motion artifacts in dynamic monitoring and daily life scenarios, resulting in a decrease in signal-to-noise ratio and making it difficult to achieve accurate feature detection and disease early warning.
A dynamic parameter feature extraction method based on SVM is adopted. Electromyography and power frequency interference are removed by Butterworth low-pass filter and IIR notch filter, and baseline drift is eliminated by wavelet decomposition. The nonlinear decision boundary is adaptively learned by the RBF-SVM model to classify heartbeat abnormalities.
It significantly improves the accuracy and robustness of heart rhythm abnormality detection, reduces the rate of missed and false detections, enhances the ability to recognize complex electrocardiogram waveforms, and supports real-time automated early warning for multiple types of diseases.
Smart Images

Figure CN121867807A_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 SVM. 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, given the application scenarios of wearable real-time monitoring and the practical need for multi-source noise interference, there is an urgent need to propose a heartbeat abnormality classification method to improve the ability to predict heart diseases. 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 the ECG signal to the host computer, and process the ECG signal in the software (Matlab) to obtain clean data; S2: Calculate the dynamic composite threshold using clean data, and obtain the heart rate QRS characteristic value based on the composite threshold; S3: Calculate the dynamic characteristics of each heartbeat based on the QRS eigenvalues. ); S4: Input dynamic features into the RBF-SVM model, solve the soft margin maximization problem in the kernel feature space, adaptively learn the nonlinear decision boundary that conforms to the distribution of ECG dynamic features, and finally output the judgment result for each heartbeat; where RBF-SVM means support vector machine with radial basis function kernel.
[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. 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:
[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; By utilizing the reconstruction results of the low-frequency components, the baseline drift component in the signal can be 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: Let the preprocessed single-lead ECG sequence be... The sampling frequency is For each sampling point Meanwhile, considering amplitude, slope, acceleration, and the time interval between the previous heartbeat, a comprehensive index is constructed to determine candidate points for the R wave. Define four dimensionless scoring components: amplitude scoring, etc. Slope scoring Acceleration score Scoring based on time intervals ; The comprehensive threshold is denoted as:
[0019] S22: Solve the specific QRS feature value by using the dynamic parameter differential comprehensive threshold method. When the comprehensive threshold of the data point input this time is greater than or equal to 0.9, it is considered that the point is likely to be the peak of the R wave, and the first round of detection is completed. S23: Denote the position of a candidate R-wave point obtained in the first round of detection as... To avoid R-wave positioning deviation, it is performed... Local traversal search, within the interval Find the sampling point with the largest amplitude within the range, and denote the index of that point as... As the first Precise location of the R wave per heartbeat.
[0020] S24: Determine the Q-wave initiation point by using local extrema and slope at the finally determined R-wave peak position. and the end of the S wave The specific method is as follows: To estimate the first The start and end positions of the QRS waveform of each heartbeat are first used to construct a difference sequence. for:
[0021] Let the first The position of the R wave peak of the second heartbeat is .
[0022] Determine the Q wave initiation point: In the interval The starting point of the Q wave is determined internally. Let the index of the local maximum preceding the Q wave trough be denoted as . Q-trough index is Define the slope of this segment. for:
[0023] Then the Q wave starting point sampling index It is given by the following formula:
[0024] here This indicates the location of the sampling point that yields the minimum amplitude under given conditions.
[0025] Similarly, in the interval The endpoint of the S-wave is determined internally. Let the index of the local maximum preceding the S-wave trough be denoted as . , S-trough index is , The corresponding slope is defined as
[0026] S-wave endpoint sampling index Defined as
[0027] Furthermore, in step S21, four dimensionless scoring components are defined: amplitude scoring. Slope scoring Acceleration score Scoring based on time intervals Its definition is as follows: Let the preprocessed single-lead ECG sequence be... The sampling frequency is ; Current sampling point amplitude for ; Slope of the current sampling point for:
[0028] acceleration at the current sampling point for:
[0029] The time interval between the current sampling point and the previous R-wave peak is ; The four components are then defined in piecewise linear normalized form:
[0030]
[0031]
[0032]
[0033] in: Take the nearest The average of the maximum amplitude of each heartbeat waveform times; Get the nearest The average of the maximum slopes of each heartbeat waveform within the body. times; Acceleration threshold: take the nearest one The average value of the maximum "acceleration" of each heartbeat waveform within the body. times; For time interval threshold: take the first... The average of the RR intervals times.
[0034] Record this heartbeat (number) The characteristic statistics for (times) are: Maximum amplitude of the current heartbeat waveform The maximum slope of the current heartbeat waveform The maximum "acceleration" of the current heartbeat waveform. The RR interval in this case ; After each heartbeat, the four thresholds are updated exponentially smoothed:
[0035] With the above updates, the overall threshold... It can dynamically adjust according to recent changes in electrocardiogram morphology.
[0036] Furthermore, step S3 specifically includes: after obtaining the first... Q wave origin of the second heartbeat S-wave endpoint and the position of the R-wave peak Then, a set of dynamic features can be extracted for SVM classification: The duration characteristic of QRS is denoted as:
[0037] If necessary, it can be divided by the sampling frequency. Convert it to a time length.
[0038] Definition of the first The interval between RR cycles is:
[0039] Calculate the average value based on the previous five RR intervals.
[0040] Calculate dynamic features To characterize the relative error of the RR intervals, the first five intervals are used as the baseline:
[0041] Calculate dynamic features This characteristic is the variance of the RR interval, with the most recent interval as the basis. The sample consists of RR intervals:
[0042] Calculate dynamic features This characteristic is the relative error of the R-wave peak value, with the most recent The sample consists of RR intervals: Let the first The peak amplitude of the R wave per heartbeat is
[0043] Average the peak R wave values of the previous 6 heartbeats:
[0044] The relative error characteristics of the R-wave peak value Defined as:
[0045] Calculate dynamic features This characteristic is the R-wave peak variance, with the most recent The sample consists of RR intervals:
[0046] In practical applications, it can be
[0047] As the first The dynamic feature vectors of each heartbeat are input into a support vector machine (SVM) model for automatic classification of heartbeat abnormality types.
[0048] Furthermore, step S4 specifically includes the following steps: S41: Assume the training samples are... ,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: SVM learns the optimal separating hyperplane in the feature space by solving the soft margin maximization problem; the specific optimization model is as follows:
[0049] in, This is the penalty coefficient, used to adjust the tradeoff between maximizing the margin and training error; and The weight vector and intercept of the hyperplane, respectively, determine the discriminant hyperplane in the original feature space. ; These are slack variables used to allow for controlled misclassification of some difficult-to-classify samples. S The number of sample points; In the above optimization model, an eigenmap implicitly defined by a kernel function is introduced, and a radial basis function kernel is selected, resulting in the kernel function form:
[0050] in, For two 3D feature vector; parameters This is the width parameter, used to control the complexity of the decision boundary; Represents the square of the Euclidean distance between two vectors; automatic search through cross-validation. and The combination of these factors is used to achieve optimal generalization performance on the cardiac level discrimination task. S43: In the dual form, the decision function obtained by training RBF-SVM is:
[0051] in, Let be the decision function; It is a set of support vectors; For the corresponding dual variables; For training labels; This is the intercept.
[0052] The beneficial effects of this invention are as follows: By constructing a multi-level filtering system, specifically by using a Butterworth low-pass filter to effectively reduce electromyographic interference, employing an IIR notch filter to accurately filter out 50 / 60Hz power frequency interference, and applying wavelet decomposition technology (Daubechies wavelet basis) to reconstruct and eliminate baseline drift, this combined method ensures that the input data has reached a stable state of "clean data" before entering the feature extraction stage, laying a solid foundation for subsequent high-precision analysis and significantly improving the signal-to-noise ratio of the signal.
[0053] This invention, based on traditional differential thresholding and dynamic thresholding methods, significantly enhances the feature extraction capability under heart rate fluctuation conditions by dynamically adjusting parameters, employing multiple threshold judgments, and using local traversal search. This improves the accuracy of R-wave recognition and ensures the stability of the recognition results. This effectively avoids interference from non-pathological heart rate acceleration on feature extraction, while reducing the incidence of missed and false detections.
[0054] This invention addresses the nonlinearity of electrocardiogram (ECG) signal feature distribution and the extreme imbalance between positive and negative samples (abnormal heartbeats are typically far fewer than normal heartbeats). It constructs an optimized Support Vector Machine (SVM) classification model with a radial basis function (RBF) kernel. By employing kernel tricks to map features to a high-dimensional space, the model can adaptively learn complex nonlinear decision boundaries, solving the problem of linear classifiers' inability to handle complex ECG waveforms. Furthermore, a cost-sensitive strategy is introduced, imposing a higher misclassification cost weight on abnormal heartbeat samples. This makes the model focus more on minority (abnormal) samples during training, effectively improving the recall rate for potential cardiac abnormalities and avoiding misclassification.
[0055] In summary, this invention can robustly extract multidimensional features under low signal-to-noise ratio and dynamic physiological conditions, and combines adaptive strategies with advanced machine learning / deep learning methods to achieve multi-class classification and early warning, thereby improving early detection capabilities and supporting proactive intervention and clinical decision-making. It achieves more stable recognition results in dynamic monitoring scenarios, significantly improving the accuracy and robustness of heartbeat prediction under dynamic monitoring, and has high application value for detecting abnormal heartbeats in clinical applications and routine monitoring.
[0056] 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
[0057] 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 SVM-based dynamic parameter feature extraction and heartbeat abnormality classification method of the present invention; Figure 2 A schematic diagram of the 1-minute ECG signal data and the data after removing the electromyography signal for MIT-BIH sample number 100; Figure 3 A schematic diagram of baseline drift removed data from a 1-minute ECG of MIT-BIH sample number 100; Figure 4 This is a schematic diagram of the 1-minute ECG data of MIT-BIH sample number 100 after removing the power frequency signal. Figure 5 The spectrum of the 1-minute ECG after cleaning of the MIT-BIH sample number 100; Figure 6 The amplitude-frequency response of the notch filter for a 1-minute ECG of MIT-BIH sample number 100 when processing a 60Hz power frequency signal. Figure 7 This is a schematic diagram of ECG feature extraction for MIT-BIH sample number 100 (the first 3000 features are taken). Figure 8 The ROC curve obtained by training a classifier using RBF SVM; Figure 9 The confusion matrix diagram obtained by training a classifier using RBF SVM; Figure 10 This is a comparison of different algorithms. Detailed Implementation
[0058] 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.
[0059] 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 the ECG signal to the host computer and process the ECG signal in 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. :
[0060] in, , , The passband cutoff frequency, This is the stopband cutoff frequency.
[0061] 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:
[0062] 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:
[0063] in, Represents the response function. To represent a complex variable, This indicates that if the sampling frequency is ,but 。; The output of the input ECG signal after digital filtering is:
[0064] 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:
[0065] in, This is the stopband cutoff frequency; This filter can effectively filter out 50 / 60Hz power frequency interference.
[0066] S13: Finally, the ECG signal, after filtering out EMG and power frequency signals, is subjected to wavelet decomposition to remove baseline drift. The signal is decomposed into... L Layer, calculate wavelet coefficients:
[0067] in, Represents the scaling factor. For Daubechies wavelet basis functions, L Indicates the number of wavelet functions; By utilizing the reconstruction results of the low-frequency components, the baseline drift component in the signal can be extracted:
[0068] in, Indicates the baseline. Represents the scaling function. Indicates the translation (displacement) index; Finally, the corrected electrocardiogram signal was obtained:
[0069] in, This indicates clean data.
[0070] 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.
[0071] S2: Calculate the dynamic composite threshold using clean data, and obtain the heart rate QRS characteristic value based on the composite threshold. This includes the following steps: S21: Let the preprocessed single-lead ECG sequence be... The sampling frequency is For each sampling point Meanwhile, considering amplitude, slope, acceleration, and the time interval between the previous heartbeat, a comprehensive index is constructed to determine candidate points for the R wave. Define four dimensionless scoring components: amplitude scoring, etc. Slope scoring Acceleration score Scoring based on time intervals ; The comprehensive threshold is denoted as:
[0072] S22: Solve the specific QRS feature value by using the dynamic parameter differential comprehensive threshold method. When the comprehensive threshold of the data point input this time is greater than or equal to 0.9, it is considered that the point is likely to be the peak of the R wave, and the first round of detection is completed. S23: Denote the position of a candidate R-wave point obtained in the first round of detection as... To avoid R-wave positioning deviation, it is performed... Local traversal search, within the interval Find the sampling point with the largest amplitude within the range, and denote the index of that point as... As the first Precise location of the R wave per heartbeat.
[0073] S24: Determine the Q-wave initiation point by using local extrema and slope at the finally determined R-wave peak position. and the end of the S wave The specific method is as follows: To estimate the first The start and end positions of the QRS waveform of each heartbeat are first used to construct a difference sequence. for
[0074] Let the first The position of the R wave peak of the second heartbeat is .
[0075] Determine the Q wave initiation point: In the interval The starting point of the Q wave is determined internally. Let the index of the local maximum preceding the Q wave trough be denoted as . Q-trough index is The slope of this segment is defined as...
[0076] Then the Q wave starting point sampling index It is given by the following formula:
[0077] here This indicates the location of the sampling point that yields the minimum amplitude under given conditions.
[0078] Similarly, in the interval The endpoint of the S-wave is determined internally. Let the index of the local maximum preceding the S-wave trough be denoted as . , S-trough index is , The corresponding slope is defined as
[0079] S-wave endpoint sampling index Defined as
[0080] In step S21, : Let the preprocessed single-lead ECG sequence be... The sampling frequency is ; Current sampling point amplitude for ; Slope of the current sampling point for:
[0081] acceleration at the current sampling point for:
[0082] The time interval between the current sampling point and the previous R-wave peak is ; The four components are then defined in piecewise linear normalized form: in: Take the nearest The average of the maximum amplitude of each heartbeat waveform times; Get the nearest The average of the maximum slopes of each heartbeat waveform within the body. times; Acceleration threshold: take the nearest one The average value of the maximum "acceleration" of each heartbeat waveform within the body. times; For time interval threshold: take the first... The average of the RR intervals times.
[0083] Record this heartbeat (number) The characteristic statistics for (times) are: Maximum amplitude of the current heartbeat waveform The maximum slope of the current heartbeat waveform The maximum "acceleration" of the current heartbeat waveform. The RR interval in this case ; After each heartbeat, the four thresholds are updated exponentially smoothed:
[0084] With the above updates, the overall threshold... It can dynamically adjust according to recent changes in electrocardiogram morphology.
[0085] S3: Calculate the dynamic characteristic parameters of each heartbeat based on the QRS eigenvalues. Specifically, this includes: obtaining the first... Q wave origin of the second heartbeat S-wave endpoint and the position of the R wave peak Then, a set of dynamic features can be extracted for SVM classification: The duration characteristic of QRS is denoted as:
[0086] If necessary, it can be divided by the sampling frequency. Convert it to a time length.
[0087] Definition of the first The interval between RR cycles is:
[0088] Calculate the average value based on the previous five RR intervals.
[0089] Calculate dynamic features To characterize the relative error of the RR intervals, the first five intervals are used as the baseline:
[0090] Calculate dynamic features This characteristic is the variance of the RR interval, with the most recent interval as the basis. The sample consists of RR intervals:
[0091] Calculate dynamic features This characteristic is the relative error of the R-wave peak value, with the most recent The sample consists of RR intervals: Let the first The peak amplitude of the R wave per heartbeat is:
[0092] Average the peak R wave values of the previous 6 heartbeats:
[0093] The relative error characteristics of the R-wave peak value Defined as:
[0094] Calculate dynamic features This characteristic is the R-wave peak variance, with the most recent The sample consists of RR intervals:
[0095] In practical applications, it can be As the first The dynamic feature vectors of each heartbeat are input into a support vector machine (SVM) model for automatic classification of heartbeat abnormality types.
[0096] S4: Input dynamic features into a Support Vector Machine (SVM) model with a Radial-Basis Function (RBF) kernel, and output the judgment result for each heartbeat.
[0097] This invention addresses the problems of nonlinear distribution and extreme class imbalance in electrocardiogram (ECG) signal discrimination at the heartbeat level by constructing a kernel support vector heartbeat discrimination model based on dynamic parameter features. This model takes the dynamic feature vector of the heartbeat extracted in step S3 as input and outputs a "normal / abnormal" discrimination result for each heartbeat.
[0098] During the training phase, this embodiment uses the MIT-BIH arrhythmia database as the source of labeled samples. This database contains 48 half-hour long-term ECG records from 47 subjects, covering various typical and complex arrhythmia patterns. Based on this, the present invention constructs a training sample set that matches the dynamic parameter features, enabling the model to learn a stable mapping between the "dynamic feature space → heartbeat category space" for subsequent online heartbeat status recognition.
[0099] This embodiment uses the RBF-SVM model as the core for cardiac rhythm discrimination. Unlike traditional algorithms based on fixed thresholds or linear discrimination, this invention adaptively learns a nonlinear decision boundary that conforms to the dynamic feature distribution of electrocardiograms by solving the soft margin maximization problem in the kernel feature space. The specific steps are as follows: S41: Assume the training samples are... ,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: SVM learns the optimal separating hyperplane in the feature space by solving the soft margin maximization problem; the specific optimization model is as follows:
[0100] in, This is the penalty coefficient, used to adjust the tradeoff between maximizing the margin and training error; and The weight vector and intercept of the hyperplane, respectively, determine the discriminant hyperplane in the original feature space. ; These are slack variables used to allow for controlled misclassification of some difficult-to-classify samples. S The number of sample points; In the above optimization model, an eigenmap implicitly defined by a kernel function is introduced, and a radial basis function kernel is selected, resulting in the kernel function form:
[0101] in, For two 3D feature vector; parameters This is the width parameter, used to control the complexity of the decision boundary; Represents the square of the Euclidean distance between two vectors; automatic search through cross-validation. and The combination of these factors is used to achieve optimal generalization performance on the cardiac level discrimination task. S43: In the dual form, the decision function obtained by training RBF-SVM is:
[0102] in, Let be the decision function; It is a set of support vectors; For the corresponding dual variables; For training labels; This is the intercept.
[0103] To address the class imbalance characteristic in electrocardiogram (ECG) data, where abnormal heartbeat samples are significantly fewer than normal heartbeat samples, this invention introduces a cost-sensitive strategy into the aforementioned optimization model: applying a higher misjudgment cost weight to abnormal heartbeat samples, making the training process focus more on the identification of minority class samples, thereby achieving a more reasonable trade-off between overall accuracy and abnormal heartbeat recall, and improving the ability to detect potential cardiac abnormalities.
[0104] S5: The level of the abnormal signal is obtained by the ratio of abnormal heartbeats to normal heartbeats in all heartbeats.
[0105] Its characteristics The specific description is as follows:
[0106] 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).
[0107] 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.
[0108] Table 1 Experimental Parameter Settings
[0109] The MIT-BIH Arrhythmia Database dataset contains 48.5-hour resident ECG records from 47 subjects in the United States, documenting various arrhythmias. This data is currently widely used in cardiac rhythm analysis research and the evaluation of arrhythmia detectors.
[0110] 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.
[0111] 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.
[0112] The test set was obtained by combining 10% of the training set with real ECG signal data from 3 subjects over 1 minute.
[0113] Due to space limitations, the 1-minute ECG signal data of subject number "100" after signal processing 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.
[0114] The relevant test parameters obtained by using the RBF-SVM method for machine learning classification are shown in Table 2.
[0115] Table 2 Model Validation Parameters
[0116] This experiment also plotted the confusion matrix and ROC curve, showing that the model has a high validation rate, consistent with the 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 the SVM method. Figures 8-10 As shown.
[0117] 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 SVM, characterized in that, The method specifically includes the following steps: S1: Input the ECG signal to the host computer, and process the ECG signal in the software to obtain clean data; S2: Calculate the dynamic composite threshold using clean data, and obtain the heart rate QRS characteristic value based on the composite threshold; S3: Calculate the dynamic characteristics of each heartbeat based on the QRS eigenvalues; S4: Input dynamic features into the RBF-SVM model, solve the soft margin maximization problem in the kernel feature space, adaptively learn the nonlinear decision boundary that conforms to the distribution of ECG dynamic features, and finally output the judgment result for each heartbeat; where RBF-SVM means support vector machine with radial basis function kernel.
2. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on SVM 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. S The number of sample points; S12: Filter the electrocardiogram (ECG) signal (excluding EMG signals) 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 SVM 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 SVM according to claim 1, characterized in that, Step S2 specifically includes the following steps: S21: Let the preprocessed single-lead ECG sequence be... The sampling frequency is For each sampling point Simultaneously considering amplitude, slope, acceleration, and the time interval between the previous heartbeat, a comprehensive index is constructed to determine candidate points for the R-wave. Define four dimensionless scoring components: amplitude scoring, etc. Slope scoring Acceleration score Scoring by time interval ; The comprehensive threshold is denoted as: S22: Solve the specific QRS feature value by using the dynamic parameter differential comprehensive threshold method. When the comprehensive threshold of the data point input this time is greater than or equal to 0.9, it is considered that the point is likely to be the peak of the R wave, and the first round of detection is completed. S23: Denote the position of a candidate R-wave point obtained in the first round of detection as... To avoid R-wave positioning deviation, it was performed... Local traversal search, within the interval Find the sampling point with the largest amplitude within the range, and denote the index of that point as... As the first Precise location of the R wave per heartbeat; S24: Determine the Q-wave initiation point by using local extrema and slope at the finally determined R-wave peak position. and the end of the S wave The specific method is as follows: To estimate the first The start and end positions of the QRS waveform of each heartbeat are first used to construct a difference sequence. for: Let the first The position of the R wave peak of the second heartbeat is ; Determine the Q-wave initiation point: In the interval The starting point of the Q wave is determined internally; the index of the local maximum preceding the Q wave trough is denoted as . Q-wave trough index is Define the slope of this segment. for: Then the Q wave starting point sampling index It is given by the following formula: in, This indicates the location of the sampling point that yields the minimum amplitude under given conditions; Similarly, in the interval The S-wave endpoint is determined internally; the index of the local maximum preceding the S-wave trough is denoted as . , S trough index is , corresponding slope Defined as: S-wave endpoint sampling index Defined as: 。 5. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on SVM according to claim 4, characterized in that, In step S21, four dimensionless scoring components are defined: amplitude scoring. Slope scoring Acceleration score Scoring by time interval Its definition is as follows: Let the preprocessed single-lead ECG sequence be... The sampling frequency is ; Current sampling point amplitude for ; Slope of the current sampling point for: acceleration at the current sampling point for: The time interval between the current sampling point and the previous R-wave peak is ; The four components are then defined in piecewise linear normalized form: in, The amplitude threshold is set to 0.5 times the average of the maximum amplitude values of the heartbeat waveforms within the last 10 seconds. The slope threshold is set to 0.6 times the average of the maximum slopes of the heartbeat waveforms within the last 10 seconds. As the acceleration threshold, take the nearest one. The average value of the maximum "acceleration" of each heartbeat waveform. times; The time interval threshold is taken first. The average of the RR intervals times; This is the first time. The characteristic statistics of the number of heartbeats are: Maximum amplitude of the current heartbeat waveform The maximum slope of the current heartbeat waveform The maximum "acceleration" of the current heartbeat waveform. The RR interval in this case ; After each heartbeat, the four thresholds are updated exponentially smoothed: With the above updates, the overall threshold... It can dynamically adjust according to recent changes in electrocardiogram morphology.
6. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on SVM according to claim 4, characterized in that, Step S3 specifically includes: after obtaining the first... Q wave origin of the second heartbeat S-wave endpoint and the position of the R wave peak Then, a set of dynamic features for SVM classification is extracted: QRS duration characteristics Recorded as: If necessary, it can be divided by the sampling frequency. Convert it to a time length; Definition of the first The interval between RR cycles for: Calculate the average value based on the previous five RR intervals. Calculate dynamic features To characterize the relative error of the RR intervals, the first five intervals are used as the baseline: Calculate dynamic features This characteristic is the variance of the RR interval, with the most recent interval as the basis. The sample consists of RR intervals: Calculate dynamic features This characteristic is the relative error of the R-wave peak value, with the most recent The sample consists of RR intervals: Let the first The peak amplitude of the R wave per heartbeat is: Average the peak R wave values of the previous 6 heartbeats: The relative error characteristics of the R-wave peak value Defined as: Calculate dynamic features This characteristic is the R-wave peak variance, with the most recent The sample consists of RR intervals: 。 7. The method for dynamic parameter feature extraction and heartbeat abnormality classification based on SVM according to claim 1, characterized in that, Step S4 specifically includes the following steps: S41: Assume the training samples are... ,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: SVM learns the optimal separating hyperplane in the feature space by solving the soft margin maximization problem; the specific optimization model is as follows: in, This is the penalty coefficient, used to adjust the tradeoff between maximizing the margin and training error; and The weight vector and intercept of the hyperplane, respectively, determine the discriminant hyperplane in the original feature space. ; These are slack variables used to allow for controlled misclassification of some difficult-to-classify samples. In the above optimization model, an eigenmap implicitly defined by a kernel function is introduced, and a radial basis function kernel is selected, resulting in the kernel function form: in, For two 3D feature vector; parameters This is the width parameter, used to control the complexity of the decision boundary; Represents the square of the Euclidean distance between two vectors; automatic search through cross-validation. and The combination of these factors is used to achieve optimal generalization performance on the cardiac level discrimination task. S43: In the dual form, the decision function obtained by training RBF-SVM is: in, Let it be the decision function; It is a set of support vectors; For the corresponding dual variables; For training labels; This is the intercept.