Electrocardiogram analysis method based on multi-lead adaptive perception and fusion waveform generation

CN122911518APending Publication Date: 2026-10-16CHONGQING KOANRULER SCI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611342909.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-01
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0007]有鉴于此,本发明的目的在于提供一种基于多导联自适应感知与融合波形生成的心电分析方法,旨在克服现有动态心电分析技术对人工选择参考导联的依赖,解决动态心电信号受运动伪迹、基线漂移干扰下心搏识别准确率下降的问题

Benefits of technology

[0052]1.本发明通过多导联协同编码结合跨尺度多头注意力残差聚合机制,能够在特征空间中自主评估各导联的实时信噪比,对电极脱落、基线漂移、肌电干扰等造成的高噪声导联特征进行主动抑制,并为信号质量优良的导联分配更高融合权重,彻底摆脱对人工指定参考导联的依赖。克服了传统算法以及现有深度学习方案中单导联失效即造成整体分析失效的缺陷,有效解决异位心搏在不同胸导联极性不一致带来的心搏漏检、误判问题,分析结果不再受制于操作人员的主观经验,有效降低临床医生报告复核的工时负担,显著提升动态心电分析在复杂信号场景下的鲁棒性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122911518A_ABST
    Figure CN122911518A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on multi-lead adaptive perception and fusion waveform generation electrocardio analysis method, belong to electrocardio signal processing technical field.This method acquires at least 8 lead synchronous electrocardio signal, carries out hierarchical adaptive feature coding by encoder, dynamic evaluation lead signal-to-noise ratio and inhibit noise channel;Through the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of the rhythm dependence of the long-range of
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electrocardiogram (ECG) signal processing technology, specifically relating to an ECG analysis method based on multi-lead adaptive sensing and fusion waveform generation. Background Technology

[0002] Holter monitoring, as an important non-invasive clinical diagnostic tool for arrhythmias and myocardial ischemia, has been widely used in clinical practice. However, during the acquisition process, factors such as human movement and poor electrode contact can easily lead to the inclusion of electromyographic noise, motion artifacts, and baseline drift interference in the acquired ECG signals, posing a significant challenge to the automatic analysis of ECG signals.

[0003] Existing dynamic electrocardiogram (ECG) automatic analysis algorithms mainly fall into two categories: traditional signal processing algorithms and deep learning analysis algorithms. Traditional detection algorithms, represented by the Pan-Tompkins algorithm and its derivatives, require clinicians to pre-select reference leads for heartbeat localization and identification. Since ectopic heartbeats exhibit significant differences in polarity across different chest leads, if the selected reference lead experiences electrode detachment, signal drift, or atypical waveform polarity characteristics, it will directly lead to missed or false heartbeats, making the identification performance highly dependent on the operator's subjective experience. Furthermore, traditional algorithms typically use fixed-parameter bandpass filtering for noise suppression, which, while filtering out interference, loses high-frequency details of the QRS complex. Additionally, the fixed cutoff frequency cannot adapt to the time-varying characteristics of noise, creating a contradiction between filtering and preserving effective signals. Moreover, traditional algorithms mostly perform independent detection for each lead, fusing multi-lead results only through a simple voting mechanism. This fails to fully utilize the spatial complementary information between multiple leads, and the failure of a single lead signal will cause a decline in overall analysis performance.

[0004] With the development of artificial intelligence technology, single-lead deep learning ECG detection algorithms have been extensively studied. However, these algorithms only utilize the features of a single ECG signal, and their detection performance significantly degrades when the quality of the single-lead signal deteriorates. While existing multi-lead deep learning schemes can receive input from multiple leads, most employ fixed fusion weights or rely solely on global statistical information to fuse multi-lead features. They cannot perceive the dynamic changes in the signal-to-noise ratio of each lead in real time, and when sudden noise occurs in a lead, the noise features still participate in high-level feature calculations. Furthermore, existing multi-lead networks suffer from insufficient cross-scale feature interaction; shallow detail features and deep rhythm features are simply concatenated or added, and skip connections in the decoding stage are not filtered, easily transmitting residual noise from the encoder to the waveform reconstruction output.

[0005] In addition, most existing ECG analysis systems directly output heart rate classification labels in a black-box manner, failing to generate heart rate waveforms with uniform polarity or provide traceable structured waveform evidence. The systems cannot provide confidence assessments of the analysis results, and even in scenarios with poor signal quality, they still force the output of identification results, lacking the ability to reject cases with low confidence levels. Clinicians cannot directly accept automatically generated conclusions and still need to manually complete waveform segment selection and report editing, making it difficult to support automated report generation and limiting the overall level of automated analysis.

[0006] Therefore, overcoming the dependence on manual reference lead selection, improving the robustness of ECG recognition in noisy environments, and outputting interpretable ECG analysis results are the technical problems that urgently need to be solved in the field of dynamic ECG analysis. Summary of the Invention

[0007] In view of this, the purpose of this invention is to provide an electrocardiogram (ECG) analysis method based on multi-lead adaptive sensing and fusion waveform generation, which aims to overcome the dependence of existing dynamic ECG analysis technology on manual selection of reference leads and solve the problem of decreased accuracy of heartbeat recognition under the interference of motion artifacts and baseline drift in dynamic ECG signals.

[0008] To achieve the above objectives, the present invention adopts the following technical solution:

[0009] An electrocardiogram (ECG) analysis method based on multi-lead adaptive sensing and fusion waveform generation includes the following steps:

[0010] S1. Multi-lead synchronous ECG signal acquisition: Acquire at least 8 leads of synchronous ECG signals, and extract signal segments of a predetermined time length as model input;

[0011] S2. Hierarchical adaptive feature encoding: The multi-lead ECG signal is input into the encoder network, and multi-scale temporal features are extracted through a progressively downsampled deep convolutional structure. The features at different scales are adaptively weighted and fused through a multi-scale dilated convolutional fusion module to generate enhanced bottleneck features, providing high-quality feature input for subsequent long-range dependency modeling.

[0012] The adaptive weighted fusion dynamically generates fusion weights for each scale through global pooling and gating networks, implicitly evaluates the signal-to-noise ratio of each lead in the feature space, and actively suppresses noise-dominant channels.

[0013] S3. Long-range temporal dependency modeling: The enhanced bottleneck features are input into the Transformer temporal encoder, and the long-range rhythm dependency of the heartbeat sequence is captured through stacked efficient Transformer blocks. The temporal enhancement features are output, which integrate local morphological details and global rhythmic context information.

[0014] S4. Cross-scale attention decoding: The temporal enhancement features are input into the decoder network, and the temporal resolution is restored by upsampling step by step. In each upsampling stage, an attention gating mechanism is used to filter the noise of the encoder features of the skip connections, and only the spatial information related to the reconstruction target is transmitted to generate the decoded features.

[0015] S5. Dual-branch probability field output: The decoded features are input into two parallel output convolution heads to generate a heartbeat center probability field peak_prob and a heartbeat class probability field class_prob. The probability fields provide quantifiable confidence basis for downstream heartbeat localization, fusion waveform generation and confidence assessment.

[0016] Among them, peak_prob is a single-channel probability heatmap, representing the confidence level of each time point belonging to the heartbeat center region; class_prob is a K-channel probability distribution map, K≥2, representing the probability distribution of each time point belonging to each category of heartbeat;

[0017] S6. Heartbeat localization and classification: Non-maximum suppression is applied to the heartbeat center probability field to extract the heartbeat peak position, and the category label of each heartbeat is determined by combining the heartbeat category probability field;

[0018] S7. Fusion Waveform Generation: Based on the extracted heartbeat location and category label, a fusion lead waveform with uniform polarity is generated using a polar Gaussian synthesis method. Normal heartbeats are superimposed with a positive Gaussian curve, and abnormal heartbeats of different categories are superimposed with Gaussian curves of corresponding polarity and width. The synthesis process introduces a priori constraints on physiological width. The fusion waveform provides traceable structured waveform evidence for clinical diagnosis.

[0019] Furthermore, the encoder network in step S2 specifically includes:

[0020] The input layer uses a one-dimensional convolutional kernel to perform preliminary downsampling of the signal and maps the number of leads to the initial number of feature channels C_base, where C_base is a power of 2 between 32 and 64.

[0021] Stack at least three depthwise separable convolutional residual blocks, each residual block consisting of two layers of depthwise separable convolutions combined with batch normalization and ReLU activation, and introduce identity mapping residual connections; when the number of input and output channels is inconsistent, the number of channels is adjusted by 1×1 convolution;

[0022] Each residual block is followed by a regular convolutional layer with a stride of 2 to achieve downsampling, thereby halving the temporal resolution and doubling the number of feature channels step by step.

[0023] Furthermore, the multi-scale dilated convolution fusion module in step S2 specifically includes:

[0024] The feature maps at least three different scales output by the encoder are fed into parallel dilated convolutional fusion blocks. Each fusion block contains multiple 3×1 convolutional branches with different dilation rates. After concatenation and 1×1 convolution to restore the number of channels, the features at each scale are aligned to the same temporal resolution and number of channels through adaptive pooling.

[0025] The aligned multi-scale features are stacked and then subjected to global average pooling and two fully connected layers to generate scale gating coefficients.

[0026] The features at each scale are weighted and summed according to the scale gating coefficients, and then added to the residual of the deep coding features to output the enhanced bottleneck features.

[0027] Furthermore, step S2 also includes an enhanced channel attention module, the specific process of which is as follows:

[0028] Perform global average pooling and global max pooling on the input features respectively;

[0029] The two pooling results are concatenated and then compressed and restored by 1×1 convolution, with Sigmoid activation added to generate channel attention weights.

[0030] The channel attention weights are multiplied element-wise into the input features, and residual connections are used to output the enhanced channel attention features.

[0031] Furthermore, step S2 also includes a cross-scale attention residual aggregation step, used to dynamically aggregate historical features from different abstraction levels of the encoder, specifically including:

[0032] Each historical feature is mapped to the target number of channels through a trainable linear projection layer; the time length of each historical feature is aligned to the current feature length through bilinear interpolation, and smooth convolution is used to reduce interpolation artifacts;

[0033] Using the current feature as the query and each historical feature as the key and value, perform multi-head cross-attention operation to obtain multiple attention outputs;

[0034] The average of multiple attention outputs along the historical dimension is used to output the final feature through residual connections, a trainable scaling factor gamma, and layer normalization.

[0035] Furthermore, the Transformer timing encoder in step S3 specifically includes:

[0036] Multi-scale initial convolution: Using at least three parallel one-dimensional convolutions with different kernel sizes, the input features are decomposed into multiple subspace features and then concatenated along the channels to capture multi-scale local patterns;

[0037] Enhanced channel attention: Channel recalibration of the spliced ​​features is performed and concatenated with the original input residuals;

[0038] Learnable sinusoidal position coding: Sine and cosine position codes are superimposed on each time point, without introducing CLS tokens;

[0039] Stacked Efficient Transformer Blocks: Stack at least two layers of Efficient Transformer Blocks. Each block includes a self-attention sub-layer and a feedforward sub-layer. Each sub-layer is followed by a Pre-LN structure with residual connections and Dropout. The self-attention sub-layer uses hierarchical attention and performs self-attention calculation within a local window. The feedforward sub-layer adopts a hybrid expert MoE architecture, containing at least three experts. Each expert is a fully connected network with SwiGLU activation. The gating network selects the top-two experts at each time point and performs a weighted combination output.

[0040] Inter-block attention residual aggregation: After each Transformer block operation is completed, the output feature of the current Transformer block is used as the query, and multi-head cross-attention calculation is performed on the output features of all historical Transformer blocks to obtain the fused feature; the fused feature is added to the residual of the output feature of the current Transformer block, and then layer normalization is performed.

[0041] Furthermore, in step S4, the attention gating mechanism in the decoder network specifically includes:

[0042] The upsampled decoded features are used as gating signals, and the corresponding layer encoder features are used as skip connection inputs.

[0043] The gating signal and the jump connection input are projected to the number of intermediate channels by 1×1 convolution, then added together, activated by ReLU, and then generated by 1×1 convolution and Sigmoid to generate spatial attention coefficients.

[0044] The spatial attention coefficient is multiplied element-wise with the jump connection feature to achieve noise suppression and key information filtering;

[0045] The gated jump connection features and upsampled features are concatenated along the channel and fed into a depthwise separable convolutional residual block for feature fusion.

[0046] Furthermore, in step S7, the polar Gaussian synthesis method specifically includes:

[0047] An independent Gaussian kernel parameter set, including polarity, width, and amplitude coefficients, is pre-configured for each type of heartbeat; at each heartbeat location, a Gaussian curve with the corresponding parameters is superimposed according to the heartbeat's category label.

[0048] The physiological width prior constraint is that the signal can only be effectively accumulated when the signal duration conforms to the normal physiological width range of QRS, where the normal physiological width of QRS is 60ms to 120ms.

[0049] By expanding the output dimension of class_prob from 2 classes to K classes and configuring an independent Gaussian kernel parameter set for each class of abnormal heartbeats, the unified polarity strategy is extended to the generation and identification of fusion waveforms of at least one of the abnormal heartbeats, such as atrial premature beats, atrial fibrillation, bundle branch block, or junctional escape beats, without the need to redesign the network architecture.

[0050] Furthermore, it also includes step S8 confidence assessment and structured evidence output: based on the peak confidence of the heartbeat center probability field and the maximum class probability of the heartbeat class probability field, a comprehensive confidence score is calculated for each detected heartbeat; when the comprehensive confidence score is lower than a preset threshold, the heartbeat is marked as low confidence or rejected, and the corresponding evidence fragments and lead information are output, supporting graded report output.

[0051] Beneficial effects:

[0052] 1. This invention, through multi-lead collaborative coding combined with a cross-scale multi-head attention residual aggregation mechanism, can autonomously evaluate the real-time signal-to-noise ratio of each lead in the feature space. It actively suppresses high-noise lead features caused by electrode detachment, baseline drift, and electromyographic interference, and assigns higher fusion weights to leads with excellent signal quality, completely eliminating the dependence on manually designated reference leads. It overcomes the shortcomings of traditional algorithms and existing deep learning schemes where a single lead failure leads to overall analysis failure. It effectively solves the problems of missed and misjudged heartbeats caused by inconsistent polarity in different chest leads, and the analysis results are no longer subject to the operator's subjective experience, effectively reducing the workload of clinicians in reviewing reports and significantly improving the robustness of dynamic electrocardiogram analysis in complex signal scenarios.

[0053] 2. This invention abandons the rigid bandpass filtering at the original signal end, achieving noise suppression at the feature level. It avoids the filtering paradox of traditional filtering algorithms that irreversibly lose the high-frequency effective components of the QRS complex while filtering out interference, thus fully preserving the fine morphological features used for differential diagnosis of arrhythmias, such as QRS notches and fragmented potentials. Simultaneously, by combining non-maximum suppression peak search with the physiological prior constraint of a QRS physiological width of 60-120ms, it can automatically eliminate isolated noise spikes, breaking the vicious cycle of missed and false detections of heartbeats under low signal-to-noise ratio conditions, achieving a balance between noise suppression and effective signal preservation.

[0054] 3. This invention outputs the probability field of the heartbeat center and the probability field of the heartbeat category in parallel, and further synthesizes them into a fused waveform with unified polarity, changing the output mode of existing technologies that only output black-box classification labels. Each heartbeat identification conclusion can be traced back to the corresponding probability field and the structured evidence of the fused waveform, improving the interpretability of ECG analysis results. The fused waveform eliminates polarity contradictions of the same heartbeat between different leads, providing a stable and unified logical anchor point for the backend diagnostic rule engine, solving the technical problem of establishing stable discrimination rules in automated reports, and providing a reliable intermediate carrier for the generation of fully automated dynamic ECG reports. At the same time, relying on the confidence information output by the probability field, it can realize the labeling and rejection of low-confidence results, distinguish between reliable diagnostic conclusions and doubtful conclusions, and reduce the workload of doctors to review each result indiscriminately.

[0055] 4. This invention simultaneously captures local morphological details of the electrocardiogram (ECG) and global rhythmic information of the RR interval through cross-scale feature interaction. It leverages a Transformer temporal encoder to enhance long-range dependency modeling of heartbeat sequences, improving the sensitivity to abnormal morphologies such as wide and aberrant ventricular beats. Validated on a large-scale real-world clinical dynamic ECG dataset containing 322,770 labeled heartbeats, the ventricular beat recognition AUC reaches 0.980, with a precision of 98.53%, a recall of 98.35%, and an F1-score of 98.44%. This represents a significant improvement in recognition performance compared to the traditional Pan-Tompkins algorithm, demonstrating excellent recognition performance in heartbeat localization and abnormal heartbeat classification tasks.

[0056] 5. The overall network architecture of this invention possesses excellent task generalization capabilities. Without modifying the network backbone structure, only expanding the output channel dimension of the heartbeat category probability field and configuring independent Gaussian kernel parameter groups corresponding to various abnormal heartbeats is required to extend the recognition and waveform fusion of multiple arrhythmias such as atrial premature beats, atrial fibrillation, and bundle branch block. The network as a whole adopts a lightweight encoder-decoder architecture, and the number of parameters can be flexibly adjusted through the number of channel cardinality and Transformer layers. It can adapt to various hardware environments such as Holter acquisition devices and edge computing servers, offering high flexibility for engineering deployment.

[0057] 6. This invention introduces an attention gating mechanism at the decoder end to filter skip connection features, passing only valid relevant features to the waveform reconstruction stage and blocking the downward propagation of residual noise at the encoder end; in conjunction with the multi-scale dilated convolution fusion module and the enhanced channel attention module, feature recalibration is completed to further ensure the output quality of the probability field and the fused waveform reconstruction, and improve the output stability of the overall method in noisy scenarios.

[0058] 7. The data chain dependency relationship formed by the five core technical links of this invention significantly distinguishes its overall technical effect from the simple splicing of individual modules. In a simple splicing scheme, each module is optimized independently, and the degradation of the output quality of the preceding stage cannot be perceived or compensated by the following stage. However, this invention achieves robust system characteristics of "the preceding stage ensuring the input quality of the following stage, and the following stage being tolerant of the deviation of the preceding stage" through functional coupling between links—adaptive fusion provides a clean base for the Transformer, the Transformer provides sufficient context for the probability field, and the probability field provides quantitative basis for Gaussian synthesis and confidence assessment. This characteristic makes the overall technical effect of this invention (AUC 0.980, F1 98.44%, and low-confidence rejection capability) significantly better than the sum of the effects of implementing each link individually. No single existing technology discloses the above complete technical chain. Attached Figure Description

[0059] Figure 1 This is a flowchart of the electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to the present invention;

[0060] Figure 2 This is a diagram of the network architecture of the deep learning model in this embodiment;

[0061] Figure 3 This is a flowchart of the probability field estimation-nonmaximum suppression-polar Gaussian synthesis third-order detection processing in this embodiment;

[0062] Figure 4 This is a schematic diagram of the ROC curve and classification performance bars for cardiac rhythm classification in this embodiment. Detailed Implementation

[0063] To make the technical solutions, advantages, and objectives of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the protection scope of this application.

[0064] like Figures 1-3 As shown, this invention provides an electrocardiogram (ECG) analysis method based on multi-lead adaptive sensing and fusion waveform generation, comprising the following steps:

[0065] S1. Multi-lead synchronous ECG signal acquisition: Acquire at least 8 leads of synchronous ECG signals, and extract signal segments of a predetermined time length as model input;

[0066] S2. Hierarchical adaptive feature encoding: The multi-lead ECG signal is input into the encoder network, and multi-scale temporal features are extracted through a progressively downsampled deep convolutional structure. The features at different scales are then adaptively weighted and fused through a multi-scale dilated convolutional fusion module to generate enhanced bottleneck features.

[0067] Adaptive weighted fusion dynamically generates fusion weights for each scale through global pooling and gating networks, implicitly evaluates the signal-to-noise ratio of each lead in the feature space, and actively suppresses noise-dominant channels.

[0068] S3. Long-range temporal dependency modeling: The enhanced bottleneck features are input into the Transformer temporal encoder, and the long-range rhythm dependency of the heartbeat sequence is captured through stacked efficient Transformer blocks, and the temporal enhancement features are output.

[0069] S4. Cross-scale attention decoding: The temporal enhancement features are input into the decoder network, and the temporal resolution is restored by upsampling step by step. In each upsampling stage, an attention gating mechanism is used to filter the noise of the encoder features of the skip connections, and only the spatial information related to the reconstruction target is transmitted to generate the decoded features.

[0070] S5. Dual-branch probability field output: The decoded features are input into two parallel output convolution heads to generate the heart rate center probability field peak_prob and the heart rate class probability field class_prob;

[0071] Among them, peak_prob is a single-channel probability heatmap, representing the confidence level of each time point belonging to the heartbeat center region; class_prob is a K-channel probability distribution map, K≥2, representing the probability distribution of each time point belonging to each category of heartbeat;

[0072] S6. Heartbeat localization and classification: Non-maximum suppression is applied to the heartbeat center probability field to extract the heartbeat peak position, and the category label of each heartbeat is determined by combining the heartbeat category probability field;

[0073] S7. Fusion Waveform Generation: Based on the extracted heartbeat location and category label, a fusion lead waveform with uniform polarity is generated using a polar Gaussian synthesis method. Normal heartbeats are superimposed with a positive Gaussian curve, while abnormal heartbeats of different categories are superimposed with Gaussian curves of corresponding polarity and width. The synthesis process introduces a priori constraints on physiological width.

[0074] S8. Confidence Assessment and Structured Evidence Output: Based on the peak confidence of the heartbeat center probability field and the maximum class probability of the heartbeat class probability field, a comprehensive confidence score is calculated for each detected heartbeat. When the comprehensive confidence score is lower than a preset threshold, the heartbeat is marked as low confidence or rejected, and the corresponding evidence fragments and lead information are output, supporting graded report output.

[0075] The multi-lead intelligent ECG analysis network constructed in this invention adopts an end-to-end encoder-decoder architecture. The overall input is an 8-lead synchronous ECG signal segment, and the output consists of two parallel probability fields: a heartbeat center probability heatmap (peak_prob) and a heartbeat category probability field (class_prob). The network mainly comprises five parts: an encoder, a multi-scale dilated convolutional fusion module, a Transformer temporal encoder, a decoder, and a dual-branch output head. The specific construction of each module is as follows:

[0076] Encoder

[0077] The encoder is responsible for extracting hierarchical temporal features from the raw multi-lead signal step by step. The network input layer uses a one-dimensional convolutional kernel (size can be set to 7 or 9, stride of 2) to initially downsample the signal and map the number of leads to the initial number of feature channels (the number of channels C_base is a configurable hyperparameter, preferably a power of 2 between 32 and 64). Subsequently, three depthwise separable convolutional residual blocks (DS-Conv Blocks) are stacked. Each residual block consists of two depthwise separable convolutional layers (kernel size 3, stride 1) combined with batch normalization and ReLU activation, and an identity mapping residual connection is introduced (adjusted by 1×1 convolution when the number of input and output channels is inconsistent). The three residual blocks work sequentially, and each block is followed by a regular convolutional layer with a stride of 2 (kernel size 3) to achieve downsampling, accompanied by batch normalization and ReLU activation. This structure halves the temporal resolution step by step and doubles the number of feature channels step by step, thereby capturing multi-scale temporal patterns from fine to coarse while maintaining computational efficiency.

[0078] Multi-Scale Dilated Fusion Module

[0079] To enhance the network's adaptability to the diversity of heartbeat morphology, the feature maps output by the encoder at three different scales are fed into parallel dilated convolutional fusion blocks. Each fusion block contains multiple 3×1 convolutional branches with different dilation rates (the number of branches is related to the scale level, typically increasing with depth; for example, shallow layers use 2-3 dilation rates, and deep layers use 4-6). The output channels of each branch are equally distributed, batch normalized, and activated by ReLU. After concatenation along the channel axis, the output channels are restored to the input channel number by 1×1 convolution and activated again. This design allows the network to obtain parallel responses with multiple receptive fields at the same computational cost.

[0080] Subsequently, the outputs of the three fusion blocks are uniformly pooled to the same temporal resolution (based on the length of the deep features) using adaptive pooling, and the number of channels is uniformly matched to the deep features using 1×1 convolutions. These three aligned features are then stacked along the time-channel axis to form a four-dimensional tensor (dimensions: batch size × uniform time length × number of scales × number of uniform channels). Global average pooling is performed on this stacked tensor along the time and channel dimensions to obtain a scale weight vector. This vector is then passed through two fully connected layers (with ReLU and Sigmoid activation functions) to generate normalized scale gating coefficients. These coefficients are weighted and summed with the stacked features to obtain a multi-scale aggregated feature, which is then added to the residual of the deep encoded features to output the enhanced bottleneck feature.

[0081] Enhanced Channel Attention (ECA) module

[0082] As an optional auxiliary feature adjustment layer, this scheme also designs an EnhancedCaBlock1D module to enhance the discriminative information of the channel dimension. This module performs global average pooling and global max pooling on the input features, concatenates the two pooling results, and adjusts the number of channels through a 1×1 convolution. Then, it performs dimensionality reduction (compression ratio of ratio) through a 1×1 convolution, layer normalization, and ReLU activation, followed by another 1×1 convolution to restore the original number of channels and adding Sigmoid activation to generate channel attention weights. These weights are then broadcast element-wise to the input features, and residual connections (output = input + attention-weighted features) are used to stabilize training. This module is applied in both the encoder bottleneck layer and the decoder start layer.

[0083] Cross-Scale Attention Residual Module

[0084] As a replaceable enhancement component of this network, the CrossScaleAttnRes module (implemented as a class in the code) is used to dynamically aggregate historical features from different abstraction levels of the encoder. This module supports feature inputs with arbitrary number of channels and duration: first, a trainable linear projection layer maps each historical feature to the target number of channels; then, bilinear interpolation aligns the duration to the current feature length, and smooth convolution reduces interpolation artifacts. Subsequently, using the current feature as the query and each historical feature as the key and value, a multi-head cross-attention operation is performed, resulting in multiple attention outputs. These outputs are then averaged along the historical dimension, and finally, residual connections are used with a trainable scaling factor gamma and layer normalization. This module can dynamically integrate shallow details and deep semantic information at each downsampling stage of the encoder. In a preferred embodiment of this invention, this module is embedded in the build_autoencoder_attention_residuals model architecture for selection in different scenarios.

[0085] Transformer Temporal Encoder

[0086] To further capture long-range dependencies in the heartbeat sequence (such as RR interval rhythms), the enhanced bottleneck feature `enc3_enhanced` is input into the Transformer-based temporal encoder `CreateBaseNetwork`. This encoder contains the following substructures:

[0087] Multi-scale initial convolution: Parallel one-dimensional convolution with three different kernel sizes (1, 3, 5) is used to decompose the input features into multiple subspace features and then concatenate them along the channels, thereby capturing multi-scale local patterns at an early stage.

[0088] Enhanced channel attention: EnhancedCaBlock1D is applied again to recalibrate the channels of the spliced ​​features and concatenate them with the original input residuals.

[0089] Learnable sinusoidal position encoding: The CLS Sinusoidal PositionEmbs layer is used to inject position information into the sequence (without introducing CLS tokens, only sine and cosine position encodings are superimposed on each time point), ensuring that the Transformer is aware of the temporal order.

[0090] Stacked Efficient Transformer Blocks: A total of 2 stacked Efficient TransformerBlocks are used. Each block employs Hierarchical Attention as a self-attention sub-layer, which is computed within a local window to reduce complexity. The feedforward sub-layer adopts a Hybrid Expert (MoE) architecture, containing 3 experts (num_experts=3). Each expert is a fully connected network with SwiGLU activation. The gating network selects the top-2 experts at each time point and weights and combines them for output. Each sub-layer is followed by a Pre-LN structure (layer normalization before sub-layer computation) combined with residual connections and Dropout (ratio 0.1).

[0091] Attention Residual Aggregation: After each Transformer block, the output of the current block is fused with the outputs of all previous blocks (stored as a historical list on a block-by-block basis) using multi-head cross-attention. Specifically, the historical block outputs are stacked along the block dimension, the current block output is used as the query, cross-attention is applied to the historical blocks, and the output is then added to the current block residual and normalized layer by layer. This mechanism allows deep blocks to explicitly review early features, alleviates gradient vanishing, and enhances feature reuse.

[0092] The encoder eventually outputs a feature tensor of the same size as the input, which serves as the starting feature for the decoder.

[0093] Decoder and skip connection attention gating

[0094] The decoder employs a symmetrical structure, gradually restoring temporal resolution through upsampling. First, the Transformer output is upsampled (by a factor of 2) to restore the same temporal length as the previous layer's encoded features. To effectively utilize the spatial details preserved by the encoder, an attention gate mechanism is introduced: the upsampled decoded features are used as the gate signal, and the corresponding layer's encoder features are used as skip connections. These are projected onto the number of intermediate channels (configurable) via 1×1 convolutions, summed, activated by ReLU, and then subjected to another 1×1 convolution followed by a sigmoid function to generate spatial attention coefficients. These coefficients are multiplied element-wise with the skip connection features, thereby achieving noise suppression and key information filtering. The gated skip connections and upsampled features are concatenated along the channels and fed into a depthwise separable convolutional residual block for feature fusion.

[0095] The above operation is repeated in each upsampling stage of the decoder until the original time length is restored. Each upsampling doubles the time resolution while the number of channels is halved step by step to maintain symmetry with the encoder.

[0096] Dual-Head Output

[0097] The final features are processed by two independent 1×1 convolutional layers, generating two branches:

[0098] The peak_prob probability field (peak_prob) has one output channel and no activation function is applied (linear output). During the training phase, it is mapped to the [0,1] interval through Sigmoid cross-entropy or combined loss function, representing the confidence that each time point belongs to the heartbeat center region (absolute value is independent of polarity). This branch is independent of the number of categories and has complete task generality.

[0099] Heartbeat category probability field (class_prob): The number of output channels is set to K (K≥2), where K is the total number of predefined heartbeat categories. This branch uses linear output (Logits) without additional Softmax activation to preserve numerical stability. In actual clinical deployment, K can be freely expanded according to application needs: for example, K=3 corresponds to (sinus, ventricular, atrial premature beats), K=4 corresponds to (sinus, ventricular, atrial premature beats, atrial fibrillation), and K=5 and above can further include subtypes such as bundle branch block and junctional escape beats.

[0100] Overall data flow

[0101] The computational flow of the entire network can be summarized as follows: original multi-lead signal segment → encoder downsampling to extract multi-scale features → multi-scale dilated convolution fusion → Transformer temporal modeling → decoder upsampling (including attention-gated skip connections) → dual-branch probability field output. The total number of network parameters remains within a deployable lightweight range, and the specific values ​​depend on the selected channel base C_base and the number of Transformer layers L. Those skilled in the art can flexibly adjust these parameters according to hardware conditions.

[0102] It is important to note that the aforementioned modules are not simply a stack of independent functions, but rather constitute a complete technical chain that mutually supports each other. The quality of the multi-scale features output by the encoder, after adaptive weighted fusion by the multi-scale dilated convolution fusion module, directly affects the accuracy of the Transformer temporal encoder's modeling of rhythm dependencies. If the temporal enhancement features output by the Transformer lack global contextual information, the probability field reconstructed by the decoder will struggle to accurately reflect the true distribution of heartbeats. If the probability field output lacks quantifiable confidence information, the downstream polar Gaussian synthesis will lack reliable category and location information, and confidence assessment and rejection mechanisms cannot be established. Conversely, when these five stages work together, adaptive fusion suppresses noise interference with Transformer modeling, Transformer modeling provides global rhythmic context for the probability field, the probability field provides confidence information for Gaussian synthesis and confidence assessment, Gaussian synthesis provides traceable waveform evidence for clinical diagnosis, and confidence assessment provides a quality control mechanism for automated reporting. It is precisely this synergistic relationship of "each link supporting the other and none being dispensable" that makes the overall technical effect of the present invention significantly better than the sum of the effects of each module implemented individually.

[0103] Experimental verification and performance evaluation

[0104] To verify the effectiveness of the multi-lead adaptive sensing and fusion waveform generation method proposed in this invention, this embodiment conducted a systematic performance evaluation on a large-scale dynamic electrocardiogram dataset containing 322,770 labeled heartbeats. The test set covered synchronized 8-lead electrocardiogram signals (leads I, II, V1~V6), with heartbeat categories including sinus (N) and ventricular (V). The data source was real clinical Holter records, and the annotations were independently completed by experienced electrocardiogram physicians.

[0105] (1) Cardiac beat classification performance

[0106] The deep learning front-end of this invention outputs a heartbeat category probability field (class_prob), with ventricular heartbeats (V) as the positive category. The receiver operating characteristic (ROC) curve is used to evaluate the model's binary classification discrimination ability. Experimental results show that ( Figure 4 The area under the ROC curve (AUC) reached 0.980, indicating that the model has excellent ability to distinguish between ventricular and non-ventricular heartbeats. Under the decision condition with a probability threshold of 0.5, the model's classification precision was 98.53%, recall was 98.35%, and F1-score was 98.44%, all three indicators exceeding 98%, fully demonstrating the superior performance of the method of this invention in automatic heartbeat category identification.

[0107] (2) Model Analysis

[0108] The above results fully verify the effectiveness of the following core innovative points of this invention:

[0109] The multi-lead adaptive attention fusion mechanism enables the model to autonomously perceive the real-time signal-to-noise ratio of each lead in the feature space. Even if some leads have electrode detachment or baseline drift, it can still maintain stable classification performance through weighted compensation of high-resolution leads.

[0110] Cross-scale multi-head attention residual aggregation (CrossLayerAttnRes) effectively coordinates local detail features with global rhythm background, and is particularly sensitive to the morphological features of ventricular beat widening and anomaly.

[0111] The pointwise probability output of the class probability field (class_prob) provides a reliable basis for downstream fusion waveform synthesis, avoiding the unreliable classification caused by the "forced output" of traditional black box models.

[0112] Compared to the traditional Pan-Tompkins algorithm's F1 score of approximately 97% on the MIT-BIH database, this invention improves the F1 score to 98.44%, a relative improvement of about 1.5 percentage points. More importantly, the validation results of this invention on a large-scale clinical sample of 322,770 samples have greater practical clinical reference value, with an AUC as high as 0.980, indicating that the model's ability to distinguish ventricular beats is close to its theoretical limit, providing a reliable decision-making basis for automated clinical reporting systems. In summary, this invention achieves a balanced and optimal performance (all > 98%) in Precision, Recall, and F1 scores while maintaining a near 100% AUC discrimination capability, significantly outperforming traditional single-lead and fixed-reference-lead schemes, laying a solid data foundation for subsequent fully automated report generation.

[0113] It is hereby declared that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. An electrocardiogram (ECG) analysis method based on multi-lead adaptive sensing and fusion waveform generation, characterized in that, Includes the following steps: S1. Multi-lead synchronous ECG signal acquisition: Acquire at least 8 leads of synchronous ECG signals, and extract signal segments of a predetermined time length as model input; S2. Hierarchical adaptive feature encoding: The multi-lead ECG signal is input into the encoder network, and multi-scale temporal features are extracted through a progressively downsampled deep convolutional structure. The features at different scales are then adaptively weighted and fused through a multi-scale dilated convolutional fusion module to generate enhanced bottleneck features. The adaptive weighted fusion dynamically generates fusion weights for each scale through global pooling and gating networks, implicitly evaluates the signal-to-noise ratio of each lead in the feature space, and actively suppresses noise-dominant channels. S3. Long-range temporal dependency modeling: The enhanced bottleneck features are input into the Transformer temporal encoder, and the long-range rhythm dependency of the heartbeat sequence is captured through stacked efficient Transformer blocks. The temporal enhancement features are output, which integrate local morphological details and global rhythmic context information. S4. Cross-scale attention decoding: The temporal enhancement features are input into the decoder network, and the temporal resolution is restored by upsampling step by step. In each upsampling stage, an attention gating mechanism is used to filter the noise of the encoder features of the skip connections, and only the spatial information related to the reconstruction target is transmitted to generate the decoded features. S5. Dual-branch probability field output: The decoded features are input into two parallel output convolution heads to generate the heart rate center probability field peak_prob and the heart rate class probability field class_prob; Among them, peak_prob is a single-channel probability heatmap, representing the confidence level of each time point belonging to the heartbeat center region; class_prob is a K-channel probability distribution map, K≥2, representing the probability distribution of each time point belonging to each category of heartbeat; S6. Heartbeat localization and classification: Non-maximum suppression is applied to the heartbeat center probability field to extract the heartbeat peak position, and the category label of each heartbeat is determined by combining the heartbeat category probability field; S7. Fusion Waveform Generation: Based on the extracted heartbeat location and category label, a fusion lead waveform with uniform polarity is generated using a polar Gaussian synthesis method. Normal heartbeats are superimposed with a positive Gaussian curve, while abnormal heartbeats of different categories are superimposed with Gaussian curves of corresponding polarity and width. The synthesis process introduces a priori constraints on physiological width.

2. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 1, characterized in that, The encoder network in step S2 specifically includes: The input layer uses a one-dimensional convolutional kernel to perform preliminary downsampling of the signal and maps the number of leads to the initial number of feature channels C_base, where C_base is a power of 2 between 32 and 64. Stack at least three depthwise separable convolutional residual blocks, each residual block consisting of two layers of depthwise separable convolutions combined with batch normalization and ReLU activation, and introduce identity mapping residual connections; when the number of input and output channels is inconsistent, the number of channels is adjusted by 1×1 convolution; Each residual block is followed by a regular convolutional layer with a stride of 2 to achieve downsampling, thereby halving the temporal resolution and doubling the number of feature channels step by step.

3. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 2, characterized in that, The multi-scale dilated convolution fusion module in step S2 specifically includes: The feature maps at least three different scales output by the encoder are fed into parallel dilated convolutional fusion blocks. Each fusion block contains multiple 3×1 convolutional branches with different dilation rates. After concatenation and 1×1 convolution to restore the number of channels, the features at each scale are aligned to the same temporal resolution and number of channels through adaptive pooling. The aligned multi-scale features are stacked and then subjected to global average pooling and two fully connected layers to generate scale gating coefficients. The features at each scale are weighted and summed according to the scale gating coefficients, and then added to the residual of the deep coding features to output the enhanced bottleneck features.

4. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 3, characterized in that, Step S2 also includes an enhanced channel attention module, the specific process of which is as follows: Perform global average pooling and global max pooling on the input features respectively; The two pooling results are concatenated and then compressed and restored by 1×1 convolution, with Sigmoid activation added to generate channel attention weights. The channel attention weights are multiplied element-wise into the input features, and residual connections are used to output the enhanced channel attention features.

5. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 4, characterized in that, Step S2 also includes a cross-scale attention residual aggregation step, used to dynamically aggregate historical features from different abstraction levels of the encoder, specifically including: Each historical feature is mapped to the target number of channels through a trainable linear projection layer; the time length of each historical feature is aligned to the current feature length through bilinear interpolation, and smooth convolution is used to reduce interpolation artifacts; Using the current feature as the query and each historical feature as the key and value, perform multi-head cross-attention operation to obtain multiple attention outputs; The average of multiple attention outputs along the historical dimension is used to output the final feature through residual connections, a trainable scaling factor gamma, and layer normalization.

6. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 5, characterized in that, The Transformer timing encoder in step S3 specifically includes: Multi-scale initial convolution: Using at least three parallel one-dimensional convolutions with different kernel sizes, the input features are decomposed into multiple subspace features and then concatenated along the channels to capture multi-scale local patterns; Enhanced channel attention: Channel recalibration of the spliced ​​features is performed and concatenated with the original input residuals; Learnable sinusoidal position coding: Sine and cosine position codes are superimposed on each time point, without introducing CLS tokens; Stacked Efficient Transformer Blocks: Stack at least two layers of Efficient Transformer Blocks. Each block includes a self-attention sub-layer and a feedforward sub-layer. Each sub-layer is followed by a Pre-LN structure with residual connections and Dropout. The self-attention sub-layer uses hierarchical attention and performs self-attention calculation within a local window. The feedforward sub-layer adopts a hybrid expert MoE architecture, containing at least three experts. Each expert is a fully connected network with SwiGLU activation. The gating network selects the top-two experts at each time point and performs a weighted combination output. Inter-block attention residual aggregation: After each Transformer block operation is completed, the output feature of the current Transformer block is used as the query, and multi-head cross-attention calculation is performed on the output features of all historical Transformer blocks to obtain the fused feature; the fused feature is added to the residual of the output feature of the current Transformer block, and then layer normalization is performed.

7. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 6, characterized in that, In step S4, the attention gating mechanism in the decoder network specifically includes: The upsampled decoded features are used as gating signals, and the corresponding layer encoder features are used as skip connection inputs. The gating signal and the jump connection input are projected to the number of intermediate channels by 1×1 convolution, then added together, activated by ReLU, and then generated by 1×1 convolution and Sigmoid to generate spatial attention coefficients. The spatial attention coefficient is multiplied element-wise with the jump connection feature to achieve noise suppression and key information filtering; The gated jump connection features and upsampled features are concatenated along the channel and fed into a depthwise separable convolutional residual block for feature fusion.

8. The electrocardiogram analysis method based on multi-lead adaptive sensing and fusion waveform generation according to claim 7, characterized in that, In step S7, the polar Gaussian synthesis method specifically includes: An independent Gaussian kernel parameter set, including polarity, width, and amplitude coefficients, is pre-configured for each type of heartbeat; at each heartbeat location, a Gaussian curve with the corresponding parameters is superimposed according to the heartbeat's category label. The physiological width prior constraint is that the signal can only be effectively accumulated when the signal duration conforms to the normal physiological width range of QRS, where the normal physiological width of QRS is 60ms to 120ms. By expanding the output dimension of class_prob from 2 classes to K classes and configuring an independent Gaussian kernel parameter set for each class of abnormal heartbeats, the unified polarity strategy is extended to the generation and identification of fusion waveforms of at least one of the abnormal heartbeats, such as atrial premature beats, atrial fibrillation, bundle branch block, or junctional escape beats, without the need to redesign the network architecture.