An image processing method for electrocardiograms

By converting ECG signals into two-dimensional images and applying an improved multi-scale entropy and ELM classifier, the problems of information loss and low accuracy in ECG signal diagnosis are solved, and more accurate CHF diagnosis is achieved.

CN116109589BActive Publication Date: 2026-05-26JIANGSU UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGSU UNIV OF SCI & TECH
Filing Date
2023-02-07
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies for ECG signal diagnosis suffer from problems such as information loss and low classification accuracy, especially in the diagnosis of CHF. Traditional methods are complex and costly, and it is difficult to accurately distinguish between normal and CHF patients.

Method used

The ECG signal was converted into a two-dimensional image, and features were extracted using an improved two-dimensional multi-scale entropy method. Extreme Learning Machine (ELM) was used for classification, and the accuracy of entropy estimation and classification precision were improved by combining the GAF algorithm and wavelet denoising.

Benefits of technology

It improves the classification accuracy of ECG signals, enabling more accurate differentiation between normal and CHF patients, reducing the probability of undefined entropy, and providing more objective and rapid support for cardiac diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116109589B_ABST
    Figure CN116109589B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of image processing technology, specifically, it is an image processing method for the diagnosis of congestive heart failure (CHF). First, the electrocardiogram (ECG) data is segmented and denoised. Second, the segmented data undergoes Fast Fourier Transform (FFT) to obtain the corresponding Doppler spectrum sequence. Then, GAF is applied to encode the Doppler spectrum sequence into GASF and GADF images. Next, features are extracted from the two-dimensional images using an improved two-dimensional multi-scale entropy method. Finally, the features are sent to an ELM classifier for classification. The improved two-dimensional multi-scale entropy algorithm disclosed in this invention can improve the accuracy of entropy estimation, reduce the probability of inducing undefined entropy, and more clearly reflect the multi-scale entropy features at each scale. By utilizing ELM to mine deeper information about CHF, it can distinguish between normal and CHF patients, providing diagnostic assistance to cardiologists through a more objective and faster interpretation of ECG signals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology, specifically, it is an image processing method applied to electrocardiograms. Background Technology

[0002] Congestive heart failure (CHF) is a clinical condition characterized by insufficient ventricular filling or insufficient myocardial contraction (heart failure) caused by changes in the structure and function of the heart. It has been identified as a major public health problem. According to statistics, the number of people with CHF worldwide has reached 26 million. Due to population aging and increased survival rates after myocardial infarction, the number of CHF patients is rapidly increasing. Furthermore, CHF can lead to several underlying heart diseases. Early detection of CHF to prevent further structural or functional damage to the heart is crucial and can save lives.

[0003] The diagnosis of CHF is typically based on a patient's medical history, physical examination, echocardiography, electrocardiography, and many other tests, which are complex, time-consuming, and costly. Electrocardiography (ECG) is a non-invasive method of measuring cardiac activity, offering advantages such as affordability, speed, and convenience. Therefore, using ECG signals to diagnose CHF can overcome the weaknesses of traditional diagnostic methods and support physicians' clinical diagnostic decisions. Numerous studies on CHF detection algorithms using ECG signals exist in public databases. ECG signals are non-stationary and non-linear, exhibiting complex fluctuation patterns across a wide range of time scales, making it necessary to quantify the time series to assess their complexity. Methods for quantifying ECG signal complexity include entropy theory, fractal dimension, and the Lyapunov exponent. Many studies have demonstrated the effectiveness of entropy in CHF screening and its contribution to CHF diagnosis. However, the amplitude and duration of ECG signals are relatively small, making visual interpretation of ECG signals a challenge. Furthermore, due to issues such as noise filtering, some ECG signal information may be lost, reducing classification accuracy; however, this can be avoided by converting one-dimensional ECG signals into two-dimensional ECG images. To fully utilize the temporal correlation structure in ECG signals, improve classification accuracy, and more accurately diagnose CHF, this invention proposes a diagnostic method for congestive heart failure based on GAF and an improved two-dimensional multi-scale entropy. The preprocessed ECG signal is converted into a two-dimensional image using GAF. Then, based on the extraction of improved multi-scale entropy image features, Extreme Learning Machine (ELM) is applied to CHF diagnosis. This not only improves the accuracy of two-dimensional entropy estimation and reduces the probability of undefined entropy, but also distinguishes between normal and CHF patients, providing valuable reference for clinical cardiologists in diagnosing CHF.

[0004] Entropy is a feasible method for measuring the complexity of ECG signals, and multiscale entropy (MSE) is an ideal tool for measuring the complexity of time series. In 2002, Costa et al. improved sample entropy and proposed the concept of MSE, which assesses the complexity of a time series by quantifying its entropy across a series of time scales. Since its inception, MSE has become a widely used method for quantifying signal complexity and has been successfully applied in various research fields, including biomedical time series. Developing a complexity metric for the two-dimensional case has also been a long-term goal. In 2014, Silva proposed extending sample entropy to two-dimensional analysis, namely two-dimensional sample entropy (SampEn2D), which extracts information related to pattern repetition in images. Results showed that SampEn2D can be used for histological image analysis. In 2016, Silva used SampEn2D to measure irregularities in pixel patterns, demonstrating that SampEn2D exhibits sufficient stability and robustness for use as a texture feature quantifier. In 2018, Silva proposed two-dimensional multiscale entropy, showing that two-dimensional entropy algorithms are meaningful in the biomedical field, suitable for image analysis and classification based on image texture, and capable of distinguishing different images.

[0005] One-dimensional multi-scale entropy algorithms, due to their coarsening process, significantly reduce the length of the time series on a large scale, leading to inaccurate entropy estimates or the introduction of many undefined entropies. Testing revealed that two-dimensional multi-scale entropy also suffers from the same problem. Furthermore, multi-scale entropy features are relatively limited. While it can output a one-dimensional feature vector, the subsequent classifiers often employ traditional machine learning methods or have numerous training parameters and slow learning speeds, failing to fully extract the internal information of ECG signal features and thus reducing the classification accuracy of ECG signals. Summary of the Invention

[0006] This invention proposes an image processing method for electrocardiograms that can solve the following problems: converting one-dimensional ECG signals into two-dimensional images, improving the accuracy of two-dimensional multi-scale entropy estimation, reducing the probability of undefined entropy, and distinguishing between normal and CHF patients, thereby helping clinicians to diagnose CHF more accurately.

[0007] The specific technical solution adopted in this invention is as follows:

[0008] An image processing method for electrocardiograms (ECGs) first segments and denoises the ECG data. Then, it performs a Fast Fourier Transform (FFT) on the segmented data to obtain the corresponding Doppler spectrum sequence. Next, it applies a Gaussian Image Processing (GAF) to encode the Doppler spectrum sequence into GASF and GADF images. Following this, it extracts features from the two-dimensional images using an improved two-dimensional multi-scale entropy method. Finally, it feeds the features into an ELM classifier for classification.

[0009] Specifically, the following steps are included:

[0010] Step 1: Acquire ECG signal.

[0011] The congestive heart failure database (BIDMC) and the MIT-BIH normal sinus rhythm database (NSRDB) were obtained from PhysioNet. The BIDMC database contained 15 patients with congestive heart failure, with a sampling frequency of 250 Hz, and each patient's record contained two ECG signals. The NSRDB database contained 18 healthy subjects, with a sampling frequency of 128 Hz, and each subject's record contained two ECG signals. Therefore, this invention used a total of 15×2 + 18×2 = 66 ECG signals. The signals from BIDMC were downsampled to 128 Hz to ensure that the sampling frequency of all databases reached the standard value of 128 Hz.

[0012] Step 2: Denoise the ECG signal.

[0013] The wavelet basis functions of the eighth-order Daubechies mother wavelet are calculated using the following formula:

[0014]

[0015] in, Indicates scale. Indicates the amount of translation. The wavelet basis function is used to perform a three-level wavelet decomposition on the ECG signal to obtain a clean ECG signal with baseline drift and high-frequency noise removed.

[0016] Step 3: ECG signal segmentation.

[0017] Experiments have verified that the multi-scale entropy value does not strongly depend on the data length. Therefore, this invention divides the ECG signal into 2-second segments, with each ECG signal (2 seconds) containing 256 samples. 60 segments are taken from each ECG signal in the BIDMC database, resulting in a total data size of 1800×256; 50 segments are taken from each ECG signal in the NSRDB database, also resulting in a total data size of 1800×256.

[0018] Step 4: FFT transformation.

[0019] Each ECG segment ...Perform an FFT transformation, and the calculation formula is as follows:

[0020]

[0021] The continuous spectrum of the ECG signal was obtained, then the zero-frequency component was moved to the center of the spectrum, and finally the spectrum was normalized to obtain its normalized Doppler spectrum. A segment of ECG signal from a normal subject and a segment from a CHF patient were selected, with 256 sample points.

[0022] Step 5: Convert the ECG signal into a two-dimensional image.

[0023] The specific implementation of the GAF algorithm steps is as follows:

[0024] Time series Given n observations, rescale X to ensure all values ​​fall within the interval using the following formula. or :

[0025]

[0026] Therefore, by encoding values ​​as angle cosines and timestamps as radii, a formula can be used to represent rescaled time series in polar coordinates. :

[0027]

[0028] in, It is a timestamp and A constant factor is used to adjust the span of the polar coordinate system. When transforming to the polar coordinate system, the scaling data of the two normalization operations correspond to different angle ranges, and the data within the range... Corresponding to The range of angles for the inverse cosine function, and The range of arccosine values ​​corresponding to the data within the range is: .

[0029] Finally, after converting the rescaled time series to polar coordinates, temporal correlations within different time intervals can be identified using angular perspective by considering the triangulation sum / difference between each point. The GAF is defined as follows:

[0030]

[0031] in, It is a unit row vector. and These represent different row vectors. From the equations above, note that GAF is a newly constructed operation, corresponding to a penalized version of the traditional inner product. The sample points used in this invention are 256, therefore the image size after GAF conversion is 256×256. The ECG signal segment selected from CHF patients has 256 sample points, therefore the image size after GAF conversion is 256×256.

[0032] Step 6: Perform improved two-dimensional multi-scale entropy feature extraction on each image.

[0033] This invention proposes an improved two-dimensional multi-scale entropy algorithm, namely... It is composed of two-dimensional multi-scale entropy ( The improvement was obtained. Define two dimensions A square window of varying sizes will be used for each scale. Next A coarse-grained image Size pattern and all others within the image Compare the size patterns. If the difference between each pixel in a pattern and its corresponding pixel in the comparison image does not exceed a certain value... If so, then pattern matching should be considered. The implementation steps are as follows:

[0034] ① For any image with a width of The height is image ,set up for The first scale A coarse-grained image, with width and If the height is such that the coarse-grained image is defined as follows:

[0035]

[0036] in, , Not greater than The largest integer, .

[0037] Each time, the image is actually involved in the calculation. ,when The image used in the calculation is the original image. This results in partitions of equal size. The number of non-intersecting patterns is But if it is The images used in the calculation were discarded images. The first row and first column Then, under such circumstances, the sizes obtained are equal ( The number of non-intersecting patterns is And so on, when The resulting sizes are equal. The number of non-intersecting patterns is .

[0038] For example: if the image The original size is If scale Then we can obtain disjoint pairs, all of which are of different sizes. There are 25 images. When At that time, there were 25 images in size. For each image, sum the pixels of each image and divide by 1. You can get Image after coarsening .

[0039] when At that time, there were 16 images in size. For each of the given images, sum the pixels of each image and divide by 1 / 2. You can get Image after coarsening .

[0040] when At that time, there were 16 images in size. For each of the given images, sum the pixels of each image and divide by 1 / 2. The image after coarsening .

[0041] ②For the newly generated image ,set up for A square window of size, with the origin at... , From column arrive and the to The set of pixels for a row:

[0042] set up for Internal can generate The total number of windows of different sizes, of which .

[0043] ③ Definition For is a vector and The one with the largest distance difference between corresponding pixels between the two, namely: ,in , , .

[0044] ④ Given similarity tolerance ,statistics Less than r The number of values ​​(called the template match number) is calculated, and the scale is determined. Next A coarse-grained image Number of images matched in a rectangular window of different sizes and The ratio of , denoted as ,all average Seek its effect on all The average value below is .

[0045] ⑤ Let for A square window of length is obtained by repeating steps two through four. Endogenous generation The total number of square windows of different sizes is , No. A coarse-grained image Number of images matched in a rectangular window of different sizes and The ratio is ,all The average value below is .

[0046] ⑥ At the scale of In this case, the improved two-dimensional multiscale entropy value is defined as and The logarithm of the ratio is defined as:

[0047] in, , .

[0048] The above steps were repeated for each scale, resulting in improved two-dimensional multi-scale entropy features for GASF and GADF images from both databases. 180 two-dimensional images from NSR and CHF were selected respectively to simulate the embedding dimension. , ( (Standard deviation of pixels in each image) Up to 20 scale Average and average value.

[0049] As the scale factor increases, the average amplitude of the CHF entropy gradually increases, while the NSR at small scales ( When the scale decreases, the average entropy value decreases. Over time, the average value gradually increases, and the multiscale entropy value of normal individuals is greater than that of CHF patients. At scales up to 20, the entropy values ​​of NSR and CHF GASF images are difficult to distinguish; within scales of 20, GADF images have greater discriminative power. For GASF images, the standard deviation of the entropy value gradually increases with scale; hour, SD and The SDs are almost equal; the scales hour, SD greater than The SD of NSR images increases with scale, while the SD of CHF images fluctuates significantly; at scales 1 to 20, SD is slightly larger than SD, and using There is no undefined entropy in the algorithm.

[0050] When using When analyzing GASF and GADF images, NSR exhibits undefined entropy with a probability of 0.10, meaning that undefined entropy exists at two of the 20 scales. For GASF images, the sample entropy obtained at scales 19 and 20 is uncertain, thus exhibiting undefined entropy. For GADF images, undefined entropy exists at scales 17 and 20. When analyzing the two-dimensional images of NSR and CHF, the probability of undefined entropy is zero. Therefore, This can reduce the probability of undefined entropy and improve the effectiveness of the algorithm. When using entropy values ​​to analyze two-dimensional GAF images, and The average entropy values ​​obtained are almost equal, but SD is slightly larger than The result of using SD indicates that... The entropy ratio obtained by the algorithm is used The obtained entropy is more accurate. Compared with the two-dimensional multi-scale entropy algorithm, the improved two-dimensional multi-scale entropy algorithm proposed in this invention can improve the accuracy of two-dimensional entropy estimation and reduce the probability of undefined entropy.

[0051] Step 7: Split the dataset.

[0052] In this invention, practical experience shows that GADF is more suitable for ECG time series. The embedding dimension is selected. , , The improved multi-scale entropy features at scale 20 resulted in a final GADF feature map size of 1800×20. Therefore, the feature size obtained from both the BIDMC and NSRDB databases was 1800×20. After feature extraction from the two-dimensional images, the improved multi-scale entropy of each image was used as a dataset, with each feature dataset being 1800×20, representing a total of 1800 samples and 20 features, resulting in a total feature set of 3600×20. A five-fold cross-validation algorithm was used, with 4 / 5 of the feature set used for training and the remaining feature set used for testing. The specific category of each sample was determined through manual annotation.

[0053] Step 8: Construct the Extreme Learning Machine (ELM).

[0054] The ELM was trained using a training sample set. The Extreme ELM consists of an input layer, hidden layers, and an output layer, and is a single-hidden-layer feedforward neural network. The connection weights between the hidden and output layers are determined in one step by solving a system of equations, rather than iteratively adjusted by setting the number of neurons in the hidden layer. From a learning efficiency perspective, the Extreme Learning Machine has advantages such as fewer training parameters, faster learning speed, and stronger generalization ability. To improve the network's learning performance and effectiveness, the ELM parameters were adjusted using a training set, and the optimal number of hidden layer nodes was determined to be 80 through five-fold cross-validation.

[0055] Step 9: Classification results.

[0056] The test set is used to generate classification results through a trained neural network model. The experimental results are evaluated using accuracy (ACC), precision (PPV), sensitivity (SEN), and specificity (SPE), as shown in the following formulas:

[0057]

[0058] Wherein, TP represents the frequency of predicting a positive sample as positive, TN represents the frequency of predicting a negative sample as negative, FP represents the frequency of predicting a negative sample as positive, and FN represents the frequency of predicting a positive sample as negative.

[0059] Step 10: Compare the results of the one-dimensional algorithm and the two-dimensional algorithm.

[0060] Using the same database and data types, to reduce undefined entropy, the ECG signal was divided into 32-second segments, with each ECG signal containing 8192 samples. 50 segments were taken from each ECG signal in the BIDMC database, resulting in a total data set of 1500×8192; 50 segments were taken from each ECG signal in the NSRDB database, resulting in a total data set of 1800×8192. Scales ranging from 11 to 20 were selected, and the embedding dimension was... and The feature sizes of the simulated one-dimensional multi-scale entropy are 1800×10, and the total feature set is 3300×10, which is designated as feature set A. Improved two-dimensional multi-scale entropy features at scales 11 to 20 are selected from step 7. The feature set of the BIDMC database is 1500×10, and the feature set of the NSRDB database is 1800×10, with a total feature set of 3300×10, which is designated as feature set B.

[0061] The beneficial effects of this invention are as follows: The improved two-dimensional multi-scale entropy algorithm disclosed in this invention can improve the accuracy of entropy estimation and reduce the probability of inducing undefined entropy. By using this method to extract features from image signals, it can more clearly reflect the multi-scale entropy features at each scale. By using ELM to mine deeper information about CHF, it can distinguish between normal and CHF patients. By providing a more objective and faster interpretation of electrocardiogram signals, it can provide diagnostic assistance to cardiologists. Attached Figure Description

[0062] Figure 1 This is a flowchart of the method of the present invention.

[0063] Figure 2a This is the original NSR ECG signal diagram in an embodiment of the present invention.

[0064] Figure 2b This is a diagram of the original CHF ECG signal in an embodiment of the present invention.

[0065] Figure 3a This is the normalized Doppler spectrum of the NSR ECG signal in an embodiment of the present invention.

[0066] Figure 3b This is a normalized Doppler spectrum of the CHF ECG signal in an embodiment of the present invention.

[0067] Figure 4 This is a schematic diagram of converting a Doppler spectral sequence into a GAF image in an embodiment of the present invention.

[0068] Figure 5 As described in the embodiments of the present invention A schematic diagram of the pattern comparison scheme.

[0069] Figure 6 This is a comparison chart of multi-scale entropy values ​​and improved multi-scale entropy values ​​in an embodiment of the present invention.

[0070] Figure 7 This is a comparison chart of the standard deviation of the multi-scale entropy value and the improved multi-scale entropy value in the embodiments of the present invention. Detailed Implementation

[0071] To enhance understanding of the present invention, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. These embodiments are only used to explain the invention and do not limit the scope of protection of the invention.

[0072] Example: An image processing method for electrocardiograms (ECG) first segments and denoises the ECG data. Then, it performs a Fast Fourier Transform (FFT) on the segmented data to obtain the corresponding Doppler spectrum sequence. Next, it applies a Gaussian Image Processing (GAF) algorithm to encode the Doppler spectrum sequence into GASF and GADF images. Following this, it extracts features from the two-dimensional image using an improved two-dimensional multi-scale entropy method. Finally, it feeds the features into an ELM classifier for classification. Figure 1 As shown, the specific steps include:

[0073] Step 1: Acquire ECG signal.

[0074] The congestive heart failure database (BIDMC) and the MIT-BIH normal sinus rhythm database (NSRDB) were obtained from PhysioNet. The BIDMC database contains data from 15 patients with congestive heart failure, with a sampling frequency of 250 Hz, and each patient's record contains two ECG signals. The NSRDB database contains data from 18 healthy subjects, with a sampling frequency of 128 Hz, and each subject's record contains two ECG signals. Therefore, this invention used a total of [data missing - likely related to data collection techniques]. Figure 2 shows the raw ECG signals of typical normal subjects (NSR) and CHF patients. The signals from BIDMC were downsampled to 128 Hz to bring the sampling frequency of all databases up to the standard value of 128 Hz.

[0075] The wavelet basis functions of the eighth-order Daubechies mother wavelet are calculated using the following formula:

[0076]

[0077] in, Indicates scale. Indicates the amount of translation. This represents the wavelet basis function. A three-level wavelet decomposition is performed on the ECG signal to obtain a clean ECG signal with baseline drift and high-frequency noise removed.

[0078] Step 3: ECG signal segmentation.

[0079] Experiments have verified that the multi-scale entropy value does not strongly depend on the data length. Therefore, this invention divides the ECG signal into 2-second segments, with each ECG signal (2 seconds) having a length of 256 samples. 60 segments are taken from each ECG signal in the BIDMC database, resulting in a total data count of 1800*256. 50 segments are taken from each ECG signal in the NSRDB database, resulting in a total data count of 1800*256.

[0080] Step 4: FFT transformation.

[0081] Each ECG segment. Perform an FFT transformation; the calculation formula is as follows:

[0082]

[0083] The continuous spectrum of the ECG signal was obtained, then the zero-frequency component was shifted to the center of the spectrum, and finally the spectrum was normalized to obtain its normalized Doppler spectrum. A segment of ECG signal from a normal subject and a segment from a CHF patient were selected, with 256 sample points. The normalized spectrum is shown in Figure 3.

[0084] Step 5: Convert the ECG signal into a two-dimensional image.

[0085] Inspired by the success of deep learning in computer vision, Wang et al. proposed two processing algorithms for encoding time series data into images: GASF and GADF. These algorithms can convert one-dimensional time series into two-dimensional images, thereby enabling the visualization of time series data. Simultaneously, the encoded images retain the temporal and correlational properties of the original data. The GAF algorithm does not use Cartesian coordinates derived from the Gram matrix, but instead represents the time series in polar coordinates. The specific implementation steps of the GAF algorithm are as follows:

[0086] Time series Include Each observation, rescaled The following formula ensures that all values ​​fall within the interval. or :

[0087]

[0088] Therefore, by encoding values ​​as angle cosines and timestamps as radii, a formula can be used to represent rescaled time series in polar coordinates. :

[0089]

[0090] in, It is a timestamp and A constant factor is used to adjust the span of the polar coordinate system. When transforming to the polar coordinate system, the scaling data of the two normalization operations correspond to different angle ranges, and the data within the range... Corresponding to The range of angles for the inverse cosine function, and The range of arccosine values ​​corresponding to the data within the range is: ;

[0091] Finally, after converting the rescaled time series to polar coordinates, temporal correlations within different time intervals can be identified using angular perspective by considering the triangulation sum / difference between each point. The GAF is defined as follows:

[0092]

[0093] in, It is a unit row vector. and These represent different row vectors. From the equations above, note that GAF is a newly constructed operation, corresponding to a penalized version of the traditional inner product. The sample points used in this invention are 256, therefore the image size after GAF conversion is 256*256. An ECG signal segment from a CHF patient is selected, with 256 sample points. Figure 4 The complete process of converting a rescaled Doppler spectrum sequence into a GAF coded map is shown.

[0094] Step 6: Perform improved two-dimensional multi-scale entropy feature extraction on each image.

[0095] This invention proposes an improved two-dimensional multi-scale entropy algorithm, namely... It is composed of two-dimensional multi-scale entropy ( (This was obtained through improvement.) Define two dimensions A square window of varying sizes will be used for each scale. Next A coarse-grained image Size pattern and all others within the image Compare the size patterns. If the difference between each pixel in a pattern and its corresponding pixel in the comparison image does not exceed a certain value... If so, then pattern matching should be considered. Figure 5 Showing An example of the pattern comparison step. The implementation steps are as follows:

[0096] ① For any image with a width of The height is image ,set up for The first scale A coarse-grained image, with width and If the height is such that the coarse-grained image is defined as follows:

[0097]

[0098] in , Not greater than The largest integer, .

[0099] Each time, the image is actually involved in the calculation. ,when The image used in the calculation is the original image. This results in partitions of equal size. The number of non-intersecting patterns is But if it is The images used in the calculation were discarded images. The first row and first column Then, under such circumstances, the sizes obtained are equal ( The number of non-intersecting patterns is And so on, when The resulting sizes are equal. The number of non-intersecting patterns is .

[0100] For example: if the image The original size is If scale Then we can obtain disjoint pairs, all of which are of different sizes. There are 25 images. When At that time, there were 25 images in size. For each image, sum the pixels of each image and divide by 1. You can get Image after coarsening .

[0101] when At that time, there were 16 images in size. For each of the given images, sum the pixels of each image and divide by 1 / 2. You can get Image after coarsening .

[0102] when At that time, there were 16 images in size. For each of the given images, sum the pixels of each image and divide by 1 / 2. The image after coarsening .

[0103] ②For the newly generated image ,set up for A square window of size, with the origin at... , It is from the column. .arrive and the to The set of pixels for a row: .set up for Internal can generate The total number of windows of different sizes, of which .

[0104] ③ Definition For is a vector and The one with the largest distance difference between corresponding pixels between the two, namely: ,in .

[0105] ④ Given similarity tolerance ,statistics Less than r The number of values ​​(called the template match number) is calculated, and the scale is determined. Next A coarse-grained image Number of images matched in a rectangular window of different sizes and The ratio of , denoted as ,all average Seek its effect on all The average value below is .

[0106] ⑤ Let for A square window of length, obtained by repeating steps ②-④. Endogenous generation The total number of square windows of different sizes is , No. A coarse-grained image Number of images matched in a rectangular window of different sizes and The ratio is ,all The average value below is .

[0107] ⑥ At the scale of In this case, the improved two-dimensional multiscale entropy value is defined as and The logarithm of the ratio is defined as:

[0108]

[0109] in, , .

[0110] The above steps were repeated for each scale, resulting in improved two-dimensional multi-scale entropy features for GASF and GADF images from both databases. 180 two-dimensional images from NSR and CHF were selected respectively to simulate the embedding dimension. , ( (Standard deviation of pixels in each image) Scale Average and Average value, results as follows Figure 6 As shown, the standard deviation (SD) comparison is as follows: Figure 7 As shown in Table 1, the mean and standard deviation of the entropy of NSR and CHF are shown in Table 1.

[0111] Table 1. NSR and CHF at scales 1 to 20 , mean and standard deviation

[0112]

[0113] according to Figure 6 It can be observed that as the scale factor increases, the average amplitude of the CHF entropy gradually increases; the NSR at a small scale ( When the scale decreases, the average entropy value decreases. Over time, the average value gradually increases, and the multiscale entropy value of normal individuals is greater than that of CHF patients. At a scale of 20, the entropy values ​​of NSR and CHF GASF images are difficult to distinguish; within a scale of 20, GADF images have greater discriminative power. Figure 7 The display shows the standard deviation of the two-dimensional entropy, verifying the accuracy of the proposed algorithm. For GASF images, the standard deviation of the entropy value gradually increases with scale; scale... hour, SD and The SDs are almost equal; the scales hour, SD greater than The SD of NSR images increases with scale, while the SD of CHF images fluctuates significantly; at scales 1 to 20, SD is slightly larger than SD, and using There is no undefined entropy in the algorithm.

[0114] As shown in Table 1, when using When analyzing GASF and GADF images, NSR exhibits undefined entropy with a probability of 0.10, meaning that undefined entropy exists at two of the 20 scales. For GASF images, the sample entropy obtained at scales 19 and 20 is uncertain, thus exhibiting undefined entropy. For GADF images, undefined entropy exists at scales 17 and 20. When analyzing the two-dimensional images of NSR and CHF, the probability of undefined entropy is zero. Therefore, This can reduce the probability of undefined entropy and improve the effectiveness of the algorithm. When using entropy values ​​to analyze two-dimensional GAF images, and The average entropy values ​​obtained were almost equal (NSR is shown in columns 2 and 4, 3 and 5 of Table 1; CHF is shown in columns 6 and 8, 7 and 9), but... SD is slightly larger than The result of using SD indicates that... The entropy ratio obtained by the algorithm is used The obtained entropy is more accurate. Compared with the proposed two-dimensional multi-scale entropy algorithm, the improved two-dimensional entropy estimation algorithm can improve the accuracy of two-dimensional entropy estimation and reduce the probability of undefined entropy.

[0115] In this invention, practical experience shows that GADF is more suitable for ECG time series. Selection of embedding dimension. , , The improved multi-scale entropy features at scale 20 resulted in a final GADF feature map size of 1800*20. Therefore, the feature size obtained from both the BIDMC and NSRDB databases is 1800*20. After feature extraction from the two-dimensional images, the improved multi-scale entropy of each image was used as the dataset, with each feature dataset being 1800*20, representing a total of 1800 samples and 20 features. This resulted in a total feature set of 3600*20 for both datasets. A five-fold cross-validation algorithm was used, with 4 / 5 of the feature set used for training and the remaining feature set used for testing. The specific category of each sample was determined through manual annotation.

[0116] The ELM was trained using a training sample set. The Extreme ELM consists of an input layer, hidden layers, and an output layer, and is a single-hidden-layer feedforward neural network. The connection weights between the hidden and output layers are determined in one step by solving a system of equations, rather than iteratively adjusted by setting the number of neurons in the hidden layer. From a learning efficiency perspective, the Extreme Learning Machine has advantages such as fewer training parameters, faster learning speed, and stronger generalization ability. To improve the network's learning performance and effectiveness, the ELM parameters were adjusted using a training set, and the optimal number of hidden layer nodes was determined to be 80 through five-fold cross-validation.

[0117] The test set is used to generate classification results through a trained neural network model. The experimental results are evaluated using accuracy (ACC), precision (PPV), sensitivity (SEN), and specificity (SPE), as shown in the following formulas:

[0118]

[0119] Wherein, TP represents the frequency of predicting a positive sample as positive, TN represents the frequency of predicting a negative sample as negative, FP represents the frequency of predicting a negative sample as positive, and FN represents the frequency of predicting a positive sample as negative.

[0120] The average classification results of the five-fold cross-validation are shown in Table 2. The proposed algorithm achieved significant results in CHF detection, with an accuracy of 89.53%, precision of 90.50%, sensitivity of 88.35%, and specificity of 90.72%. The SEN value was 88.35%, meaning that 88.35% of normal ECG segments were correctly classified as normal. The SPEC value was 90.72%, indicating that 90.72% of CHF signals were correctly classified as CHF, while 11.65% and 9.28% of ECG signals were incorrectly classified as CHF and normal, respectively. Table 2 shows that the proposed algorithm can distinguish between normal and CHF patients, making it an effective method for diagnosing CHF.

[0121] Table 2 Classification results of the dataset

[0122]

[0123] Using the same database and data types, to reduce undefined entropy, the ECG signal was divided into 32-second segments, with each ECG signal containing 8192 samples. 50 segments were taken from each ECG signal in the BIDMC database, resulting in a total data set of 1500*8192; 50 segments were taken from each ECG signal in the NSRDB database, resulting in a total data set of 1800*8192. Scales ranging from 11 to 20 were selected, and the embedding dimension was... and The simulated one-dimensional multi-scale entropy features were 1800*10, with a total feature set of 3300*10, designated as feature set A. Improved two-dimensional multi-scale entropy features at scales 11 to 20 were selected from step 7. The feature set from the BIDMC database was 1500*10, and the feature set from the NSRDB database was 1800*10, with a total feature set of 3300*10, designated as feature set B. An ELM classifier with 80 hidden layer nodes was selected for classification, and a five-fold cross-validation experiment was performed. The average results are shown in Table 3.

[0124] Table 3. Comparison of one-dimensional multi-scale entropy and improved two-dimensional multi-scale entropy algorithms.

[0125]

[0126] According to Table 3, the accuracy, precision, sensitivity, and specificity of classification using one-dimensional multi-scale entropy features (Group A) were 80.94%, 84.68%, 79.46%, and 82.73%, respectively. The accuracy, precision, sensitivity, and specificity of classification using improved two-dimensional multi-scale entropy features (Group B) were 88.85%, 89.88%, 89.67%, and 87.87%, respectively. All evaluation indicators for Group B were higher than those for Group A. These results indicate that using two-dimensional image feature extraction can improve the classification rate of CHF and help clinicians better diagnose CHF.

[0127] The above description is an exemplary embodiment of the present invention and does not limit the scope of patent protection of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. An image processing method applied to electrocardiogram, characterized in that, First, the ECG data is segmented and denoised. Next, a Fast Fourier Transform (FFT) is performed on the segmented data to obtain the corresponding Doppler spectrum sequence. Then, the GAF is applied to encode the Doppler spectrum sequence into GASF and GADF images. Next, features are extracted from the two-dimensional images using an improved two-dimensional multi-scale entropy method. Finally, the features are fed into an ELM classifier for classification processing. The specific steps include: Step 1: Acquire ECG signal; Step 2: Denoising the ECG signal; Step 3: ECG signal segmentation; Step 4: FFT transformation; Step 5: Convert the ECG signal into a two-dimensional image; Step 6: Perform improved two-dimensional multi-scale entropy feature extraction on each image; Step 7: Split the dataset; Step 8: Construct the Extreme Learning Machine; Step 9: Classification results; Step 10: Compare the results of the one-dimensional algorithm and the two-dimensional algorithm; Step 6: Apply improved two-dimensional multi-scale entropy to each image. The specific process of feature extraction is as follows: a two-dimensional... A square window of varying sizes will be used for each scale. Next A coarse-grained image Size pattern and all others within the image When comparing large and small patterns, if the difference between each pixel in one pattern and the corresponding pixel in the comparison image does not exceed a certain value... If so, then consider pattern matching; The implementation steps are as follows: For any image with width The height is image ,set up for The first scale A coarse-grained image, with width and If the height is such that the coarse-grained image is defined as follows: , in, , Not greater than The largest integer, ; For the newly generated image ,set up for A square window of size, with the origin at... , From column arrive and the to The set of pixels in a row: , set up for Endogenous generation The total number of windows of different sizes, of which ; definition For is a vector and The one with the largest distance difference between corresponding pixels between the two, namely: ,in , , ; Given similarity tolerance ,statistics Count the number of values ​​less than r, and determine the scale. Next A coarse-grained image Number of images matched in a rectangular window of different sizes and The ratio of , denoted as , all average , Seek its approximation for all The average value below is ; set up for A rectangular window of length, repeating the first... -No. Step to get Endogenous generation The total number of square windows of different sizes is , No. A coarse-grained image Number of images matched in a rectangular window of different sizes and The ratio is ,all The average value below is ; At scale In this case, the improved two-dimensional multiscale entropy value is defined as and The logarithm of the ratio is defined as: , in, , The above steps were repeated at each scale to obtain improved two-dimensional multi-scale entropy features for GASF and GADF images from the two databases. 180 two-dimensional images from NSR and CHF were selected respectively to simulate the embedding dimension. , , The standard deviation of each image pixel is . Up to 20 scale Average and average value.

2. The image processing method for electrocardiograms according to claim 1, characterized in that, The specific process for obtaining ECG signals in Step 1 is as follows: Obtain the congestive heart failure database BIDMC and the MIT-BIH normal sinus rhythm database NSRDB from PhysioNet. The BIDMC database contains 15 patients with congestive heart failure, with a sampling frequency of 250Hz, and each patient's record contains two ECG signals. The NSRDB database contains 18 healthy subjects, with a sampling frequency of 128Hz, and each subject's record contains two ECG signals. Therefore, a total of 66 ECG signals were used. The signals from BIDMC were downsampled to 128Hz so that the sampling frequency of all databases reached the standard value of 128Hz.

3. The image processing method for electrocardiograms according to claim 2, characterized in that, The specific process for ECG signal denoising in step 2 is as follows: using the wavelet basis function of the eighth-order Daubechies mother wavelet, the calculation formula is as follows: , in, Indicates scale. Indicates the amount of translation. The wavelet basis function is used to perform a three-level wavelet decomposition on the ECG signal to obtain a clean ECG signal with baseline drift and high-frequency noise removed.

4. The image processing method for electrocardiograms according to claim 3, characterized in that, The specific process of ECG signal segmentation in step 3 is as follows: the ECG signal is segmented into 2-second segments, each ECG signal has a length of 256 samples, 60 segments are taken from each ECG signal in the BIDMC database, and the total number of data is 1800×256; 50 segments are taken from each ECG signal in the NSRDB database, and the total number of data is 1800×256.

5. The image processing method for electrocardiogram according to claim 4, characterized in that, The specific process of FFT transformation in step 4 is as follows: Each ECG segment... The FFT transformation is performed, and the calculation formula is as follows: , The continuous spectrum of the ECG signal was obtained, then the zero-frequency component was moved to the center of the spectrum, and finally the spectrum was normalized to obtain its normalized Doppler spectrum. A segment of ECG signal from a normal subject and a segment from a CHF patient were selected, with 256 sample points.

6. The image processing method for electrocardiogram according to claim 5, characterized in that, The specific process for converting the ECG signal into a two-dimensional image in step 5 is as follows: The specific implementation of the GAF algorithm steps is as follows: Time series Include Each observation, rescaled The following formula ensures that all values ​​fall within the interval. or : , Therefore, by encoding values ​​as angle cosines and timestamps as radii, a formula can be used to represent the rescaled time series in polar coordinates. : , in, It is a timestamp and A constant factor is used to adjust the span of the polar coordinate system. When transforming to the polar coordinate system, the scaling data of the two normalization operations correspond to different angle ranges, and the data within the range... Corresponding to The range of angles for the inverse cosine function, and The range of arccosine values ​​corresponding to the data within the range is: ; Finally, after converting the rescaled time series to polar coordinates, angular perspective is used to identify temporal correlations within different time intervals by considering the trigonometric sums / differences between each point. The GAF is defined as follows: , in, It is a unit row vector. and Different row vectors are represented by 256 sample points. Therefore, the image size after GAF conversion is 256×256. The ECG signal segment of the CHF patient is selected, and the number of sample points is 256. Therefore, the image size after GAF conversion is 256×256.

7. The image processing method for electrocardiogram according to claim 6, characterized in that, The specific process for partitioning the dataset in step 7 is as follows: Selecting the embedding dimension. , , Improved multi-scale entropy features at scale 20 were used. The GADF feature map size was 1800×20, the feature size obtained from the BIDMC database was 1800×20, and the feature size obtained from the NSRDB database was 1800×20. After feature extraction from the two-dimensional images, the improved multi-scale entropy of each image was used as the dataset, and each feature dataset was 1800×20, indicating that the total number of samples was 1800 and the number of features was 20, resulting in a total feature set of 3600×20 for the two datasets. A five-fold cross-validation algorithm was used, with 4 / 5 of the feature set used for training and the remaining feature set used for testing. The specific category of each sample was determined by manual annotation.

8. The image processing method for electrocardiogram according to claim 7, characterized in that, The specific process of constructing the Extreme Learning Machine (ELM) in step 8 is as follows: The ELM consists of an input layer, a hidden layer, and an output layer. The number of neurons in the hidden layer is set. The connection weights between the hidden layer and the output layer are not adjusted iteratively, but determined once by solving a system of equations. The parameters of the ELM are adjusted by selecting a training set. The optimal number of hidden layer nodes in the ELM is determined to be 80 through five-fold cross-validation.

9. The image processing method for electrocardiogram according to claim 8, characterized in that, The specific process for classifying the results in step 9 is as follows: the test set is used to generate classification results through a trained neural network model, and the experimental results are evaluated using accuracy (ACC), precision (PPV), sensitivity (SEN), and specificity (SPE), as shown in the following formulas: , , , , Where TP represents the frequency of predicting a positive sample as positive, TN represents the frequency of predicting a negative sample as negative, FP represents the frequency of predicting a negative sample as positive, and FN represents the frequency of predicting a positive sample as negative. Step 10, comparing the results of the one-dimensional and two-dimensional algorithms, involves the following steps: Using the same database and data types, to reduce undefined entropy, the ECG signal is divided into 32-second segments, with each ECG signal containing 8192 samples. 50 segments are taken from each ECG signal in the BIDMC database, resulting in a total data set of 1500×8192. Similarly, 50 segments are taken from each ECG signal in the NSRDB database, resulting in a total data set of 1800×8192. A scale of 11 to 20 is selected, along with the embedding dimension. and The feature sizes of the simulated one-dimensional multi-scale entropy are 1800×10, and the total feature set is 3300×10, which is set as feature set A. Improved two-dimensional multi-scale entropy features at scales 11 to 20 are selected from step 7. The feature set of the BIDMC database is 1500×10, and the feature set of the NSRDB database is 1800×10, with a total feature set of 3300×10, which is set as feature set B.