A method and system for electrocardiogram image classification applied to a smart watch

By applying a lightweight three-branch attention module and a deep separable convolutional network with residual connections to a smartwatch, the problem of insufficient memory and computing power in smartwatches is solved, and efficient classification of electrocardiograms is achieved.

CN116563621BActive Publication Date: 2026-03-03SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310498511.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2026-03-03
Estimated Expiration
2043-04-27

AI Technical Summary

Technical Problem

Smartwatches have limited memory and low computing power, making it impossible for existing image classification models to achieve accurate and efficient classification of electrocardiograms.

Method used

A lightweight three-branch attention module and a deep separable convolutional network with residual connections are used to perform cross-dimensional image interaction, thereby improving the model's classification accuracy and computational efficiency.

Benefits of technology

It effectively improves the accuracy and computational efficiency of electrocardiogram (ECG) image classification, meets the memory and computing power requirements of smartwatches, and enables rapid ECG recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116563621B_ABST
    Figure CN116563621B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of image classification technology and provides a method and system for classifying electrocardiogram (ECG) images for smartwatches. The ECG image classification model of this invention includes a convolutional layer for initial feature extraction, two multi-scale depthwise separable convolutional modules that integrate a lightweight attention mechanism, a single-scale depthwise separable convolutional module, and a fully connected classification module. The lightweight attention mechanism uses a three-branch attention mechanism to enable cross-dimensional image interaction. The lightweight depthwise separable convolutional layer fully considers image features at different scales, and the lightweight three-branch attention module enables cross-dimensional image interaction. Residual connections are also introduced, effectively improving the model's classification accuracy and computational efficiency, thus meeting the requirements of smartwatches for ECG image recognition algorithms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image classification technology, and in particular relates to a method and system for classifying electrocardiogram images for use in smartwatches. Background Technology

[0002] An electrocardiogram (ECG) can reflect various abnormalities in the human heart and has very important clinical reference value. Many heart diseases often have a rapid onset and can be life-threatening in severe cases, making routine monitoring essential. Currently, many smartwatches with built-in ECG sensors can conveniently and effectively monitor the user's ECG signals continuously, thereby detecting abnormalities in the heart in a timely manner.

[0003] The inventors discovered that smartwatches have limited memory and low computing power, which requires that the applied electrocardiogram classification methods and models have the lowest possible time and space complexity while maintaining accuracy, so as to enable smartwatches to quickly identify users' electrocardiograms. However, existing image classification models cannot achieve accurate and efficient classification of lightweight images in smartwatches. Summary of the Invention

[0004] To address the aforementioned problems, this invention proposes a method and system for classifying electrocardiogram (ECG) images for smartwatches. This invention achieves cross-dimensional image interaction through a lightweight three-branch attention module and introduces residual connections, effectively improving the model's classification accuracy and computational efficiency, thus meeting the requirements of smartwatches for ECG image recognition algorithms.

[0005] To achieve the above objectives, the present invention is implemented through the following technical solution:

[0006] In a first aspect, the present invention provides an electrocardiogram image classification system for use in smartwatches, comprising:

[0007] The data acquisition module is configured to acquire electrocardiogram (ECG) images.

[0008] The classification module is configured to obtain classification results based on the acquired electrocardiogram (ECG) images and a preset ECG image classification model.

[0009] The electrocardiogram (ECG) image classification model includes a convolutional layer for initial feature extraction, two multi-scale deep separable convolutional modules incorporating a lightweight attention mechanism, a single-scale deep separable convolutional module, and a fully connected classification module. The first multi-scale deep separable convolutional module comprises three parallel deep separable convolutional units with different kernel sizes, which are connected via residual connections for feature extraction. The second multi-scale deep separable convolutional module comprises two parallel deep separable convolutional units, which are connected via residual connections for feature extraction. The single-scale deep separable convolutional module comprises one deep separable convolutional unit, each of which includes two deep separable convolutional layers, a lightweight attention layer, and a max-pooling layer. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The fully connected classification module outputs the final classification result of the ECG image.

[0010] Furthermore, the acquired electrocardiogram images are subjected to aspect ratio settings, grayscale processing, and normalization.

[0011] Furthermore, each depthwise separable convolutional layer includes two processes: channel-wise convolution and pointwise convolution.

[0012] Furthermore, the lightweight attention layer uses a three-branch attention mechanism to enable cross-dimensional interaction of images.

[0013] Furthermore, firstly, in the first branch of the attention mechanism, the dimension of the C×H×W feature map A is transformed to H×C×W to obtain feature map A1. A Z-Pool operation is performed on the H dimension to obtain a tensor of the form 2×C×W. This tensor then passes through a depthwise separable convolutional layer, a batch normalization layer, and a sigmoid activation function layer to obtain attention weights. These attention weights are then multiplied by feature map A1, and the dimension is transformed again to obtain a C×H×W feature map B1. Secondly, in the second attention mechanism branch, the dimension of the C×H×W feature map A is transformed to W×H×C to obtain feature map A2. A Z-Pool operation is performed on the W dimension to obtain a tensor of the form 2×H×C. This tensor then passes through a depthwise separable convolutional layer, a batch normalization layer, and a sigmoid activation function layer to obtain attention weights. The attention weights are then multiplied by feature map A1, and the dimension is transformed again to obtain a C×H×W feature map B1. After the normalization layer and the sigmoid activation function layer, attention weights are obtained. These attention weights are multiplied by feature map B1, and the dimensions are transformed again to obtain feature map B2 of C×H×W. In the third attention mechanism branch, a Z-Pool operation is performed on dimension C to obtain a tensor of the form 2×H×W. This tensor is then passed through a depthwise separable convolutional layer, a batch normalization layer, and a sigmoid activation function layer to obtain attention weights. These attention weights are multiplied by feature map C1, and the dimensions are transformed again to obtain feature map B3 of C×H×W. Then, the output tensors of the three attention mechanism branches are summed and averaged to obtain the output feature B of the lightweight attention layer. Finally, the output feature B is fed into a max pooling layer to obtain feature C.

[0014] Furthermore, the final classification results of the electrocardiogram images include normal beats, supraventricular ectopic beats, ventricular ectopic beats, and fused beats.

[0015] Secondly, the present invention also provides a method for classifying electrocardiogram images for use in smartwatches, comprising:

[0016] Obtain electrocardiogram (ECG) images;

[0017] Based on the acquired electrocardiogram (ECG) images and the preset ECG image classification model, the classification results are obtained;

[0018] The electrocardiogram (ECG) image classification model includes a convolutional layer for initial feature extraction, two multi-scale deep separable convolutional modules incorporating a lightweight attention mechanism, a single-scale deep separable convolutional module, and a fully connected classification module. The first multi-scale deep separable convolutional module comprises three parallel deep separable convolutional units with different kernel sizes, which are connected via residual connections for feature extraction. The second multi-scale deep separable convolutional module comprises two parallel deep separable convolutional units, which are connected via residual connections for feature extraction. The single-scale deep separable convolutional module comprises one deep separable convolutional unit, each of which includes two deep separable convolutional layers, a lightweight attention layer, and a max-pooling layer. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The fully connected classification module outputs the final classification result of the ECG image.

[0019] Thirdly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the electrocardiogram image classification method for smartwatches described in the first aspect.

[0020] Fourthly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the electrocardiogram image classification method for smartwatches described in the first aspect.

[0021] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0022] The electrocardiogram (ECG) image classification model in this invention includes a convolutional layer for initial feature extraction, two multi-scale depthwise separable convolutional modules incorporating a lightweight attention mechanism, a single-scale depthwise separable convolutional module, and a fully connected classification module. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The lightweight depthwise separable convolutional layer fully considers image features at different scales, and the lightweight three-branch attention module enables cross-dimensional image interaction. Residual connections are also introduced, effectively improving the model's classification accuracy and computational efficiency, meeting the time and memory requirements of smartwatches, and fulfilling the requirements of smartwatches for ECG image recognition algorithms. Attached Figure Description

[0023] The accompanying drawings, which form part of this embodiment, are used to provide a further understanding of this embodiment. The illustrative embodiments and their descriptions are used to explain this embodiment and do not constitute an improper limitation of this embodiment.

[0024] Figure 1 This is a flowchart of Embodiment 1 of the present invention;

[0025] Figure 2 This is a structural diagram of the lightweight electrocardiogram image classification model of Embodiment 1 of the present invention;

[0026] Figure 3 This is a schematic diagram of the channel-by-channel convolution process of the depth-separable convolutional layer DS_Conv in Embodiment 1 of the present invention;

[0027] Figure 4 This is a schematic diagram of the pointwise convolution process of the depth-separable convolutional layer DS_Conv in Embodiment 1 of the present invention;

[0028] Figure 5 This is a structural diagram of the lightweight attention layer in Embodiment 1 of the present invention. Detailed Implementation

[0029] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0030] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0031] Example 1:

[0032] Given the limited memory and low computing power of smartwatches, the applied electrocardiogram (ECG) classification method must maintain accuracy while minimizing time and space complexity. This is crucial for enabling smartwatches to quickly identify users' ECGs and effectively reduce the risks associated with delayed treatment of heart diseases. This embodiment provides an ECG image classification system for smartwatches, comprising:

[0033] The data acquisition module is configured to acquire electrocardiogram (ECG) images.

[0034] The classification module is configured to obtain classification results based on the acquired electrocardiogram (ECG) images and a preset ECG image classification model.

[0035] The electrocardiogram (ECG) image classification model includes a convolutional layer for initial feature extraction, two multi-scale depthwise separable convolutional modules incorporating a lightweight attention mechanism, a single-scale depthwise separable convolutional module, and a fully connected classification module. The first multi-scale depthwise separable convolutional module comprises three parallel depthwise separable convolutional units with different kernel sizes, which are connected via residual connections for feature extraction. The second multi-scale depthwise separable convolutional module comprises two parallel depthwise separable convolutional units. The single-scale depthwise separable convolutional module comprises one depthwise separable convolutional unit, which is connected via residual connections for feature extraction. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The fully connected classification module outputs the final classification result of the ECG image. The lightweight three-branch attention module enables cross-dimensional image interaction, and the introduction of residual connections effectively improves the model's classification accuracy and computational efficiency, meeting the requirements of smartwatches for ECG image recognition algorithms. The specific steps for implementing the ECG image classification system for smartwatches in this embodiment are as follows:

[0036] S1. Acquire electrocardiogram (ECG) images, including ECG images from multiple users collected by the smartwatch's ECG monitoring program. The heart rhythm types mainly include four types: normal beats, supraventricular ectopic beats, ventricular ectopic beats, and fusion beats.

[0037] S2. Preprocess the electrocardiogram image, including setting the image width and height, grayscale conversion, and normalization; optionally, set the image size to 128×128 and perform grayscale conversion to further improve computational efficiency. Finally, perform normalization on the image to accelerate model convergence.

[0038] S3. Constructing a Lightweight ECG Image Classification Model: This model mainly consists of a regular convolutional layer, two multi-scale deep separable convolutional modules with lightweight attention mechanisms, a single-scale deep separable convolutional module, and a fully connected classification module. The first multi-scale deep separable convolutional module contains three parallel deep separable convolutional units with different kernel sizes, thus extracting richer features. Residual connections further improve model accuracy. Its lightweight attention layer uses a three-branch attention mechanism to achieve cross-dimensional interaction. The second multi-scale deep separable convolutional module differs from the first in that it contains two parallel deep separable convolutional units. The single-scale deep separable convolutional module contains only one deep separable convolutional unit. Finally, the fully connected classification module outputs the final classification result for the input ECG image.

[0039] Specifically, a depthwise separable convolutional unit consists of two depthwise separable convolutional layers, a lightweight attention layer, and a max-pooling layer. For example... Figure 3 As shown, depthwise separable convolutional layers include both channel-wise convolution and pointwise convolution, effectively reducing the number of model parameters; lightweight attention layers use methods such as... Figure 4 The three-branch attention mechanism shown enables cross-dimensional interaction. First, in the first branch, the dimension of the C×H×W feature map A is transformed to H×C×W, resulting in feature map A1. A Z-Pool operation is performed on the H dimension, concatenating the results of max pooling and average pooling operations performed on the 0th dimension to obtain a tensor of the form 2×C×W. This tensor then passes sequentially through a depthwise separable convolutional layer, a batch normalization layer, and a sigmoid activation function layer to obtain the attention weights. The first branch multiplies the output of feature map A1 by the first branch, and then performs a dimensionality transformation on the output to obtain feature map B1 (C×H×W). In the second branch, the dimension of feature map A is transformed to W×H×C to obtain feature map A2. A Z-Pool operation is performed on the W dimension to obtain a tensor of the form 2×H×C. The same operation as the first branch is then performed to obtain feature map B2 (C×H×W). In the third branch, a Z-Pool operation is performed on the C dimension to obtain a tensor of the form 2×H×W. The same operation as the first branch is then performed to obtain feature map B3 (C×H×W). Next, the output tensors from the three branches are summed and averaged to obtain the output feature B of the lightweight attention layer. This B is then fed into a max-pooling layer to obtain feature C. Finally, the input of the depthwise separable convolutional unit is fed into a regular convolutional layer with a 1×1 kernel for dimensionality upscaling, and its output is added to feature C to obtain the final output of that unit.

[0040] In the first multi-scale depthwise separable convolutional module, the three depthwise separable convolutional layers use convolutional kernels of different sizes: 3×3, 5×5, and 7×7. This helps the model extract richer image features. Finally, the outputs of the three depthwise separable convolutional units with different kernel sizes are fused, i.e., added together. In the second multi-scale depthwise separable convolutional module, the two depthwise separable convolutional layers use convolutional kernels of sizes 3×3 and 5×5, respectively. The outputs of the two units are also added together. In the single-scale depthwise separable convolutional module, the depthwise separable convolutional layers only use convolutional kernels of size 3×3.

[0041] Finally, the fully connected classification module consists of a fully connected layer and a softmax layer, which outputs the final classification result of the input electrocardiogram image.

[0042] S4. Input the collected ECG images into a lightweight ECG image classification model and optimize the model using a weighted cross-entropy loss function. Optionally, the Adam optimizer can be used to optimize the model during training until the loss function converges. The weighted cross-entropy loss function is defined as follows:

[0043]

[0044] in, c It is the number of categories; Indicates category as The reciprocal of the proportion of samples in the dataset; Represents the true label when the sample category belongs to hour, It is 1 if it is true, otherwise it is 0. This indicates that the model predicts the sample belongs to a certain category. The probability of.

[0045] This embodiment utilizes lightweight, depthwise separable convolutional layers, fully considers image features at different scales, and achieves cross-dimensional image interaction through a lightweight three-branch attention module. Residual connections are also introduced, effectively improving the model's classification accuracy and computational efficiency, thus meeting the requirements of smartwatches for ECG image recognition algorithms. Furthermore, this invention employs a weighted cross-entropy loss function to address the problem of imbalanced ECG image categories.

[0046] Example 2:

[0047] This embodiment provides a method for classifying electrocardiogram (ECG) images for use in smartwatches, employing the system described in Embodiment 1, including:

[0048] Obtain electrocardiogram (ECG) images;

[0049] Based on the acquired electrocardiogram (ECG) images and the preset ECG image classification model, the classification results are obtained;

[0050] The electrocardiogram (ECG) image classification model includes a convolutional layer for initial feature extraction, two multi-scale deep separable convolutional modules incorporating a lightweight attention mechanism, a single-scale deep separable convolutional module, and a fully connected classification module. The first multi-scale deep separable convolutional module comprises three parallel deep separable convolutional units with different kernel sizes, which are connected via residual connections for feature extraction. The second multi-scale deep separable convolutional module comprises two parallel deep separable convolutional units, which are connected via residual connections for feature extraction. The single-scale deep separable convolutional module comprises one deep separable convolutional unit, each of which includes two deep separable convolutional layers, a lightweight attention layer, and a max-pooling layer. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The fully connected classification module outputs the final classification result of the ECG image.

[0051] The working method of the system is the same as that of the electrocardiogram image classification system applied to smartwatches in Embodiment 1, and will not be described again here.

[0052] Example 3:

[0053] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the electrocardiogram image classification method for smartwatches described in Embodiment 1.

[0054] Example 4:

[0055] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the electrocardiogram image classification method for smartwatches described in Embodiment 1.

[0056] The above description is merely a preferred embodiment of this practice and is not intended to limit the scope of this practice. Various modifications and variations can be made to this practice by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this practice should be included within the protection scope of this practice.

Claims

1. An electrocardiogram (ECG) image classification system for use in smartwatches, characterized in that, include: The data acquisition module is configured to acquire electrocardiogram (ECG) images. The classification module is configured to obtain classification results based on the acquired electrocardiogram (ECG) images and a preset ECG image classification model. The electrocardiogram (ECG) image classification model includes a convolutional layer for initial feature extraction, two multi-scale deep separable convolutional modules incorporating a lightweight attention mechanism, a single-scale deep separable convolutional module, and a fully connected classification module. The first multi-scale deep separable convolutional module comprises three parallel deep separable convolutional units with different kernel sizes, which are connected via residual connections for feature extraction. The second multi-scale deep separable convolutional module comprises two parallel deep separable convolutional units, which are connected via residual connections for feature extraction. The single-scale deep separable convolutional module comprises one deep separable convolutional unit, each of which includes two deep separable convolutional layers, a lightweight attention layer, and a max-pooling layer. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The fully connected classification module outputs the final classification result of the ECG image.

2. The electrocardiogram image classification system for smartwatches as described in claim 1, characterized in that, The acquired electrocardiogram images are then subjected to aspect ratio settings, grayscale conversion, and normalization.

3. The electrocardiogram image classification system for smartwatches as described in claim 1, characterized in that, Each depthwise separable convolutional layer includes two processes: channel-wise convolution and pointwise convolution.

4. The electrocardiogram image classification system for smartwatches as described in claim 1, characterized in that, The lightweight attention layer uses a three-branch attention mechanism to enable cross-dimensional interaction of images.

5. The electrocardiogram image classification system for smartwatches as described in claim 4, characterized in that, First, in the first attention mechanism branch, the dimension of the C×H×W feature map A is transformed to H×C×W to obtain feature map A1. A Z-Pool operation is performed on the H dimension to obtain a tensor of the form 2×C×W. This tensor then passes through a depthwise separable convolutional layer, a batch normalization layer, and a sigmoid activation function layer to obtain attention weights. These attention weights are then multiplied by feature map A1, and the dimension is transformed again to obtain a C×H×W feature map B1. In the second attention mechanism branch, the dimension of the C×H×W feature map A is transformed to W×H×C to obtain feature map A2. A Z-Pool operation is performed on the W dimension to obtain a tensor of the form 2×H×C. This tensor then passes through a depthwise separable convolutional layer, a batch normalization layer, and a sigmoid activation function layer to obtain attention weights. After passing through a layer and a Sigmoid activation function layer, attention weights are obtained. These attention weights are then multiplied by feature map B1, and the dimensions are transformed again to obtain feature map B2 (C×H×W). In the third attention mechanism branch, a Z-Pool operation is performed on dimension C to obtain a tensor of the form 2×H×W. This tensor is then passed through a depthwise separable convolutional layer, a batch normalization layer, and a Sigmoid activation function layer to obtain attention weights. These attention weights are then multiplied by feature map C1, and the dimensions are transformed again to obtain feature map B3 (C×H×W). Finally, the output tensors of the three attention mechanism branches are summed and averaged to obtain the output feature B of the lightweight attention layer. The output feature B is then fed into a max pooling layer to obtain feature C.

6. The electrocardiogram image classification system for smartwatches as described in claim 1, characterized in that, The final classification of electrocardiogram images includes normal beats, supraventricular ectopic beats, ventricular ectopic beats, and fused beats.

7. A method for classifying electrocardiogram (ECG) images applied to smartwatches, characterized in that, include: Obtain electrocardiogram (ECG) images; Based on the acquired electrocardiogram (ECG) images and the preset ECG image classification model, the classification results are obtained; The electrocardiogram (ECG) image classification model includes a convolutional layer for initial feature extraction, two multi-scale deep separable convolutional modules incorporating a lightweight attention mechanism, a single-scale deep separable convolutional module, and a fully connected classification module. The first multi-scale deep separable convolutional module comprises three parallel deep separable convolutional units with different kernel sizes, which are connected via residual connections for feature extraction. The second multi-scale deep separable convolutional module comprises two parallel deep separable convolutional units, which are connected via residual connections for feature extraction. The single-scale deep separable convolutional module comprises one deep separable convolutional unit, each of which includes two deep separable convolutional layers, a lightweight attention layer, and a max-pooling layer. The lightweight attention mechanism uses a three-branch attention mechanism for cross-dimensional image interaction. The fully connected classification module outputs the final classification result of the ECG image.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the steps of the electrocardiogram image classification method for smartwatches as described in any one of claims 1-6.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the electrocardiogram image classification method for smartwatches as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Single-stage action positioning method based on multi-scale convolution kernel and super event module

    CN111291647A

  • Real-time semantic segmentation method based on multi-branch depth separable cavity convolution

    CN115761238A