Electrocardiogram key band extraction method, device and medium

Through mathematical morphological filtering, Wiener filtering, empirical mode analysis and Welch power spectrum analysis, the problem of noise interference in the ECG signal is solved, and accurate ECG signals are generated, which improves the diagnostic accuracy and the accuracy of feature extraction.

CN114587375BActive Publication Date: 2024-12-20联通数智医疗科技有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210315803.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2024-12-20
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

Electrocardiogram signals are susceptible to noise interference, resulting in a decrease in diagnostic accuracy. It is difficult for the prior art to effectively remove baseline drift, industrial frequency interference, electromyography interference and motion artifact noise.

Method used

Mathematical morphological filtering algorithm is used to remove baseline drift, Wiener filtering algorithm is used to remove industrial frequency interference, empirical mode analysis method and principal component analysis method to remove electromyography interference, and combined with Welch power spectrum analysis method to remove motion artifact noise to generate pure hearts electric signal.

Benefits of technology

Effectively filter out noise in the ECG signal, improve diagnostic accuracy, enhance the accuracy and adaptability of feature extraction, and reduce model inference time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114587375B_ABST
    Figure CN114587375B_ABST
Patent Text Reader

Abstract

The present invention relates to an electrocardiogram key band extraction method, device and medium. The electrocardiogram preprocessing method comprises: obtaining an electrocardiogram to be processed, determining an electrocardiogram signal to be processed according to the electrocardiogram to be processed; performing baseline drift removal processing on the electrocardiogram signal to be processed based on a mathematical morphology filtering algorithm to obtain an electrocardiogram signal without baseline drift; performing power frequency interference removal processing on the electrocardiogram signal without baseline drift based on a Wiener filtering algorithm to obtain an electrocardiogram signal without power frequency interference; performing myoelectric interference removal processing on the electrocardiogram signal without power frequency interference based on an empirical mode analysis method and a principal component analysis to obtain an electrocardiogram signal without myoelectric interference; performing motion artifact removal processing on the electrocardiogram signal without myoelectric interference based on an empirical mode analysis method and a Welch power spectrum analysis method to obtain an electrocardiogram signal without motion artifact. The present invention is used to remove noise from an electrocardiogram and improve the accuracy of electrocardiogram diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electrocardiogram processing, and more specifically, to a method, device and medium for extracting key bands of an electrocardiogram. Background Art

[0002] Electrocardiogram (ECG) is a technology that uses an electrocardiograph to record the graph of electrical activity changes generated by each cardiac cycle from the body surface. It is one of the important means for doctors to diagnose patients' heart-related diseases. Therefore, the accuracy of the electrocardiogram seriously affects the accuracy of diagnosis. The ECG signal collected by the electrocardiogram is a weak signal with strong nonlinearity, non-stationarity and randomness. The frequency is usually between 0.05 and 100 Hz, of which more than 90% of the ECG signal energy is concentrated between 0.25 Hz and 35 Hz, and the amplitude is between 10uV and 5mV. In the process of collecting it, it is very susceptible to the influence of the internal and external environment, such as the movement of the human limbs, breathing, electromagnetic interference in the surrounding environment, etc. Therefore, the directly collected ECG signal is accompanied by a lot of noise. Common noises include baseline drift, power frequency interference, myoelectric interference and motion artifacts. Summary of the invention

[0003] The present invention aims to overcome at least one defect (shortcoming) of the above-mentioned prior art and provide a method, device and medium for extracting key bands of an electrocardiogram, which are used to remove noise from the electrocardiogram and improve the accuracy of electrocardiogram diagnosis.

[0004] The technical solution adopted by the present invention is a method for preprocessing an electrocardiogram, comprising:

[0005] Acquire an electrocardiogram to be processed, and determine an electrocardiogram signal to be processed according to the electrocardiogram to be processed;

[0006] Performing baseline drift removal processing on the to-be-processed ECG signal based on a mathematical morphology filtering algorithm to obtain a baseline drift-free ECG signal;

[0007] Based on the Wiener filtering algorithm, the baseline drift-free ECG signal is subjected to power frequency interference removal processing to obtain a power frequency interference-free ECG signal;

[0008] Based on the empirical mode analysis method and the principal component analysis, the power frequency-removed ECG signal is processed to remove the myoelectric interference to obtain the ECG signal without the myoelectric interference;

[0009] The electrocardiogram signal without myoelectric interference is subjected to motion artifact removal processing based on empirical mode analysis and Welch power spectrum analysis to obtain a motion artifact removed electrocardiogram signal.

[0010] Furthermore, the method of performing baseline drift removal processing on the electrocardiogram signal to be processed based on a mathematical morphology filtering algorithm to obtain an electrocardiogram signal without baseline drift includes:

[0011] The preset structural element sequence and the previous average signal sequence of the ECG signal to be processed The estimated value obtained by first performing an opening operation and then a closing operation is converted into the preset structure element sequence. and the previous average signal sequence of the ECG signal to be processed The estimated values ​​obtained by performing a closing operation and then an opening operation are averaged to obtain the average signal sequence of the electrocardiogram signal to be processed. ;

[0012] According to the average signal sequence of the electrocardiographic signal to be processed The electrocardiogram signal to be processed is obtained as ,in, is the original signal sequence of the electrocardiogram signal to be processed.

[0013] Furthermore, after performing baseline drift removal processing on the to-be-processed ECG signal based on the mathematical morphology filtering algorithm to obtain the baseline drift-free ECG signal, the method further includes:

[0014] Based on Butterworth filter algorithm , performing filtering processing on the baseline drift-free ECG signal.

[0015] Furthermore, the method of removing myoelectric interference from the power frequency-removed ECG signal based on the empirical mode analysis method and the principal component analysis method to obtain the myoelectric interference-removed ECG signal includes:

[0016] Based on the first layer intrinsic mode function signal, decomposing the first layer residual value signal from the power frequency interference-free electrocardiogram signal;

[0017] The principal component analysis method is used to obtain the principal component of the first layer of intrinsic modal function signals, and the first layer of intrinsic modal function signals are reconstructed according to the principal component to obtain the next layer of intrinsic modal function signals;

[0018] Based on the intrinsic modal function signal of the next layer, the residual value signal of the first layer is further decomposed into the residual value signal of the next layer;

[0019] Determining whether the next layer residual value signal is a single stable signal;

[0020] If yes, the next layer of residual value signal is used as the ECG signal without myoelectric interference. If no, the principal component analysis method is continued to be used to obtain the principal component components of the next layer of intrinsic modal function signal, and the next layer of intrinsic modal function signal is reconstructed according to the principal component components until the next layer of residual value signal is determined to be a single stable signal.

[0021] Furthermore, the acquisition of the first layer intrinsic modal function signal includes:

[0022] Obtaining the upper envelope and the lower envelope of the electrocardiogram signal without power frequency interference;

[0023] Calculating the average envelope value of the upper envelope and the lower envelope, and calculating the signal difference between the power frequency interference-free ECG signal and the average envelope value;

[0024] Taking the signal difference as a new ECG signal without power frequency interference, and judging whether the new ECG signal without power frequency interference meets the requirements of the intrinsic mode function signal;

[0025] If so, the new power-frequency interference-free ECG signal is used as the first-layer intrinsic modal function signal; if not, the upper envelope and lower envelope of the new power-frequency interference-free ECG signal are continuously obtained until it is determined whether the new power-frequency interference-free ECG signal meets the requirements of the intrinsic modal function signal.

[0026] Furthermore, the method of performing motion artifact removal processing on the electromyographic interference-free ECG signal based on the empirical mode decomposition method and the Welch power spectrum analysis method to obtain the motion artifact-free ECG signal includes:

[0027] After performing empirical mode decomposition on the removed electromyographic interference signal, intrinsic mode function signals of various orders are obtained;

[0028] Perform Welch power spectrum analysis on each order of intrinsic mode function signals;

[0029] Eliminate the intrinsic mode function signal that does not conform to the frequency spectrum distribution of the ECG signal waveform;

[0030] The remaining intrinsic mode function signal that conforms to the frequency spectrum distribution of the ECG signal band after elimination is synthesized into the ECG signal without motion artifacts.

[0031] Furthermore, the frequency spectrum distribution of the ECG signal waveform is 0-40 Hz, the P wave is 0-18 Hz, the QRS wave is 0-37 Hz, and the T wave is 0-18 Hz.

[0032] Another technical solution adopted by the present invention is a method for extracting key bands of an electrocardiogram, comprising:

[0033] The electrocardiogram is preprocessed by using the electrocardiogram preprocessing method;

[0034] The key bands are extracted from the preprocessed electrocardiogram.

[0035] Another technical solution adopted by the present invention is a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the electrocardiogram preprocessing method or the steps of the electrocardiogram key band extraction method.

[0036] Another technical solution adopted by the present invention is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes the steps of the electrocardiogram preprocessing method or the steps of the electrocardiogram key band extraction method.

[0037] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention provides an electrocardiogram key band extraction method, device and medium, which pre-process the electrocardiogram signal, effectively filter out baseline drift noise, power frequency interference noise, myoelectric interference noise and motion artifact noise in the electrocardiogram signal, and generate a pure and accurate electrocardiogram signal; and extract the electrocardiogram key band of the electrocardiogram signal after the noise is filtered out, improve the accuracy of feature extraction, improve the adaptability of features, reduce the time of model inference, and achieve the purpose of automatically removing redundancy. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 The present invention is a flowchart of an electrocardiogram preprocessing method.

[0039] Figure 2 The present invention is a flow chart of a method for extracting key bands of an electrocardiogram.

[0040] Figure 3 It is a cluster decision diagram. DETAILED DESCRIPTION

[0041] The drawings of the present invention are only used for illustrative purposes and are not to be construed as limiting the present invention.

[0042] Baseline drift is caused by human breathing movement and slight movement of the electrode on the skin. Its frequency is generally lower than 5Hz. As time goes by, the ECG signal will be disturbed by baseline drift and will show a steady decline. If the interference is serious, it will show a sharp rise or decline in a short period of time, which will seriously interfere with the amplitude and shape of the real ECG signal.

[0043] Power frequency interference is mainly generated on power supply equipment. The power supply equipment and power supply frequency used in different countries are different. For example, most of the power supply equipment in my country uses 50Hz alternating current. The use of 50Hz alternating current will produce 50Hz power frequency interference. Therefore, when collecting ECG signals, it will be affected by power frequency interference. The small ripples on the ECG waveform are power frequency interference. This small influence can easily be confused with the small incisions in the ECG waveform caused by the disease, so it is necessary to filter it out.

[0044] Myoelectric interference generally comes from muscle contraction and tremor. The amplitude of such interference is small, but the frequency is high, ranging from 5Hz to 2000Hz, showing irregular and fast-changing waveforms, which overlap with the 0.05-100Hz frequency of the ECG signal. It will appear as irregular, small, high-frequency fluctuations on a normal ECG signal, which can easily cause visual confusion with the small fluctuations caused by the disease, thus leading to misdiagnosis of the ECG signal.

[0045] Motion artifacts are caused by slight movements of the human body. Their main characteristic is mutation. The frequency range is generally between 3Hz and 14Hz, and the duration is also very short. Because the frequency band of the motion artifact signal has a large overlap with the useful ECG signal, the removal of motion artifacts in ECG signals has always been a difficult point in the preprocessing of ECG data.

[0046] An electrocardiogram preprocessing method provided in an embodiment of the present invention can filter out baseline drift noise, power frequency interference noise, myoelectric interference noise and motion artifact noise from the electrocardiogram signal respectively, generate a pure and accurate electrocardiogram signal, and facilitate accurate diagnosis and processing based on the electrocardiogram signal.

[0047] Example 1

[0048] like Figure 1 As shown, an electrocardiogram preprocessing method according to an embodiment of the present invention comprises the following steps:

[0049] Step S110, obtain the electrocardiogram to be processed, and determine the electrocardiogram signal to be processed according to the electrocardiogram to be processed; the electrocardiogram mainly includes QRS wave, P wave, and T wave, each wave measures a change in the potential of the heart, for example, the P wave represents the change in potential when the left and right atria are depolarized, and the QRS wave represents the change in potential when the left and right ventricles are depolarized, which belongs to the basic concept of the electrocardiogram. Those skilled in the art can understand the basic concepts in the electrocardiogram, and no specific description is given here. The electrocardiogram itself can be understood as an electrocardiogram signal, but it is different from the recognized signal. Here, the electrocardiogram signal should be understood as a code that can be calculated and processed by a computer, but whether it is a code or an electrocardiogram, it is only a different form of expression, and the information contained therein is no substantial difference.

[0050] During the electrocardiogram detection process, considering that external interference factors may generate noise interference of varying degrees, the electrocardiogram needs to be denoised after it is output. The embodiments of the present invention mainly focus on the removal of baseline drift, power frequency interference, myoelectric interference and motion artifact noise.

[0051] Step S120, performing baseline drift removal processing on the to-be-processed ECG signal based on a mathematical morphology filtering algorithm to obtain a baseline drift-removed ECG signal;

[0052] In an embodiment of the present invention, baseline drift can directly affect the upper and lower positions of the ECG signal, causing trouble for the detection of the QRS complex of the ECG signal and the direct diagnosis of the ECG. Therefore, the embodiment of the present invention adopts the principle of the mathematical morphological filtering method to eliminate the baseline drift. It can be understood that for image processing, mathematical morphological filtering refers to mathematical morphological filtering, especially the filtering processing of images. Its essence is the same as other filters, and it can perform denoising and enhancement on images. Mathematical morphological filtering includes many operations. The two most basic morphological operations are corrosion and expansion. Other advanced morphological operations are based on these two basic morphological operations, such as opening operation, closing operation, morphological gradient, top hat, black hat, etc.

[0053] Among them, the definitions of erosion and expansion operations are:

[0054] set up and are one-dimensional discrete functions, , where f(n) is the signal sequence to be processed and k(m) is the structure element sequence;

[0055] The erosion operation of f(n) with respect to k(m) is defined as:

[0056]

[0057] The dilation operation of f(n) with respect to k(m) is defined as:

[0058]

[0059] The definitions of opening and closing operations are:

[0060] The two basic operations of erosion and dilation can be composed of opening and closing operations. Among them, the opening operation is defined as the signal being eroded by the structural element and then dilated, denoted as ︒, which is ; The closing operation is defined as the signal being expanded by the structural element and then corroded, denoted by ·, that is, ;

[0061] Preferably, step S120 specifically includes the following steps:

[0062] Step S121: Set the preset structural element sequence and the previous average signal sequence of the ECG signal to be processed The estimated value obtained by first performing an opening operation and then a closing operation is converted into the preset structure element sequence. and the previous average signal sequence of the ECG signal to be processed The estimated values ​​obtained by performing a closing operation and then an opening operation are averaged to obtain the average signal sequence of the electrocardiogram signal to be processed. ;

[0063] Step S122: based on the average signal sequence of the electrocardiogram signal to be processed The electrocardiogram signal to be processed is obtained as ,in, is the original signal sequence of the electrocardiogram signal to be processed.

[0064] Specifically, the average signal sequence of the ECG signal to be processed is obtained as The process is:

[0065] The preset structural element sequence and the original signal sequence of the ECG signal to be processed Perform a closed operation and then convert the preset structural element sequence and the original signal sequence of the ECG signal to be processed Perform an open operation to obtain an estimated value of ;

[0066] The preset structural element sequence and the original signal sequence of the ECG signal to be processed Perform an open operation and then convert the preset structure element sequence and the ECG signal sequence to be processed Perform a closed operation to get the estimated value 2 ;

[0067] The estimated value and estimated value 2 After the averaging operation, the average signal sequence of the ECG signal to be processed is: .

[0068] The average signal sequence of the ECG signal to be processed is The process is:

[0069] The preset structural element sequence and the average signal sequence Perform a closed operation and then convert the preset structural element sequence and the average signal sequence Perform an open operation to obtain an estimated value of ;

[0070] The preset structural element sequence and the average signal sequence Perform an open operation and then convert the preset structure element sequence and the average signal sequence Perform a closed operation to get the estimated value 2 ;

[0071] The estimated value and estimated value 2 After the averaging operation, the average signal sequence of the ECG signal to be processed is: ;

[0072] By analogy, the ECG signal to be processed after baseline drift removal is obtained as follows: .

[0073] Preferably, after step S120, the method further includes the following steps:

[0074] Based on Butterworth filter algorithm , performing filtering processing on the baseline drift-free ECG signal.

[0075] In the embodiment of the present invention, the electrocardiogram after filtering by the mathematical morphology method still has noise interference of about 1 Hz, so a Butterworth digital filter is used to filter it out to better highlight the QRS complex. The Butterworth filter is:

[0076]

[0077] It is worth noting that when calculating the output When , the output value and input value at the previous moment are needed. The Butterworth filter has a feedback link, and the general form of the transfer function of the system is: .

[0078] Step S130, performing power frequency interference removal processing on the baseline drift-free ECG signal based on a Wiener filtering algorithm to obtain a power frequency interference-free ECG signal;

[0079] In the embodiment of the present invention, the Wiener filter is:

[0080]

[0081] Where * represents convolution, represents the input signal, Represents the output signal, Represents the useful signal part of the input signal, Represents the noise portion of the input signal.

[0082] Use Wiener filtering to ensure output and the real signal The difference is the smallest, because and It is a time series signal, so the mean square error of the two must be minimized, so the following calculation process is required:

[0083]

[0084] That is to make Smallest .so right Find the partial derivative, we have:

[0085]

[0086]

[0087]

[0088] set up and The correlation coefficient is , then:

[0089]

[0090] in, express and The correlation coefficient is is fixed, is changing, and , express and The correlation coefficient of s. It represents the time point in the timing signal.

[0091] This gives us N linear equations:

[0092]

[0093] Written in matrix form, we have:

[0094]

[0095] in, are the required filter parameters,

[0096] is the correlation coefficient between x and s,

[0097]

[0098] According to the matrix equation (8), we can obtain:

[0099]

[0100] Substituting into the optimization objective function (2), we can obtain:

[0101]

[0102]

[0103]

[0104] According to equation (5), we can get:

[0105]

[0106] Assuming that the signal s(n) and the noise v(n) are independent of each other, then:

[0107]

[0108]

[0109]

[0110] According to equation (12), we have:

[0111]

[0112] According to the Wiener filter calculation process, the baseline drift-free ECG signal can be processed to remove the power frequency interference.

[0113] Step S140, performing myoelectric interference removal processing on the power frequency-removed ECG signal based on empirical mode analysis and principal component analysis to obtain an ECG signal without myoelectric interference;

[0114] The embodiment of the present invention removes the myoelectric interference of the power frequency ECG signal based on the empirical mode analysis method EMD and the principal component analysis method PCA. The empirical mode decomposition method EMD is an adaptive and efficient decomposition method that can decompose any complex signal into a finite number of intrinsic mode functions (IMF). This method takes into account the characteristics of the noise contained in the intrinsic mode function IMF. The denoising process does not require the calculation of the threshold and can effectively maintain the integrity of the modal unit.

[0115] Preferably, step S140 specifically includes the following steps:

[0116] Based on the first layer intrinsic mode function signal, decomposing the first layer residual value signal from the power frequency interference-free electrocardiogram signal;

[0117] The principal component analysis method is used to obtain the principal component of the first layer of intrinsic modal function signals, and the first layer of intrinsic modal function signals are reconstructed according to the principal component to obtain the next layer of intrinsic modal function signals;

[0118] Based on the intrinsic modal function signal of the next layer, the residual value signal of the first layer is further decomposed into the residual value signal of the next layer;

[0119] Determining whether the next layer residual value signal is a single stable signal;

[0120] If yes, the next layer of residual value signal is used as the ECG signal without myoelectric interference. If no, the principal component analysis method is continued to be used to obtain the principal component components of the next layer of intrinsic modal function signal, and the next layer of intrinsic modal function signal is reconstructed according to the principal component components until the next layer of residual value signal is determined to be a single stable signal.

[0121] Furthermore, the acquisition of the first layer intrinsic modal function signal comprises the steps of:

[0122] Obtaining the upper envelope and the lower envelope of the electrocardiogram signal without power frequency interference;

[0123] Calculating the average envelope value of the upper envelope and the lower envelope, and calculating the signal difference between the power frequency interference-free ECG signal and the average envelope value;

[0124] Taking the signal difference as a new ECG signal without power frequency interference, and judging whether the new ECG signal without power frequency interference meets the requirements of the intrinsic mode function signal;

[0125] If so, the new power-frequency interference-free ECG signal is used as the first-layer intrinsic modal function signal; if not, the upper envelope and lower envelope of the new power-frequency interference-free ECG signal are continuously obtained until it is determined whether the new power-frequency interference-free ECG signal meets the requirements of the intrinsic modal function signal.

[0126] Specifically, the empirical mode analysis (EMD) method is used to analyze the power frequency interference of the ECG signal. The decomposition process is:

[0127] First, get The local maximum and minimum of the upper envelope are calculated using cubic spline interpolation and lower envelope ;

[0128] Secondly, calculate the upper envelope and lower envelope The average , and calculate and The difference: ;

[0129] Then, (3) As a new signal, repeat steps 1 and 2 until the obtained ECG signal satisfies the first IMF above: , the remaining value ;

[0130] Finally, As a new signal, repeat the first three steps to obtain all IMFs. When it becomes a stable signal, the iteration process stops and the EMD decomposition of the signal x(t) is completed.

[0131] Step S150, performing motion artifact removal processing on the electromyographic interference-free ECG signal based on an empirical mode analysis method and a Welch power spectrum analysis method to obtain a motion artifact-free ECG signal.

[0132] Preferably, step S150 specifically includes the following steps:

[0133] After performing empirical mode decomposition on the removed electromyographic interference signal, intrinsic mode function signals of various orders are obtained;

[0134] Perform Welch power spectrum analysis on each order of intrinsic mode function signals;

[0135] Eliminate the intrinsic mode function signal that does not conform to the frequency spectrum distribution of the ECG signal waveform;

[0136] The remaining intrinsic mode function signal that conforms to the frequency spectrum distribution of the ECG signal band after elimination is synthesized into the ECG signal without motion artifacts.

[0137] Preferably, the frequency spectrum distribution of the ECG signal waveform is 0-40 Hz, the P wave is 0-18 Hz, the QRS wave is 0-37 Hz, and the T wave is 0-18 Hz.

[0138] Example 2

[0139] like Figure 2 FIG. 1 is a flow chart of a method for extracting a key band of an electrocardiogram according to an embodiment of the present invention. The method for extracting a key band of an electrocardiogram comprises:

[0140] Step S210, preprocessing the electrocardiogram using the steps of the electrocardiogram preprocessing method in Example 1;

[0141] Step S220: extract key bands from the preprocessed electrocardiogram.

[0142] Preferably, in step S220, key band extraction is performed on the preprocessed electrocardiogram, which specifically includes the following steps:

[0143] Step S221, using the unsupervised pre-training model MoCo to extract electrocardiogram features;

[0144] Step S222: cluster the electrocardiogram features using the density peak clustering algorithm (DPCA), extract the cluster cores as the key band features of the electrocardiogram, and remove redundant frames at the edge of the cluster.

[0145] Specifically, in step S221, an unsupervised pre-trained model MoCo (unsupervised visual representation learning with momentum contrast) is used to extract electrocardiogram features.

[0146] It can be understood that a pre-trained model refers to a representation (i.e., feature) that can be transferred to downstream tasks through fine-tuning. Pre-training methods are generally divided into supervised, semi-supervised, and unsupervised. The most commonly used supervised pre-training technique is: first train the model on a large dataset with annotations, and then use the model as a pre-trained model to perform downstream tasks. The representative of the semi-supervised method is self-training, which uses a small amount of labeled data and a large amount of unlabeled data to jointly train the model. Unsupervised pre-training constructs a "label" from the sample in an unsupervised manner in a certain way, thereby pre-training the model and improving the performance of downstream tasks. Unsupervised methods are trained on unlabeled datasets and obtain a general representation of the data through methods such as contrast loss and mutual information maximization.

[0147] Unsupervised learning is relative to supervised learning, because most of the data encountered in reality are unlabeled samples. In order to use supervised learning, it is necessary to manually label the sample labels in advance. The cost and time of this process are huge, so unsupervised learning is a method of using unlabeled samples to find data patterns.

[0148] The unsupervised pre-training model MoCo adopted in the embodiment of the present invention is a mechanism for establishing a dynamic dictionary for contrastive learning, which can be used for various tasks. The visual representation encoder is trained by matching the encoded query q with the encoded key dictionary using contrastive loss. A pair of query query and key value key is composed of a sample pair. If they come from the same, it is a positive sample pair, otherwise it is a negative sample pair. Two transformations v and v' of the same x are passed through the same network to produce two projections z and z'. The purpose of contrastive loss is to maximize the similarity of two projections from the same input x while minimizing the similarity with other projections in the same mini-batch. MoCo maintains the dictionary as a data sample queue, so that the encoded key values ​​in the current mini-batch can be reused. At the same time, the queue can decouple the dictionary size and the mini-batch size. The dictionary size can be much larger than the mini-batch size and can be used as a hyperparameter. Since the mini-batch follows the first-in-first-out principle, the dictionary always represents a subset of all data. The online network is updated using the stochastic gradient descent method, and the momentum network is updated based on the exponential moving average of the online network weights.

[0149] Specifically, in step S222, the process of clustering the electrocardiogram features using the density peak clustering algorithm (DPCA) is as follows:

[0150] A neighborhood radius is given in advance , define any The distance between two points is express.

[0151] first, express The density of the points, Point density calculation rules: The point is the center of the circle, contained in the radius The number of points in the circle is The density of the points. That is, compare the distance between two points With field radius If it is less than, it is inside the circle and the count is 1; if it is greater than, it is outside the circle and the count is 0. Finally, sum it up. The larger the point The greater the local density, the more likely it is to become a cluster center. The formula is as follows:

[0152]

[0153]

[0154] Secondly, define the cluster center distance ,

[0155] 1. First, arrange the density of each point from large to small: ; The method for determining the distance of the cluster center of the point with the highest density is different from the method for determining the distance of the cluster center of other points;

[0156] 2. First determine the cluster center distance of the point with the highest density The point is the point with the highest density, and its cluster center distance Equal to The farthest point To point Straight line distance ;

[0157] 3. Determine the cluster center distance of other points - the cluster center distance of other points is equal to the smallest distance from the point in the set of points with a density greater than that of the point. For example , , The density is higher than The density of points is high, and Point away The point is closest, The cluster center distance of the point is equal to

[0158] 4. Determine all cluster center distances in turn , cluster center distance The mathematical formula is as follows:

[0159]

[0160] When the value is maximum, .

[0161] Finally, by Figure 3 The decision diagram shown determines the cluster core and cluster edge according to the local density of each point. , cluster center distance The value of group Projected into a two-dimensional coordinate system. The cluster center distance is normalized and the cluster center distance of point ① is Set to 1.

[0162] Example 3

[0163] Another embodiment provided by the present invention is a computer device, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the electrocardiogram preprocessing method in Example 1, or executes the steps of the electrocardiogram key band extraction method in Example 2.

[0164] Another embodiment provided by the present invention is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes the steps of the electrocardiogram preprocessing method in Example 1, or executes the steps of the electrocardiogram key band extraction method in Example 2.

[0165] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the technical solution of the present invention, and are not intended to limit the specific implementation methods of the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the claims of the present invention shall be included in the protection scope of the claims of the present invention.

Claims

1. A method for extracting key bands of an electrocardiogram, characterized in that: include: Preprocessing of the electrocardiogram; Extracting key bands from the preprocessed electrocardiogram; The unsupervised pre-trained model MoCo is used to extract ECG features; The density peak clustering algorithm (DPCA) is used to cluster the ECG features, and the cluster core is extracted as the key band feature of the ECG, and the redundant frames at the edge of the cluster are removed.

2. The method for extracting key bands of an electrocardiogram according to claim 1, characterized in that: The electrocardiogram is preprocessed, comprising: Acquire an electrocardiogram to be preprocessed, and determine an electrocardiogram signal to be processed according to the electrocardiogram to be preprocessed; Performing baseline drift removal processing on the to-be-processed ECG signal based on a mathematical morphology filtering algorithm to obtain a baseline drift-free ECG signal; Based on the Wiener filtering algorithm, the baseline drift-free ECG signal is subjected to power frequency interference removal processing to obtain a power frequency interference-free ECG signal; Based on the empirical mode analysis method and the principal component analysis method, the power frequency interference-free ECG signal is subjected to myoelectric interference-free processing to obtain an myoelectric interference-free ECG signal; The electrocardiogram signal without myoelectric interference is subjected to motion artifact removal processing based on empirical mode analysis and Welch power spectrum analysis to obtain a motion artifact removed electrocardiogram signal.

3. The method for extracting key bands of an electrocardiogram according to claim 2, characterized in that: The method of performing baseline drift removal processing on the electrocardiogram signal to be processed based on a mathematical morphology filtering algorithm to obtain an electrocardiogram signal without baseline drift includes: The preset structural element sequence and the previous average signal sequence of the ECG signal to be processed The estimated value obtained by first performing an opening operation and then a closing operation is converted into the preset structure element sequence. and the previous average signal sequence of the ECG signal to be processed The estimated values ​​obtained by performing a closing operation and then an opening operation are averaged to obtain the average signal sequence of the electrocardiogram signal to be processed. .

4. The method for extracting key bands of an electrocardiogram according to claim 2, characterized in that: After performing baseline drift removal processing on the to-be-processed ECG signal based on the mathematical morphology filtering algorithm to obtain the baseline drift-free ECG signal, the method further includes: The baseline drift-free electrocardiogram signal is defiltered based on a Butterworth filtering algorithm.

5. The method for extracting key bands of an electrocardiogram according to claim 2, characterized in that: The method of performing myoelectric interference removal processing on the power frequency interference-removed ECG signal based on the empirical mode analysis method and the principal component analysis method to obtain the myoelectric interference-removed ECG signal includes: Based on the first layer intrinsic mode function signal, decomposing the first layer residual value signal from the power frequency interference-free electrocardiogram signal; The principal component analysis method is used to obtain the principal component of the first layer of intrinsic modal function signals, and the first layer of intrinsic modal function signals are reconstructed according to the principal component to obtain the next layer of intrinsic modal function signals; Based on the intrinsic modal function signal of the next layer, the residual value signal of the first layer is further decomposed into the residual value signal of the next layer; Determining whether the next layer residual value signal is a single stable signal; If yes, the next layer of residual value signal is used as the ECG signal without myoelectric interference. If no, the principal component analysis method is continued to be used to obtain the principal component components of the next layer of intrinsic modal function signal, and the next layer of intrinsic modal function signal is reconstructed according to the principal component components until the next layer of residual value signal is determined to be a single stable signal.

6. The method for extracting key bands of an electrocardiogram according to claim 5, characterized in that: The acquisition of the first layer intrinsic modal function signal includes: Obtaining the upper envelope and the lower envelope of the electrocardiogram signal without power frequency interference; Calculating the average envelope value of the upper envelope and the lower envelope, and calculating the signal difference between the power frequency interference-free ECG signal and the average envelope value; Taking the signal difference as a new power frequency interference-free ECG signal, and judging whether the new power frequency interference-free ECG signal meets the requirements of the intrinsic mode function signal; If so, the new ECG signal without power frequency interference is used as the first layer intrinsic modal function signal. If not, the upper envelope and lower envelope of the new ECG signal without power frequency interference are continuously obtained until it is determined whether the new ECG signal without power frequency interference meets the requirements of the intrinsic modal function signal.

7. The method for extracting key bands of an electrocardiogram according to claim 2, characterized in that: The method of performing motion artifact removal processing on the electromyographic interference-free electrocardiogram signal based on the empirical mode decomposition method and the Welch power spectrum analysis method to obtain the motion artifact-free electrocardiogram signal comprises: Performing empirical mode decomposition on the electrocardiogram signal without myoelectric interference to obtain intrinsic mode function signals of various orders; Welch power spectrum analysis is performed on each order of intrinsic mode function signals; Eliminate the intrinsic mode function signal that does not conform to the frequency spectrum distribution of the ECG signal waveform; The intrinsic mode function signal remaining after the elimination that conforms to the frequency spectrum distribution of the ECG signal waveform is synthesized into the motion artifact-free ECG signal.

8. The method for extracting key bands of an electrocardiogram according to claim 7, characterized in that: The frequency spectrum distribution of the ECG signal waveform is 0-40 Hz, the P wave is 0-18 Hz, the QRS wave is 0-37 Hz, and the T wave is 0-18 Hz.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method for extracting key bands of an electrocardiogram as claimed in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the electrocardiogram key band extraction method according to any one of claims 1 to 8.