Method and device for extracting heartbeat cycle and numerical signal from ECG shot image

By preprocessing and signal dimensionality reduction of ECG images, the heartbeat cycle and numerical signals are extracted, and the problems of low image quality and unstable characteristics are solved, and efficient diagnosis and numerical signal extraction of ECG images are realized, suitable for real medical scenarios diagnosis.

CN119074003APending Publication Date: 2024-12-06HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411191122.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The prior art is difficult to effectively extract heartbeat period and numerical signals from ECG images, mainly due to low image quality, changes in angle and lighting conditions, and the interference between the peak area and the grid line affects the accuracy of signal extraction.

Method used

By acquiring ECG images for preprocessing, including rotation, cropping, grayscale, Gaussian filtering smoothing, binarization, contour signal extraction and normalization processing, combined with PCA model to reduce the signal dimensions, and finally convert the image into a one-dimensional signal to extract the heartbeat cycle.

Benefits of technology

It realizes accurate extraction of heartbeat cycles and numerical signals from paper ECG images, improves the efficiency and accuracy of ECG image diagnosis, adapts to the needs of machine learning methods, has good interpretable performance and graphical feature display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119074003A_ABST
    Figure CN119074003A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for extracting a heartbeat cycle and a numerical signal from an ECG shot image.The method comprises the steps that S1, an ECG image of a patient is obtained; s2, carrying out preprocessing on the ECG image; s3, performing signal preprocessing on the preprocessed post-ECG image; s4, extracting a heartbeat cycle from the ECG image after signal preprocessing; and S5, performing signal dimension reduction on the ECG image after signal preprocessing. According to the method, an electrocardiogram paper record is converted into a one-dimensional signal from a shot paper image through a machine learning and image processing method in the diagnosis process, P, QRS and T waves existing in the electrocardiogram signal and a heartbeat cycle are extracted so as to adapt to diagnosis of the machine learning method for the ECG image, the specific processed image can be directly exported, and the diagnosis efficiency is improved. Therefore, the method has good interpretable performance and graphical feature display.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of ECG image diagnosis, image recognition and processing, image signal extraction and numerical signal conversion, and multimodal technology, and more specifically, to a method and device for extracting heartbeat cycles and numerical signals from ECG images. Background Art

[0002] Electrocardiography (ECG or EKG) is a diagnostic technique that records the electrophysiological activity of the heart. It records the electrical activity of the heart in units of time and captures and records it on electrodes that contact the skin. Although this imaging examination is very simple, the interpretation of the ECG requires a lot of training. Manual inspection and re-inspection of ECG paper records usually takes a lot of time and it is difficult to give quick and accurate predictions. Machine learning is a method that uses algorithms to identify patterns in a set of data and make predictions. Machine learning methods play an important role in the interpretation of electrocardiograms (ECGs). However, most of the current machine learning methods are trained and modeled based on raw ECG numerical signal data. In real clinical scenarios, due to the limitations of ECG equipment manufacturers, doctors and patients cannot directly obtain the original ECG signal data, and can only view or print out the ECG. If the corresponding heartbeat cycle and numerical signal can be extracted from the ECG image (taken from the screen or taken on paper ECG), the utilization rate of ECG medical data will be significantly improved. However, it is still challenging to convert ECG images into numerical signal data.

[0003] First, the low quality of medical images taken by users brings great difficulties to image recognition and prediction. Although the original image is relatively clear, unlike image scanning, the different angles and lighting conditions in the image shooting lead to uneven color changes and unstable features, which are not easy to be directly diagnosed automatically; secondly, the changes in the peak area and the grid lines with similar colors to the waveform seriously undermine the accuracy and effectiveness of image signal extraction; finally, it is crucial to convert the processed image into a numerical signal and segment the complete heartbeat cycle. Only by connecting machine learning with numerical signals, rather than the original image, can accurate and efficient prediction results be obtained. Summary of the invention

[0004] The purpose of the present invention is to provide a method and device for extracting heartbeat cycle and numerical signal from ECG images, so as to overcome the defects of the prior art.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0006] A method for extracting a heartbeat cycle and a numerical signal from an ECG image comprises the following steps:

[0007] S1, obtaining the patient's ECG image;

[0008] S2, preprocessing the ECG image;

[0009] S3, performing signal preprocessing on the preprocessed ECG image;

[0010] S4, extracting the heartbeat cycle from the ECG image after signal preprocessing;

[0011] S5. Perform signal dimension reduction on the ECG image after signal preprocessing.

[0012] Furthermore, the step S2 specifically includes:

[0013] S20, using the PIL library to load the ECG image, and using the streamlit library to enable the user to rotate the image at angles of -180, -90, 0, 90, and 180 and crop the image according to the cropping frame, and the cropped image is converted into a NumPy array representing the image using the imread function in the scikit-image library;

[0014] S21, segmenting the cropped image, obtaining 2 / 3 of the content according to the overall area as analysis data, dividing 12 short leads and 1 long lead according to the height and width, and saving them in a lead set;

[0015] S22. Use the color.rgb2gray method to convert the color image into a grayscale image.

[0016] Furthermore, the step S3 specifically includes:

[0017] S30, converting the lead into a grayscale image, applying Gaussian filtering to smooth the image, finding a global threshold through the Otsu threshold method to perform a binarization operation, and converting the grayscale image into a binary image showing a specific waveform;

[0018] S31. Use contour technology to track the converted binary image, extract the contour signal in the image, use the MinMaxScaler tool to normalize and scale the values, use the fit_transform() function to fit and transform, and then use the DataFrame in the pandas library to export the data;

[0019] S32. Set the X-axis to correspond to high points and low points, and the Y-axis to correspond to the curve / shape, and merge the normalized and scaled one-dimensional signal values ​​in the X-axis of all leads and save them separately in a CSV file.

[0020] Furthermore, the step S4 is specifically as follows: for the scaled one-dimensional signal value CSV file, the heartbeat cycle is divided and extracted based on the extreme point information and corresponding coordinates.

[0021] Furthermore, the step S5 specifically includes: using the loaded PCA model to perform dimensionality reduction processing on the input CSV file.

[0022] The present invention also provides a device for implementing the above-mentioned method of extracting heartbeat cycle and numerical signal from ECG captured images, comprising:

[0023] An acquisition module, used for acquiring ECG images of patients;

[0024] A first preprocessing module, used for preprocessing the ECG image;

[0025] A second preprocessing module, used for performing signal preprocessing on the preprocessed ECG image;

[0026] An extraction module, used for extracting the heartbeat cycle from the ECG image after signal preprocessing;

[0027] The dimension reduction module is used to perform signal dimension reduction on the ECG image after signal preprocessing.

[0028] Compared with the prior art, the advantages of the present invention are: the present invention is used for paper electrocardiogram recognition and processing tasks to enhance ECG image diagnosis; the present invention combines the various challenges faced by ECG images in real medical diagnosis; the present invention proposes that during the diagnosis process, the captured paper images are converted into one-dimensional signals through machine learning and image processing methods, and the P, QRS and T waves and the heart cycle present in the electrocardiogram signal are extracted to adapt to the diagnosis of ECG images by machine learning methods, and the specific processed images can be directly exported, so the method has good interpretability and graphical feature display. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 It is a model framework of the method of extracting heartbeat cycle and numerical signal from ECG captured images of the present invention.

[0031] Figure 2b and c in the figure are the heart cycle images extracted from a by the lead information according to the present invention.

[0032] Figure 3 It is a schematic diagram of a device for extracting a heartbeat cycle and a numerical signal from an ECG image according to the present invention. DETAILED DESCRIPTION

[0033] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more definite definition of the protection scope of the present invention.

[0034] See also Figure 1 and Figure 2 As shown, this embodiment discloses a method for extracting a heartbeat cycle and a numerical signal from an ECG image, comprising the following steps:

[0035] Step S1, obtaining the patient's ECG image.

[0036] Step S2, preprocessing the ECG image, specifically comprising:

[0037] Step S20, cropping and rotation: Use the PIL library to load a given patient's original ECG image, and use the streamlit library to enable the user to rotate the image at angles of -180, -90, 0, 90, and 180, and crop the image according to the cropping frame. The cropped image is converted into a NumPy array representing the image using the imread function in the scikit-image library.

[0038] Step S21, lead division: segment the cropped image, obtain 2 / 3 of the content according to the overall area as analysis data, divide it into 12 short leads and 1 long lead according to the height and width, and save them in the lead set. These leads represent different parts and angles of the heart, which can comprehensively evaluate the function and health of the heart.

[0039] Step S22, grayscale processing: use the color.rgb2gray method to convert the color image into a grayscale image.

[0040] Step S3, performing signal preprocessing on the preprocessed ECG image, specifically comprising:

[0041] Step S30, data cleaning and feature conversion: 13 leads are processed, including converting the leads into grayscale images, applying Gaussian filtering to smooth the images, finding the global threshold through the Otsu threshold method to perform a binarization operation, and finally converting the grayscale image into a binary image showing a specific waveform to achieve the effect of removing the grid lines.

[0042] Step S31, signal extraction and signal scaling: Use contour technology to track the converted binary image, extract the contour signal in the image, and use the MinMaxScaler tool to normalize and scale the values. Use the fit_transform() function to fit and transform to achieve data standardization and ensure that the data range is between 0 and 1. Finally, use the DataFrame in the pandas library to export the data.

[0043] Step S32, extract high and low points and merge leads: set the X-axis to correspond to high points and low points, and the Y-axis to correspond to the curve / shape, merge the normalized and scaled one-dimensional signal values ​​in the X-axis of all leads and save them separately in a CSV file.

[0044] Step S4, extracting the heartbeat cycle from the ECG image after signal preprocessing: for the CSV file of the scaled one-dimensional signal value, divide and extract the heartbeat cycle based on the extreme point information and corresponding coordinates.

[0045] Step S5, performing signal dimensionality reduction on the ECG image after signal preprocessing: specifically, using the loaded PCA model to perform dimensionality reduction processing on the input CSV file.

[0046] See also Figure 3 As shown, the present invention also provides a device for implementing the above-mentioned method of extracting heartbeat cycle and numerical signal from ECG captured images, including: an acquisition module 1, used to acquire the patient's ECG image; a first preprocessing module 2, used to preprocess the ECG image; a second preprocessing module 3, used to perform signal preprocessing on the preprocessed ECG image; an extraction module 4, used to extract the heartbeat cycle from the ECG image after signal preprocessing; a dimensionality reduction module 5, used to perform signal dimensionality reduction on the ECG image after signal preprocessing.

[0047] The present invention is used for paper electrocardiogram recognition and processing tasks to enhance ECG image diagnosis; the present invention combines the various challenges faced by ECG images in real medical diagnosis; the present invention proposes that during the diagnosis process, the captured paper images are converted into one-dimensional signals through machine learning and image processing methods, and the P, QRS and T waves and the heart cycle present in the electrocardiogram signal are extracted to adapt to the diagnosis of ECG images by machine learning methods, and the specific processed images can be directly exported, so the method has good interpretability and graphical feature display.

[0048] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, the patent owner may make various variations or modifications within the scope of the appended claims. As long as they do not exceed the protection scope described in the claims of the present invention, they should be within the protection scope of the present invention.

Claims

1. A method for extracting heartbeat cycle and numerical signal from ECG images, characterized in that: The following steps are involved: S1, obtaining the patient's ECG image; S2, preprocessing the ECG image; S3, performing signal preprocessing on the preprocessed ECG image; S4, extracting the heartbeat cycle from the ECG image after signal preprocessing; S5. Perform signal dimension reduction on the ECG image after signal preprocessing.

2. The method for extracting heartbeat cycle and numerical signal from ECG captured images according to claim 1, characterized in that: The step S2 specifically includes: S20, using the PIL library to load the ECG image, and using the streamlit library to enable the user to rotate the image at angles of -180, -90, 0, 90, and 180 and crop the image according to the cropping frame, and the cropped image is converted into a NumPy array representing the image using the imread function in the scikit-image library; S21, segmenting the cropped image, obtaining 2 / 3 of the content according to the overall area as analysis data, dividing 12 short leads and 1 long lead according to the height and width, and saving them in a lead set; S22. Use the color.rgb2gray method to convert the color image into a grayscale image.

3. The method for extracting heartbeat cycle and numerical signal from ECG captured images according to claim 1, characterized in that: The step S3 specifically includes: S30, converting the lead into a grayscale image, applying Gaussian filtering to smooth the image, finding a global threshold through the Otsu threshold method to perform a binarization operation, and converting the grayscale image into a binary image showing a specific waveform; S31. Use contour technology to track the converted binary image, extract the contour signal in the image, use the MinMaxScaler tool to normalize and scale the values, use the fit_transform() function to fit and transform, and then use the DataFrame in the pandas library to export the data; S32. Set the X-axis to correspond to high points and low points, and the Y-axis to correspond to the curve / shape, and merge the normalized and scaled one-dimensional signal values ​​in the X-axis of all leads and save them separately in a CSV file.

4. The method for extracting heartbeat cycle and numerical signal from ECG captured images according to claim 1, characterized in that: The step S4 specifically includes: dividing and extracting the heartbeat cycle according to the extreme point information and corresponding coordinates for the scaled one-dimensional signal value CSV file.

5. The method for extracting heartbeat cycle and numerical signal from ECG captured images according to claim 1, characterized in that: The step S5 specifically includes: using the loaded PCA model to perform dimensionality reduction processing on the input CSV file.

6. A device for implementing the method of extracting heartbeat cycle and numerical signal from ECG captured images as described in any one of claims 1 to 5, characterized in that: include: An acquisition module, used for acquiring ECG images of patients; A first preprocessing module, used for preprocessing the ECG image; A second preprocessing module, used for performing signal preprocessing on the preprocessed ECG image; An extraction module, used for extracting the heartbeat cycle from the ECG image after signal preprocessing; The dimension reduction module is used to perform signal dimension reduction on the ECG image after signal preprocessing.