Electrocardiogram multi-granularity diagnosis system, method, device, readable storage medium and program product

By utilizing a multi-granularity electrocardiogram (ECG) diagnostic system and employing cascaded conditionalization mechanisms and conditional feature modulation, the problems of low hierarchical consistency and accuracy in ECG diagnosis have been solved, resulting in a significant improvement in multi-level diagnosis and greater flexibility.

CN122135933APending Publication Date: 2026-06-02VERISILICON MICROELECTRONICS (HAINAN) CO LTD +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
VERISILICON MICROELECTRONICS (HAINAN) CO LTD
Filing Date
2026-02-11
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing technologies lack deep feature space interaction and hierarchical dependency modeling in multi-level ECG diagnosis, resulting in low hierarchical consistency and accuracy of the diagnostic system, especially in the frequent conflicts between fine-grained prediction results and coarse-grained classification.

Method used

A multi-granularity ECG diagnostic system is adopted, which outputs temporal continuous features and multi-lead spatial features through the backbone network module. It utilizes the cascaded conditionalization mechanism and conditional feature modulation (FiLM) to transfer diagnostic knowledge between different granularity levels. Combined with progressive training strategy and gradient truncation operation, the weights are dynamically adjusted to improve diagnostic accuracy.

Benefits of technology

It achieves significant performance improvements across different levels of the multi-granularity electrocardiogram diagnostic system, ensuring consistency and accuracy in diagnosis across levels, adapting to the diagnostic needs of devices with different computing resources, and providing flexibility from coarse screening to precise diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122135933A_ABST
    Figure CN122135933A_ABST
Patent Text Reader

Abstract

This application provides a multi-granularity electrocardiogram (ECG) diagnostic system, method, device, readable storage medium, and program product. The system includes an ECG signal input module for inputting ECG signals; a backbone network module for outputting the temporal continuous features and multi-lead spatial features corresponding to the ECG signals; a first granularity module for outputting a first granularity probability vector and a first granularity diagnostic label; a second granularity module for determining second granularity features and outputting the second granularity probability vector and the second granularity diagnostic label; and a third granularity module for determining third granularity features and outputting the third granularity diagnostic label corresponding to the third granularity features. The multi-granularity ECG diagnostic system of this application employs a cascaded conditionalization mechanism, enabling significant and balanced performance improvements at each diagnostic level. This solves the problem of conflicting prediction results between different levels in existing parallel multi-head structures, improving the accuracy of multi-granularity ECG diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of medical signal processing technology and relates to an electrocardiogram multi-granularity diagnostic system, method, device, readable storage medium and program product. Background Technology

[0002] Current technologies for multi-level ECG diagnosis often limit the inter-level association mechanisms to shallow numerical constraints at the level of output probability distribution, lacking deep modeling of hierarchical dependencies and class exclusivity between diagnostic labels at the feature level. This loosely coupled approach based on shallow probability matching leads to the inability to guarantee hierarchical consistency of prediction results at different granularities during inference, frequently resulting in hierarchical prediction conflicts (i.e., fine-grained prediction results violating coarse-grained classification categories). Furthermore, the lack of deep feature space interaction and hierarchical guidance limits the model's effective extraction and discrimination of subtle lesions, resulting in low overall accuracy of the diagnostic system. Therefore, improving the accuracy of multi-granularity ECG diagnosis has become an urgent technical problem to be solved. Summary of the Invention

[0003] This application provides a multi-granularity electrocardiogram (ECG) diagnostic system, method, device, readable storage medium, and program product to improve the accuracy of multi-granularity ECG diagnosis.

[0004] In a first aspect, this application provides an electrocardiogram (ECG) multi-granularity diagnostic system, the system comprising: an ECG signal input module for inputting ECG signals; a backbone network module connected to the ECG signal input module for outputting temporal continuous features and multi-lead spatial features corresponding to the ECG signals; a first granularity module connected to the backbone network module for outputting a first granularity probability vector and a first granularity diagnostic label corresponding to the temporal continuous features and the multi-lead spatial features; a second granularity module connected to both the backbone network module and the first granularity module for determining a second granularity feature corresponding to the temporal continuous features, the multi-lead spatial features, and the first granularity probability vector, and outputting a second granularity probability vector and a second granularity diagnostic label corresponding to the second granularity feature; and a third granularity module connected to both the backbone network module and the second granularity module for determining a third granularity feature corresponding to the temporal continuous features, the multi-lead spatial features, and the second granularity probability vector, and outputting a third granularity diagnostic label corresponding to the third granularity feature.

[0005] In one implementation of the first aspect, the first granularity module includes a first granularity probability vector output unit and a first label output unit. The first granularity probability vector output unit is connected to the backbone network and is used to output the first granularity probability vector corresponding to the temporal continuous features and the multi-lead spatial features. The first label output unit is connected to the first granularity probability vector output unit and is used to normalize the first granularity probability vector and output the first granularity diagnostic label.

[0006] In one implementation of the first aspect, the second granularity module includes a second conditional vector mapping unit, a second feature modulation unit, a second granularity probability vector output unit, and a second label output unit. The second conditional vector mapping unit is connected to the first granularity module and is used to map the first granularity probability vector into a second low-dimensional conditional vector. The second feature modulation unit is connected to both the backbone network module and the second conditional vector mapping unit and is used to modulate the temporal continuous features, the multi-lead spatial features output by the backbone network module, and the second low-dimensional conditional vector output by the second conditional vector mapping unit into second granular features. The second granularity probability vector output unit is connected to the second feature modulation unit and is used to output the second granularity probability vector corresponding to the second granular feature. The second label output unit is connected to the second granularity probability vector output unit and is used to normalize the second granularity probability vector and output a second granularity diagnostic label.

[0007] In one implementation of the first aspect, the third granularity module includes a third conditional vector mapping unit, a third feature modulation unit, a third granularity probability vector output unit, and a third label output unit. The third conditional vector mapping unit is connected to the second granularity module and is used to map the second granularity probability vector into a third low-dimensional conditional vector. The third feature modulation unit is connected to both the backbone network module and the third conditional vector mapping unit and is used to modulate the temporal continuous feature, the multi-lead spatial feature output by the backbone network module, and the third low-dimensional conditional vector output by the third conditional vector mapping unit into a third granularity feature. The third granularity probability vector output unit is connected to the third feature modulation unit and is used to output the third granularity probability vector corresponding to the third granularity feature. The third label output unit is connected to the third granularity probability vector output unit and is used to normalize the third granularity probability vector and output a third granularity diagnostic label.

[0008] Secondly, this application provides a training method for an electrocardiogram (ECG) multi-granularity diagnostic system. The method includes: acquiring multiple sets of ECG signals to be trained; constructing sample labels for each set of ECG signals to be trained; sequentially inputting each set of ECG signals to be trained into the ECG multi-granularity diagnostic system to obtain a first granularity probability vector, a second granularity probability vector, and a third granularity probability vector, as well as a first granularity diagnostic label, a second granularity diagnostic label, and a third granularity diagnostic label output by the ECG multi-granularity diagnostic system for each set; determining the total loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector; and adopting a progressive training strategy to dynamically adjust the weights of each part within the total loss until the adjusted first granularity diagnostic label, the second granularity diagnostic label, and the third granularity diagnostic label are consistent with the sample labels corresponding to the ECG signals to be trained, thus completing the training.

[0009] In one implementation of the second aspect, determining the total loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector includes: determining a first loss, a second loss, and a third loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector, respectively; using a gradient truncation operation to determine the distribution alignment loss corresponding to the first granularity probability vector and the second granularity probability vector; and determining the total loss based on the first loss, the second loss, the third loss, and the distribution alignment loss.

[0010] In one implementation of the second aspect, determining the first loss corresponding to the first granularity probability vector includes: obtaining a first granularity sample label of the ECG signal to be trained in a first granularity module; obtaining a first granularity label mask of the ECG signal to be trained in the first granularity module; and determining the first loss based on the first granularity sample label, the first granularity label mask, and the first granularity probability vector.

[0011] In one implementation of the second aspect, the step of employing gradient truncation to determine the distribution alignment loss corresponding to the first granularity probability vector and the second granularity probability vector includes: determining a second granularity probability projection vector based on a first medical prior mapping matrix and the third granularity probability vector; determining a first granularity probability projection vector based on the second medical prior mapping matrix and the third granularity probability vector; and determining the distribution alignment loss based on the second granularity probability projection vector, the second granularity probability vector, the first granularity probability projection vector, and the first granularity probability vector.

[0012] In one implementation of the second aspect, the step of constructing sample labels corresponding to each group of electrocardiogram signals includes: determining a first medical prior mapping matrix and a second medical prior mapping matrix; and constructing sample labels corresponding to the electrocardiogram signals to be trained using the first medical prior mapping matrix and the second medical prior mapping matrix based on a multi-level label and mask construction process.

[0013] In one implementation of the second aspect, determining the first and second medical prior mapping matrices includes: constructing a first-level, second-level, and third-level electrocardiogram (ECG) disease labeling system; determining the first medical prior mapping matrix based on the second-level and third-level ECG disease labeling systems; and determining the second medical prior mapping matrix based on the first-level and third-level ECG disease labeling systems.

[0014] Thirdly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the training method of the electrocardiogram multi-granularity diagnostic system as described in any one of the second aspects of this application.

[0015] Fourthly, embodiments of this application provide an electronic device, the electronic device comprising: a memory storing a computer program; and a processor communicatively connected to the memory, wherein when the computer program is invoked, the training method of the electrocardiogram multi-granularity diagnostic system as described in any one of the second aspects of this application is executed.

[0016] Fifthly, embodiments of this application provide a computer program product, which includes computer program code. When the computer program code is run on a computer, the computer implements the training method for the electrocardiogram multi-granularity diagnostic system as described in the second aspect.

[0017] As described above, the electrocardiogram multi-granularity diagnostic system, method, device, readable storage medium, and program product described in this application have the following beneficial effects:

[0018] 1) The ECG multi-granularity diagnostic system of this application can solve the problem in the prior art where the parallel multi-head structure (i.e., each classification head acts independently on different levels of features of the backbone network without interaction) keeps the constraints between diagnostic levels at a shallow probability matching level, resulting in contradictory prediction results and poor prediction performance indicators between different levels. The system adopts a cascaded conditionalization mechanism. The first granularity provides a reliable semantic basis for higher-level diagnosis. Under the guidance of the conditional modulation mechanism, the second granularity diagnosis can effectively utilize the semantic context provided by the first granularity diagnosis and reduce confusion between categories. The third granularity diagnosis obtains guidance from the upper layer through unidirectional information flow, improving the consistency with the diagnosis of higher-level modules while maintaining accuracy. This embedded hierarchical linkage optimization mechanism enables significant and balanced performance improvement at each diagnostic level and ensures the consistency of diagnosis between levels.

[0019] 2) This application creatively applies Feature-wise Linear Modulation (FiLM) to multi-granularity electrocardiogram diagnostic tasks, realizing the conditional modulation of lower-level module features by upper-level module diagnostic knowledge. It employs a mechanism that uses conditional vectors generated by upper-level module predictions to perform affine transformations on lower-level module features; and a hierarchical conditional modulation architecture with first, second, and third granularities. Compared to traditional probabilistic constraints or multi-task learning, this deep feature modulation mechanism enables more fundamental inter-level knowledge transfer.

[0020] 3) The electrocardiogram multi-granularity diagnostic system provided in this application operates independently of the three classification heads when reasoning based on electrocardiogram signals. It can dynamically adjust the diagnostic level of the system output according to the computing resources of the equipment deployed in the system, without having to adjust the system structure or retrain. It can adapt to different scenario needs from coarse screening on mobile terminals to precise diagnosis on professional workstations, providing technical support for the intelligent construction of the hierarchical diagnosis and treatment system and has important clinical application prospects.

[0021] 4) The embodiments of this application adopt a "progressive training strategy" combined with a "dynamic weight adjustment" method to simulate the thinking process of a doctor diagnosing an electrocardiogram. Through mathematical dynamic weight allocation, the optimal balance between feature learning ability, training stability and final diagnostic accuracy is achieved, thereby improving the accuracy of training.

[0022] 5) The embodiments of this application adopt a gradient protection mechanism. By introducing gradient truncation operation on the feature modulation path, the lower layer loss will not directly affect the upper layer parameters, thereby improving training stability. This design greatly reduces the oscillation phenomenon during training, speeds up the convergence speed, and reduces the dependence on fine-tuning of hyperparameters, thereby improving training accuracy.

[0023] 6) In this embodiment, soft consistency constraints based on Kullback-Leibler (KL) divergence are introduced in the first and second granularity modules to prevent a large number of high-frequency gradients generated by the third granularity task from interfering with the learning of the coarse second granularity task, thereby avoiding training instability and upper-level semantic drift. The soft constraints are implemented from the bottom up at the statistical level through distribution alignment. This consistency guarantee greatly enhances the clinical credibility of the diagnostic labels output by the system.

[0024] 7) In this embodiment of the application, the medical knowledge graph is transformed into a computable first medical prior mapping matrix and a second medical prior mapping matrix. The first medical prior mapping matrix and the second medical prior mapping matrix encode the diagnostic logical relationship. The first medical prior mapping matrix and the second medical prior mapping matrix serve as built-in constraints of the system to ensure the clinical rationality of the diagnostic results. This method of transforming authoritative medical knowledge into structured constraints of deep learning models solves the core problems of strong subjectivity and lack of medical basis in the hierarchical relationship in traditional methods. Attached Figure Description

[0025] Figure 1 The diagram shown is a structural diagram of the electrocardiogram multi-granularity diagnostic system provided in an embodiment of this application.

[0026] Figure 2 The diagram shown is a structural diagram of the first granularity module provided in an embodiment of this application.

[0027] Figure 3 The diagram shown is a structural diagram of the second granularity module provided in an embodiment of this application.

[0028] Figure 4 The diagram shown is a structural diagram of the third granularity module provided in an embodiment of this application.

[0029] Figure 5 The diagram shown is an overall structural diagram of the electrocardiogram multi-granularity diagnostic system provided in the embodiments of this application.

[0030] Figure 6A The flowchart shown is a training method for the electrocardiogram multi-granularity diagnostic system provided in the embodiments of this application.

[0031] Figure 6B The flowchart shown is a signal preprocessing flowchart provided in an embodiment of this application.

[0032] Figure 6C The diagram shown is a forward flowchart of the electrocardiogram multi-granularity diagnostic system provided in an embodiment of this application.

[0033] Figure 7 The flowchart shown is a process for determining the total loss during the training of a multi-granularity electrocardiogram diagnostic system provided in an embodiment of this application.

[0034] Figure 8 The flowchart shown is a process for determining the first loss corresponding to the first granularity probability vector provided in an embodiment of this application.

[0035] Figure 9A The flowchart shown is for determining the distribution alignment loss provided in an embodiment of this application.

[0036] Figure 9B The flowchart shown is a reverse process corresponding to the electrocardiogram multi-granularity diagnostic system provided in the embodiments of this application.

[0037] Figure 10A The flowchart shown is a process for constructing sample labels corresponding to electrocardiogram signals according to an embodiment of this application.

[0038] Figure 10B The flowchart shown is a representation of the label construction process provided in this application embodiment.

[0039] Figure 11A The flowchart shown is for determining the first medical prior mapping matrix and the second medical prior mapping matrix as provided in an embodiment of this application.

[0040] Figure 11B The diagram shown is a structural diagram of the first medical prior mapping matrix provided in an embodiment of this application.

[0041] Figure 11C The diagram shown is a structural diagram of the second medical prior mapping matrix provided in an embodiment of this application.

[0042] Figure 12 The diagram shown is a structural diagram of an electronic device provided in an embodiment of this application.

[0043] Component designation explanation

[0044] 100 Electrocardiogram multi-granularity diagnostic system 153 Third-level probability vector output unit 110 ECG signal input module 154 Third tag output unit 120 Backbone network module S61~S65 step 130 First Granularity Module S71~S73 step 131 First granularity probability vector output unit S81~S83 step 132 First tag output unit S91~S93 step 140 Second granularity module S101~S102 step 141 Second conditional vector mapping unit S111~S113 step 142 Second feature modulation unit 200 electronic devices 143 Second granularity probability vector output unit 201 processor 144 Second tag output unit 202 Non-volatile storage media 150 Third Granularity Module 203 System bus 151 Third conditional vector mapping unit 204 Internal memory 152 Third Feature Modulation Unit 205 Network interface Detailed Implementation

[0045] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.

[0046] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0047] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0048] like Figure 1 As shown in the figure, this application provides a structural diagram of an electrocardiogram multi-granularity diagnostic system. Figure 1 As shown, the electrocardiogram multi-granularity diagnostic system 100 provided in this application embodiment includes an electrocardiogram signal input module 110, a backbone network module 120, a first granularity module 130, a second granularity module 140, and a third granularity module 150.

[0049] The electrocardiogram (ECG) signal input module is used to input ECG signals.

[0050] The backbone network module is connected to the electrocardiogram signal input module and is used to output the temporal continuous features and multi-lead spatial features corresponding to the electrocardiogram signal.

[0051] Specifically, the backbone network can use an improved ResNet-1D, which can efficiently encode electrocardiogram (ECG) signals and extract the temporal continuity features and multi-lead spatial features of the ECG signals.

[0052] Specifically, ResNet-1D originates from the residual learning concept. Its core advantage lies in solving the gradient vanishing and degradation problems in backbone network training through the "identical skip connection" structure, enabling the backbone network to maintain stable convergence even at deeper layers and possessing strong feature reuse capabilities. In the embodiments of this application, the backbone network of the One-Dimensional Residual Network (ResNet-1D) consists of three convolutional residual modules connected in series. Each layer includes multiple convolutional units, batch normalization (BN) layers, and rectified linear units (ReLU). Each layer continuously downsamples and increases the number of channels through convolutional units, achieving multi-scale abstraction from local waveforms to global rhythms. To maintain feature expressiveness with a relatively small number of parameters, a bottleneck structure design is employed within each residual block. This involves first compressing the number of channels using a 1×1 convolution, then extracting temporal dependencies using a 3×1 convolution, and finally restoring the number of channels using a 1×1 convolution. This design significantly reduces the number of parameters and multiply-accumulate operations while maintaining expressiveness. To improve model stability and generalization performance, the backbone network also incorporates random deactivation layers (Dropout Layer, DL) between residual blocks to prevent overfitting. Dropout, a regularization technique to prevent overfitting in deep neural networks, increases the model's generalization ability by randomly shutting down some neurons during training. The high-dimensional temporal feature vector output by the backbone network serves as the shared input for subsequent multi-level classification heads, enabling feature discrimination in different levels of diagnostic tasks.

[0053] It should be noted that the temporal continuous features and multi-lead spatial features output by the backbone network module listed in the above examples are merely illustrative. In practical applications, multi-scale feature fusion mechanisms can also be introduced. These mechanisms specifically include: 1) directly extracting multi-layer features from the backbone network and splicing them; 2) introducing a cross-lead spatiotemporal attention fusion mechanism, designing an ECG lead relationship modeling module to capture the physiological correlations between different leads; 3) developing a multi-scale pyramid to simultaneously capture features such as heart rate and rhythm in the time dimension; and 4) exploring frequency-time domain cross-fusion, extracting frequency domain features through wavelet transform, and performing cross-attention fusion with the original time domain signal. This application does not impose any limitations on these aspects.

[0054] The first granularity module, connected to the backbone network module, is used to output the first granularity probability vector and the first granularity diagnostic label corresponding to the temporal continuous features and the multi-lead spatial features.

[0055] Specifically, the first granularity probability vector represents the coarse-grained vector corresponding to the electrocardiogram signal, and the first granularity diagnostic label represents the coarse-grained label corresponding to the electrocardiogram signal.

[0056] The second granularity module is connected to the backbone network module and the first granularity module respectively, and is used to determine the second granularity feature corresponding to the temporal continuous feature, the multi-lead spatial feature and the first granularity probability vector, and output the second granularity probability vector and the second granularity diagnostic label corresponding to the second granularity feature.

[0057] Specifically, the second granularity probability vector represents the medium granularity vector corresponding to the electrocardiogram signal, and the second granularity diagnostic label represents the medium granularity label corresponding to the electrocardiogram signal.

[0058] The third granularity module is connected to the backbone network module and the second granularity module respectively, and is used to determine the third granularity feature corresponding to the temporal continuous feature, the multi-lead spatial feature and the second granularity probability vector, and output the third granularity diagnostic label corresponding to the third granularity feature.

[0059] Specifically, the third-granularity diagnostic label represents the fine-grained label corresponding to the electrocardiogram signal.

[0060] It should be noted that the diagnostic scope of the first-granularity diagnostic label output by the first granularity module, the second-granularity diagnostic label output by the second granularity module, and the third-granularity diagnostic label output by the third granularity module gradually decreases. The first-granularity diagnostic label output by the first granularity module corresponds to the major diagnostic category, the second-granularity diagnostic label output by the second granularity module corresponds to the anatomical subcategory, and the third-granularity diagnostic label output by the third granularity module corresponds to the specific lesion. This enables accurate localization from the major diagnostic category (such as myocardial infarction, conduction disorder) to the anatomical subcategory (such as anterior wall infarction, inferior wall infarction) and then to the specific lesion.

[0061] This application provides a multi-granularity electrocardiogram (ECG) diagnostic system. This system addresses the problems in existing parallel multi-head structures (where each classifier independently acts on different levels of the backbone network without interaction), where diagnostic constraints remain at a shallow probability matching level. This results in contradictory predictions and poor performance across different levels. The system employs a cascaded conditionalization mechanism. The first granularity layer provides a reliable semantic foundation for higher-level diagnoses. The second granularity layer, guided by the conditional modulation mechanism, effectively utilizes the semantic context provided by the first granularity layer, reducing confusion between categories. The third granularity layer receives guidance from higher layers through unidirectional information flow, maintaining accuracy while improving consistency with higher-level diagnoses. This embedded hierarchical linkage optimization mechanism achieves significant and balanced performance improvements across all diagnostic levels, ensuring consistency between levels.

[0062] like Figure 2 As shown in the figure, this application provides a structural diagram of a first granularity module. Figure 2 As shown, the first granularity module 130 provided in this application embodiment includes a first granularity probability vector output unit 131 and a first tag output unit 132.

[0063] The first granularity probability vector output unit is connected to the backbone network and is used to output the first granularity probability vector corresponding to the temporal continuous features and the multi-lead spatial features.

[0064] Specifically, the temporal continuity features and the multi-lead spatial features are... express.

[0065] Specifically, the first-granularity probability vector output unit includes a first-granularity (coarse) classification head, which comprises a squeeze-and-excitation (SE) layer, a feature aggregation layer (in one embodiment, the feature aggregation layer is a global average pooling (GAP) layer), a dropout layer (DL), and a linear discriminant layer. The squeeze-and-excitation (SE) layer adaptively adjusts the importance of features in each channel (i.e., ECG leads), enabling the backbone network to automatically highlight key leads and suppress invalid leads and noise. The global average pooling (GAP) layer averages the features of each channel in the temporal dimension, achieving compression from temporal features to global semantics. The first-granularity probability vector output by the first-granularity probability vector output unit is... express.

[0066] The first tag output unit is connected to the first granularity probability vector output unit and is used to normalize the first granularity probability vector and output the first granularity diagnostic tag.

[0067] Specifically, within the first tag output unit, for Pick As the final first-level diagnostic label.

[0068] This application provides a structure for a first granularity module, which includes a first granularity probability vector output unit and a first label output unit. The first granularity probability vector output unit is connected to the backbone network and is used to output the first granularity probability vector corresponding to the temporal continuous features and the multi-lead spatial features. The first label output unit is connected to the first granularity probability vector output unit and is used to normalize the first granularity probability vector and output the first granularity diagnostic label, providing an accurate label basis for subsequent training of the system.

[0069] like Figure 3 As shown in the figure, this application provides a structural diagram of a second granularity module, as follows. Figure 3 As shown, the second granularity module 140 provided in this application embodiment includes a second conditional vector mapping unit 141, a second feature modulation unit 142, a second granularity probability vector output unit 143, and a second tag output unit 144.

[0070] The second condition vector mapping unit is connected to the first granularity module and is used to map the first granularity probability vector into a second low-dimensional condition vector.

[0071] Specifically, after the first granularity probability vector output by the first granularity module enters the second conditional vector mapping unit, the second conditional vector mapping unit includes a conditional multi-layer perceptron (CondMLP). The second conditional vector mapping unit performs dimensionality reduction processing on the first granularity probability vector to obtain the second low-dimensional conditional vector corresponding to the first granularity probability vector.

[0072] For example, the expression for mapping the first granularity probability vector to the second low-dimensional condition vector within the second condition vector mapping unit is as follows:

[0073]

[0074] in, This represents the probability output of the higher-level classification. Indicates by The set of vectors consisting of real numbers. , , and Let represent the learnable parameters of the two fully connected transformation matrices, respectively. and This represents the activation function. This represents the second low-dimensional conditional vector. Indicates by The set of vectors consisting of real numbers, due to the effect of nonlinear compression mapping, has a dimension of Much smaller than the number of feature channels in the input .

[0075] The second feature modulation unit is connected to the backbone network module and the second conditional vector mapping unit respectively, and is used to modulate the temporal continuous feature, the multi-lead spatial feature output by the backbone network module and the second low-dimensional conditional vector output by the second conditional vector mapping unit into a second granular feature.

[0076] Specifically, the second feature modulation unit modulates the temporal continuous feature, the multi-lead spatial feature, and the second low-dimensional conditional vector into a second granular feature, wherein the second feature modulation unit includes feature-wise linear modulation (FiLM).

[0077] For example, within the second feature modulation unit, the expression for modulating the temporally continuous feature, the multi-lead spatial feature, and the second low-dimensional conditional vector into a second granular feature is as follows:

[0078]

[0079] in, Indicates batch aisle Time point Feature tensor values ​​before modulation Indicates batch aisle Time point Modulated feature tensor values, and These represent the scaling and offset coefficients generated from the condition vector, respectively. and It only applies to the channel dimension, meaning it is broadcast to the batch and time dimensions.

[0080] Specifically, determine and The expression is:

[0081]

[0082] in, and These represent the learnable parameters.

[0083] It should be noted that the advantage of mapping the first granularity probability vector to a second low-dimensional conditional vector in the second granularity module, and obtaining the temporal continuous features, multi-lead spatial features, and the second granularity features corresponding to the second low-dimensional conditional vector, is that it can transfer the diagnostic semantics of the upper layer to the lower layer without significantly increasing the number of parameters. For example, if the first granularity module classifies the sample as myocardial infarction (MI), the system will enhance the modeling and attention to morphological evidence related to ischemia / infarction in the second and third granularity modules, including but not limited to ST segment deviation, abnormal T wave morphology, and abnormal progression of pathological Q waves and R waves. This feature modulation method is similar to the diagnostic logic of doctors first determining the broad category and then locating the lesion, and has intuitive physical significance.

[0084] The second granularity probability vector output unit is connected to the second feature modulation unit and is used to output the second granularity probability vector corresponding to the second granularity feature.

[0085] Specifically, the second-granularity probability vector output unit includes a second-granularity (middle) classification head, which comprises a channel attention layer, a feature aggregation layer, a dropout layer (DL), and a linear discriminant layer. The second-granularity probability vector output by the second-granularity probability vector output unit is... express.

[0086] The second tag output unit is connected to the second granularity probability vector output unit and is used to normalize the second granularity probability vector and output the second granularity diagnostic tag.

[0087] Specifically, within the second tag output unit, for Pick As the final second-level diagnostic label.

[0088] It should be noted that the second feature modulation unit (second granularity FiLM) listed in the above example is merely illustrative. In practical applications, the second feature modulation unit can be further extended to more flexible forms, specifically including: 1) introducing a bidirectional attention routing mechanism (current feature modulation is unidirectional), which not only guides from the first granularity to the third granularity, but also allows the third granularity features to reconstruct the first granularity representation through attention weights; 2) further exploring dynamic information flow control, adaptively adjusting the intensity of information flow between layers according to the complexity of the input samples, reducing computation for simple samples, and enhancing layer interaction for complex samples. This application does not impose any limitations on this.

[0089] This application provides a structure for a second granularity module, which includes a second conditional vector mapping unit, a second feature modulation unit, a second granularity probability vector output unit, and a second label output unit. In the second granularity module, the first granularity probability vector output by the first granularity module can be dimensionality reduced to obtain a second low-dimensional conditional vector. The temporal continuous features, multi-lead spatial features, and the second low-dimensional conditional vector are modulated into second granular features. Based on the second granular features, a second granularity probability vector and a second granularity diagnostic label are obtained. This application can transfer the diagnostic semantics corresponding to the first granularity probability vector of the upper-level first granularity module to the lower-level second granularity module without significantly increasing the number of parameters. This avoids the problem of conflicting prediction results between the first and second granularity modules, providing an accurate data foundation for obtaining accurate multi-granularity classification results of electrocardiogram signals.

[0090] like Figure 4 As shown in the diagram, this application provides a structural diagram of a third granularity module. Figure 4 As shown, the third granularity module 150 provided in this application embodiment includes a third conditional vector mapping unit 151, a third feature modulation unit 152, a third granularity probability vector output unit 153, and a third tag output unit 154.

[0091] The third condition vector mapping unit is connected to the second granularity module and is used to map the second granularity probability vector into a third low-dimensional condition vector.

[0092] Specifically, after the second granularity probability vector output by the second granularity module enters the third conditional vector mapping unit (third granularity CondMLP), the third conditional vector mapping unit performs dimensionality reduction processing on the second granularity probability vector to obtain the third low-dimensional conditional vector corresponding to the second granularity probability vector.

[0093] It should be noted that the expression for mapping the second granularity probability vector to the third low-dimensional condition vector in the third condition vector mapping unit is similar to the expression for mapping the first granularity probability vector to the second low-dimensional condition vector in the second condition vector mapping unit, and will not be repeated here.

[0094] The third feature modulation unit is connected to the backbone network module and the third conditional vector mapping unit, respectively, and is used to modulate the temporal continuous feature, the multi-lead spatial feature output by the backbone network module and the third low-dimensional conditional vector output by the third conditional vector mapping unit into a third granular feature.

[0095] Specifically, the third feature modulation unit (third granularity FiLM) modulates the temporal continuous feature, the multi-lead spatial feature, and the third low-dimensional conditional vector into a third granularity feature.

[0096] It should be noted that this application creatively applies the FiLM mechanism to multi-granularity diagnostic tasks in electrocardiograms. middle This method achieves conditional modulation of lower-level module features by diagnostic knowledge from upper-level modules. Specifically, it includes: a mechanism for performing affine transformations on lower-level module features using conditional vectors generated by upper-level module predictions; and a hierarchical conditional modulation architecture with first, second, and third granularities. Compared to traditional probabilistic constraints or multi-task learning, this deep feature modulation mechanism enables more fundamental inter-level knowledge transfer. In one embodiment, the macro-averaged area under the curve (Macro AUC) for the first, second, and third granularity tasks reached 0.915, 0.872, and 0.851, respectively. The average sensitivity of each category in the first granularity task reached 0.752, significantly better than the average sensitivity of each category in the first granularity task in traditional methods, which is generally between 0.65 and 0.70. The average specificity of each category was 0.91, on par with traditional methods.

[0097] It should be noted that, within the third feature modulation unit, the expression for modulating the temporal continuous feature, the multi-lead spatial feature, and the third low-dimensional conditional vector into a third granular feature is similar to the expression for modulating the temporal continuous feature, the multi-lead spatial feature, and the second low-dimensional conditional vector into a second granular feature within the second feature modulation unit, and will not be repeated here.

[0098] The third granularity probability vector output unit is connected to the third feature modulation unit and is used to output the third granularity probability vector corresponding to the third granularity feature.

[0099] Specifically, the third-granularity probability vector output unit includes a third-granularity (fine) classification head, which comprises a channel attention layer, a feature aggregation layer, a dropout layer (DL), and a linear discriminant layer. The third-granularity probability vector output by the third-granularity probability vector output unit is... express.

[0100] The third tag output unit is connected to the third granularity probability vector output unit and is used to normalize the third granularity probability vector and output the third granularity diagnostic tag.

[0101] Specifically, within the third tag output unit, for Pick As the final second-level diagnostic label.

[0102] It's important to note that the advantage of using Sigmoid is its ability to independently predict each disease, aligning with the reality that a patient may suffer from multiple diseases. Since the semantic information ensuring consistency between levels is already embedded in the system's forward architecture during training, consistency checks are unnecessary during inference. This allows the three classification heads to operate independently during inference, dynamically adjusting the system's output diagnostic hierarchy based on the computing resources of the deployed devices without requiring system restructuring or retraining. On workstations or cloud servers with strong computing power, complete hierarchical diagnosis can be enabled, providing comprehensive analysis from disease categories to specific lesions. For example, on low-power microcontroller units (MCUs) and smart patch devices, only the first-level prediction result can be output, reducing computational load; while on computers and cloud devices, prediction results from all modules can be output, providing doctors with detailed hierarchical diagnostic references for further diagnosis. This system architecture can adapt to different scenarios, from coarse screening on mobile terminals to precise diagnosis on professional workstations, providing technical support for the intelligent construction of a hierarchical medical system and possessing significant commercial value and clinical application prospects.

[0103] This application provides a structure for a third granularity module, which includes a third conditional vector mapping unit, a third feature modulation unit, a third granularity probability vector output unit, and a third label output unit. This application can transfer the diagnostic semantics corresponding to the second granularity probability vector of the upper-level second-granularity module to the lower-level third-granularity module without significantly increasing the number of parameters. This avoids the problem of conflicting prediction results between the second and third granularity modules, thus improving the accuracy of multi-granularity classification of electrocardiogram signals.

[0104] like Figure 5 As shown in the figure, this application provides an overall structural diagram of an electrocardiogram multi-granularity diagnostic system. Figure 5 The various modules and units mentioned above Figures 1 to 4 The details have already been explained in the document, and will not be repeated here.

[0105] like Figure 6A As shown, this application provides a flowchart of a training method for a multi-granularity electrocardiogram diagnostic system. Figure 6A As shown, the training method of the electrocardiogram multi-granularity diagnostic system provided in this application embodiment includes the following steps S61 to S65.

[0106] S61, acquire multiple sets of ECG signals to be trained.

[0107] For example, the PTB-XL (a large, publicly available ECG dataset) can be used to obtain 12-lead ECG signals from different patients.

[0108] For example, after acquiring multiple sets of ECG signals to be trained, the process includes preprocessing these signals. Specifically, preprocessing includes selecting the number of leads (supporting various configurations such as 12 leads, 6 leads, and 4 leads), truncating the ECG signal to a fixed length (e.g., a 10-second signal with a 500Hz sampling rate, i.e., 5000 sampling points), and zero-mean normalization (Z-score) standardization, where the Z-score standardization formula is as follows:

[0109]

[0110] in, and These represent the ECG signals to be trained before and after standardization, respectively. and These represent the mean and standard deviation of the ECG signal to be trained before processing, respectively. The preprocessing procedure is as follows: Figure 6B As shown.

[0111] It should be noted that the examples above, which use the large-scale (Physikalisch-Technische Bundesanstalt-Extra Large, PTB-XL) publicly available electrocardiogram dataset published by the German National Institute of Metrology to obtain electrocardiogram signals from different patients, are merely illustrative. In practical applications, other multi-level diagnostic frameworks that conform to the consensus of the medical community can also be constructed, including: 1) designing dynamic hierarchical construction algorithms that can automatically generate appropriate diagnostic levels based on different medical knowledge graphs; 2) developing cross-modal hierarchical fusion to integrate multi-source information such as electrocardiograms, clinical indicators, and medical images to construct comprehensive diagnostic levels; 3) exploring personalized hierarchical adjustments to dynamically optimize diagnostic granularity and paths based on patients' historical data and individual characteristics; and 4) constructing open-vocabulary hierarchical recognition that can identify and process new diagnostic categories that do not appear in the training set but conform to medical logic. This application does not impose any restrictions on these aspects.

[0112] S62, construct sample labels for each group of ECG signals to be trained.

[0113] S63, sequentially input each group of ECG signals to be trained into the ECG multi-granularity diagnostic system to obtain the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector, as well as the first granularity diagnostic label, the second granularity diagnostic label, and the third granularity diagnostic label output by the ECG multi-granularity diagnostic system for each group.

[0114] Please see Figure 6C , Figure 6C The diagram shown is a forward flowchart of the electrocardiogram multi-granularity diagnostic system provided in an embodiment of this application.

[0115] like Figure 6C It can be seen that the first granularity probability prediction can output the first granularity diagnostic label corresponding to the ECG signal to be trained, the second granularity probability prediction can output the second granularity diagnostic label corresponding to the ECG signal to be trained, and the third granularity probability prediction can output the third granularity diagnostic label corresponding to the ECG signal to be trained.

[0116] S64, determine the total loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector.

[0117] S65. A progressive training strategy is adopted to dynamically adjust the weights of each part of the total loss until the adjusted first-granularity diagnostic label, second-granularity diagnostic label, and third-granularity diagnostic label are consistent with the sample label corresponding to the ECG signal to be trained, and the training is completed.

[0118] For example, a progressive training strategy is adopted, dynamically adjusting the weights of each component of the total loss, wherein... Indicates the third granularity weight. Indicates the second granularity weight. This represents the first-level weights. In the early stages of training, the focus is on learning the first-level classification. As the number of training rounds increases, the third granularity weight is gradually increased, eventually reaching... .

[0119] To further improve the stability and convergence speed of training, a cosine annealing learning rate scheduling mechanism with a warm-up phase is introduced into the training process. Several rounds are reserved as a warm-up phase in the early stage of training, and the learning rate is gradually increased to prevent divergence caused by the initial weights of the model being updated too quickly. Then, the learning rate is gradually reduced using the cosine annealing function, so that the model can be finely optimized with a smaller step size in the later stage.

[0120] For example, through a multi-level label and mask construction process, the ECG signal to be trained and its corresponding sample labels are predetermined. During the training process of inputting the ECG signal to be trained into the ECG multi-granularity diagnostic system, the weights of each part in the total loss are dynamically adjusted until the training label composed of the first granularity diagnostic label, the second granularity diagnostic label and the third granularity diagnostic label after adjustment is consistent with the predetermined sample label of the ECG signal to be trained, and the training is completed.

[0121] It should be noted that the progressive training strategy adopted in this application has brought about a significant improvement in training stability. In the early stage of training, the system focuses on learning the first-granularity task; then, the second-granularity and third-granularity supervision signals are introduced, which avoids the complexity of multi-task optimization from the beginning.

[0122] This application provides a training method for a multi-granularity electrocardiogram (ECG) diagnostic system. In this method, the ECG multi-granularity diagnostic system is trained using multiple sets of ECG signals to be trained and corresponding sample labels for each set of signals. During training, a progressive training strategy is employed, dynamically adjusting the weights of each part of the total loss until the adjusted first-granularity diagnostic label, second-granularity diagnostic label, and third-granularity diagnostic label are consistent with the sample labels corresponding to the ECG signals to be trained. Training is then complete. Compared to simultaneously and randomly initializing all levels and attempting one-time optimization, the progressive strategy provides a clear "learning path," eliminating the need to waste significant time exploring incorrect third-granularity directions. Instead, it rapidly approaches the optimal solution along the correct path from coarse to fine, thus typically accelerating the overall convergence speed. This application employs a "progressive training strategy" combined with "dynamic weight adjustment" to simulate the thought process of a doctor diagnosing ECGs (first looking at the broad categories, then the details). Through mathematical dynamic weight allocation, an optimal balance is achieved between feature learning ability, training stability, and final diagnostic accuracy, improving training accuracy.

[0123] like Figure 7 As shown in the figure, this application provides a flowchart for determining the total loss during the training process of an electrocardiogram multi-granularity diagnostic system, such as... Figure 7 As shown in the embodiments of this application, the method for determining the total loss during the training process of an electrocardiogram multi-granularity diagnostic system includes the following steps S71 to S73.

[0124] S71, determine the first loss, second loss and third loss corresponding to the first granularity probability vector, the second granularity probability vector and the third granularity probability vector respectively.

[0125] Specifically, the masked binary cross-entropy (BCE) loss function can be applied to calculate the first loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector. Second loss and third loss Among them, masked BCE is a variant of the binary cross-entropy loss function, suitable for multi-label tasks and partially missing label tasks.

[0126] S72, employing a gradient truncation operation, determines the distribution alignment loss corresponding to the first granularity probability vector and the second granularity probability vector.

[0127] S73, determine the total loss based on the first loss, the second loss, the third loss, and the distribution alignment loss.

[0128] For example, the expression for determining the total loss based on the first loss, the second loss, the third loss, and the distribution alignment loss is as follows:

[0129]

[0130] in, Indicates the total loss. Indicates the third granularity weight. Indicates the second granularity weight. Indicates the first granularity weight. This represents the distribution alignment weights.

[0131] This application provides a method for determining the total loss during the training process of an electrocardiogram multi-granularity diagnostic system. In this method, a first loss, a second loss, and a third loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector are determined respectively. A gradient truncation operation is used to determine the distribution alignment loss corresponding to the first granularity probability vector and the second granularity probability vector. A gradient protection mechanism is employed, introducing a gradient truncation operation on the feature modulation path to prevent lower-level losses from directly influencing upper-level parameters, thereby improving training stability. This design significantly reduces oscillations during training, accelerates convergence speed, and reduces reliance on fine-tuning of hyperparameters, thus improving training accuracy.

[0132] like Figure 8 As shown in the figure, this application provides a flowchart for determining the first loss corresponding to the first granularity probability vector, as follows: Figure 8 As shown, the method for determining the first loss corresponding to the first granularity probability vector provided in this application embodiment includes the following steps S81 to S83.

[0133] S81, acquire the first granularity sample label of the ECG signal to be trained in the first granularity module.

[0134] Specifically, the first granularity sample label of the ECG signal to be trained can be obtained in the first granularity module based on the first medical prior mapping matrix and the second medical prior mapping matrix.

[0135] S82, obtain the first granularity label mask of the ECG signal to be trained in the first granularity module.

[0136] Specifically, the first granularity label mask of the ECG signal to be trained can be obtained in the first granularity module based on the first medical prior mapping matrix and the second medical prior mapping matrix.

[0137] S83, determine the first loss based on the first granularity sample label, the first granularity label mask, and the first granularity probability vector.

[0138] For example, the expression for determining the first loss based on the first granularity diagnostic label, the first granularity label mask, and the first granularity probability vector is as follows:

[0139]

[0140] in, Indicates the first-level sample label, Indicates the first-level label mask, This represents the first-granularity probability vector.

[0141] It should be noted that the methods or steps for determining the second and third losses are similar to the method for determining the first loss in this embodiment, and will not be described again in this application.

[0142] This application provides a method for determining the first loss corresponding to the first granularity probability vector. In this method, the first granularity sample label and the first granularity label mask of the electrocardiogram signal to be trained are obtained, and the first loss is determined based on the first granularity diagnostic label, the first granularity label mask and the first granularity probability vector. Unlike traditional methods that simply use parallel classification heads and cost functions for training, this application improves the accuracy of determining the first loss corresponding to the first granularity probability vector.

[0143] like Figure 9A As shown, this application provides a flowchart for determining the distribution alignment loss, as illustrated in the embodiment. Figure 9A As shown, the method for determining the distribution alignment loss provided in this application embodiment includes the following steps S91 to S93.

[0144] S91, determine the second granularity probability projection vector based on the first medical prior mapping matrix and the third granularity probability vector.

[0145] For example, the expression for determining the second granularity probability projection vector based on the first medical prior mapping matrix and the third granularity probability vector is as follows:

[0146]

[0147] in, This represents the second-granularity probability projection vector. This represents the first medical prior mapping matrix. This represents the third-granularity probability vector.

[0148] S92, determine the first granularity probability projection vector based on the second medical prior mapping matrix and the third granularity probability vector.

[0149] For example, the expression for determining the first granularity probability projection vector based on the second medical prior mapping matrix and the third granularity probability vector is as follows:

[0150]

[0151] in, This represents the first-granularity probability projection vector. This represents the second medical prior mapping matrix.

[0152] It should be noted that, to avoid gradient loop propagation in the hierarchical model leading to training instability, a gradient truncation operation is introduced on the feature modulation path to prevent the lower-layer loss from directly influencing the upper-layer parameters. To ensure consistency in predictions between layers, Kullback-Leibler (KL) divergence loss is introduced in the first and second granularity modules to construct soft inverse constraints as an alternative.

[0153] It's important to note that soft consistency constraints based on KL loss are introduced in the first and second granularity modules. These constraints are implemented statistically at the bottom-up level through distribution alignment. For example, the specific lesion location at the third granularity must correspond to the corresponding disease category at the second granularity, and the disease diagnosis at the second granularity must belong to the correct disease category at the first granularity. This consistency guarantee significantly enhances the clinical credibility of the diagnostic labels output by the system. Traditional multi-task learning methods often neglect the logical constraints between levels, potentially leading to medically contradictory diagnostic results.

[0154] It should be noted that soft aggregation of the predicted probability distributions across the three modules is achieved through the first and second medical prior mapping matrices. Compared to traditional hard constraints or simple mean squared error loss, this method ensures both the medical rationality of the predictions between levels and preserves the integrity of the probability distribution, avoiding the system training difficulties caused by excessive constraints and thus guaranteeing the reliability of the medical AI system.

[0155] S93, determine the distribution alignment loss based on the second granularity probability projection vector, the second granularity probability vector, the first granularity probability projection vector, and the first granularity probability vector.

[0156] For example, the expression for determining the distribution alignment loss based on the second granularity probability projection vector, the second granularity probability vector, the first granularity probability projection vector, and the first granularity probability vector is as follows:

[0157]

[0158] in, This represents the distribution alignment loss.

[0159] It should be noted that the soft backpropagation constraint formed by the KL loss indirectly guides the upper-layer parameters toward the distribution of the third granularity layer. This provides stable backpropagation from a statistical perspective through distribution alignment rather than gradient backflow. The KL loss mainly serves to guide the upper layers from the lower layers, pushing the upper-layer probabilities to align with the projection of the third-granularity layer. Therefore, there is no KL loss term in the lowest third-granularity layer. This not only reduces redundant computation, allowing the third-granularity layer to focus solely on the binary cross-entropy (BCE) loss, but also forms a gradient protection mechanism. This prevents a large number of high-frequency gradients generated by the third-granularity task from interfering with the learning of the coarse second-granularity task, avoiding training instability and upper-layer semantic drift. It also avoids the interference of lower-layer gradient noise on upper-layer training during the training process, greatly improving the training effect and stability.

[0160] Please see Figure 9B , Figure 9B The flowchart shown is a reverse process corresponding to the electrocardiogram multi-granularity diagnostic system provided in the embodiments of this application. Arrows indicate the direction of gradient backpropagation, while arrows marked with "×" indicate that lower-level gradients do not directly act on upper-level gradients.

[0161] The KL interlayer soft backward constraint and the conditional feature modulation mechanism in the model structure together enable the system to achieve the effect of asymmetric bidirectional information flow. The forward process is responsible for structural semantic guidance, and the backward process is responsible for optimization feedback adjustment, enabling the system to stably optimize towards the target.

[0162] like Figure 10A As shown in the figure, this application provides a flowchart for constructing sample labels corresponding to electrocardiogram signals, as follows: Figure 10A As shown, the method for constructing sample labels corresponding to electrocardiogram signals provided in this application embodiment includes the following steps S101 to S102.

[0163] S101, determine the first medical prior mapping matrix and the second medical prior mapping matrix.

[0164] For example, a first medical prior mapping matrix and a second medical prior mapping matrix can be determined based on diagnostic labels of a standardized communications protocol diagnostic statement set (SCP) based on a broad consensus.

[0165] S102, based on the multi-level label and mask construction process, the sample labels corresponding to the ECG signal to be trained are constructed using the first medical prior mapping matrix and the second medical prior mapping matrix.

[0166] Specifically, the multi-level label and mask construction process includes multi-label sample processing, automatic label completion, and label masking. For multi-label sample processing, when a sample of an ECG signal to be trained has multiple third-level granularity sample labels (e.g., the sample has both first-degree atrioventricular block (1AVB) and anterior myocardial infarction (ALMI), a soft label encoding method is used to ensure logical consistency between levels of labels. For automatic label completion, when a sample only has lower-level labels, the upper-level labels can be automatically completed based on the first and second medical prior mapping matrices, ensuring self-consistency between label levels. Specifically, this involves traversing all third-level granularity sample labels of the sample. Then, the corresponding second-granularity sample labels and first-granularity sample labels are set, and then the label vector of each level is normalized so that the sum of all labels in each level is 1. The formula is as follows:

[0167]

[0168]

[0169]

[0170]

[0171] in, This represents the normalized first-granularity sample label, second-granularity sample label, or third-granularity sample label.

[0172] Furthermore, when a sample only has upper-level labels but lacks lower-level labels, a label mask is introduced to indicate the presence or absence of labels at each level. This ensures that during subsequent training, the loss is calculated only for labeled samples, and samples with missing layer labels are not included in gradient updates. This adaptively adjusts the gradient propagation range and supports joint training of samples with partially missing labels. Its advantage is that the constructed upper-level labels more closely resemble the actual medical structural data processing workflow.

[0173] The process of constructing sample labels is as follows Figure 10B As shown, Figure 10BSpecifically, the process includes: sequentially determining whether each group of ECG signals to be trained has a third-granularity sample label; if so, obtaining the first-granularity sample label and the second-granularity sample label corresponding to the ECG signal to be trained based on the first and second medical prior mapping matrices, and normalizing the first-granularity sample label and the second-granularity sample label to obtain normalized multi-level labels as the first-granularity sample label and the sample second-granularity label. If not, the mask indicates that the third-granularity label is missing, and the multi-level label mask corresponding to the ECG signal to be trained is obtained as the third-granularity label mask.

[0174] The system sequentially determines whether the ECG signal to be trained that lacks a third-level label has a second-level label. If so, it obtains a first-level label based on the first and second medical prior mapping matrices, and normalizes the first-level label to obtain a normalized multi-level label as the first-level label. If not, it uses a mask to mark the second-level label as missing, obtaining a multi-level label mask corresponding to the ECG signal to be trained, which consists of a second-level label mask and a third-level label mask.

[0175] The system sequentially determines whether the ECG signal to be trained that is missing the second granularity label has the first granularity sample label. If it does, the system determines the first granularity sample label corresponding to the ECG signal to be trained that is missing the second granularity label, and normalizes the first granularity sample label to obtain the normalized multi-level label as the first granularity sample label. If not, the ECG signal to be trained is missing all labels.

[0176] This application provides a method for constructing sample labels corresponding to the electrocardiogram (ECG) signal, including determining a first medical prior mapping matrix and a second medical prior mapping matrix; and constructing sample labels corresponding to the ECG signal to be trained using the first medical prior mapping matrix and the second medical prior mapping matrix based on a multi-level label and mask construction process.

[0177] This ensures that the constructed upper-level labels are smoother and closer to the actual medical structural data processing flow, providing an accurate label basis for the ECG signals to be trained in the subsequent training system.

[0178] like Figure 11A As shown, this application provides a flowchart for determining a first medical prior mapping matrix and a second medical prior mapping matrix, as illustrated below. Figure 11A As shown, the method for determining the first medical prior mapping matrix and the second medical prior mapping matrix provided in this application embodiment includes the following steps S111 to S113.

[0179] S111, construct the first-level, second-level, and third-level electrocardiogram disease labeling systems respectively.

[0180] For example, based on the widely agreed-upon SCP diagnostic labels, a first-level granularity ECG disease labeling system, a second-level granularity ECG disease labeling system, and a third-level granularity ECG disease labeling system can be constructed respectively.

[0181] Specifically, the first-level electrocardiogram disease labeling system includes five first-level categories: Conduction Disorder (CD), Hypertrophy (HYP), Myocardial Infarction (MI), Normal Sinus Rhythm (NORM), and ST Segment and T Wave Change (STTC).

[0182] Specifically, the second-level electrocardiogram disease labeling system includes 23 second-level categories: atrioventricular block (AVB), anterior myocardial infarction (AMI), complete left bundle branch block (CLBBB), complete right bundle branch block (CRBBB), etc.

[0183] Specifically, the third-level electrocardiogram disease labeling system includes 44 fine-grained categories, such as first-degree atrioventricular block (1AVB), second-degree atrioventricular block (2AVB), and third-degree atrioventricular block (3AVB).

[0184] Within this framework, a many-to-one deterministic mapping exists between each lower-level label and its upper-level label, reflecting the hierarchical relationship of ECG abnormalities from waveform characteristics (third granularity), pathological location (second granularity), to disease mechanism (first granularity). For example, "1AVB", "2AVB", and "3AVB" at the third granularity level all belong to the "_AVB" category at the second granularity level, while "_AVB" and "CLBBB / CRBBB" at the second granularity level all belong to the "CD" category at the first granularity level, and so on.

[0185] S112, determine the first medical prior mapping matrix based on the second granularity level electrocardiogram disease labeling system and the third granularity level electrocardiogram disease labeling system.

[0186] For example, the first medical prior mapping matrix This represents the label mapping relationship from category 23 to category 44.

[0187] Given a 23x44 matrix, if the second granularity label in the i-th row contains the third granularity label in the j-th column according to medical standards, then the element in the i-th row and j-th column of the matrix is ​​1; otherwise, it is 0.

[0188]

[0189]

[0190] in, This indicates a second-level granularity label in medical standards. The third granularity label set, 1[∙] represents the indicator function, which takes the value 1 when the condition is true and 0 otherwise. The structure of the first medical prior mapping matrix is ​​as follows: Figure 11B As shown.

[0191] S113, determine the second medical prior mapping matrix based on the first granularity level electrocardiogram disease labeling system and the third granularity level electrocardiogram disease labeling system.

[0192] For example, the second medical prior mapping matrix This represents the label mapping relationship from category 5 to category 44. It is a 5x44 matrix. If the first granularity label in the i-th row contains the third granularity label in the j-th column according to medical standards, then the element in the i-th row and j-th column of this matrix is ​​1; otherwise, it is 0. The structure of the second medical prior mapping matrix is ​​as follows: Figure 11C As shown.

[0193] It should be noted that the first and second medical prior mapping matrices will be embedded into the system as prior knowledge. During the training process, the consistency loss constraint will constrain the medical rationality of the predictions between levels to ensure that the diagnostic results are consistent with clinical logic. At the same time, the system can learn jointly in a multi-scale semantic space, thereby improving the ability to identify and interpret complex electrocardiogram lesions.

[0194] This application provides a method for determining a first medical prior mapping matrix and a second medical prior mapping matrix. This method involves transforming medical knowledge graphs (SCP statements) into computable hierarchical mapping matrices. Specifically, this includes: constructing 5-class, 23-class, and 44-class label systems based on the PTB-XL official diagnostic system; and using the first and second medical prior mapping matrices (…) , The system encodes the logical relationships of diagnosis; the mapping matrix serves as a built-in constraint to ensure the clinical rationality of the diagnostic results. This method, which transforms authoritative medical knowledge into structured constraints for deep learning models, solves the core problems of strong subjectivity and lack of medical basis in traditional methods regarding hierarchical relationships.

[0195] The scope of protection of the training method for the electrocardiogram multi-granularity diagnostic system described in this application is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this application is included within the scope of protection of this application.

[0196] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.

[0197] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this application, depending on actual needs. For example, the functional modules / units in the various embodiments of this application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0198] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0199] This application also provides an electronic device. Figure 12 The diagram shown is a structural schematic of an electronic device 200 in one embodiment of this application. The training method for the electrocardiogram multi-granularity diagnostic system provided in this embodiment can be applied to... Figure 12 The electronic device shown is 200, but it is not limited thereto. For example... Figure 12 As shown, the electronic device 200 includes a processor 201, a memory, a system bus 203, and a network interface 205. The memory may include a non-volatile storage medium 202 and internal memory 204.

[0200] The non-volatile storage medium 202 can store an operating system and a computer program. The computer program includes program instructions that, when executed, cause the processor to perform any of the training methods for the electrocardiogram multi-granularity diagnostic system provided in the embodiments of this application.

[0201] The processor provides computing and control capabilities, supporting the operation of the entire computer device.

[0202] The internal memory 204 provides an environment for the execution of a computer program in a non-volatile storage medium. When the computer program is executed by the processor, it enables the processor to execute any of the training methods for the electrocardiogram multi-granularity diagnostic system provided in the embodiments of this application.

[0203] The network interface 205 is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0204] It should be understood that processor 201 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0205] The electronic device 200 in this application embodiment may include terminal devices such as tablet computers, laptop computers, mobile phones, supercomputers, and smart wearable devices. It can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. This application embodiment does not impose any restrictions on the specific type of electronic device.

[0206] For example, electronic devices can be stations (STAION, ST) in WLANs, cellular phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, computers, laptops, handheld communication devices, handheld computing devices, and / or other devices for communicating over wireless systems, as well as next-generation communication systems, such as mobile terminals in 5G networks, mobile terminals in future evolved Public Land Mobile Networks (PLMNs), or mobile terminals in future evolved Non-terrestrial Networks (NTNs).

[0207] This application also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0208] This application embodiment may also provide a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application embodiment are generated. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0209] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product can be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.

[0210] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.

[0211] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A multi-granularity electrocardiogram diagnostic system, characterized in that, The system includes: Electrocardiogram (ECG) signal input module, used to input ECG signals; The backbone network module is connected to the electrocardiogram signal input module and is used to output the temporal continuous features and multi-lead spatial features corresponding to the electrocardiogram signal. The first granularity module, connected to the backbone network module, is used to output the first granularity probability vector and the first granularity diagnostic label corresponding to the temporal continuous features and the multi-lead spatial features; The second granularity module is connected to the backbone network module and the first granularity module respectively, and is used to determine the second granularity feature corresponding to the temporal continuous feature, the multi-lead spatial feature and the first granularity probability vector, and output the second granularity probability vector and the second granularity diagnostic label corresponding to the second granularity feature. The third granularity module is connected to the backbone network module and the second granularity module respectively, and is used to determine the third granularity feature corresponding to the temporal continuous feature, the multi-lead spatial feature and the second granularity probability vector, and output the third granularity diagnostic label corresponding to the third granularity feature.

2. The system according to claim 1, characterized in that, The first granularity module includes a first granularity probability vector output unit and a first label output unit. The first granularity probability vector output unit is connected to the backbone network and is used to output the first granularity probability vector corresponding to the temporal continuous feature and the multi-lead spatial feature; The first tag output unit is connected to the first granularity probability vector output unit and is used to normalize the first granularity probability vector and output the first granularity diagnostic tag.

3. The system according to claim 1, characterized in that, The second granularity module includes a second conditional vector mapping unit, a second feature modulation unit, a second granularity probability vector output unit, and a second label output unit. The second conditional vector mapping unit is connected to the first granularity module and is used to map the first granularity probability vector into a second low-dimensional conditional vector. The second feature modulation unit is connected to the backbone network module and the second conditional vector mapping unit respectively, and is used to modulate the temporal continuous feature, the multi-lead spatial feature output by the backbone network module and the second low-dimensional conditional vector output by the second conditional vector mapping unit into a second granular feature. The second granularity probability vector output unit is connected to the second feature modulation unit and is used to output the second granularity probability vector corresponding to the second granularity feature; The second tag output unit is connected to the second granularity probability vector output unit and is used to normalize the second granularity probability vector and output the second granularity diagnostic tag.

4. The system according to claim 1, characterized in that, The third granularity module includes a third conditional vector mapping unit, a third feature modulation unit, a third granularity probability vector output unit, and a third label output unit. The third condition vector mapping unit is connected to the second granularity module and is used to map the second granularity probability vector into a third low-dimensional condition vector. The third feature modulation unit is connected to the backbone network module and the third conditional vector mapping unit respectively, and is used to modulate the temporal continuous feature, the multi-lead spatial feature output by the backbone network module and the third low-dimensional conditional vector output by the third conditional vector mapping unit into a third granular feature. The third granularity probability vector output unit is connected to the third feature modulation unit and is used to output the third granularity probability vector corresponding to the third granularity feature; The third tag output unit is connected to the third granularity probability vector output unit and is used to normalize the third granularity probability vector and output the third granularity diagnostic tag.

5. A training method for a multi-granularity electrocardiogram diagnostic system, characterized in that, The method, applied to the electrocardiogram multi-granularity diagnostic system according to any one of claims 1 to 4, comprises: Acquire multiple sets of ECG signals to be trained; Construct sample labels for each group of ECG signals to be trained; Each set of ECG signals to be trained is sequentially input into the ECG multi-granularity diagnostic system to obtain the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector, as well as the first granularity diagnostic label, the second granularity diagnostic label, and the third granularity diagnostic label output by the ECG multi-granularity diagnostic system for each set. Determine the total loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector; A progressive training strategy is adopted to dynamically adjust the weights of each part of the total loss until the adjusted first-granularity diagnostic label, second-granularity diagnostic label, and third-granularity diagnostic label are consistent with the sample label corresponding to the ECG signal to be trained, and the training is completed.

6. The method according to claim 5, characterized in that, Determining the total loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector includes: The first loss, the second loss, and the third loss corresponding to the first granularity probability vector, the second granularity probability vector, and the third granularity probability vector are determined respectively; A gradient truncation operation is used to determine the distribution alignment loss corresponding to the first granularity probability vector and the second granularity probability vector; The total loss is determined based on the first loss, the second loss, the third loss, and the distribution alignment loss.

7. The method according to claim 6, characterized in that, Determining the first loss corresponding to the first granularity probability vector includes: Obtain the first granularity sample label of the ECG signal to be trained in the first granularity module; Obtain the first granularity label mask of the ECG signal to be trained in the first granularity module; The first loss is determined based on the first granularity sample label, the first granularity label mask, and the first granularity probability vector.

8. The method according to claim 6, characterized in that, The step of employing gradient truncation to determine the distribution alignment loss corresponding to the first granularity probability vector and the second granularity probability vector includes: The second granularity probability projection vector is determined based on the first medical prior mapping matrix and the third granularity probability vector; The first granularity probability projection vector is determined based on the second medical prior mapping matrix and the third granularity probability vector; The distribution alignment loss is determined based on the second granularity probability projection vector, the second granularity probability vector, the first granularity probability projection vector, and the first granularity probability vector.

9. The method according to claim 5, characterized in that, The step of constructing sample labels corresponding to each group of electrocardiogram signals includes: Determine the first and second medical prior mapping matrices; Based on the multi-level label and mask construction process, the sample labels corresponding to the ECG signal to be trained are constructed using the first medical prior mapping matrix and the second medical prior mapping matrix.

10. The method according to claim 9, characterized in that, The determination of the first medical prior mapping matrix and the second medical prior mapping matrix includes: We constructed three electrocardiogram (ECG) disease labeling systems: a first-level granularity ECG disease labeling system, a second-level granularity ECG disease labeling system, and a third-level granularity ECG disease labeling system. The first medical prior mapping matrix is ​​determined based on the second granularity level electrocardiogram disease labeling system and the third granularity level electrocardiogram disease labeling system; A second medical prior mapping matrix is ​​determined based on the first granularity-level electrocardiogram disease labeling system and the third granularity-level electrocardiogram disease labeling system.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 5 to 10.

12. An electronic device, characterized in that, The electronic device includes: A memory that stores a computer program; The processor, which is communicatively connected to the memory, executes the method of any one of claims 5 to 10 when the computer program is invoked.

13. A computer program product, characterized in that, The computer program product includes computer program code that, when run on a computer, causes the computer to implement the method as described in any one of claims 5 to 10.