A multi-feature auxiliary diagnosis method based on dual-lead ECG signals, terminal and readable storage medium
Through multi-feature extraction and fusion of ECG signals, combined with the SVM classification model, the problem of insufficient template library in ECG signal diagnosis is solved, the accuracy and robustness of diagnosis are improved, and more efficient auxiliary diagnostic parameters are provided.
Patent Information
- Application Number
- CN202410325203.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-21
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-03-21
AI Technical Summary
The current ECG signal diagnosis relies on a preset template library. If the library does not contain enough matching templates, the ECG signal may not be accurately diagnosed.
A multi-feature auxiliary diagnosis method based on dual-lead ECG signals is used to collect ECG signals through hardware devices, perform preprocessing and feature extraction, including the fusion of time features, time-frequency features and spatial features, and use the SVM classification model for diagnosis.
It effectively solves the problem that the template library does not store enough matching templates, improves the accuracy and robustness of ECG signal diagnosis, and provides auxiliary diagnostic parameters with greater information content and higher applicability than a single data model.
Smart Images

Figure CN118285809B
Abstract
Description
Background Art
[0002] Electrocardiogram (ECG), as an important technology for recording cardiac electrophysiological activity, is one of the most commonly used non-invasive diagnostic tools, also known as static electrocardiogram. It represents a comprehensive representation of cardiac electrical activity presented on the body surface and is an objective evaluation standard for the cardiac excitation process, conduction mode and recovery status. The electrocardiogram contains a wealth of information about the basic functions and pathologies of the heart, and can accurately reflect the rhythm and electrical activity of the heart. Therefore, the electrocardiogram plays an important role and significance in the evaluation of cardiac safety and various treatment methods. It is currently one of the most commonly used and most accurate non-invasive means for analyzing and diagnosing various cardiovascular diseases. In most cases, arrhythmia presents as intermittent attacks, that is, it is not a continuous problem. Patients will experience symptoms such as palpitations or irregular heartbeats, chest discomfort, dizziness, dyspnea, fatigue, etc. Many patients usually seek medical treatment only after symptoms such as syncope or loss of consciousness occur, which may delay the best time for diagnosis. The dynamic two-lead electrocardiogram can record various activities in daily life and continuously monitor cardiac electrophysiological activities for a long time, so as to better capture possible intermittent arrhythmias. Long-term dynamic electrocardiogram can provide more comprehensive cardiac electrophysiological information. Long-term electrocardiogram, individual differences of patients and complexity of diseases bring great challenges to doctors in identifying abnormal heartbeats. Long-term work will cause doctors fatigue and easily increase missed detection or misjudgment. In order to help doctors concentrate on judging abnormal ECG waveforms and improve the efficiency of ECG diagnosis, dual-lead ECG automatic analysis technology is applied to ECG analysis, and computer automatic identification is used to assist in the diagnosis of various arrhythmia diseases.
[0003] At present, the diagnosis of ECG signals mainly adopts the preset template matching method. This method requires the establishment of a template library for various arrhythmia diseases. In actual diagnosis, the ECG is divided into segments, each segment is compared with the previously established template library, and the difference is calculated. When the difference is less than the set threshold, the segment is classified into the corresponding template. However, due to the wide variety of abnormal heart rhythms and the huge differences in the performance of the same type of abnormality in individuals, a more complex and diverse template library is needed. If the template library does not contain a sufficient number of matching templates, it may not be possible to accurately diagnose the ECG signal. Summary of the invention
[0004] The present invention provides a multi-feature auxiliary diagnosis method based on dual-lead ECG signals, a terminal and a readable storage medium, so as to at least solve the problem in the prior art that the template library does not contain sufficiently rich matching templates, which may lead to the inability to accurately diagnose the electrocardiogram signal.
[0005] According to one embodiment of the present application, a multi-feature auxiliary diagnosis method based on a dual-lead ECG signal is provided, the method comprising:
[0006] Step 1: construct the functional architecture of the dual-lead arrhythmia auxiliary diagnosis system, and extract the ECG signal in the dual-lead arrhythmia auxiliary diagnosis system;
[0007] Step 2: Collect ECG signals using hardware equipment;
[0008] Step 3: preprocessing the ECG signal;
[0009] The preprocessing method includes: segmenting the ECG signal according to a preset window size and step size; performing data normalization processing on the segmented ECG signal;
[0010] Step 4: extracting the time features, time-frequency features and spatial features of the ECG signal data;
[0011] Step 5: Use weighted addition fusion to fuse the time features, time-frequency features, and spatial features in step 4 to obtain fused features;
[0012] Step 6: Input the fusion features into the SVM classification model to obtain the diagnostic parameters.
[0013] In an exemplary embodiment, the hardware device in step 2 includes: Raspberry Pi, PCF8591 module and AD8232 module;
[0014] Raspberry Pi, PCF8591 module and AD8232 module are connected through DuPont line communication. The AD8232 module is equipped with three probes, which are placed on the left arm, right arm and left leg of the human body respectively to collect the human electrocardiogram signal.
[0015] In an exemplary embodiment, the method of segmenting the heartbeat data according to the preset window size and step size in step 3 further includes:
[0016] Define a heartbeat as 0.6s to 0.8s, set the ECG signal segmentation window to 0.8s, i.e. 288 sampling points; set the step length to 0.6s, i.e. 216 sampling points; construct the ECG signal data set Y with the preset number of heartbeats;
[0017] Normalize the ECG signal data set Y based on the following formula and output the processed data set Y′;
[0018] The normalization formula is:
[0019]
[0020] Where y is the original data of the ECG signal, min(y) represents the minimum value of the ECG sample amplitude, and max(y) represents the maximum value of the ECG sample amplitude.
[0021] In an exemplary embodiment, the step 4 further comprises:
[0022] S401: Extracting time features based on the Informer model:
[0023] S402: Extract spatial features based on SimCLR-ResNet model;
[0024] The feature representation of the SimCLR-ResNet model is connected to the ResNet encoder through a 1×1 convolution. The ResNet encoder extracts the spatial features of the ECG data based on the SimCLR algorithm encoder to achieve dimensionality reduction of the features.
[0025] S403: Extract time-frequency features based on 2D RCNN.
[0026] In an exemplary embodiment, step S401 further includes:
[0027] The probabilistic sparse self-attention mechanism based on the Informer model uses the query matrix Q, key matrix K and value matrix V to calculate the attention A(Q,K,V), where Q, K, d L is the input dimension;
[0028]
[0029] Input the length of ECG signal sequence L, and randomly select Top U (U=L Q LqCy K ), calculate the i-th row vector q of the query matrix i The sparsity formula is as follows:
[0030]
[0031] Where: M(·) is the sparsity measure; for q i and k j The maximum LSE (Log-Sum-Exp) of the inner product; is the arithmetic mean, L k The length of the query vector;
[0032] The distillation operation is used to continuously extract the time features of the ECG data to obtain the features that are of particular interest. The calculation formula of the distillation operation is as follows:
[0033]
[0034] Where: stands for Attention Block; (Conv1d(·) is a 1D-CNN; the ELU(·) activation function performs a one-dimensional convolution filter in the time dimension; MaxPool(·) is a pooling with a stride of 2.
[0035] In an exemplary embodiment, in step S403, the 2D time-frequency diagram of the ECG after wavelet transformation is used as the input of the 2D RCNN model, the time-frequency features are extracted through the backbone network of convolutional layers and pooling layers, and each heart beat is mapped to a feature vector using a pooling operation;
[0036] The wavelet transform formula is as follows:
[0037]
[0038] Among them, ψ a,b is the mother wavelet function, a is the scale factor, and b is the translation factor.
[0039] In an exemplary embodiment, the step five further includes: the formula of weighted addition fusion is expressed as follows:
[0040] C=α·T+β·F+γ·P
[0041] In the formula, C represents the fusion feature in the weighted addition method, T represents the time feature, F represents the time-frequency feature, and P represents the spatial feature; α, β, and γ are all weight coefficients.
[0042] In an exemplary embodiment, the step six further comprises:
[0043] S601: Using the fusion feature as the input of the SVM classification model and the corresponding ECG category as the output, the SVM classification model is established;
[0044] S602: improving the parameter selection process of the SVM classification model by using the GA algorithm, and selecting the optimal penalty factor C and kernel function σ of the SVM classification model;
[0045] Set the GA algorithm population size and number of iterations, and encode the penalty factor C and kernel parameter σ in binary mode;
[0046] S603: Using a 5-fold cross validation method, the average accuracy of the SVM classification model is used as the fitness function; wherein the calculation formula of the average accuracy Acc is:
[0047] Acc=T / n
[0048] Where: T is the total number of correct classifications; n is the total number of samples;
[0049] S604: Use crossover and mutation genetic operators to process the current population and generate the next generation;
[0050] S605: Determine whether the convergence condition is met;
[0051] If satisfied, proceed to the next step, otherwise proceed to step S603;
[0052] S606: Output the optimal parameters of the SVM classification model to implement the GA-SVM classification model construction;
[0053] S607: Obtain classification results.
[0054] According to another embodiment of the present application, a terminal is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a multi-feature auxiliary diagnosis method based on dual-lead ECG signals when executing the program.
[0055] According to another embodiment of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the multi-feature auxiliary diagnosis method based on dual-lead ECG signals are implemented.
[0056] It can be seen from the above technical solutions that the present invention has the following advantages:
[0057] The multi-feature auxiliary diagnosis method based on dual-lead ECG signals provided by the present invention analyzes the morphological features and statistical features of the electrocardiogram signal, and realizes the processing and analysis of the dual-lead ECG signal based on the time features, time-frequency features and spatial features of the electrocardiogram signal. The method of the present invention constructs a functional module architecture for determining the ECG auxiliary diagnosis system. The ECG signal is collected by hardware equipment. The ECG signal is then preprocessed, and the ECG data is segmented and normalized during this stage. Then, the ECG signal with multiple features is extracted, including the time features, time-frequency features and spatial features of the signal. To make up for the deficiency of the single modal feature, the feature is weighted and fused to form a high-dimensional feature. Finally, a classification model is designed and determined, and after the fused feature is input, the diagnostic parameters of the auxiliary diagnosis ECG signal are given. The present invention integrates the ECG signal with multiple features, which can effectively solve the problem that if the template library does not store a sufficiently rich matching template, the ECG signal diagnosis cannot be realized, which leads to the problem that the diagnosis cannot be performed normally. Thus, auxiliary diagnosis parameters with greater information volume, higher applicability and stronger robustness are obtained than those of a single data model. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0059] Figure 1 This is a hardware structure block diagram of a terminal device of the multi-feature auxiliary diagnosis method based on dual-lead ECG signals involved in the present invention;
[0060] Figure 2 It is a flow chart of a multi-feature auxiliary diagnosis method based on dual-lead ECG signals;
[0061] Figure 3 Schematic diagram of an embodiment of a multi-feature auxiliary diagnosis method based on dual-lead ECG signals;
[0062] Figure 4 It is a functional architecture diagram of a dual-lead arrhythmia auxiliary diagnosis system;
[0063] Figure 5 The present invention is a flow chart of an embodiment of a multi-feature auxiliary diagnosis method based on dual-lead ECG signals. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] The multi-feature auxiliary diagnosis method based on dual-lead ECG signals provided in the embodiments of the present application can be executed in a terminal or a similar auxiliary diagnosis device. Taking the terminal as an example, Figure 1 1 is a hardware structure block diagram of a terminal of a processor of an embodiment of the present application for a multi-feature auxiliary diagnosis method based on a dual-lead ECG signal. Figure 1 As shown, the terminal may include one or more ( Figure 1The present invention relates to a processor 101 (only one is shown in the figure) and a memory 102 for storing data. The processor 101 can be implemented by using at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a microcontroller, a microprocessor, an electronic unit designed to perform the functions described herein, and in some cases, such an implementation can be implemented in a controller. For software implementation, an implementation such as a process or function can be implemented with a separate software module that allows execution of at least one function or operation.
[0066] The terminal may further include a communication module 103 and an input / output device 104 for communication functions. The input / output device 104 may include a printer, a liquid crystal display (LCD), a touch screen display, a keyboard, a mouse, a trackball, and a paper tape reader. The communication module 103 may be a modem, an Ethernet card, a universal serial bus (USB) interface card, etc.
[0067] This embodiment also stores the execution program corresponding to the multi-feature auxiliary diagnosis method based on the dual-lead ECG signal in the memory 102 for the processor 101 to call and execute. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0068] The multi-feature auxiliary diagnosis method based on dual-lead ECG signals provided in this embodiment is: Figure 2 is a flow chart of a multi-feature auxiliary diagnosis method based on a dual-lead ECG signal executed by a processor in an embodiment of the present application, such as Figure 2 and 3 As shown, the process includes the following steps:
[0069] S101: Construct a functional architecture of a dual-lead arrhythmia auxiliary diagnosis system, and extract electrocardiogram signals in the dual-lead arrhythmia auxiliary diagnosis system.
[0070] In an exemplary embodiment, Figure 4As shown, the dual-lead arrhythmia auxiliary diagnosis system is a medical device that can detect heart rate information and then monitor abnormalities in the heart rate information, that is, arrhythmia.
[0071] It should be noted that arrhythmia refers to an abnormal rate or rhythm of the heart's beating. The dual-lead system can use two electrodes to simultaneously record the heart's electrical activity. These electrodes are placed in specific parts of the patient's body to capture the heart's electrical signals. By comparing and analyzing the electrocardiogram (ECG) signals recorded by the two leads (i.e., the two electrodes), more ECG signals about the heart's electrical activity can be obtained and displayed for doctors to view and use.
[0072] In the above embodiment, the functional architecture of the dual-lead arrhythmia auxiliary diagnosis system may include hardware and software components. The hardware components include electrodes, wires, amplifiers, and recording devices for capturing and transmitting the heart's electrocardiogram signals. The software components are responsible for processing and analyzing these signals, generating electrocardiograms, and may provide the function of automatically detecting arrhythmias.
[0073] The functional architecture of the dual-lead arrhythmia auxiliary diagnosis system in this embodiment can be used to record the electrical activity of the heart. This is based on the fact that the electrical stimulation in the heart is initially at the sinoatrial node, which can be the pacemaker of a normal heart rate, and the electrical excitation is transmitted to the bilateral atria, causing atrial depolarization. The electrical excitation is then transmitted to the atrioventricular node through the interatrial bundle, where there will be a short delay, and then the electrical excitation is transmitted through the His bundle, the left and right bundle branches, and the Purkinje fibers to reach the ventricle.
[0074] It can be seen that the myocardial membrane is stimulated, causing the movement of positive and negative ions inside and outside the membrane, triggering a chain of potential fluctuations, causing a potential difference, realizing induction detection, and collecting potential difference data at different parts of the human body through hardware components. The ECG signal can be displayed in the form of a waveform curve in this embodiment.
[0075] S102: Collecting ECG signals using hardware equipment.
[0076] In this embodiment, the hardware device includes: Raspberry Pi, PCF8591 module and AD8232 module.
[0077] It should be noted that each generation of Raspberry Pi, as a series of computers, uses an ARM architecture processor produced by Broadcom. Its memory is between 2GB and 8GB, and a TF card can be used as the system storage medium.
[0078] The Raspberry Pi of this embodiment is equipped with a USB interface and HDMI video output, and has built-in Ethernet / WLAN / Bluetooth network connection methods. In this way, the Raspberry Pi can use a variety of operating systems, and this embodiment is a single-chip computer based on Linux, its processor is ARM architecture, and mainly uses SD card or TF card as storage media. Its latest system is pre-installed with python3.7 and supports tensorflow2.0, which provides convenience for deployment.
[0079] In an exemplary embodiment, the PCF8591 module is a commonly used analog-to-digital conversion chip. The ECG module collects analog signals from the human body and transmits them to the PCF8591 module, which then converts them into digital signals as inputs to the model.
[0080] In an exemplary embodiment, the AD8232 module is an integrated signal conditioning module for ECG and other biopotential measurement applications. The device is designed to extract, amplify, and filter weak biopotential signals in the presence of noise generated by motion or remote electrode placement. The design allows an ultra-low power analog-to-digital converter (ADC) or embedded microcontroller to easily acquire the output signal.
[0081] In this embodiment, the Raspberry Pi, the PCF8591 module and the AD8232 module are connected via DuPont cables. The AD8232 module has three probes, which are placed on the left arm, the right arm and the left leg of the human body to collect ECG signals.
[0082] S103: Preprocessing the ECG signal.
[0083] The preprocessing method includes: segmenting the ECG signal according to a preset window size and step size; and performing data normalization processing on the segmented ECG signal.
[0084] S104: Extracting time features, time-frequency features, and spatial features of the ECG signal data.
[0085] S105: The time features, time-frequency features and space features in step 4 are fused by weighted addition fusion to obtain fused features.
[0086] S106: Input the fused features into the SVM classification model to obtain diagnostic parameters.
[0087] In the above embodiment, the SVM classification model is used to obtain the diagnostic parameters. The SVM classification model (Support Vector Machine) involved here is a binary classification model, and the SVM classification model is a linear classifier with the largest interval defined in the feature space. The learning strategy of the SVM classification model is to maximize the interval, which can eventually be converted into the solution of a convex quadratic programming problem. The classification principle of the SVM classification model is to find an optimal hyperplane so that the hyperplane can separate samples of different categories, and the distance between the hyperplane and the nearest samples on both sides is required to be maximized.
[0088] Among them, the SVM classification model involved in the multi-feature auxiliary diagnosis method based on dual-lead ECG signals in this embodiment is a linearly separable support vector machine. The SVM classification model can train data to be approximately linearly separable, that is, there are some special points, and the samples after removing these special points are linearly separable.
[0089] In the SVM classification model involved in the multi-feature auxiliary diagnosis method of this embodiment, the support vector is the sample point in the training data set that plays a decisive role in the classification decision. The optimal hyperplane and the corresponding support vector can be found by solving the convex quadratic programming problem, thereby constructing the SVM classification model.
[0090] In the above embodiment, the multi-feature auxiliary diagnosis method extracts multi-feature ECG signals, makes up for the shortcomings of single modal features, and fuses the features by weighted addition to form a high-dimensional feature. Finally, a classification model is designed and determined, and after the fused features are input, the diagnostic parameters for auxiliary diagnosis of ECG signals are given. The present invention integrates multi-feature ECG signals, which can effectively solve the problem that if the template library does not store a sufficient number of matching templates, the diagnosis of ECG signals cannot be achieved, which leads to the problem that normal diagnosis cannot be performed. Thereby, an auxiliary diagnosis method with greater information content, higher applicability, and stronger robustness is obtained than a single data model.
[0091] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0092] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process in this embodiment, a specific multi-feature auxiliary diagnosis method based on a dual-lead ECG signal is provided, the method comprising:
[0093] S201: Construct a functional architecture of a dual-lead arrhythmia auxiliary diagnosis system, and extract electrocardiogram signals in the dual-lead arrhythmia auxiliary diagnosis system.
[0094] S202: Collecting ECG signals using hardware equipment.
[0095] S203: Preprocessing the ECG signal.
[0096] In an exemplary embodiment, the preprocessing process is to segment the heartbeat data according to a preset window size and step size. The segmentation method is based on a complete heartbeat of 0.6s to 0.8s. This is because some arrhythmia diseases are difficult to be identified within a heartbeat, so the ECG signal segmentation window is set to 0.8s, i.e. 288 sampling points. The step size is 0.6s, i.e. 216 sampling points; this ensures the correlation characteristics between adjacent heartbeats.
[0097] Optionally, 10 complete heart beats may be combined into an ECG signal data set Y.
[0098] In this embodiment, the ECG signal data set Y is further processed in a normalized manner, and the processed data set Y′ is output; each ECG signal segment y is normalized by the following formula:
[0099]
[0100] Where y is the original data of the ECG signal, min(y) represents the minimum value of the ECG sample amplitude, and max(y) represents the maximum value of the ECG sample amplitude.
[0101] It should be noted that the normalization processing method takes into account that the electrocardiogram (ECG) signal is collected from a variety of sensors, resulting in large differences between each detection method and the value, which easily leads to increased errors. Therefore, the electrocardiogram (ECG) signal needs to be normalized and scaled proportionally so that the normalization processing is within the preset threshold range. This can speed up the convergence of the deep model and achieve the optimal value.
[0102] S204: Extracting time features, time-frequency features, and spatial features of the ECG signal data.
[0103] This embodiment specifically uses the following steps to extract features from ECG signal data:
[0104] S401: Extracting time features based on the Informer model.
[0105] In this embodiment, since the LSTM (Long Short-Term Memory) recurrent neural network (RNN) architecture uses the back propagation algorithm when calculating the loss function, as the sequence length increases, it becomes difficult to calculate the gradient, making it difficult for the model to converge. Informer does not need to calculate the attention of each point with other points in a long sequence, so it has better parallelism and global information processing capabilities.
[0106] It should be noted that Informer is a model designed for long-series time series prediction. It uses a variant of the self-attention mechanism and performs calculations based on some key queries (i.e., sparse), which significantly reduces the amount of calculation and memory usage. In this way, Informer's probabilistic sparse self-attention mechanism is conducive to capturing the characteristics of ECG signal sequences.
[0107] In this embodiment, in order to more effectively extract the temporal features of ECG data, two probabilistic sparse self-attention mechanisms are used to extract the features of long time series and short time series of ECG data respectively. Probabilistic sparsity can ensure that the model focuses on the extraction of important features, avoiding unnecessary computational overhead and information redundancy, and helping to more accurately analyze ECG data and discover its laws and features.
[0108] It should be noted that the probabilistic sparse attention mechanism uses the query matrix Q, the key matrix K and the value matrix V to calculate the attention A(Q,K,V), where Q, K, d L is the input dimension.
[0109]
[0110] Input the length of ECG signal sequence L, and randomly select Top U (U=L Q LqCy K ), calculate the i-th row vector q of the query matrix i The sparsity formula is as follows:
[0111]
[0112] Where: M(·) is the sparsity measure; Q i and k j The maximum LSE (Log-Sum-Exp) of the inner product; is the arithmetic mean, L k The length of the query vector.
[0113] However, the ProbSparse (sparse) autocorrelation mechanism uses the mean of V to fill in, so there will be redundant attention sources. We apply convolution and pooling between adjacent attention blocks to downsample the features to solve this problem. The distillation operation is used to continuously extract the time features of the ECG data to obtain the features that are focused on. The calculation formula of the distillation operation is as follows:
[0114]
[0115] Where: stands for Attention Block, which includes multi-head ProbSparse sub-correlation; (Conv1d(·) is 1D-CNN; ELU(·) activation function performs a one-dimensional convolution filter in the time dimension; MaxPool(·) is a pooling with stride 2.
[0116] S402: Extract spatial features based on the SimCLR-ResNet model.
[0117] It should be noted that the SimCLR (self-supervised learning contrast) model learns more discriminative and robust feature representations through contrastive learning. Since CNN (convolutional neural network) may encounter problems such as gradient disappearance, network degradation, and overfitting as the number of network layers increases, ResNet (residual network) was selected to introduce the residual block structure. ResNet uses residual connections to allow signals to skip some layers for transmission, effectively alleviating the gradient problem; helping the model to better learn the features in the deep network; and improving the efficiency and generalization ability of the model.
[0118] The ECG data is transformed through a one-dimensional encoder and a projection head to extract the features of the sample. The entire network is trained to maximize the similarity of positive sample pairs through contrast loss. After pre-training, the one-dimensional encoder and the extracted feature representation are used for downstream tasks. The similarity calculation formula is as follows:
[0119]
[0120] Where: sim(z i ,z j ) is the cosine similarity calculation; z i , z j The features extracted and obtained by the multi-layer perceptron; For z i The transpose of ||z i ||2 and ||z j ||2 are z i , z j Model.
[0121] The SimCLR model maximizes the feature distance between the input sample and the positive sample, while minimizing the feature distance between the input sample and the negative sample. The cross entropy loss function is selected for the model to achieve better learning to distinguish the two types of samples. The contrast loss formula is as follows:
[0122]
[0123] Where: l(i,j) is the cross entropy loss function; exp is the exponential function; sim(z i ,z j ) is z i , z j The cosine similarity of [q≠i] ∈{0,1} is an indicator function, whose value is 1 if and only if q≠i; τ is an adjustable parameter, whose value is 1.
[0124] Finally, the final loss function is used to measure the performance of the contrastive learning task. The final loss function formula is as follows:
[0125]
[0126] Where: L is the final loss function; N is the number of data blocks; l is the cross entropy loss function; q represents the number of data blocks.
[0127] The feature representation based on the SimCLR model is connected to the ResNet encoder through a 1×1 convolution. The ResNet encoder extracts the spatial features of the ECG data based on the SimCLR algorithm encoder. The 1×1 convolution reduces the dimension of the feature representation, reduces overfitting, and improves the accuracy of the model with a small amount of training data.
[0128] S403: Extract time-frequency features based on 2D RCNN.
[0129] This embodiment is based on the idea of localization of short-time transformation inherited from wavelet transform. This method can overcome the defect of constant time window size and provide a time-frequency window whose window width can be widened or narrowed with frequency transformation, thereby fully highlighting some important features of the signal.
[0130] It should be noted that a mother wavelet of finite length or fast decay is first constructed, and a series of daughter wavelets are generated by scaling and translation, which are superimposed to match the input signal. The scaling scale and translation parameters are respectively mapped to the frequency and time parameters, and finally the time-frequency diagram of the signal is obtained.
[0131] In this embodiment, the 2D time-frequency diagram of the ECG after wavelet transformation is used as the input of the 2D RCNN (regional convolutional neural network) model, the time-frequency features are extracted through the backbone network of convolutional layers and pooling layers, and finally each heartbeat is mapped to a feature vector using a pooling operation.
[0132] It should be noted that the wavelet transform formula is as follows:
[0133]
[0134] Among them, ψ a,b is the mother wavelet function, a is the scale factor, and b is the translation factor.
[0135] S205: The time features, time-frequency features and space features in step 4 are fused by weighted addition fusion to obtain fused features.
[0136] In this embodiment, the formula of weighted addition fusion is expressed as follows:
[0137] C=α·T+β·F+γ·P
[0138] In the formula: C represents the fusion feature in the weighted addition method, T represents the time feature, F represents the time-frequency feature, P represents the spatial feature; α, β, γ are weights.
[0139] Step 6: Input the fusion features into the SVM classification model to obtain the diagnostic parameters.
[0140] In an exemplary embodiment, Figure 5 As shown in Figure 1, SVM is a supervised classification method that can effectively overcome the limitation of too few data samples and has a good classification effect. ECG classification type belongs to the nonlinear problem of multi-classification. Through the kernel function K(x i ,x j )The sample data can be converted into a high-dimensional space.
[0141] The kernel function is the radial basis function, and the formula is as follows:
[0142]
[0143] Where: σ is the kernel parameter.
[0144] By introducing the Lagrange function, the optimal hyperplane search process is converted into an optimization problem:
[0145]
[0146]
[0147] Where: α i is the Lagrange multiplier; C is the penalty factor.
[0148] The classification decision function can be obtained by solving the above equation:
[0149] f(x)=sgn[α i y i K(x i ,x)+b]
[0150] S601: Use the fused feature data as the input of SVM and the corresponding ECG category as the output to establish an SVM classification model.
[0151] S602: Improve the SVM parameter selection process through the GA algorithm to select the optimal SVM penalty factor C and kernel function σ.
[0152] In this embodiment, the population size and the number of iterations of the GA algorithm may be set, and the parameters C and σ may be encoded in a binary manner.
[0153] S603: Using the 5-fold cross validation method, the average accuracy of the SVM classification model is used as the fitness function, and the accuracy calculation formula is:
[0154] Acc=T / n
[0155] Where: T is the total number of correct classifications; n is the total number of samples.
[0156] S604: Use crossover and mutation genetic operators to process the current population and generate the next generation.
[0157] S605: Determine whether the convergence condition is met. If so, proceed to the next step, otherwise proceed to step S603.
[0158] S606: Output the optimal SVM parameters to implement the GA-SVM classification model construction.
[0159] S607: Obtain classification results.
[0160] The above-mentioned multi-feature auxiliary diagnosis method involved in this embodiment integrates multi-feature ECG signals, which can effectively solve the problem that if the template library does not store enough matching templates, the ECG signal diagnosis cannot be realized, which leads to the problem that the diagnosis cannot be performed normally. Thus, an auxiliary diagnosis method with greater information content, higher applicability and stronger robustness is obtained than a single data model.
[0161] An embodiment of the present application further provides a readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of the above-mentioned multi-feature auxiliary diagnosis method based on dual-lead ECG signals when running.
[0162] In an exemplary embodiment, the readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0163] Those skilled in the art will appreciate that various aspects of the multi-feature auxiliary diagnosis method based on dual-lead ECG signals can be implemented as a system, method or program product. Therefore, various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, which can be collectively referred to as a "circuit", "module" or "system" here.
[0164] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A multi-feature auxiliary diagnosis method based on dual-lead ECG signals, Characterized in that the method include: Step 1: construct the functional architecture of the dual-lead arrhythmia auxiliary diagnosis system, and extract the ECG signal in the dual-lead arrhythmia auxiliary diagnosis system; Step 2: Collect ECG signals using hardware equipment; Step 3: preprocessing the ECG signal; The preprocessing method includes: segmenting the ECG signal according to a preset window size and step size; performing data normalization processing on the segmented ECG signal; Step 4: extracting the time features, time-frequency features and spatial features of the ECG signal data; S401: Extracting time features based on the Informer model: The probabilistic sparse self-attention mechanism based on the Informer model uses the query matrix Q, key matrix K and value matrix V to calculate the attention A(Q, K, V), where d L is the input dimension; Input the length of ECG signal sequence L, and randomly sample and select Top U, U=L Q LqCy K an important position; Where: Top U is the U positions randomly selected from the ECG signal sequence; L Q is the length of the query vector; L K is the length of the key vector; Calculate the i-th row vector q of the query matrix i The sparsity formula is as follows: Where: M(·) is the sparsity measure; q i is the query vector; k j is the key vector, k j The transpose of is the square root of the vector dimension; for q i and k j The maximum LSE (Log-Sum-Exp) of the inner product; is the arithmetic mean, L k The length of the query vector; The distillation operation is used to continuously extract the time features of the ECG data to obtain the features that are of particular interest. The calculation formula of the distillation operation is as follows: Where: stands for Attention Block; Conv1d(·) is a 1D-CNN; the ELU(·) activation function performs a one-dimensional convolution filter in the time dimension; MaxPool(·) is a pooling with a stride of 2; S402: Extracting spatial features based on SimCLR-ResNet model; The feature representation of the SimCLR-ResNet model is connected to the ResNet encoder through a 1×1 convolution. The ResNet encoder extracts the spatial features of the ECG data based on the SimCLR algorithm encoder to achieve dimensionality reduction of the features. S403: Extract time-frequency features based on 2D RCNN; The 2D time-frequency diagram of ECG after wavelet transformation is used as the input of the 2D RCNN model, and the time-frequency features are extracted through the backbone network of convolutional layers and pooling layers. Each heartbeat is mapped to a feature vector using the pooling operation. The wavelet transform formula is as follows: Among them, ψ a,b is the mother wavelet function, a is the scale factor, b is the translation factor, t is the time variable, f(t) is the signal to be analyzed, is the mother wavelet function after scaling and translation; Step 5: Use weighted addition fusion to fuse the time features, time-frequency features, and spatial features in step 4 to obtain fused features; Step 6: Input the fusion features into the SVM classification model to obtain the diagnostic parameters.
2. The multi-feature auxiliary diagnosis method based on dual-lead ECG signals according to claim 1, It is characterized in that The hardware equipment in step 2 includes: Raspberry Pi, PCF8591 module and AD8232 module; Raspberry Pi, PCF8591 module and AD8232 module are connected through DuPont line communication. The AD8232 module is equipped with three probes, which are placed on the left arm, right arm and left leg of the human body respectively to collect the human electrocardiogram signal.
3. The multi-feature auxiliary diagnosis method based on dual-lead ECG signals according to claim 1, It is characterized in that The method of segmenting the heartbeat data according to the preset window size and step length in step 3 also includes: Define a heartbeat as 0.6s to 0.8s, set the ECG signal segmentation window to 0.8s, i.e. 288 sampling points; set the step length to 0.6s, i.e. 216 sampling points; construct the ECG signal data set Y with the preset number of heartbeats; The ECG signal dataset Y is normalized based on the following formula, and the processed dataset Y is output ′ ; The normalization formula is: Where y is the original data of the ECG signal, min(y) represents the minimum value of the ECG sample amplitude, and max(y) represents the maximum value of the ECG sample amplitude.
4. The multi-feature auxiliary diagnosis method based on dual-lead ECG signals according to claim 1 or 3, It is characterized in that The step five also includes: the formula of weighted addition fusion is expressed as follows: C=α·T+β·F+γ·P In the formula, C represents the fusion feature in the weighted addition method, T represents the time feature, F represents the time-frequency feature, and P represents the spatial feature; α, β, and γ are all weight coefficients.
5. The multi-feature auxiliary diagnosis method based on dual-lead ECG signals according to claim 1 or 3, It is characterized in that The step six also includes: S601: Using the fusion feature as the input of the SVM classification model and the corresponding ECG category as the output, the SVM classification model is established; S602: improving the parameter selection process of the SVM classification model by using the GA algorithm, and selecting the optimal penalty factor C and kernel function σ of the SVM classification model; Set the GA algorithm population size and number of iterations, and encode the penalty factor C and kernel parameter σ in binary mode; S603: Using a 5-fold cross validation method, the average accuracy of the SVM classification model is used as the fitness function; wherein the calculation formula of the average accuracy Acc is: Acc=T / n Where: T is the total number of correct classifications; n is the total number of samples; S604: Use crossover and mutation genetic operators to process the current population and generate the next generation; S605: Determine whether the convergence condition is met; If satisfied, proceed to the next step, otherwise proceed to step S603; S606: Output the optimal parameters of the SVM classification model to implement the GA-SVM classification model construction; S607: Obtain classification results.
6. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps of the multi-feature auxiliary diagnosis method based on dual-lead ECG signals as described in any one of claims 1 to 5 are implemented.
7. A readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the multi-feature auxiliary diagnosis method based on dual-lead ECG signals as described in any one of claims 1 to 5 are implemented.
