A sub-waveform recognition method and system for electrocardiogram
By combining the fully convolutional network and the particle swarm algorithm, the accuracy and speed issues of neutron waveform recognition in automatic ECG analysis were solved, more efficient multi-label overlap detection was achieved, and the accuracy and speed of ECG recognition were improved.
Patent Information
- Application Number
- CN202310255110.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2043-03-13
AI Technical Summary
Existing technologies for automatic ECG analysis, especially for the recognition of sub-waveforms in dynamic electrocardiograms, suffer from low accuracy and slow inference speed. In particular, when the amount of data is large, it is difficult to effectively detect sub-waveforms with overlapping multiple labels.
Full convolution technology is combined with particle swarm optimization and non-maximum suppression method to extract the feature vector of the electrocardiogram through a fully convolutional network. The particle swarm optimization algorithm is used to perform global optimal search for the feature threshold, and the non-maximum suppression method is used to decode the position and category of the sub-waveform.
The accuracy of sub-waveform recognition is improved while maintaining a faster inference speed, solving the problem of multi-label overlap and achieving higher recognition efficiency.
Smart Images

Figure CN116458895B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of waveform recognition, and in particular relates to a sub-waveform recognition method and system applied to an electrocardiogram. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Electrocardiograms (ECGs) are undulating curves measured by an electrocardiograph (ECG) that describe heart activity. Changes in the electrical potential within these waves represent changes in the heart's electrical activity and, consequently, the heart's various activities. Analysis of ECG-related data is crucial for advancing intelligent healthcare services, improving their quality, and reducing treatment response times.
[0004] In automated ECG analysis, sub-waveforms that need to be detected include P waves, QRS waves, T waves, U waves, F waves, and pacing spikes. Accurately detecting these sub-waveforms provides crucial parameters for disease diagnosis, such as QRS wave frequency and interval size. Figure 1 Figure 1 is a labeled example of an electrocardiogram (ECG) wave, where each shaded bar represents a sub-waveform.
[0005] The waveforms presented vary greatly depending on the patient's condition, and the same sub-waveform may have multiple overlapping labels. This is especially true for dynamic electrocardiograms, which are often on the order of 24 hours. The amount of data is large, and the inference speed is crucial.
[0006] There are also some related studies on the detection of various sub-waveforms of ECG waveforms. Using morphological methods to detect the peaks of various types, thereby detecting the presence of such waves, is a common method. Using CNN modules to extract time-domain features and wavelets to extract frequency-domain features is a common method that requires a high level of professional knowledge. Alternatively, there are methods that combine CNN modules with RNN modules to extract waveform feature representations, and then perform post-processing decoding using NMS (non-maximum suppression) or CRF (conditional random fields) to determine the region and category of the sub-waveform. However, the introduction of RNN modules can significantly reduce the inference speed, affecting the efficiency of sub-waveform recognition. Summary of the Invention
[0007] To overcome the deficiencies of the above-mentioned prior art, the present invention provides a sub-waveform recognition method and system for electrocardiograms. A sub-waveform recognition model is proposed by applying full convolution technology. This model combines the noise resistance and parallelism of the convolution module, and sets a perception field that meets actual medical needs. Ultimately, it achieves a higher accuracy than traditional mainstream methods, while also providing a faster inference speed. Moreover, through a post-processing module with non-maximum suppression as the core, it solves the problem that multiple labels may overlap for the same sub-waveform.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] A first aspect of the present invention provides a sub-waveform recognition method applied to an electrocardiogram;
[0010] A sub-waveform recognition method applied to an electrocardiogram, comprising:
[0011] Preprocessing the collected ECG data to obtain a training data set, and training the sub-waveform recognition model based on the training data set;
[0012] The training data set is inferred to obtain the characteristic vector of the electrocardiogram. Based on the particle swarm algorithm, a global optimal search is performed on the characteristic thresholds of various sub-waveforms in the characteristic vector to obtain the optimal thresholds of various sub-waveforms.
[0013] Input the ECG wave data to be identified into the trained sub-waveform recognition model to obtain the ECG wave feature vector;
[0014] Based on the optimal threshold of each sub-waveform, the non-maximum suppression method is used to decode the feature vector of the ECG data to obtain the position and category of the sub-waveform.
[0015] Furthermore, the training data set includes electrocardiogram data, sub-waveforms annotated in the electrocardiogram data, and multi-lead voltage value vectors corresponding to the electrocardiogram data;
[0016] The sub-waveform recognition model takes electrocardiogram data as input and takes the characteristic vector of the electrocardiogram as output.
[0017] Furthermore, the feature vector of the electrocardiogram is composed of the activation feature vector, overlapping feature vector, starting distance feature vector, ending distance feature vector, and regression distance feature vector of each category corresponding to each wave point;
[0018] The element values of the activation feature vector and the overlapping feature vector are 1 / 0, indicating whether they are activation points and overlapping points; the starting distance feature vector is composed of the distance between the activation point and the starting point; the ending feature vector is composed of the distance between the activation point and the ending point; and the regression feature vector is composed of the distance between the activation point and the single waveform point.
[0019] Furthermore, the particle swarm algorithm is used to perform a global optimal search for the characteristic thresholds of various sub-waveforms, where the characteristic thresholds include activation thresholds, overlap thresholds, and length thresholds of various waves. The specific steps are as follows:
[0020] Set the parameters of the particle swarm algorithm: the number of random particles N, the number of iterations, and the particles are represented as:
[0021] X i =(x i1 ,x i2 ,…,x iD ), i=1,2,…,N
[0022] Among them, X i Represents the i-th particle, which is a random vector of dimension D, where D is the number of thresholds to be optimized, x i1 ,x i2 ,…,x iD Represent the 1st, 2nd, ..., Dth feature thresholds respectively;
[0023] Bring each particle into the effect evaluation function to calculate the individual optimal solution found by each particle and the global optimal solution of the entire community;
[0024] Iteratively update the velocity and position of each particle and evaluate the effect until the iteration count is reached;
[0025] When the number of iterations ends, the global optimal solution of the entire community is obtained, and its corresponding vector is the various optimal thresholds searched.
[0026] Furthermore, the sub-waveform recognition model is based on full convolution technology, which extracts features through downsampling by the encoder and then fuses multi-level features through upsampling by the decoder to obtain corresponding feature vectors.
[0027] Furthermore, the loss function of the sub-waveform recognition model is the sum of the average values of the classification loss and the regression loss in units of sub-waveforms;
[0028] The classification loss is the loss calculation of binary classification based on the activation point features, overlapping point features, and classification labels of the sub-waveforms;
[0029] The regression loss is calculated by using the starting point features, the ending point features, and the regression point features of the sub-waveform.
[0030] Furthermore, the non-maximum suppression method is used to decode the characteristic vector of the electrocardiogram to obtain the category and position of the sub-waveform on the electrocardiogram, specifically:
[0031] When the value of the overlapping feature is greater than the overlapping threshold, the value of the activation feature is set to 0, that is, the distance feature of the point does not participate in the position calculation of the boundary point of the sub-waveform; when the value of the activation feature is greater than the activation threshold, the distance feature of the point participates in the position calculation of the boundary point of the sub-waveform; when the number of continuous classification points greater than the activation threshold is greater than the length threshold, these continuous classification points can become a waveform.
[0032] A second aspect of the present invention provides a sub-waveform recognition system for electrocardiograms.
[0033] A sub-waveform recognition system for electrocardiograms includes a model training module, a threshold optimization module, an inference feature module, and a waveform post-processing module:
[0034] The model training module is configured to: pre-process the collected ECG data to obtain a training data set, and train the sub-waveform recognition model based on the training data set;
[0035] The threshold optimization module is configured to: infer the feature vector of the ECG wave from the training data set, and perform a global optimal search for the feature thresholds of various sub-waveforms in the feature vector based on the particle swarm algorithm to obtain the optimal thresholds for each sub-waveform;
[0036] The inference feature module is configured to: input the ECG wave data to be identified into the trained sub-waveform recognition model to obtain a feature vector of the ECG wave;
[0037] The waveform post-processing module is configured to decode the feature vector of the electrocardiogram data based on the optimal threshold of each sub-waveform and adopt the non-maximum suppression method to obtain the position and category of the sub-waveform.
[0038] A third aspect of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps of the sub-waveform recognition method applied to an electrocardiogram as described in the first aspect of the present invention.
[0039] The fourth aspect of the present invention provides an electronic device, comprising a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps of a sub-waveform recognition method applied to an electrocardiogram as described in the first aspect of the present invention are implemented.
[0040] One or more of the above technical solutions have the following beneficial effects:
[0041] To address the problem of ECG waveform classification, this paper creatively uses full convolution technology to propose a deep learning model suitable for ECG sub-waveform recognition, which not only achieves a very competitive accuracy rate but also ensures a good inference speed of the model.
[0042] The present invention uses a particle swarm algorithm to perform optimal search for threshold values of various types, thereby improving the classification accuracy of the model without affecting the reasoning speed of the model.
[0043] Advantages of additional aspects of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0045] Figure 1 This is a labeled sample image of an ECG band.
[0046] Figure 2 This is a flow chart of the method of the first embodiment.
[0047] Figure 3 Generate a graph for the data features of an ECG point.
[0048] Figure 4 This is a training graph of the sub-waveform recognition model of the first embodiment.
[0049] Figure 5 This is the inference flow chart of the sub-waveform recognition model of the first embodiment.
[0050] Figure 6 This is a system structure diagram of the second embodiment. DETAILED DESCRIPTION
[0051] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0052] Example 1
[0053] This embodiment discloses a sub-waveform recognition method applied to an electrocardiogram;
[0054] like Figure 2 As shown, a sub-waveform recognition method applied to an electrocardiogram includes:
[0055] Step S1: Preprocess the collected ECG multi-lead data to obtain a training data set, and train the sub-waveform recognition model based on the training data set. The specific steps are as follows:
[0056] Step S101: Collect data
[0057] The data used in this example is 500 Hz, mostly 10-20 seconds long, and 12-lead two-dimensional data. Its dimensions are expressed as [N, L], where N represents the number of collected ECG leads and L represents the length of the band. Each point in the ECG wave represents a voltage value, which corresponds to a pixel value in the field of image processing.
[0058] Figure 1 is a labeled sample diagram of electrocardiogram, such as Figure 1 As shown, each shaded area represents an annotated sub-waveform instance. P waves, QRS waves, U waves, and T waves have large spans and distinct starting and ending points. These are treated as bilateral sub-waveforms, with their initial features represented as [starting point, ending point]. F waves and pacers have difficult starting and ending points, so their drastically changing points are used as feature points. These are treated as unilateral sub-waveforms, with their initial features represented as [regression point]. This generates annotated boxes for unilateral and bidirectional sub-waveforms.
[0059] Step S102: Data preprocessing, generating a feature vector of the ECG wave from the labeled boxes of the sub-waveforms.
[0060] After the ECG data is processed by baseline removal and then manually labeled, the training data set is obtained. Specifically:
[0061] Since the activation area of the unilateral sub-waveform has only one point, in order to facilitate the extraction of the feature representation and unified representation of the feature vector of the surrounding points on the activation point, the boundaries of the unilateral sub-waveform and the bilateral sub-waveform are expanded. At this point, the unilateral and bilateral sub-waveforms each form their own activation box.
[0062] In order to facilitate the representation of the activation box of the sub-waveform in the model, we extract its initial features to form a feature vector to uniformly represent the electrocardiogram. The features of the bilateral sub-waveform include the activation feature representing the activation point, the overlapping feature representing the overlap with the same sub-waveform, the starting distance feature representing the starting point, and the ending distance feature representing the ending point, a total of 4 features; the features of the unilateral waveform include the activation feature representing the activation point, the overlapping feature representing the overlap with the same sub-waveform, and the regression distance feature representing the regression point, a total of 3 features, which ultimately form the feature vector of the wave point as shown in the figure below. Figure 3 As shown, each wave point is represented as a 22-dimensional feature vector.
[0063] The activation features and overlapping features generated by manual labels have values of 1 / 0, which is a classification problem. The prediction of the starting distance feature, ending distance feature, and regression distance feature is a regression problem, and the regression feature calculation method is as follows.
[0064]
[0065] In the above formula, i represents the id number of the sub-waveform activation box, Indicates the starting point position of the bilateral sub-waveform (or the regression point position of the unilateral sub-waveform) and the ending point position, s * Indicates the starting distance characteristic value of the activation point, e * Represents the termination distance characteristic value of the activation point, r * Indicates the regression distance trait value of the activation point.
[0066] At this point, the feature vector involved in model training is generated by manual labels, and its dimension is expressed as [22, L], where L represents the length of the electrocardiogram wave.
[0067] Step S103: Training of sub-waveform recognition model
[0068] The data in the training dataset is input into the sub-waveform recognition model for training and reasoning. The model architecture process is as follows: Figure 4 As shown, specifically:
[0069] (1) In order for the model to obtain integers during downsampling, the input data is padded to a multiple of 512, so that the model can obtain a receptive field of more than 7 seconds, which is consistent with medical recommendations. For the sake of simplicity in the following description, the length of the data after padding is called the data length, and the actual length of the data is called the true value length.
[0070] (2) After the data is input into the model, it will first undergo a multi-scale convolution. The sizes of the convolution kernels are 1*3, 1*5, 1*7, and 1*9, namely Encoder0. The convolution kernels are connected in parallel to fully extract the data features of the electrocardiogram. After maximum pooling, the data length becomes 1 / 2 of the original.
[0071] (3) The data enters encoders Encoder1, Encoder2, Encoder3, and Encoder4 in sequence. The internal structures of these four encoders are basically the same. After entering each encoder, the data will be sequentially subjected to convolution matrix calculation. The convolution kernel sizes refer to the ResNet network design, which are 1*1, 1*5, and 1*1, respectively, in series mode. When the convolution kernel size is 1*5, the data length is reduced to 1 / 4 of the original by setting the calculation step size to 4. Considering the time complexity of each layer, when the data length is reduced, the number of convolution kernels is increased to 4 times the original number in the next calculation. After serial processing by these encoders, the data length becomes 1 / 512 of the original data.
[0072] (4) The data enters the CenterBlock module. The size of the convolution kernel in CenterBlock essentially determines the receptive field of view of the model. For practical purposes, a 1x7 convolution kernel is selected. The data length remains unchanged in this module, at 1 / 512 of the original data.
[0073] (5) The data enters decoder Decoder4, Decoder3, Decoder2, Decoder1, and Decoder0 in sequence; the internal structures of these five encoders are basically the same, such as Figure 3 As shown in the figure, except that the amplification factor in Decoder0 is 2 times, in order to restore the original length of the data; after entering each decoder, the data will be serially calculated through convolution in sequence, and the convolution kernel size is designed to be 1*5 and 1*5; when the data just enters the decoder, in order to perform the splicing operation with the corresponding encoder output, the data length must first be expanded to 4 times the original length (except Decoder0) to align with the corresponding encoder output length; considering the time complexity of each layer, when the data length is expanded by 4 times, the number of convolution kernels in the next calculation becomes 1 / 4 of the original; after serial processing by these decoders, the data length is restored to the original data length.
[0074] (6) The output of the decoder enters the terminal module of the next step, undergoes convolution with kernels of 1*3 and 1*1 in series, and then passes through the sigmoid activation function to obtain the final output vector pr of the model. Let the feature vector generated based on the labeled data be gt, and the dimension of gt is the same as pr.
[0075] (7) Based on the training data set, the loss of the model’s output vector is calculated. The loss function is the sum of the average of the classification loss and the regression loss.
[0076] The activation features and overlapping features output by the model are calculated after sigmoid calculation, and then the loss of binary classification is calculated with the activation features and overlapping features generated by the label.
[0077] The regression loss is calculated based on the starting distance feature, ending distance feature, and regression distance feature output by the model and the starting distance feature, ending distance feature, and regression distance feature generated by the label.
[0078] (8) The feature vector output by the model is decoded through the post-processing step of the non-maximum suppression (NMS) module. After decoding, the initial representation of the single and double-sided sub-waveform is generated, and the IOU calculation is performed with the initial label of the model to obtain the IOU-mean value of each single and double-sided sub-waveform.
[0079] The value of IOU-mean can be used to influence the model parameters through the scheduler, so as to transfer the point prediction to the sub-waveform prediction and reduce the impact of the length of the sub-waveform on the model.
[0080] In order to accurately calculate the IOU of the unilateral sub-waveform, the initial features of the unilateral sub-waveform are optimized and changed to [regression point - sl, regression point + sl]. The sl value is determined according to the sub-waveform spacing of this type of wave, usually 40 to 60 wave points.
[0081] The NMS module's feature thresholds include: four bilateral waveform activation thresholds, four bilateral waveform overlap thresholds, four bilateral waveform length thresholds, two unilateral waveform activation thresholds, two unilateral waveform overlap thresholds, and two unilateral waveform length thresholds, for a total of 18 thresholds. The default values for the probability threshold are 0.5, and the default value for the length threshold is 3. These thresholds influence model training through the scheduler.
[0082] Step S2: Inferring the training data set to obtain the characteristic vector of the electrocardiogram, and performing a global optimal search for the characteristic thresholds of various sub-waveforms in the characteristic vector based on the particle swarm algorithm to obtain the optimal thresholds of various sub-waveforms.
[0083] In order to improve the instance recognition ability, the particle swarm algorithm is used to perform global optimal search for the thresholds of various sub-waveforms. This step occurs after the model training is completed.
[0084] The specific steps for optimizing the feature threshold are as follows:
[0085] Step (1): Save the feature vector of the training dataset after model inference.
[0086] Step (2): Set the parameters required by the particle swarm algorithm, namely the number of random particles N and the number of model iterations. The i-th particle is expressed as:
[0087] X i =(x i1 ,x i2 ,…,x iD ), i=1,2,…,N
[0088] Among them, X i is the i-th particle, which is a random vector of D dimensions. D is the number of thresholds to be optimized. Each element in the vector represents a feature threshold. Here, D is 18.
[0089] The velocity of the i-th particle is also expressed as a random vector of dimension D, namely:
[0090] V i =(v i1 ,v i2 ,…,v iD), i=1,2,…,N
[0091] Among them, V i is the velocity of the i-th particle, and each element in the vector represents the velocity of a characteristic threshold.
[0092] Similarly, the maximum boundary bound_up and the minimum boundary bound_down are also D-dimensional vectors, which are set here as
[0093]
[0094] Step (3): Bring each particle into the effect evaluation function (i.e., the NMS function in post-processing) and calculate the effect evaluation value; the fitness obtained by the i-th particle is Iou-mean i In addition, the individual optimal solution pi found by each particle and the global optimal solution pg of the entire community should be saved at any time.
[0095] Step (4): The i-th particle updates its velocity and position according to the following formula (3):
[0096]
[0097] Where s represents the i-th iteration; r1 and r2 are random vectors; w, c1, and c2 are update weights, which are related to the number of iterations and are updated as shown in formula (4):
[0098]
[0099] Among them, max_steps is the total number of iterations, which is a preset value.
[0100] It can be seen from formula (4) that the value of w decreases as the number of iterations increases, and the value of c1 increases as the number of iterations increases.
[0101] X i During the update process, the value of is also subject to the maximum boundary bound_up and the minimum boundary bound_down to prevent its value from crossing the boundary.
[0102] Step (5): When the number of iterations ends, the global optimal solution pg of the entire community is obtained, and its corresponding vector is the various optimal thresholds to be searched.
[0103] Step S3: Input the electrocardiogram data to be recognized into the trained sub-waveform recognition model to obtain the characteristic vector of the electrocardiogram.
[0104] Step S4: Based on the optimal threshold of each sub-waveform, the non-maximum suppression method (NMS) is used to decode the feature vector of the ECG wave to obtain the region (sub-waveform) category of the waveform, such as Figure 5 As shown, the specific steps are:
[0105] (1) Eigenvalue judgment
[0106] The optimal feature thresholds obtained in step S2 are obtained, namely, the activation threshold, the length threshold, and the overlap threshold.
[0107] For a bilateral sub-waveform, when the overlap eigenvalue is greater than the overlap threshold, the activation eigenvalue corresponding to the point is set to 0. When the activation eigenvalue is greater than the activation threshold, the start distance feature and end distance feature of the corresponding category can participate in the calculation of the start point and end point.
[0108] For a single-sided sub-waveform, when the overlap eigenvalue is greater than the overlap threshold, the activation eigenvalue corresponding to the point is set to 0. When the activation eigenvalue is greater than the activation threshold, the regression distance feature of the corresponding category can participate in the calculation of the regression point.
[0109] When the number of consecutive points greater than the activation threshold in a certain category is greater than the length threshold, these consecutive classification points can become a waveform.
[0110] (2) Decoding process of bilateral sub-waveform
[0111] In the length dimension of the waveform, a for loop calculation is performed on the predicted feature vector of the waveform, and a threshold judgment is performed on specific points.
[0112] When the activation feature value of a specific point is greater than the threshold, its starting distance feature value is put into the prediction list of the starting point after the inverse calculation of the regression feature calculation formula, its ending distance feature value is put into the prediction list of the ending point after the inverse calculation of the regression feature calculation formula, and its activation feature value is put into the prediction list of the activation point.
[0113] When the activation feature value of a specific point is less than the threshold, if the length of the prediction list of the starting point is greater than the length threshold, and the average value of the starting point prediction list is less than the average value of the ending point prediction list, and the two average values are greater than 0, then the average value of the starting point prediction list is used as the starting point of the waveform, the average value of the ending point prediction list is used as the ending point of the waveform, and the average value of the activation prediction list is used as the weight of the sub-waveform to form a triplet of bilateral sub-waveforms; after that, the values of the starting point prediction list and the ending point prediction list are cleared and continue to participate in the calculation.
[0114] For the intersection of bilateral sub-waveforms, if they are of the same type, non-maximum suppression is performed based on the sub-waveform weight value of the triplet; if they are of different types, no consideration is needed.
[0115] (3) Decoding process of unilateral sub-waveform
[0116] In the length dimension of the waveform, a for loop calculation is performed on the predicted feature vector of the waveform, and a threshold judgment is performed on specific points.
[0117] When the activation feature value of a specific point is greater than the threshold, its regression distance feature value is calculated by the inverse of the regression feature calculation formula and put into the regression point prediction list, and its activation feature value is put into the activation point prediction list.
[0118] When the activation feature value of a specific point is less than the threshold, if the length of the regression point prediction list is greater than the length threshold and the average activation value is greater than 0, the average value of the regression point prediction list is used as the regression point of the waveform, and the average value of the activation prediction list is used as the weight of the sub-waveform, forming a binary tuple of a single-sided sub-waveform. After that, the value of the regression point prediction list is cleared and the calculation continues.
[0119] Example 2
[0120] This embodiment discloses a sub-waveform recognition system applied to an electrocardiogram;
[0121] like Figure 6 As shown in FIG, a sub-waveform recognition system for electrocardiograms includes a model training module, a threshold optimization module, an inference feature module, and a waveform post-processing module:
[0122] The model training module is configured to: pre-process the collected ECG data to obtain a training data set, and train the sub-waveform recognition model based on the training data set;
[0123] The threshold optimization module is configured to: infer the feature vector of the ECG wave from the training data set, and perform a global optimal search for the feature thresholds of various sub-waveforms in the feature vector based on the particle swarm algorithm to obtain the optimal thresholds for each sub-waveform;
[0124] The inference feature module is configured to: input the ECG wave data to be identified into the trained sub-waveform recognition model to obtain a feature vector of the ECG wave;
[0125] The waveform post-processing module is configured to decode the feature vector of the electrocardiogram data based on the optimal threshold of each sub-waveform and adopt the non-maximum suppression method to obtain the position and category of the sub-waveform.
[0126] Example 3
[0127] The purpose of this embodiment is to provide a computer-readable storage medium.
[0128] A computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of a sub-waveform recognition method applied to an electrocardiogram as described in the first embodiment of the present disclosure.
[0129] Example 4
[0130] The purpose of this embodiment is to provide an electronic device.
[0131] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps of a sub-waveform recognition method applied to an electrocardiogram as described in the first embodiment of the present disclosure are implemented.
[0132] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A sub-waveform recognition method applied to an electrocardiogram, characterized in that: include: Preprocessing the collected ECG data to obtain a training data set, and training the sub-waveform recognition model based on the training data set; The training data set is inferred to obtain the characteristic vector of the electrocardiogram. Based on the particle swarm algorithm, a global optimal search is performed on the characteristic thresholds of various sub-waveforms in the characteristic vector to obtain the optimal thresholds of various sub-waveforms. Input the ECG wave data to be identified into the trained sub-waveform recognition model to obtain the ECG wave feature vector; Based on the optimal threshold of each sub-waveform, the non-maximum suppression method is used to decode the feature vector of the ECG data to obtain the position and category of the sub-waveform; The feature vector is composed of activation feature, overlapping feature, starting distance feature, ending distance feature, and regression distance feature; The values of the activation feature and the overlapping feature are 1 / 0, the starting distance feature represents the distance between the activation point and the outward extension point and the starting point, the ending distance feature represents the distance between the activation point and the outward extension point and the ending point, and the regression distance feature represents the distance between the activation point and the outward extension point and the regression point of the single waveform.
2. The method for identifying sub-waveforms of an electrocardiogram according to claim 1, wherein: The training data set includes electrocardiogram data, labeled sub-waveforms, and electrocardiogram feature vectors; The sub-waveform recognition model takes multi-lead ECG wave data as input and takes the recognized sub-waveform and ECG wave feature vector as output.
3. The method for identifying sub-waveforms of an electrocardiogram according to claim 1, wherein: The particle swarm algorithm is used to perform global optimal search for the characteristic thresholds of various sub-waveforms. The characteristic thresholds include activation threshold, overlap threshold, and length threshold. The specific steps are as follows: Set the parameters of the particle swarm algorithm: the number of random particles N, the number of iterations, and the particles are represented as: in, Represents the i-th particle, which is a random vector of D dimensions, where D is the number of thresholds to be optimized. Respectively represent the 1st, 2nd, , D feature thresholds; Bring each particle into the effect evaluation function to calculate the individual optimal solution found by each particle and the global optimal solution of the entire community; Iteratively update the velocity and position of each particle and evaluate the effect until the iteration count is reached; When the number of iterations ends, the global optimal solution of the entire community is obtained, and its corresponding vector is the various optimal thresholds searched.
4. The sub-waveform recognition method for electrocardiogram according to claim 1, characterized in that: The sub-waveform recognition model is constructed based on full convolution technology, which performs feature extraction through downsampling of the encoder and then performs feature fusion through upsampling of the decoder to obtain the feature vector of the electrocardiogram.
5. The method for identifying sub-waveforms of an electrocardiogram according to claim 1, wherein: The loss function of the sub-waveform recognition model is the sum of the average values of the classification loss and the regression loss; The classification loss is the loss calculation of binary classification based on the activation features and overlapping features of the sub-waveforms inferred by the model and the corresponding features generated by the labels; The regression loss is calculated by calculating the regression loss based on the starting distance feature, ending distance feature, regression distance feature of the sub-waveform inferred by the model and the corresponding features generated by the label.
6. The method for identifying sub-waveforms of an electrocardiogram according to claim 1, wherein: The non-maximum suppression method is used to decode the characteristic vector of the electrocardiogram to obtain the category and position of the sub-waveform, specifically: When the overlapping eigenvalue of a certain type of wave at a specific point is greater than the threshold, the activation eigenvalue of the wave at the specific point is set to 0; when the activation eigenvalue is greater than the threshold, the starting distance feature, ending distance feature, and regression distance feature of the point can participate in the calculation of the starting point, ending point, and regression point; when the number of continuous classification points greater than the activation threshold is greater than the length threshold, these continuous classification points can become a waveform.
7. A sub-waveform recognition system for electrocardiogram, characterized in that: Including model training module, threshold optimization module, inference feature module and waveform post-processing module: The model training module is configured to: pre-process the collected ECG data to obtain a training data set, and train the sub-waveform recognition model based on the training data set; The threshold optimization module is configured to: infer the feature vector of the ECG wave from the training data set, and perform a global optimal search for the feature thresholds of various sub-waveforms in the feature vector based on the particle swarm algorithm to obtain the optimal thresholds for each sub-waveform; The inference feature module is configured to: input the ECG wave data to be identified into the trained sub-waveform recognition model to obtain a feature vector of the ECG wave; The waveform post-processing module is configured to: decode the feature vector of the ECG data using the non-maximum suppression method based on the optimal threshold of each sub-waveform to obtain the position and category of the sub-waveform; The feature vector is composed of activation feature, overlapping feature, starting distance feature, ending distance feature, and regression distance feature; The values of the activation feature and the overlapping feature are 1 / 0, the starting distance feature represents the distance between the activation point and the outward extension point and the starting point, the ending distance feature represents the distance between the activation point and the outward extension point and the ending point, and the regression distance feature represents the distance between the activation point and the outward extension point and the regression point of the single waveform.
8. An electronic device, comprising: a memory for non-transitory storage of computer-readable instructions; as well as a processor for executing said computer-readable instructions, When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is executed.
9. A storage medium, characterized by non-transitory storage of computer-readable instructions, wherein: When the non-transitory computer-readable instructions are executed by a computer, the instructions of the method according to any one of claims 1 to 6 are executed.
Citation Information
Patent Citations
Electrocardiosignal classification method based on particle swarm optimization BP neural network
CN109998495A
Method and apparatus for processing electrocardiogram data, computer device, and storage medium
WO2021169296A1