A custom fine-grained ecg self-supervised interpretable method and system

CN118051824BActive Publication Date: 2026-08-21ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410292105.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-14
Publication Date
2026-08-21
Estimated Expiration
2044-03-14

AI Technical Summary

Technical Problem

因此,从医生的角度看,模型对心电数据的解释在很大程度上还有待探索

Benefits of technology

[0041]When dividing heartbeat segments, the length of heartbeat segments can be divided according to a custom fine-grained scale to adapt to various analytical needs. When constructing the graph based on the length of the heartbeat segments, the temporal features and the structural semantic correlation of the heartbeat segments are considered, making the resulting heartbeat graph representation more conducive to subsequent signal classification. An embedded interpretable is introduced to filter the nodes in the heartbeat graph representation that play a decisive role in the signal classification results. The resulting heartbeat subgraph representation is easy to visualize and interpret the signal classification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118051824B_ABST
    Figure CN118051824B_ABST
Patent Text Reader

Abstract

The application discloses a self-defined fine-grained ECG self-supervised interpretable method and system, comprising the following steps: acquiring ECG data, dividing the ECG data into heartbeat segments according to a self-defined fine granularity, obtaining a heartbeat set composed of multiple heartbeat segments, and performing graph construction on the heartbeat set to obtain a heartbeat graph representation; embedding the heartbeat graph representation by using an encoder to obtain a graph embedding vector, and performing signal classification on the ECG data based on the graph embedding vector; and optimizing the heartbeat graph representation by using an embedding interpreter to obtain a heartbeat subgraph representation for explaining the decisive role of the signal classification result, wherein the method and the system can simultaneously perform ECG signal classification with different signal length granularities according to requirements and realize the interpretability of the classification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of combining artificial intelligence with electrocardiogram diagnosis and treatment, specifically involving a custom fine-grained ECG self-supervised interpretable method and system. Background Technology

[0002] Electrocardiography (ECG) is the most widely used and low-cost screening tool for identifying and classifying a wide range of cardiac abnormalities, including atrial fibrillation, myocardial ischemia, and hypokalemia. An ECG test records electrical activity signals and plots a voltage versus time graph.

[0003] In clinical practice, cardiologists analyze subtle changes in normal electrocardiogram (ECG) patterns caused by specific cardiac abnormalities. However, this process is very time-consuming and heavily reliant on the expert's experience. Fortunately, in recent years, especially with the rapid development of data-driven approaches, computer-aided ECG analysis has become increasingly important. Along this line of thought, machine learning methods, which rely on predefined pattern and feature recognition for classification, cannot always effectively correlate and distinguish complex patterns between ECG signals, resulting in poor performance and generalization. Meanwhile, the deep learning paradigm, with its access to large-scale raw data processing capabilities, offers a significant opportunity to improve automated ECG analysis. Known deep learning methods have achieved initial success in ECG signal classification.

[0004] RC-NNS (Multi-module recurrent convolutional neural network with transformer encoder for ECG arrhythmia classification) establishes a hybrid model incorporating CNN and RNN modules to learn spatial and temporal representations, thereby achieving accurate classification of single-lead fixed-length ECG data. 1D-CNN (Ar-rhythmia detection using deep convolutional neural network with long-duration ECG signals) adapts to long-duration ECG signals (i.e., 10 seconds) for arrhythmia classification. In fact, existing methods have achieved good classification performance, even outperforming cardiologists in a few cases of cardiac abnormalities. However, most current work only applies to ECG data with the same structure, such as the same segmentation span and the same lead numbering. For example, in [the specific context, likely a specific dataset or dataset], there are significant performance differences for each second and for each recording setting.

[0005] Variations in data generated by different ECG devices significantly impact model performance. Therefore, a unified abstraction of ECG data is needed to bridge the gap between models and data structures. ECG interpretations generated from deep learning models also play a crucial role in helping cardiologists understand diagnoses in clinical practice. MINA (Multi-level Knowledge-Guided Attention for Modeling Electrocardiogram Signals) interprets ECGs by detecting anomalies in heart rhythm and frequency; the deep convolutional neural network used for ECG data employs class activation maps to interpret classification. MPCNN (Inter-patient ECG Classification with Symbolic Representations and Multi-perspective Convolutional Neural Networks) expresses the shape and rhythm of the heartbeat through symbolic representations of ECG signals and detects supraventricular ectopic beats (SVEB) and ventricular ectopic beats (VEB) on two-lead ECG data. However, existing methods interpret ECGs from the contribution of model features to the final classification decision, rather than from the perspective of cardiologist diagnosis. Interpretable visualizations may be inconsistent with cardiologists' clinical knowledge, requiring further interpretation. Therefore, from a doctor's perspective, the model's interpretation of electrocardiogram data still needs much further exploration. Summary of the Invention

[0006] In view of the above, the purpose of this invention is to provide a custom fine-grained ECG self-supervised interpretable method and system that can classify ECG signals of different signal length granularities according to requirements, while achieving interpretability of the classification results.

[0007] To achieve the above-mentioned objectives, embodiments of the present invention provide a custom fine-grained ECG self-supervised interpretable method, comprising the following steps:

[0008] Acquire ECG data and divide the ECG data into heartbeat segments according to a custom fine-grained method to obtain a heartbeat set composed of multiple heartbeat segments. Then, construct a graph from the heartbeat set to obtain a heartbeat graph representation.

[0009] The heartbeat map representation is embedded using an encoder to obtain a graph embedding vector, and signal classification of ECG data is performed based on the graph embedding vector;

[0010] The heartbeat graph representation is optimized using an embedded interpreter to obtain a heartbeat subgraph representation that plays a decisive role in interpreting signal classification results.

[0011] Preferably, a heartbeat graph representation is obtained by constructing a graph from the heartbeat set, including:

[0012] Using heartbeat segments from the heartbeat set as nodes in the heartbeat graph, and establishing edges between nodes based on temporal information between heartbeat segments, a self-attention mechanism is used to calculate the latent semantic relevance between heartbeat segments, resulting in a node representation for each node, including:

[0013] For each heartbeat segment S b Each heartbeat segment S b As a key value, it will be associated with the heartbeat segment S b Other heartbeat segments with adjacency relationships are used as query values, and for heartbeat segment S... b Multi-head attention calculations are performed with other heartbeat segments to obtain S for each heartbeat segment. b The weights of other heartbeat segments are used as the weights of the edges connecting the two nodes. Based on these weights, the ECG data corresponding to the other heartbeat segments are weighted and summed to obtain the heartbeat segment S. b The node representation of the corresponding node.

[0014] Preferably, the heartbeat graph representation is optimized using an embedded interpretable, including:

[0015] Introduce a random mask vector p that conforms to the Laplace transform and then sequentially perform a linear transformation f. g After activation by the activation function σ, the input is fed into the MLP, and the node representation z of any two nodes in the heartbeat graph is also processed. i and z j The input is fed into the MLP, which calculates the two nodes v. i and v j The edge node weight w of the connecting edges ij :

[0016]

[0017] Where [;] represents the connection operation along the feature dimension, σ is the activation function, and the symbol is... This indicates element-wise multiplication;

[0018] When the edge node weight w ij If the value is greater than or equal to a given threshold t, then retain both nodes v. i and v j Connect edges between them, otherwise delete them. This can be expressed as a formula: E sub ={(v i ,v j ):(v i ,v i )∈E,w ij ≥t}, the resulting heartbeat subgraph representation G sub=(V,E) sub V is the set of nodes, and E is the set of nodes. sub Let E represent the set of edges that have been optimized and retained, and let E represent the original set of edges in the heartbeat graph representation.

[0019] Preferably, the encoder and the embedded interpreter need to undergo parameter optimization before being applied. The parameter optimization process includes:

[0020] A self-supervised training system is constructed, including an autoencoder consisting of an encoder and a decoder, and an embedding interpreter. The decoder is used to decode and reconstruct the reconstructed heartbeat graph representation from the masked graph embedding vector.

[0021] The loss function for constructing the self-supervised training system includes the reconstruction loss based on the original heartbeat subgraph representation and the reconstructed heartbeat subgraph representation, the subgraph generation loss based on the heartbeat subgraph representation, and the contrastive learning loss based on the heartbeat subgraph representation and the reconstructed heartbeat subgraph representation.

[0022] Based on the loss function and by introducing constraints for the embedded interpreter, the parameters of the autoencoder and the embedded interpreter in the self-supervised training system are optimized.

[0023] Preferably, the decoder adopts a single-layer GIN structure.

[0024] Preferably, the constraint on the embedded interpreter is to constrain the generation of the heartbeat subgraph representation by maximizing mutual information, and the constraint is expressed by the formula:

[0025]

[0026] Where p is a random mask vector conforming to the Laplace transform, MI() is used to calculate mutual information, and E p This represents the expected value, θ represents the parameters of the embedded interpreter, and ε() represents the embedded representation operation. This represents the heartbeat subgraph representation obtained by optimizing the original heartbeat graph representation.

[0027] Preferably, the reconstruction loss rec Represented as:

[0028]

[0029] Where γ is a hyperparameter representing the scaling factor γ, x i It is node v in the original heartbeat graph representation i The embedding vector, s i It is the node v after mask reconstruction. i Embedded vector, This represents the set of nodes used to reconstruct the heartbeat graph.

[0030] Preferably, the subgraph generation loss is... JSE Represented as:

[0031]

[0032] Where Q represents the number of samples, σ() represents the activation function, θ represents the parameters of the embedded interpretable, and z q Let z represent the heart rate map corresponding to the q-th ECG sample. q,θ Let z represent the heartbeat subgraph corresponding to the q-th ECG sample. p,θ Let p represent the heartbeat subgraph corresponding to the q-th ECG sample, where q ≠ p, and the symbol is... This indicates element-wise multiplication, where p is a random mask vector conforming to the Laplace transform, and the superscript T indicates transpose.

[0033] Preferably, the learning loss is compared. CL Represented as:

[0034]

[0035] Where τ represents the temperature parameter, q and q′ are both indices of the corresponding ECG sample plots, and Z q,i Z q,j Z represents the embedding vectors from the i-th and j-th nodes in the heartbeat map representation corresponding to the q-th ECG sample. q′,j Let q′ represent the embedding vector from the q′-th ECG sample as a negative sample, and q′≠q. N represents the number of samples in the mini-batch.

[0036] To achieve the above-mentioned objectives, embodiments of the present invention provide a custom fine-grained ECG self-supervised interpretable system, including a graph construction module, a signal classification module, and an interpretability module.

[0037] The graph construction module is used to acquire ECG data and divide the ECG data into heartbeat segments according to a custom fine-grained method to obtain a heartbeat set composed of multiple heartbeat segments. The heartbeat set is then used to construct a graph to obtain a heartbeat graph representation.

[0038] The signal classification module is used to embed the heartbeat map representation using an encoder to obtain a graph embedding vector, and to perform signal classification of ECG data based on the graph embedding vector;

[0039] The interpretable module is used to optimize the heartbeat graph representation using an embedded interpreter to obtain a heartbeat subgraph representation that plays a decisive role in interpreting the signal classification results.

[0040] Compared with the prior art, the beneficial effects of the present invention include at least the following:

[0041] When dividing heartbeat segments, the length of heartbeat segments can be divided according to a custom fine-grained scale to adapt to various analytical needs. When constructing the graph based on the length of the heartbeat segments, the temporal features and the structural semantic correlation of the heartbeat segments are considered, making the resulting heartbeat graph representation more conducive to subsequent signal classification. An embedded interpretable is introduced to filter the nodes in the heartbeat graph representation that play a decisive role in the signal classification results. The resulting heartbeat subgraph representation is easy to visualize and interpret the signal classification results. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is a flowchart of a custom fine-grained ECG self-supervised interpretable method provided in an embodiment of the present invention;

[0044] Figure 2 This is a schematic diagram of the structure of the self-supervised training system provided in an embodiment of the present invention;

[0045] Figure 3 This is a schematic diagram of the structure of a custom fine-grained ECG self-supervised interpretable system provided in an embodiment of the present invention;

[0046] Figure 4 This is a schematic diagram of the structure of a custom fine-grained ECG self-supervised interpretable system provided in the embodiment;

[0047] Figure 5 This is a schematic diagram illustrating the interpretability of an electrocardiogram provided in the embodiment. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.

[0049] The inventive concept of this invention is to address the problem that current single classification models cannot identify and analyze different types of ECG datasets, and to solve the problem that current interpretable visualizations of ECG may be inconsistent with the clinical knowledge of cardiologists. This invention provides a custom fine-grained self-supervised interpretable ECG method and system. By constructing ECG datasets from different leads into a graph structure, compatibility of ECG data from different leads is achieved, which helps to extract arrhythmia information more accurately, and at the same time can generate interpretable results suitable for doctors' needs.

[0050] The objective of this invention is: to collect data for a known duration of... ECG data from n leads, corresponding ECG signal classification labels Where y m ∈0,1 represents the value of the classification label of the m-th ECG signal. The task objective is to predict the ECG signal classification result of the untrained ECG dataset P, expressed by the formula: Understood as: based on duration Using n leads of ECG data as sample data, classification labels were applied based on ECG signals. After training model M using the labeled data, the trained model M is used to predict the ECG signal classification result Y of the input q-th ECG data. q .

[0051] Based on the above inventive concept and objectives, a custom fine-grained self-supervised interpretable method for ECG is provided, such as... Figure 1 As shown, it includes the following steps:

[0052] Step 1: Obtain ECG data and divide the ECG data into heartbeat segments according to a custom fine-grained method to obtain a heartbeat set composed of multiple heartbeat segments. Then, construct a graph representation of the heartbeat set to obtain a heartbeat graph representation.

[0053] Obtain ECG data Q = [Z1, Z2, ..., Z q ], where Z q Z represents the ECG data of the q-th test subject, corresponding to the q-th ECG sample. Specifically, Z p =[X1,X2,…,X n ], which is an n-lead of length t, usually obtained based on the subject's heart rate and measurement time, X n ∈R t This is ECG data from lead n, with a data length of t. Then, a heartbeat segmentation algorithm is used to segment X... n Divide into a heartbeat set X n =[S1,S2,…,S b ], S bIt consists of b heartbeat segments, where S b ∈R l Let l represent the length of the b-th heartbeat. The length of the heartbeat segment determines the granularity of the analysis when dividing the heartbeat into segments; this length can be customized as needed.

[0054] After obtaining the heartbeat set, a heartbeat graph representation can be constructed. The challenge in constructing this representation lies in determining the appropriate message passing paths, i.e., the edge genes of the heartbeat graph representation. The ECG dataset contains two distinct paths: one is a time-series path composed of heartbeat segments, and the other is the latent semantic correlation between structures. Simply establishing edges based on the time-series order of ECG signals is insufficient. ECG data, besides being a time-series arrangement of heartbeats, also contains more about the relationships between heartbeat signals. Therefore, when constructing the heartbeat graph representation, heartbeat segments from the heartbeat set are used as nodes in the graph, and edges are established between nodes based on the temporal information between these segments. To uncover the latent semantic relationships between heartbeat signal segments, a self-attention mechanism is used to calculate the latent semantic correlations between them, and this method is used to represent the semantic relationships between each heartbeat signal segment, resulting in the node representation for each node. Specifically, this includes:

[0055] For each heartbeat segment S b Each heartbeat segment S b As a key value, it will be associated with the heartbeat segment S b Other heartbeat segments with adjacency relationships are used as query values, and for heartbeat segment S... b Multi-head attention calculations are performed with other heartbeat segments to obtain S for each heartbeat segment. b The weights of other heartbeat segments are used as the weights of the edges connecting the two nodes. Based on these weights, the ECG data corresponding to the other heartbeat segments are weighted and summed to obtain the heartbeat segment S. b The node representation of the corresponding node.

[0056] This constructed heartbeat graph representation combines the potential semantic correlations between time series paths and structures, laying the foundation for improving the accuracy of subsequent signal classification.

[0057] Step 2: Use the encoder to embed the heartbeat map representation to obtain the graph embedding vector, and perform signal classification of ECG data based on the graph embedding vector.

[0058] In this embodiment, the encoder E and the embedded interpretable are used for signal classification and interpretable representation after parameter optimization through a constructed self-supervised training system. Figure 2As shown, the self-supervised training system includes an autoencoder and an embedded interpretable. In self-supervised learning, an innovative interpretability-based contrastive learning approach is proposed to obtain a unified representation of ECG signals. Graph contrastive learning obtains two different graph representations through graph augmentation, maximizing the mutual information of sample pairs. However, traditional graph augmentation is achieved by masking and deleting edge points. Thus, the original attributes of the graph may change during the augmentation process, resulting in anomalous sample pairs. Here, a GNN decoder is used to reconstruct the masked graph to preserve the original attributes as much as possible. On the other hand, the embedded interpretable is used to extract the graph representation, ultimately obtaining sample pairs that retain the original information. Finally, contrastive learning computation is performed to obtain the node semantics of the ECG signal and the category information of the entire graph. Finally, the graph data is classified and interpreted by the trained GNN encoder and the embedded ECG signal interpretation module.

[0059] The autoencoder consists of an encoder E and a decoder D. Self-supervised learning is performed using the autoencoder. To prevent perturbation of the original heartbeat image representation during contrastive learning, which could lead to the loss of its category attributes, the encoder and decoder are used to reconstruct the heartbeat segment S. b The structure utilizes a reconstruction mask to extract semantic information between ECG nodes, while simultaneously obtaining a perturbation map that preserves the semantic information of the original image. The encoder maps the input heartbeat map representation to a graph embedding vector, and the decoder maps the masked graph embedding vector to a reconstructed heartbeat map representation under the supervision of a reconstruction criterion. The original heartbeat map representation is G = (V, A, X), where v is the node set, N = |V| is the number of nodes in the graph, and A ∈ {0, 1}. N×N Let X ∈ R be the adjacency matrix. N×d i is the feature matrix of the input node, which is reconstructed into a heartbeat map representation G′ after encoding and decoding by an autoencoder:

[0060] H = f E (A,X)

[0061]

[0062] Among them, f E This means that the hidden code H,f is obtained by encoding the node features in the original heartbeat graph representation. D It is a decoder that processes the mask to reveal the hidden code. Reconstruct it into a reconstructed heartbeat graph representation G′.

[0063] In this embodiment, both the encoder and decoder are built based on GNN. In traditional natural language processing, the target of decoding is the masked word with rich semantic information, so traditional decoders such as MLP can achieve better performance. However, in ECG data, the relationships and shape differences between various heartbeat segments (heartbeat structures) are not significant. Using a low-level decoder will result in almost identical features between the decoded features, which are of no value. Therefore, reconstructing the heartbeat structure with corresponding semantic information is simply a matter of needing a higher-level decoder to decode the features. Therefore, this invention uses a single-layer GIN with stronger expressive power as the decoder to decode the heartbeat structure. The GIN-based decoder associates the features around its nodes to reconstruct the nodes, rather than simply reconstructing based on the nodes themselves, thereby helping the encoder learn higher-level latent semantic features. To enable the encoder to further learn the hidden semantic information of the ECG heartbeat structure, a remasking method is used to mask the encoder output. The masking process is represented as follows:

[0064]

[0065] in, h represents the representation after the mask. [M] Represents a subset of the mask Hidden encoding in h i This represents the encoded graph embedding vector.

[0066] In this embodiment, an embedded interpretable is used to augment another graph representation for comparative learning. The embedded interpretable can preserve important node information while discarding unimportant edges, preventing the loss of its own attributes during graph augmentation. Simultaneously, the embedded interpretable can also interpret classification results in downstream tasks. Specifically, such as... Figure 3 As shown, the heartbeat graph representation embedded in the interpretable execution for optimization includes: introducing a random mask vector p conforming to the Laplace transform and sequentially passing it through a linear transform f. g After activation by the activation function σ, the input is fed into the MLP, and the node representation z of any two nodes in the heartbeat graph is also processed. i and z j The input is fed into the MLP, which calculates the two nodes v. i and v j The edge node weight w of the connecting edges ij :

[0067]

[0068] Where [;] represents the connection operation along the feature dimension, σ is the activation function, and the symbol is... This indicates element-wise multiplication;

[0069] When the edge node weight w ijIf the value is greater than or equal to a given threshold t, then retain both nodes v. i and v j Connect edges between them, otherwise delete them. This can be expressed as a formula: E sub ={(v i ,v j ):(v i ,v i )∈E,w ij ≥t}, the resulting heartbeat subgraph representation G sub =(V,E) sub V is the set of nodes, and E is the set of nodes. sub Let E represent the set of edges that have been optimized and retained, and let E represent the original set of edges in the heartbeat graph representation.

[0070] In the embodiments, a loss function for the self-supervised training system is also constructed, including a reconstruction loss Loss based on the original heartbeat subgraph representation and the reconstructed heartbeat subgraph representation. rec Loss of subgraph generation based on heartbeat subgraph representation JSE And the contrastive learning loss constructed based on the heartbeat subgraph representation and the reconstructed heartbeat graph representation. CL .

[0071] Since the structural types of electrocardiograms are generally similar, the main differences lie in their overall shape. The values ​​of heartbeat structures with different labels may also be consistent. Therefore, solely pursuing accuracy in generated values ​​using MSE will lead to poor generalization ability of the model, and the semantic information between heartbeats will also be affected. The structure cannot be learned well. Therefore, cosine error is used as the standard for reconstructing the original node features. The contribution of simple samples in training is reduced by scaling the cosine error by a power factor γ≥1. For high-confidence predictions, the corresponding cosine error is usually less than 1. The final reconstruction loss, Loss, is obtained by calculating the mask error for each node in the mask. rec Represented as:

[0072]

[0073] Where, x i It is node v in the original heartbeat graph representation i The embedding vector, s i It is the node v after mask reconstruction. i Embedded vector, This represents the set of nodes in the reconstructed heartbeat map representation. γ, as a hyperparameter, can be adjusted on ECG datasets of different sizes. It can also be viewed as an adaptive sample reweighting. Adjusting the weight of each sample based on the reconstruction error significantly increases the model's generalization ability.

[0074] When calculating the subgraph loss using an embedded interpretable, the Jenson-Shannon estimator (JSE) is used to compute the subgraph generation loss. The formula is as follows:

[0075]

[0076] Where Q represents the number of samples, σ() represents the activation function, θ represents the parameters of the embedded interpretable, and z q Let z represent the heart rate map corresponding to the q-th ECG sample. q,θ Let z represent the heartbeat subgraph corresponding to the q-th ECG sample. p,θ Let p represent the heartbeat subgraph corresponding to the q-th ECG sample, where q ≠ p, and the symbol is... This indicates element-wise multiplication, where p is a random mask vector conforming to the Laplace transform, and the superscript T indicates transpose.

[0077] After ECG image data is processed by a GNN-based decoder and an embedded interpretable, two augmented images that retain the original attributes are obtained: a reconstructed heartbeat image representation and a heartbeat sub-image representation. These two augmented images are then used to form a sample pair Z. q,i Z q,j And force the maximization of positive and negative sample pairs Z q,i Z q′,j To maximize consistency, normalized temperature-scale cross-entropy loss (NT-Xent) is used to compute the contrastive learning loss. CL The formula is as follows:

[0078]

[0079] Where τ represents the temperature parameter, q and q′ are both indices of the corresponding ECG sample plots, and Z q,i Z q,j Z represents the embedding vectors from the i-th and j-th nodes in the heartbeat map representation corresponding to the q-th ECG sample. q′,j Let q′ represent the embedding vector from the q′-th ECG sample as a negative sample, and q′≠q. N represents the number of samples in the mini-batch.

[0080] Therefore, the total loss function of the above self-supervised training system is Loss ALL for:

[0081] Loss ALL =Loss rec +Loss JSE +Loss CL

[0082] During training, the parameters of the autoencoder and the embedded interpreter in the self-supervised training system are optimized based on the loss function and by introducing constraints on the embedded interpreter. The constraint is to use the method of maximizing mutual information to constrain the generation of the heartbeat subgraph representation, and the constraint is expressed by the following formula:

[0083]

[0084] Where MI() is used to calculate mutual information, E p This indicates the expected value, and ω() represents the embedding operation. This represents the heartbeat subgraph representation obtained by optimizing the original heartbeat graph representation.

[0085] The parameter-optimized encoder embeds the input heartbeat graph representation to obtain a graph embedding vector, and then performs signal classification of ECG data based on the graph embedding vector. Specifically, MLP, fully connected layers, etc. can be used for classification.

[0086] Step 3: Optimize the heartbeat graph representation using an embedded interpreter to obtain a heartbeat subgraph representation that plays a decisive role in interpreting the signal classification results.

[0087] The parameter-optimized embedded interpreter is used to optimize the heartbeat graph representation to obtain a heartbeat subgraph representation, which can explain which nodes play a decisive role in the signal classification results.

[0088] like Figure 4 As shown in the embodiment, a custom fine-grained ECG self-supervised interpretable system is also provided, including a graph construction module, a signal classification module, and an interpretable module. The graph construction module is used to acquire ECG data and divide the ECG data into heartbeat segments according to a custom fine-grained scale to obtain a heartbeat set composed of multiple heartbeat segments. The heartbeat set is then used to construct a graph to obtain a heartbeat graph representation. The signal classification module is used to embed the heartbeat graph representation using an encoder to obtain a graph embedding vector, and to perform signal classification of the ECG data based on the graph embedding vector. The interpretable module is used to optimize the heartbeat graph representation using an embedded interpreter to obtain a heartbeat subgraph representation that plays a decisive role in interpreting the signal classification results.

[0089] It should be noted that the custom fine-grained ECG self-supervised interpretable system provided in the above embodiments should be illustrated using the above functional module division as an example when performing signal classification. The functions described above can be assigned to different functional modules as needed, that is, the internal structure of the terminal or server can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the custom fine-grained ECG self-supervised interpretable system provided in the above embodiments and the custom fine-grained ECG self-supervised interpretable method embodiments belong to the same concept. For details of its implementation process, please refer to the custom fine-grained ECG self-supervised interpretable method embodiments, which will not be repeated here.

[0090] The embodiments also provide specific examples of signal classification using the aforementioned ECG self-supervised interpretable method. Specifically, the method and system were used to perform classification and interpretability analysis on three publicly available ECG benchmark datasets, and nine different types of ECG classification methods were used to evaluate the classification and interpretability effectiveness of the invention. The results are shown in Table 1. From the results, it can be observed that the performance of the present invention is superior to other baselines. The present invention can maintain the best indicators and optimal scores on different ECG datasets, and since ECG signals are essentially time-series signals, time information can be extracted from the ECG signals; therefore, time-series-based methods are much better than other baseline methods in terms of results. In GNN-based classification methods, GNNs achieve good classification performance on the relatively simple MITBIH dataset, but in the severely imbalanced ST-T dataset, message passing loses its effectiveness, failing to distinguish fewer categories in ECG data. In CNN-based methods, RCNN classifies arrhythmias by converting ECG signals into image signals; therefore, its method cannot be applied to large-scale ECG data. The present invention can better classify different types of ECG datasets with different lengths and leads.

[0091] Table 1

[0092]

[0093] Table 1: Performance comparison of arrhythmia classification with known methods on the ECG single-lead dataset. The best and second-best results are indicated by bold and underline, respectively. "-" indicates that the results could not be found or reproduced due to the proprietary implementation or inapplicable settings of the original paper.

[0094] Model interpretability refers to the ability to provide some explanation for classification results, making them easy for users to understand. However, traditional interpretability only interprets one feature of the ECG signal, often leading to confusion. For ECG data, including the complete heartbeat structure and customized fine-grained interpretations is more in line with expert diagnostic habits. Different fine-grained model interpretability tests were conducted using data from MITBIH and PTB-XL. The results are as follows... Figure 5 As shown, three different fine-grained methods were used for interpretability studies: the heartbeat layer, the heartbeat structure layer, and the heartbeat group layer. All results are of medical diagnostic significance and align with physicians' diagnostic practices. Physicians can pinpoint the range of abnormal ECG signals at a fine-grained level and then make a final decision based on their clinical experience.

[0095] The specific embodiments described above illustrate the technical solution and beneficial effects of the present invention in detail. It should be understood that the above description is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A custom fine-grained self-supervised interpretable method for ECG, characterized in that, Includes the following steps: Acquire ECG data and divide the ECG data into heartbeat segments according to a custom fine-grained method to obtain a heartbeat set composed of multiple heartbeat segments. Then, construct a graph from the heartbeat set to obtain a heartbeat graph representation. The heartbeat map representation is embedded using an encoder to obtain a graph embedding vector, and signal classification of ECG data is performed based on the graph embedding vector; The heartbeat graph representation is optimized using an embedded interpreter to obtain a heartbeat subgraph representation that plays a decisive role in interpreting signal classification results; The process of constructing a graph from the heartbeat set to obtain a heartbeat graph representation includes: Using heartbeat segments from the heartbeat set as nodes in the heartbeat graph, and establishing edges between nodes based on temporal information between heartbeat segments, a self-attention mechanism is used to calculate the latent semantic relevance between heartbeat segments, resulting in a node representation for each node, including: For each heartbeat segment Each heartbeat segment As a key, it will be associated with heartbeat fragments. Other heartbeat segments with adjacency relationships are used as query values, and the heartbeat segments are... Multi-head attention calculations are performed with other heartbeat segments to obtain each heartbeat segment. The weights of other heartbeat segments are used as the weights of the edges connecting the two nodes. The ECG data corresponding to the other heartbeat segments are then weighted and summed based on these weights to obtain the heartbeat segment. The node representation of the corresponding node; Optimize the heartbeat graph representation using an embedded interpretable, including: Introducing a random mask vector conforming to the Laplace transform And then undergo linear transformations in sequence. and activation function After activation, input the data into the MLP, and simultaneously input the node representations of any two nodes in the heartbeat graph. and The input is fed into the MLP, which then calculates two nodes. and Edge node weights of the connecting edges : in, For connection operations along the feature dimension, For activation function, symbol This indicates element-wise multiplication; When the edge node weight Greater than or equal to a given threshold Then retain two nodes. and Connect edges between nodes, otherwise delete them. This can be expressed as a formula: The resulting heartbeat subgraph represents , For a set of nodes, This represents the set of edges that have been optimized and retained. This represents the original set of edges in the heartbeat graph representation.

2. The custom fine-grained ECG self-supervised interpretable method according to claim 1, characterized in that, The encoder and embedded interpreter need to undergo parameter optimization before being applied. The parameter optimization process includes: A self-supervised training system is constructed, including an autoencoder consisting of an encoder and a decoder, and an embedding interpreter. The decoder is used to decode and reconstruct the reconstructed heartbeat graph representation from the masked graph embedding vector. The loss function for constructing the self-supervised training system includes the reconstruction loss based on the original heartbeat subgraph representation and the reconstructed heartbeat subgraph representation, the subgraph generation loss based on the heartbeat subgraph representation, and the contrastive learning loss based on the heartbeat subgraph representation and the reconstructed heartbeat subgraph representation. Based on the loss function and by introducing constraints for the embedded interpreter, the parameters of the autoencoder and the embedded interpreter in the self-supervised training system are optimized.

3. The custom fine-grained ECG self-supervised interpretable method according to claim 2, characterized in that, The decoder adopts a single-layer GIN structure.

4. The custom fine-grained ECG self-supervised interpretable method according to claim 2, characterized in that, The constraint on the embedded interpreter is to constrain the generation of the heartbeat subgraph representation by maximizing mutual information. The constraint is expressed by the formula: in, For a random mask vector that conforms to the Laplace transform, To calculate mutual information, This indicates the expectation value. The parameter represents the embedded interpreter. This indicates an embedding operation. This represents the heartbeat subgraph representation obtained by optimizing the original heartbeat graph representation.

5. The custom fine-grained ECG self-supervised interpretable method according to claim 2, characterized in that, Reconstruction losses Represented as: in, As a hyperparameter, it represents the scaling factor. , The nodes in the original heartbeat graph representation Embedded vector, The node after mask reconstruction Embedded vector, This represents the set of nodes used to reconstruct the heartbeat graph.

6. The custom fine-grained ECG self-supervised interpretable method according to claim 2, characterized in that, Subgraph generation loss Represented as: in, Indicates the number of samples. This represents the activation function. The parameter represents the embedded interpreter. Indicates the first q The heart rate chart corresponding to each ECG sample is represented. Indicates the first q The heart rate subplot corresponding to each ECG sample is represented. Indicates the first q The heart rate subplots corresponding to each ECG sample are represented, where q ≠ p, and the symbol is... This indicates element-wise multiplication. The random mask vector conforms to the Laplace transform, and the superscript T indicates transpose.

7. The custom fine-grained ECG self-supervised interpretable method according to claim 2, characterized in that, Comparative learning loss Represented as: in, Indicates temperature parameter, q and All are indices representing the ECG sample correspondence diagram. Indicates that it comes from the first q The ECG sample corresponds to the heart rate chart in the [number]th ... i Individual and j The embedding vector of each node. Indicates that it comes from the first The embedding vectors of each ECG sample are used as negative samples, and N represents the number of samples in a mini-batch.

8. A custom fine-grained ECG self-supervised interpretable system, characterized in that, Includes a graph construction module, a signal classification module, and an interpretable module. The graph construction module is used to acquire ECG data and divide the ECG data into heartbeat segments according to a custom fine-grained method to obtain a heartbeat set composed of multiple heartbeat segments. The heartbeat set is then used to construct a graph to obtain a heartbeat graph representation. The signal classification module is used to embed the heartbeat map representation using an encoder to obtain a graph embedding vector, and to perform signal classification of ECG data based on the graph embedding vector; The interpretable module is used to optimize the heartbeat graph representation using an embedded interpreter to obtain a heartbeat subgraph representation that plays a decisive role in interpreting the signal classification results; The process of constructing a graph from the heartbeat set to obtain a heartbeat graph representation includes: Using heartbeat segments from the heartbeat set as nodes in the heartbeat graph, and establishing edges between nodes based on temporal information between heartbeat segments, a self-attention mechanism is used to calculate the latent semantic relevance between heartbeat segments, resulting in a node representation for each node, including: For each heartbeat segment Each heartbeat segment As a key, it will be associated with heartbeat fragments. Other heartbeat segments with adjacency relationships are used as query values, and the heartbeat segments are... Multi-head attention calculations are performed with other heartbeat segments to obtain each heartbeat segment. The weights of other heartbeat segments are used as the weights of the edges connecting the two nodes. The ECG data corresponding to the other heartbeat segments are then weighted and summed based on these weights to obtain the heartbeat segment. The node representation of the corresponding node; Optimize the heartbeat graph representation using an embedded interpretable, including: Introducing a random mask vector conforming to the Laplace transform And then undergo linear transformations in sequence. and activation function After activation, input the data into the MLP, and simultaneously input the node representations of any two nodes in the heartbeat graph. and The input is fed into the MLP, which then calculates two nodes. and Edge node weights of the connecting edges : in, For connection operations along the feature dimension, For activation function, symbol This indicates element-wise multiplication; When the edge node weight Greater than or equal to a given threshold Then retain two nodes. and Connect edges between nodes, otherwise delete them. This can be expressed as a formula: The resulting heartbeat subgraph represents , For a set of nodes, This represents the set of edges that have been optimized and retained. This represents the original set of edges in the heartbeat graph representation.

Citation Information

Patent Citations

  • Intelligent arrhythmia diagnosis method based on multiple-lead and convolutional neural network

    CN105748063A

  • Noninvasive blood pressure prediction method, system and equipment

    CN117678989A