A deep neural network-based electrocardiosignal feature extraction and classification method
By constructing a spatial-temporal encoder and a dual-branch decoupling module of a deep neural network, and taking advantage of the physical separability difference between the magnetohydrodynamic induced component and the myocardial repolarization component, the problem of artifacts and pathological changes in the same region of ECG signals under strong static magnetic field conditions in magnetic resonance imaging was solved, and reliable ECG feature extraction and arrhythmia classification were achieved.
Patent Information
- Application Number
- CN202611392955.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-03
- Publication Date
- 2026-11-24
AI Technical Summary
In the strong static magnetic field environment of magnetic resonance scanning, magnetohydrodynamic induced voltage and real pathological ST-T changes overlap in the repolarization region. Existing technologies cannot effectively suppress magnetoinduced distortion, which leads to the failure of arrhythmia classification or systematic misjudgment. There is a lack of clean true values at the same time for reference.
By constructing a deep neural network containing a spatial-temporal encoder and a dual-branch decoupling module, and utilizing the physical separability difference between the magnetohydrodynamic induced component and the myocardial repolarization component, the components are decoupled into artifact components and real myocardial electrical activity components in the latent space of the deep network. Spatial low-rank, field strength monotonic, phase-locked, and beat consistency constraints are applied, and diagnostic features are extracted and classified only from the real myocardial repolarization component.
Under the condition that no clean true value is available for calibration, magnetic induction distortion is effectively stripped away, and reliable ECG feature extraction and arrhythmia classification are achieved while preserving the true pathological repolarization changes, thus improving the safety and accuracy of diagnosis.
Smart Images

Figure CN123147945A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of biomedical signal processing and artificial intelligence, specifically to a method for automatic feature extraction and arrhythmia classification of electrocardiogram (ECG) signals based on deep neural networks. Background Technology
[0002] Automatic feature extraction and arrhythmia classification of electrocardiogram (ECG) signals is one of the more mature applications of deep neural networks in biomedical signal processing. Under standard resting ECG or Holter ECG acquisition conditions, the P wave, QRS complex, ST segment, and T wave each occupy a relatively fixed time window and amplitude range within a single cardiac cycle. The repolarization regions of the ST segment and T wave contain a wealth of diagnostic information, including myocardial ischemia and repolarization abnormalities. Based on this prior knowledge, deep neural networks can learn the morphological features of each waveband and classify arrhythmias. Current mainstream technical approaches include: end-to-end feature extraction and classification of heartbeats or signal segments using one-dimensional convolutional networks or deep residual networks; superimposing recurrent networks or attention mechanisms on convolutional networks to consider both local waveform morphology and long-term rhythm dependence; converting ECG signals into time-frequency maps via continuous wavelet transform or short-time Fourier transform, followed by classification by two-dimensional convolutional networks; and employing domain adaptation, generative data augmentation, or test-time adaptation to improve cross-patient generalization capabilities, taking into account individual differences in morphological distribution.
[0003] The aforementioned methods achieve good results, typically based on the premise that the ECG signal entering the network reflects the true myocardial electrical activity in its critical diagnostic region. Interference, either located in a different frequency band or randomly and asynchronously distributed, can be suppressed through filtering, blind source separation, or data augmentation. However, this premise no longer holds when the acquisition environment changes or when interference highly overlaps with the true signal in both time and frequency band. Existing feature extraction and classification methods designed for conventional acquisition conditions then face challenges.
[0004] In clinical practice, there exists a special and increasingly common data acquisition scenario: patients undergoing cardiac magnetic resonance imaging (MRI) require continuous electrocardiogram (ECG) monitoring. On one hand, ECG is used for scan gating, triggering image acquisition based on the cardiac cycle; on the other hand, for critically ill patients within a closed scanning chamber, under anesthesia or sedation, ECG is also necessary for real-time monitoring of vital signs and arrhythmias. In this situation, the patient is in a strong static magnetic field, commonly 1.5T and 3T in clinical settings, and up to 7T in research scenarios. According to magnetohydrodynamics (MHD), blood, as a conductive fluid containing charged ions, flows through large blood vessels such as the aortic arch under the drive of the heartbeat. Its flow direction is perpendicular to the direction of the static magnetic field, and the charged ions are deflected towards the vessel wall under the Lorentz force, thus generating an induced voltage. This induced voltage is acquired along with the surface electrodes and superimposed on the ECG signal, forming a magnetohydrodynamic artifact.
[0005] The technical difficulties arising from this unique acquisition scenario lie primarily in the temporal concentration of the interference and its overlap with pathological regions. Blood flow velocity peaks during ventricular systole, with the strongest blood flow within the aortic arch. Consequently, the peak amplitude of the magnetohydrodynamic induced voltage falls precisely during the repolarization phase of the cardiac cycle, i.e., the time window containing the ST segment and T wave. This results in the ECG signal entering the network being contaminated in its most diagnostically valuable repolarization region by a layer of interference that occurs simultaneously with the real physiological signal, has comparable amplitude, and overlaps in frequency band. The repolarization region features extracted by the network no longer simply reflect the electrical activity of the myocardium itself. Because this interference falls within the same time window and is of the same magnitude as the real pathological ST-T changes, conventional filtering, frequency domain separation, or blind source separation methods are insufficient to distinguish between the two, often compromising true diagnostic information while suppressing artifacts.
[0006] Secondly, the amplitude and shape of the superimposed components of magnetohydrodynamics are not fixed. They vary depending on the individual patient's cardiac output, aortic geometry, and body position, and change significantly with changes in magnetic field strength, exhibiting non-stationary characteristics that fluctuate with each heartbeat and drift with both the individual and the field strength. This non-stationarity makes it difficult for artifact suppression methods based on fixed templates or uniform parameters to stably adapt to interferences with significant differences in strength at different field strengths, such as 1.5T, 3T, and 7T, and also increases the difficulty of generalizing the method across patients and across field strength scenarios.
[0007] Furthermore, because the patient is inside the scanning chamber, a clean ECG free from magnetohydrodynamic interference cannot be obtained as a reference at the same time as the acquisition. This makes the aliasing in the repolarization region a problem that is difficult to remove through external calibration, and also makes conventional schemes that rely on paired clean-contaminated samples for supervised learning lack usable training ground values in this situation.
[0008] Current research on ECG in magnetic resonance imaging (MRI) environments has not effectively addressed the aforementioned difficulties. One type of research focuses on scan gating, aiming to robustly locate the R-wave peak under elevated T-wave interference to trigger image acquisition. This approach does not concern itself with the authenticity of the repolarization region morphology, making it ineffective for interpreting repolarization abnormalities and classifying arrhythmias. Another type of research attempts to comprehensively restore and remove artifacts from ECGs contaminated by magnetohydrodynamics (MHD) to restore readability. However, because the magnetohydrodynamic components and actual pathological ST-T changes fall within the same repolarization window and are of the same magnitude, this comprehensive restoration often erases the actual ischemic and repolarization pathological changes, thus destroying the diagnostic information upon which classification depends. Furthermore, some studies employ generative models to synthesize MHD distortion templates that vary with field strength and individual aortic geometry to augment data, or geometrically suppress MHD voltages at the electrode placement and hardware levels. However, these methods either only address data enhancement and signal-level suppression or fail to address the issue of distinguishing between repolarization artifacts and pathological components.
[0009] In summary, under the strong static magnetic field environment of magnetic resonance imaging (MRI), magnetohydrodynamic induced repolarization distortion and myocardial pathological repolarization changes occur simultaneously in the same region, with similar amplitudes and overlapping frequency bands, and there is a lack of clean true values at the same time for reference. How to suppress magnetoinduced distortion while preserving the true pathological repolarization changes, so as to reliably complete the extraction of ECG features and classification of arrhythmias, remains a technical problem that has not yet been effectively solved. Summary of the Invention
[0010] To address the technical problem of the aforementioned overlap between magnetohydrodynamic induced voltage and actual pathological ST-T changes in the repolarization region under strong static magnetic field conditions during magnetic resonance scanning, and the lack of clean, interference-free true values available for calibration at the same time, leading to the failure of arrhythmia classification or systematic misjudgment, this invention provides a method and system for ECG signal feature extraction and classification based on deep neural networks. The core idea is to utilize the difference in physical origin between the magnetohydrodynamic induced component and the myocardial repolarization component—the former is driven by the Lorentz force, and its projection on each lead follows a spatial hybrid vector determined by the aortic geometry and the orientation of the static magnetic field. Its amplitude increases monotonically with the magnitude of the static magnetic field strength, and its time envelope is phase-locked with the mechanical phase of systolic blood flow; the latter is driven by the cardiac electric dipole, and its projection follows the spatial structure of ECG lead transformation. Its phase is phase-locked with the QRS electrical activity and does not change with the external magnetic field. The multi-lead ECG in the repolarization region is decoupled in the latent space of the deep network into a magnetically coupled artifact component and a real myocardial electrical activity component. Only the latter is used to extract diagnostic features and complete the classification, thereby stripping away the magnetoinduced distortion while preserving the real pathological repolarization changes.
[0011] In one aspect, the present invention provides a method for extracting and classifying electrocardiogram (ECG) signal features based on deep neural networks, comprising the following steps.
[0012] Step S1 involves acquiring multi-lead ECG signals from the patient within the MRI scanner chamber, simultaneously recording the static magnetic field strength modulus and the hemodynamic substitution signal characterizing systolic blood flow. The cardiac cycle is divided using the R wave as a reference, and within each cardiac cycle, a repolarization region window is defined from the ST segment initiation to the T wave termination. Specifically, the multi-lead acquisition preferably uses a standard twelve-lead system or its simplified lead system to obtain sufficient spatial information for subsequent spatial projection structure discrimination. The static magnetic field strength modulus is directly read from the scanner's main magnetic field parameters or synchronously acquired via the device interface, used to characterize the strength of magnetohydrodynamic interference. The hemodynamic substitution signal provides a reference for the mechanical phase of the artifact component. After dividing the continuous ECG into successive cardiac cycles based on the R wave position, the time interval covered by the ST segment initiation to the T wave termination is defined as the repolarization region window, serving as the target interval for decoupling processing. This interval is precisely the region where the peak amplitude of the magnetohydrodynamic induced voltage and the actual ST-T pathological changes both fall.
[0013] Furthermore, the multi-lead ECG signal has at least three leads, and the hemodynamic substitute signal is one of the following: pulse oxygen volume wave, gating flow velocity signal, or gating pressure signal; or, in the absence of an external substitute signal, the systolic phase envelope estimated from the multi-lead ECG signal based on the QRS initiation and ejection phase. Step S1 also includes retaining the isoelectric TP and PR segments within the same cardiac cycle as reference intervals. Specifically, the retained isoelectric TP and PR segments do not contain repolarization activity and can be used to estimate the spatial statistics and amplitude benchmark of artifact components, providing an anchoring reference for weak supervision under true-value-less conditions; the retained QRS complex interval is then used to subsequently splice with the purified repolarization components to reconstruct a complete cardiac cycle signal.
[0014] Step S2 involves constructing a deep network containing a spatial-temporal encoder and a dual-branch decoupling module. The spatial-temporal encoder extracts spatiotemporal features from the multi-lead signals within the repolarization region window. The dual-branch decoupling module separates these spatiotemporal features into a magnetohydrodynamic artifact latent component and a myocardial repolarization latent component in the latent space. The two waveforms obtained after decoding are added together on each lead to reconstruct the repolarization region window signal. Specifically, the spatial-temporal encoder receives the multi-lead signal tensor within the repolarization region window and extracts spatiotemporal features that consider both local morphology and spatial relationships between leads through one-dimensional convolution and temporal attention. The dual-branch decoupling module divides these spatiotemporal features into two latent variables in the latent space, which are then decoded by their respective decoders to obtain two temporal waveforms. The two waveforms are then added point-by-point on each lead to reconstruct the original repolarization region window signal, thus forming a decoupling framework based on reconstruction consistency and guided by subsequent physical constraints.
[0015] Preferably, before extracting the spatiotemporal features, the spatial-temporal encoder first injects the static magnetic field strength magnitude as a conditional embedding into the deep network to achieve field strength-conditional feature extraction. Specifically, the static magnetic field strength magnitude is embedded and mapped into a conditional vector and injected into the encoder's feature channel, enabling the same network to adaptively estimate the amplitude scale of artifact components under different magnetic field strengths such as 1.5T, 3T, and 7T, without needing to train a separate model for each field strength.
[0016] Step S3: Apply spatial low-rank constraints, field strength monotonic constraints, and phase-locking constraints to the magnetohydrodynamic artifact latent component, so that its projection on each lead is expressed by the outer product of a spatial mixing vector and a time envelope, its reconstructed waveform energy monotonically increases with the magnitude of the static magnetic field strength, and its time envelope has the maximum coherence with the hemodynamic substitution signal during systole. Apply lead spatial structure constraints and electrical phase coherence constraints to the myocardial repolarization latent component, so that its projection falls within the subspace spanned by the ECG lead transformation matrix, and its phase is coherent with the QRS electrical activity of the same cardiac cycle. Specifically, the spatial low-rank constraint compresses the artifact component into a rank-one structure in the lead dimension, corresponding to its Lorentz force spatial orientation characterized by a single spatial mixing vector; the field strength monotonic constraint ensures that the artifact reconstructed waveform energy maintains a monotonically increasing relationship with the recorded static magnetic field strength magnitude, corresponding to the physical law that the magnetohydrodynamic induced voltage increases with the field strength; the phase-locking constraint aligns the artifact time envelope with the systolic hemomechanical phase. For the myocardial repolarization branch, the lead spatial structure constraint ensures that its projection falls into the ECG vector subspace spanned by the ECG lead transformation matrix, corresponding to the spatial structure of the actual ECG vector; the electrical temporal coherence constraint ensures that its temporal phase is coherent with the QRS electrical activity of the same cardiac cycle, corresponding to the fact that myocardial repolarization is driven by cardiac electrical activity. All of the above constraints can be applied based on physical priors without external truth values, giving the decoupling a clear physical meaning.
[0017] Furthermore, step S3 also includes applying a beat-wise consistency constraint to the spatial mixing vector across multiple adjacent cardiac cycles, so that the magnetohydrodynamic artifact latent component shares a stable spatial orientation during multiple adjacent cardiac cycles, while the morphology of the myocardial repolarization latent component changes cycle by cycle and is not restricted by the beat-wise consistency constraint. Specifically, since the patient's position and aortic geometry remain basically unchanged within a short time window, the spatial mixing vector of the artifact component should remain stable within this short time window, so a consistency constraint is applied to the spatial mixing vector across multiple adjacent cardiac cycles; while pathological repolarization changes are allowed to change cycle by cycle, excluding them from this consistency constraint, thereby further distinguishing stable external field artifacts from variable pathological changes in the time dimension.
[0018] Furthermore, step S3 also includes a counterfactual field strength consistency constraint: using the static magnetic field strength modulus as a condition, the deep network predicts the shape of the repolarization region window under the counterfactual condition of zero magnetic field strength, and constrains this shape to be equal to the decoupled myocardial repolarization latent component. During training, magnetohydrodynamic distortion templates of different field strengths are superimposed on the same myocardial component to construct a consistency supervision sample pair where the artifact component scales proportionally with the field strength modulus while the myocardial component remains unchanged. Specifically, the counterfactual condition is to set the magnetic field strength to zero, at which point the magnetohydrodynamic induced voltage should completely disappear, and the repolarization region shape predicted by the network should be exactly the pure myocardial repolarization component. Therefore, the counterfactual shape being equal to the decoupled myocardial component is used as consistency supervision. The supervision sample pair can be constructed from records of the same patient under different field strengths, or from the superposition of a synthetic distortion template and the real myocardial component when only a single field strength clinical data is available, enabling the network to learn to classify components that scale with the field strength into the artifact branch and components that do not change with the field strength into the myocardial branch.
[0019] Furthermore, the magnetohydrodynamic artifact latent component is parameterized as a multiplicative generation structure of field strength, space, and time. That is, its waveform on each lead is equal to the product of the magnitude of the static magnetic field strength, a scalar amplitude coefficient, the outer product of the spatial mixing vector, and the temporal envelope. This makes the magnetohydrodynamic artifact latent component homogeneous with respect to the magnitude of the static magnetic field strength and rank-one in the lead dimension. The myocardial repolarization latent component is taken as the reconstruction residual of the difference between the repolarization region window signal and the magnetohydrodynamic artifact latent component and is gated by the electrical temporal coherence constraint. Specifically, the multiplicative generation structure explicitly couples the field strength, spatial mixing vector, and temporal envelope in a product form, so that the artifact component naturally satisfies the physical properties of being homogeneous with respect to the field strength and rank-one with respect to the leads. It can guarantee that the artifact component returns to zero when the inverse fact field strength is set to zero without additional penalty. The myocardial repolarization latent component is taken as the reconstruction residual of the difference between the repolarization region window signal and the artifact component, and is gated by the electrical temporal coherence constraint, retaining only the components coherent with cardiac electrical activity as the real myocardial electrical activity.
[0020] Furthermore, under the condition of a clean ECG free from magnetohydrodynamic interference at the same time, the deep network adopts self-supervised training. The losses of the self-supervised training include: isopotential segment anchoring loss, which uses the isopotential TP segment and PR segment within the same cardiac cycle to estimate the spatial statistics and amplitude benchmark of the magnetohydrodynamic artifact latent component; phase misalignment contrast loss, which uses samples aligned with the hemodynamic substitution signal as positive examples and samples with artificial phase misalignment as negative examples; and field strength contrast consistency loss. The above losses are weighted and summed to form a total loss function and jointly optimize the spatial-temporal encoder and the dual-branch decoupling module. The weight of each loss is adaptively adjusted according to the magnitude of the static magnetic field strength. The higher the field strength, the greater the weight of the constraint corresponding to the magnetohydrodynamic artifact latent component. Specifically, given that a clean, non-magnetic-hydrodynamic (MHD) electrocardiogram (ECG) can not be obtained within the scanning cavity as the true value for each frame, this invention employs multiple physical substitutions for supervision to achieve self-supervised training: The isoelectric segment anchoring loss utilizes the TP and PR segments, which lack repolarization activity, to provide spatial statistics and weak amplitude supervision priors for artifact branches; the phase misalignment contrast loss leverages the phase difference between MHD peaks aligning with mechanical systolic blood flow and myocardial repolarization aligning with cardiac electrical activity, strengthening the artifact branches' locking onto the mechanical phase of blood flow; and the field strength contrast consistency loss corresponds to the training loss under the aforementioned counterfactual field strength constraint. The parameters of the encoder and dual-branch decoder are jointly optimized via backpropagation; the weights are adaptively adjusted with the field strength to accommodate the significant differences in the strength of MHD interference under different magnetic field intensities.
[0021] Step S4: Extract diagnostic features from the decoupled myocardial repolarization hidden component and classify arrhythmias. Specifically, extract diagnostic features from the purified myocardial repolarization component obtained from steps S2 to S3, including repolarization region morphology, ST segment deviation, etc., and classify arrhythmias and repolarization abnormalities accordingly to avoid contamination of diagnostic features by magnetic induction distortion.
[0022] Furthermore, step S4 also includes a pathological residual retention mechanism: when the myocardial repolarization latent component and its reconstructed residual under the isoelectric anchoring benchmark are coherent with cardiac electrical activity in the electrical temporal phase and do not scale with field strength, the reconstructed residual is determined as a true pathological component and retained in the myocardial repolarization latent component for classification; and the energy proportion of the magnetohydrodynamic artifact latent component is used as a signal quality indicator and confidence output, and a low confidence prompt is given when the energy proportion exceeds a preset threshold. Specifically, to avoid mistakenly including true pathological components that cannot be explained by external magnetic fields into artifact branches, all residuals that are coherent with cardiac electrical activity in the electrical temporal phase and do not scale with field strength are determined as true pathological components and retained; at the same time, the energy proportion of the artifact component is used as a signal quality indicator for this classification, and a low confidence prompt is output when the proportion is too high for clinical review, improving the system's safety under high artifact contamination conditions.
[0023] Further, in step S4, the decoupled myocardial repolarization latent component is spliced with the QRS complex outside the repolarization region window and its adjacent intervals to form a cardiac cycle signal. This signal is input into a classification deep network composed of a one-dimensional convolutional residual network superimposed with temporal attention, and outputs arrhythmia category and repolarization abnormality category. The training samples of the classification deep network are expanded by superimposing a three-dimensional magnetohydrodynamic distortion template synthesized by an adversarial generative network, which varies with field strength and individual aortic geometry, onto the real myocardial component. Specifically, the QRS complex and its adjacent regions, which are not significantly contaminated by magnetohydrodynamics, are spliced with the purified myocardial repolarization component to form a complete and purified cardiac cycle signal, which is then input into a classification deep network. The classification deep network preferably uses a one-dimensional convolutional residual network superimposed with temporal attention, taking into account both local morphology and long-term rhythm dependence, and outputs categories including ST segment shifts and repolarization-related arrhythmias that indicate myocardial ischemia. The training samples are expanded by superimposing real myocardial components with a three-dimensional magnetohydrodynamic distortion template synthesized by an adversarial generative network, which varies with field strength and individual aortic geometry, to cover different body position orientations and cardiac output conditions, thereby improving the robustness of the method to inter-individual artifact morphology differences.
[0024] Another aspect of the present invention provides a deep neural network-based electrocardiogram (ECG) signal feature extraction and classification system, comprising: an acquisition unit for acquiring multi-lead ECG signals of a patient within a magnetic resonance imaging (MRI) chamber, simultaneously recording the static magnetic field strength modulus and hemodynamic surrogate signals characterizing systolic blood flow, dividing the cardiac cycle based on the R wave, and defining a repolarization region window within each cardiac cycle from the ST segment initiation to the T wave termination; and a decoupling unit for constructing a deep network containing a spatial-temporal encoder and a two-branch decoupling module, wherein the spatial-temporal encoder extracts spatiotemporal features from the multi-lead signals within the repolarization region window, and the two-branch decoupling module separates these spatiotemporal features in the latent space into a magnetohydrodynamic artifact latent component and a myocardial repolarization latent component, which are then decoded to obtain two paths. The waveforms are added together across all leads to reconstruct the repolarization region window signal; a constraint unit is used to apply spatial low-rank constraints, field strength monotonic constraints, and phase-locked constraints to the magnetohydrodynamic artifact latent component, so that its projection on each lead is expressed by the outer product of a spatial mixing vector and a time envelope, its reconstructed waveform energy monotonically increases with the magnitude of the static magnetic field strength, its time envelope is most coherent with the hemodynamic substitution signal during systole, and lead spatial structure constraints and electrical temporal coherence constraints are applied to the myocardial repolarization latent component, so that its projection falls into the subspace spanned by the ECG lead transformation matrix, and its temporal phase is coherent with the QRS electrical activity of the same cardiac cycle; a classification unit is used to extract diagnostic features from the decoupled myocardial repolarization latent component and classify arrhythmias. The functions of the acquisition unit, decoupling unit, constraint unit and classification unit correspond to the technical features of steps S1, S2, S3 and S4 in the above method. Each unit can be implemented as a dedicated hardware module, a software module running on a processor or a combination of both, so as to implement the above method on magnetic resonance monitoring equipment or post-processing platform.
[0025] Based on the physical separability differences between the magnetohydrodynamic induced component and the myocardial repolarization component in terms of spatial projection structure, field strength dependence, and mechanical or electrical phase-locked relationships, this invention decouples the two in the latent space of a deep network. It extracts diagnostic features and classifies only the real myocardial repolarization component, thereby removing magnetoinduced distortions while preserving the real pathological repolarization changes. This overcomes the shortcomings of existing overall anti-spoofing methods that erase the real ischemic and repolarization abnormal pathological changes along with the components. By employing physical prior constraints such as spatial low rank, field strength monotonicity, phase locking, beat consistency, and counterfactual field strength consistency, as well as self-supervised losses such as equipotential segment anchoring, phase misalignment comparison, and field strength comparison consistency, this invention achieves reliable decoupling even under the stringent condition that no clean true value is available for calibration within the scanning cavity, without requiring external calibration or a clean reference. The multiplicative generation structure ensures that the artifact components are homogeneous with respect to the field strength and have a single lead rank, naturally conforming to physical laws and guaranteeing that artifacts return to zero when the counterfactual field strength is zero. Field strength conditional embedding and field strength adaptive weights enable the same network to adaptively adapt to different magnetic field strengths such as 1.5T, 3T, and 7T. The pathological residual preservation mechanism prevents the erroneous stripping of true pathological components, and the artifact energy ratio serves as a confidence index to further enhance diagnostic safety. The three-dimensional distortion template synthesized by the adversarial generative network expands the training samples, improving robustness to differences in artifact morphology between individuals. Therefore, this invention effectively solves the technical problem of arrhythmia classification failure or systematic misjudgment caused by the overlap of pathological and artifact areas in the same region under continuous monitoring with strong static magnetic field of magnetic resonance imaging, and realizes reliable electrocardiogram feature extraction and arrhythmia classification under this special situation. Attached Figure Description
[0026] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0027] Figure 1 This is an overall flowchart of the ECG signal feature extraction and classification method based on deep neural networks according to an embodiment of the present invention;
[0028] Figure 2 This is a diagram showing the structure and data flow of the spatial-temporal decoupling deep network and dual-branch physical prior constraints according to an embodiment of the present invention.
[0029] Figure 3 This is a schematic diagram illustrating the principle of the counterfactual field strength consistency constraint and multiplicative generation structure according to an embodiment of the present invention;
[0030] Figure 4 This is a structural block diagram of the electrocardiogram signal feature extraction and classification system according to an embodiment of the present invention;
[0031] Figure 5 This is a schematic diagram comparing the waveforms before and after the aliasing in the same region of the complex polarization region and the decoupling of the hidden space in an embodiment of the present invention;
[0032] Figure 6This is a schematic diagram comparing the differences in the three physical separability of an embodiment of the present invention;
[0033] Figure 7 This is a physical schematic diagram illustrating the origin of the Lorentz force magnetohydrodynamic induced voltage according to an embodiment of the present invention;
[0034] Figure 8 This is a comparison chart of key diagnostic indicators for the three methods in this invention embodiment;
[0035] Figure 9 This is a graph showing the contribution of each innovative point in the ablation experiment of this invention to the macro-average F1. Detailed Implementation
[0036] To make the objectives and technical solutions of this invention clearer, the embodiments of this invention will be further described in detail below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of this invention and should not be construed as limiting the scope of protection of this invention.
[0037] Example 1
[0038] This embodiment provides a method for ECG signal feature extraction and classification based on deep neural networks. Under the strong static magnetic field environment of magnetic resonance imaging (MRI), it decouples magnetohydrodynamic induced voltage artifacts from actual pathological ST-T repolarization changes in the latent space of the deep network, extracting diagnostic features only from the purified myocardial repolarization component and completing arrhythmia classification. See also... Figure 1 The method includes steps S1 to S4. To facilitate reproduction by those skilled in the art, this embodiment first describes the inference (execution) phase of the deep network after training, and then describes the training phase of the deep network separately.
[0039] Step S1: Acquire multi-lead ECG signals of the patient within the MRI scan chamber, simultaneously record the static magnetic field strength modulus and the hemodynamic substitution signal characterizing systolic blood flow, divide the cardiac cycle with the R wave as the reference, and define the repolarization zone window from the ST segment beginning to the T wave end within each cardiac cycle.
[0040] Specifically, multi-lead ECG acquisition uses carbon fiber electrodes and a filter front end compatible with MRI, with no fewer than three leads. This embodiment preferably uses a standard twelve-lead system or a simplified lead system (such as a simplified six-lead system consisting of compression limb leads and two chest leads) to obtain sufficient spatial information for subsequent spatial projection structure discrimination. The raw ECG is resampled to 500Hz at a fixed sampling rate after in-band sampling, and a bandpass of 0.5Hz to 40Hz is applied to suppress baseline drift and power frequency noise. It should be noted that the magnetohydrodynamic induced voltage and the actual repolarization signal frequency band highly overlap, so the bandpass here is only used for routine preprocessing and does not perform decoupling and artifact removal functions. Artifact removal is completed by subsequent latent space decoupling.
[0041] Specifically, the static magnetic field strength modulus B is directly read from the scanner's main magnetic field parameters or synchronously acquired via a device interface (such as a DICOM sequence header or a supplier synchronization interface). The values cover common field strengths such as 1.5T, 3T, and 7T, used to characterize the strength of magnetohydrodynamic interference and as input for subsequent field strength condition embedding and adaptive field strength weighting. The hemodynamic substitution signal provides a reference for the mechanical phase of the artifact component. In this embodiment, pulse oxygen volume (PPG) is preferred, with its sampling rate aligned to the ECG sampling rate. When there is no external PPG, flow velocity, or pressure signal, the systolic phase envelope is estimated by the multi-lead ECG itself based on the QRS initiation and pre-ejection phase as a substitution signal. The estimation method involves constructing a half-sine mechanical phase envelope using a fixed delay after the R wave (approximately 50 to 120 ms) as the ejection initiation and an empirical delay of aortic blood flow peak (approximately 120 to 200 ms after the R wave) as the envelope peak.
[0042] Specifically, the continuous ECG is divided into cardiac cycles based on the R-wave position: robust R-wave detection of elevated T-waves (e.g., detection based on QRS energy envelope and adaptive threshold) is used to locate each R-wave peak, and a cardiac cycle is formed between two adjacent R-waves. Within each cardiac cycle, the time interval covered by the ST segment initiation (J point) to the T-wave endpoint is defined as the repolarization region window. This window is precisely the region where the peak amplitude of magnetohydrodynamic induced voltage and the actual ST-T pathological changes both fall, serving as the target interval for decoupling processing. The J point and the T-wave endpoint can be automatically delimited based on waveform slope and area, and the window length is rate-corrected according to heart rate using the Bazett or Fridricia formula. In this embodiment, the repolarization region window is uniformly resampled into a two-dimensional tensor X∈R^{C×L} with L = 256 time points and C leads as the network input.
[0043] Specifically, the isoelectric TP and PR segments within the same cardiac cycle are retained as reference intervals: the TP and PR segments contain no repolarization activity and are used to estimate the spatial statistics and amplitude benchmarks of artifact components, providing an anchoring reference for weak supervision under true-value-less conditions; simultaneously, the QRS complex interval is retained for subsequent splicing with the purified repolarization components to reconstruct the complete cardiac cycle signal. As an alternative, when spatial information is insufficient in the simplified lead system, the repolarization region window can be extended 20ms before and after to include the transition morphology before and after the J point, improving decoupling robustness.
[0044] Step S2: Construct a deep network containing a space-time encoder and a dual-branch decoupling module. The space-time encoder extracts spatiotemporal features from the multi-lead signals within the repolarization region window. The dual-branch decoupling module separates these spatiotemporal features in the latent space into a magnetohydrodynamic artifact latent component and a myocardial repolarization latent component. The two waveforms obtained after decoding are added together on each lead to reconstruct the repolarization region window signal. See also... Figure 2 .
[0045] Specifically, during the inference phase, the complex polarization region window tensor X∈R^{C×L} obtained in step S1 is input into the trained spatial-temporal encoder. The spatial-temporal encoder consists of cascaded one-dimensional convolutional residual blocks and temporal self-attention: the front end comprises four one-dimensional convolutional residual blocks with kernel lengths of 7, 5, 5, and 3, and channel numbers of 32, 64, 96, and 128, respectively. Each block contains two layers of convolution, batch normalization, GELU activation, and residual direct connections, used to extract local morphological features. Convolution is performed in the temporal dimension, with the lead dimension C serving as the input channel, thus implicitly modeling the spatial relationships between leads through channel mixing. Two layers of multi-head temporal self-attention (each layer with four attention heads, a model dimension of 128, and a feedforward dimension of 256) are superimposed on the convolutional features, and sinusoidal position encoding is added to model long-term temporal dependencies within the complex polarization region, resulting in the spatiotemporal feature H∈R^{128×L}.
[0046] Specifically, before extracting spatiotemporal features, the spatial-temporal encoder first uses the static magnetic field strength magnitude B as a conditional embedding injection network to achieve field strength conditional feature extraction: after normalizing the scalar B, it is mapped to a conditional vector e_B∈R^{128} through two fully connected layers (hidden layer 32, output 128, Tanh activation), and injected into the output of the first convolutional residual block in a channel-wise scaling and biasing (FiLM, i.e., feature-wise linear modulation) manner, i.e., H←γ(e_B)⊙H+β(e_B), so that the same network can adaptively estimate the amplitude scale of the artifact component under different magnetic field strengths such as 1.5T, 3T and 7T, without having to train a separate model for each field strength.
[0047] Specifically, the dual-branch decoupling module divides the spatiotemporal feature H into two latent variables in the latent space: the artifact branch outputs a rank-one parameter set through a one-dimensional convolution and global temporal pooling, namely the spatial mixing vector m∈R^{C}, the temporal envelope e∈R^{L}, and the scalar amplitude coefficient a, and then assembles the artifact waveform according to the multiplicative generation structure. ( Let m be the outer product of e, and let e be the artifact component be homogeneous with respect to field strength B and rank-one in the lead dimension. The myocardial repolarization branch outputs the myocardial waveform X_myo∈R^{C×L} through a one-dimensional transposed convolutional decoder (four upsampled residual blocks symmetrical to the encoder). The two waveforms are added point-by-point on each lead to obtain the reconstructed X = X_art + X_myo. During training, X approximates X to form the basis of reconstruction consistency. As an equivalent implementation, the myocardial repolarization latent component can also be taken as the reconstruction residual X_myo = X - X_art, which is the difference between the repolarization region window signal and the artifact component. It is subject to the electrical temporal coherence constraint gating described later, retaining only the components coherent with cardiac electrical activity as the real myocardial electrical activity. In the inference stage, only one forward computation is required to obtain X_myo and X_art, without iterative optimization.
[0048] like Figure 5 As shown, the upper part is the ECG waveform observed during a single cardiac cycle, which sequentially includes the P wave, QRS complex, and T wave. The cardiac cycle is defined with the R wave as the reference position, and the ST-T repolarization region window from the J point (ST initiation point) to the T wave endpoint is marked with a light gray background. The TP and PR segments on both sides of the window are isoelectric segments, marked with dotted backgrounds. The dashed line superimposed on the observed waveform is the magnetohydrodynamic artifact envelope, whose peak value falls exactly within the ST-T repolarization region window. It is in the same time window, has similar amplitude, and overlaps with myocardial repolarization in frequency band, making it difficult to directly separate in the time-frequency domain. Furthermore, through decoupling based on the physical separability of the latent space, the aliasing observation is decomposed into two output components: the left component is the magnetohydrodynamic artifact component X_art (diagonal fill), whose amplitude scales with the static magnetic field strength, exhibits a rank-one structure in the lead dimension, and is locked to the systolic blood flow mechanical phase; the right component is the myocardial repolarization component X_myo (dotted fill), which falls into the ECG lead subspace, is coherent with the QRS electrical phase, and retains the pathological ST-T morphology. This decoupling achieves separability based on differences in physical properties, under the premise that aliasing within the time window is indivisible.
[0049] Step S3: Apply spatial low-rank constraints, field strength monotonic constraints, and phase-locking constraints to the hidden component of magnetohydrodynamic artifacts; apply lead spatial structure constraints and electrical temporal coherence constraints to the hidden component of myocardial repolarization; and apply beat consistency constraints and counterfactual field strength consistency constraints. See also Figure 2 and Figure 3 It should be noted that the aforementioned physical prior constraints act on the network in the form of loss terms and structural parameterization during the training phase, and are solidified in the network weights and multiplicative generative structure during the inference phase; this step also provides the physical meaning of each constraint and its manifestation during inference.
[0050] like Figure 6As shown, this invention achieves separability decoupling based on the inherent differences between the magnetohydrodynamic artifact component and the myocardial repolarization component in three physical dimensions. The left column in the figure corresponds to the artifact component (marked with triangles and diagonal lines), and the right column corresponds to the myocardial repolarization component (marked with circles and dots). In the spatial projection structure dimension, the artifact component is generated by a single spatial hybrid vector determined by the aortic geometry and the static magnetic field orientation B0, exhibiting a rank-one projection in the lead dimension; the myocardial repolarization component falls into a multi-vector subspace spanned by ECG lead transformations. In the field strength dependence dimension, the artifact component amplitude monotonically increases with the static magnetic field strength magnitude B and is homogeneous with respect to B, while the myocardial repolarization component does not change with the external magnetic field. In the phase-locked dimension, the artifact component is phase-locked with the mechanical phase of systolic blood flow, while the myocardial repolarization component is coherent with the electrical phase of QRS electrical activity. These three differences constitute the basis for imposing physical prior constraints on the two types of components.
[0051] Specifically, the low-rank spatial constraint compresses the artifact components into a rank-one structure along the lead dimension, corresponding to the spatial orientation of the Lorentz force characterized by a single spatial mixing vector m. Since step S2 has parameterized the artifact branch as... The multiplicative generation structure inherently guarantees rank-uniformity. During inference, the projection of the artifact onto each lead is always the same time envelope e multiplied by the lead weight m, requiring no additional penalty. The monotonic constraint of the field strength ensures that the artifact reconstruction waveform energy is ||X_art||. 2 The recorded static magnetic field strength modulus B maintains a monotonically increasing relationship, corresponding to the physical law that the magnetohydrodynamic induced voltage increases with increasing field strength. Since X_art is homogeneous with respect to B, its energy exhibits a quadratic monotonically increasing relationship with B, and the artifact component automatically returns to zero when the inverse fact field strength is set to zero. The phase-locking constraint aligns the artifact time envelope e with the systolic hemomechanical phase, meaning that the constraint e and the hemodynamic alternative signal have the greatest cross-correlation during the systolic period.
[0052] Specifically, for the myocardial repolarization branch, the lead space structure constraint causes its projection to fall into the ECG vector subspace spanned by the ECG lead transformation matrix, corresponding to the spatial structure of the real ECG vector: In this embodiment, the projection operator P_M = M(MTM)^{-1}M is constructed using the standard lead transformation matrix M (such as a known linear mapping from Frank's lead to twelve leads, or a patient-specific lead subspace basis obtained by fitting the QRS region). T The constraint that the energy of X_myo in the lead dimension mainly falls into the subspace spanned by P_M. The electrical phase coherence constraint makes the phase of X_myo coherent with the QRS electrical activity of the same cardiac cycle, corresponding to the fact that myocardial repolarization is driven by cardiac electrical activity. In practice, the direction of the principal vector of QRS is used as a reference to suppress components that are not coherent with the electrical phase of QRS.
[0053] Specifically, the beat consistency constraint applies consistency of the spatial mixing vector m to multiple adjacent cardiac cycles: since the patient's position and aortic geometry remain basically unchanged within a short time window (5 to 9 adjacent beats in this embodiment), the spatial mixing vector of the artifact component should remain stable. Therefore, a directional consistency constraint is applied to the m estimated for each beat within this short time window (such as minimizing the angle between adjacent beats' m or the deviation from the mean direction within the window). Pathological repolarization changes are allowed to change beat by beat, and the morphology of the latent component of myocardial repolarization is not restricted by this consistency constraint, thereby further distinguishing stable external field artifacts from variable pathological changes in the time dimension.
[0054] Specifically, the counterfactual field strength consistency constraint uses the static magnetic field strength modulus B as a condition, requiring the network to predict the morphology of the repolarization region under the counterfactual condition of zero magnetic field strength, and constraining this morphology to be equal to the decoupled myocardial repolarization latent component. As can be seen from the multiplicative generation structure, when the conditional field strength is set to zero (B = 0), X_art = 0, and the repolarization region morphology output by the network is precisely the pure myocardial repolarization component X_myo. Therefore, counterfactual consistency is structurally inherent and further reinforced during training with sample pairs (see training phase for details). Figure 3 .
[0055] Step S4: Extract diagnostic features from the decoupled myocardial repolarization hidden component and classify arrhythmias.
[0056] Specifically, during the inference phase, the purified myocardial repolarization component X_myo obtained from the decoupling of steps S2 to S3 is taken and spliced with the QRS complex and its adjacent intervals retained in step S1, which are not significantly contaminated by magnetohydrodynamics, to form a complete and purified cardiac cycle signal, which is then input into the classification deep network. The classification deep network preferably uses a one-dimensional convolutional residual network superimposed with temporal attention: local morphology is extracted from six one-dimensional convolutional residual blocks (channels 64→128→256, including downsampling), and two layers of multi-head temporal attention (4 heads, model dimension 256) are superimposed to model long-term rhythm dependence. The final output is global average pooling and two fully connected layers to output the probability of each category, taking into account both the repolarization region morphology and cardiac rhythm. Output categories include ST segment shift (indicating myocardial ischemia), repolarization-related arrhythmias, and normal multi-class results. Diagnostic features include repolarization region morphology, ST segment shift, T wave polarity and symmetry, all extracted from the purified component to avoid contamination of diagnostic features by magnetohydrodynamic distortion.
[0057] Specifically, step S4 also includes a pathological residual retention mechanism: to avoid mistakenly including real pathological components that cannot be explained by the external magnetic field into the artifact branch, all residuals that are coherent with cardiac electrical activity in the electrical phase and do not scale with the field strength are judged as real pathological components and retained. In practice, the myocardial repolarization latent component and its reconstructed residual under the isoelectric segment anchoring reference are taken, and it is checked whether the coherence of this residual with the QRS electrical phase exceeds a threshold and whether its amplitude is not proportional to the field strength B; if both are true, the residual is retained in X_myo for classification; otherwise, it is included in the artifact branch. Simultaneously, the energy proportion of the artifact latent component ρ=||X_art‖ is... 2 / ||X|| 2 As a signal quality indicator and confidence output for this classification, a low confidence prompt is given when ρ exceeds a preset threshold (0.6 in this embodiment) for clinical review, thereby improving the system's security under conditions of high artifact contamination.
[0058] The following describes the training phase of the deep network, focusing on how to obtain the encoder, dual-branch decoupling module, and classification network used for inference from the training data.
[0059] Specifically, given that a clean, non-magnetic-hydrodynamic (MHD) ECG cannot be obtained within the scanning cavity as a true value for each frame, this embodiment employs multiple physical substitution supervision to achieve self-supervised training, eliminating the need for external calibration or a clean reference. The training data consists of multi-lead ECGs sampled within the MRI cavity, synchronously recorded field strength B, and hemodynamic substitution signals. When only single-field-strength clinical data is available, an adversarial generative network (AGN) further synthesizes a three-dimensional MHD distortion template that varies with field strength and individual aortic geometry, superimposed on the real myocardial component to expand the sample. The AGN, conditioned on field strength B, body position angle, and cardiac output, outputs a rank-one spatial mixing vector m and a systolic phase-locked temporal envelope e. The discriminator distinguishes between the spatial and temporal statistics of synthesized artifacts and sampled artifacts, thereby covering different body position and cardiac output conditions and improving the method's robustness to inter-individual artifact morphology differences.
[0060] Specifically, the total loss of self-supervised training is a weighted sum of the loss terms: the first is the reconstruction consistency loss L_rec=||XX|| 2First, the sum of the two branches ensures that the original repolarization region window is restored. Second, the isoelectric segment anchoring loss L_anchor uses the spatial statistics and amplitude benchmarks of the TP and PR segments, which do not contain repolarization activity within the same cardiac cycle, to estimate the artifact components. This constrains the spatial mixing vector and amplitude of the artifact branch in the isoelectric segment to be consistent with the measured statistics, providing a weak supervisory prior for the spatial statistics and amplitude of the artifact branch. Third, the phase misalignment contrast loss L_phase uses samples aligned with hemodynamic substitution signals as positive examples and samples with artificially misaligned time envelopes relative to the blood flow phase (such as translation by 60 to 120 ms or time flipping) as negative examples. An InfoNCE (Info Noise-Contrastive Estimation) contrast loss is constructed (temperature coefficient is set to 0.07) to strengthen the artifact branch's locking onto the mechanical phase of blood flow. Fourthly, there is the field strength contrast consistency loss L_field, which is the training loss corresponding to the counterfactual field strength constraint: constructing consistent supervision sample pairs (obtained by superimposing different field strength records or synthetic distortion templates on the same myocardial component) where the artifact component scales proportionally with the field strength modulus, while the myocardial component remains unchanged. This constrains the consistency of the myocardial component decoupled from the network under different B values, and the artifact component scales proportionally to B. Fifthly, there is the constraint regularization term L_prior, which includes the lead subspace projection constraint of myocardial branches, the electrical temporal coherence constraint, and the consistency constraint of the mixed vector of adjacent beat spaces.
[0061] Specifically, the total loss L = λ_rec·L_rec + λ_anchor·L_anchor + λ_phase·L_phase + λ_field·L_field + λ_prior·L_prior. In this embodiment, λ_rec = 1.0, λ_anchor = 0.5, λ_phase = 0.3, λ_field = 0.7, and λ_prior = 0.2 are used as initial values. The weights of each loss are adaptively adjusted according to the recorded static magnetic field strength. The higher the field strength, the greater the weight of the constraints (L_anchor, L_phase, L_field) corresponding to the artifact branch. In this embodiment, λ←λ·(1+K·(B / B_ref-1)) (the reference field strength B_ref is 1.5T and κ is 0.35) is used to linearly amplify the artifact-related weights with the field strength to adapt to the significant differences in the strength of magnetohydrodynamic interference under different magnetic field strengths.
[0062] Specifically, the training hyperparameters are as follows: the optimizer uses AdamW (weight decay of 0.012, first-order and second-order momentum of 0.9 and 0.999 respectively); the initial learning rate is set to 2.3 × 10⁻⁶. -4 A cosine annealing strategy with linear preheating was adopted, and the cosine decayed to 1.0 × 10 after 5 epochs of preheating. -6The batch size was set to 48 (each batch contained repolarization region windows from multiple patients and field strengths, grouped by adjacent batches to support cross-batch consistency constraints and field strength comparison sample pairs); the maximum number of training epochs was 120, and the early termination convergence criterion was that the consistency of myocardial component reconstruction on the validation set and the downstream classification macro-average F1 score no longer improved for 10 consecutive epochs. The encoder and dual-branch decoder were first jointly pre-trained (with only self-supervised loss), and then some of the bottom-level convolutions were frozen, and the classification network was jointly fine-tuned with a small learning rate (0.2 times the initial value); the classification network training used class-weighted cross-entropy to alleviate the imbalance of arrhythmia classes, and the samples superimposed with synthetic aberration templates were enhanced online with a probability of 0.5. Evaluation metrics included sensitivity, specificity, macro-average F1, and relative error of ST-T morphology after purification on different field strength subsets relative to the absence of magnetic field reference, used to verify the effectiveness of decoupling in removing magnetically induced aberrations while preserving real pathological changes.
[0063] Specifically, as alternatives and preferred solutions: the temporal attention of the space-time encoder can be replaced by a bidirectional gated recurrent unit or a temporal convolutional network; the lead subspace projection matrix M can be adaptively estimated from the QRS region with low artifact beats in the training data when standard lead mapping is lacking; when hemodynamic substitute signals are missing, the systolic phase envelope estimated by ECG is used instead, and the L_phase weight is adjusted accordingly; the classification network can also adopt other equivalent structures of one-dimensional convolution superimposed with multi-head attention. All the above preferred parameter ranges and alternative solutions do not depart from the core concept of this invention: utilizing physical separability differences to decouple artifacts and myocardial components in the latent space.
[0064] See Figure 4 The above method can be implemented by an electrocardiogram signal feature extraction and classification system. This system includes an acquisition unit, a decoupling unit, a constraint unit, and a classification unit. The functions of each unit correspond to steps S1 to S4 respectively. It can be implemented as a dedicated hardware module, a software module running on a processor, or a combination of both, thereby implementing the above method on magnetic resonance monitoring equipment or a post-processing platform.
[0065] Example 2
[0066] In a preferred embodiment of the present invention, the generation process of the magnetohydrodynamic artifact latent component in the dual-branch decoupling module is refined, and it is constructed as a multiplicative generation operator with explicit coupling of field strength, space, and time, ensuring the physical separability of the artifact component from the generation model level rather than the loss penalty level. The processing object of this embodiment is the multi-lead ECG signal tensor X within the repolarization region window, which has a shape of C×L, where C is the number of leads, preferably a standard twelve-lead system (C=12), or a simplified system of no less than three leads when electrodes are limited; L is the number of sampling points within the window, and when the sampling rate is 500Hz and the repolarization region window duration is approximately 320ms to 400ms, L is preferably an integer between 160 and 200.
[0067] The spatial-temporal encoder consists of cascaded one-dimensional convolutional blocks and temporal attention blocks. The one-dimensional convolutional blocks preferably have three to five layers, with kernel lengths of 7, 5, and 3 respectively along the time dimension. The number of output feature map channels ranges from 32, 64, and 128 respectively from shallow to deep. Each convolutional layer is followed by batch normalization and nonlinear activation, preserving the resolvable structure between leads in the channel dimension. That is, no lead-level mixing is performed in the first layer, allowing the rank-one structure of the subsequent spatial mixing vector to be explicitly expressed. The temporal attention block preferably employs multi-head self-attention, with 4 to 8 attention heads and a hidden dimension of 128 to 256, used to capture the long-term morphological dependence between the ST segment and T wave within the complex polarization region. Furthermore, before the convolutional block, the static magnetic field strength magnitude B read by the scanner's main magnetic field parameters is mapped into a conditional vector through a two-layer fully connected embedding network. Its dimension is consistent with the number of channels in the convolutional feature map, and it is injected into the encoder in a channel-wise scaling and biasing manner to achieve field strength conditional feature extraction. This allows the same set of network parameters to adaptively estimate the artifact amplitude scale under different field strengths such as 1.5T, 3T, and 7T.
[0068] The spatiotemporal features output by the encoder are split into two paths by the dual-branch decoupling module. For the magnetohydrodynamic artifact branch, this implementation does not directly reconstruct arbitrary waveforms by the decoder, but instead allows it to regress only three low-dimensional physical parameters: the first is a spatial mixing vector m, which is a learnable vector with a length equal to the number of leads C, representing the spatial projection direction of the induced voltage driven by the Lorentz force on each lead. Preferably, a unit norm normalization is applied to m to eliminate scale ambiguity between amplitude and envelope; the second is the time envelope e(t), which is a one-dimensional sequence with a length equal to the number of window sampling points L, representing the temporal shape of the artifact driven by the mechanical phase of systolic blood flow; the third is the scalar amplitude coefficient a, representing the overall intensity of the artifact in that beat. Accordingly, the reconstructed waveforms of the artifact components on each lead and each sampling point are analytically given by the following multiplicative generation operator:
[0069] V_MHD(l,t)=B·a·m(l)·e(t)
[0070] Where 1 is the lead index and t is the sampling point index. By denoteing the outer product, the above equation can be compactly written as: This structure ensures that the artifact component is strictly homogeneous with respect to the magnitude B of the static magnetic field strength, meaning that V_MHD is always a zero vector when B is zero. Simultaneously, in the lead dimension, the column vector of V_MHD at any given time is a scalar multiple of m, thus its rank is always one. Mathematically, this eliminates the possibility of any component that does not satisfy the condition of "linear scaling with B and lead rank one" being classified into the artifact branch. The myocardial repolarization latent component is no longer generated independently, but is instead taken as the reconstruction residual of the difference between the repolarization region window signal and the artifact component, i.e., R = X - V_MHD. This residual is then passed through a shallow decoder gated by electrical temporal coherence constraints, retaining only the component coherent with the QRS electrical activity of the same cardiac cycle as the true myocardial repolarization component S.
[0071] Constraints corresponding to their physical meanings are imposed on the above three physical parameters. The spatial low-rank constraint is naturally satisfied by the multiplicative generation structure, requiring no additional penalty term. The field strength monotonic constraint is achieved by applying monotonicity to the product of the amplitude coefficient a and the field strength B: during training, different artifact templates corresponding to B are superimposed on the same myocardial component, requiring the energy of the generated V_MHD to increase monotonically with B, and its energy to be proportional to the square of B. The phase-locking constraint acts on the time envelope e(t), maximizing its normalized cross-correlation with the hemodynamic substitute signal p(t) during systole; the substitute signal is preferably the pulse oxygen volume wave or the gated flow velocity signal, and when there is a lack of external substitute signal, it is replaced by the systolic phase envelope estimated by multi-lead ECG based on the QRS initiation and ejection phase. Apply lead spatial structure constraints to the myocardial repolarization branches, so that the projection of the decoupled S onto each lead falls into the ECG vector quantum space spanned by the ECG lead transformation matrix; and apply electrical temporal coherence constraints, so that the temporal phase of S is coherent with the QRS electrical activity of the same cardiac cycle but incoherent with the hemomechanical temporal phase.
[0072] Under the condition of using clean ECGs free from magnetohydrodynamic interference at any given moment as the true value for each beat, this implementation uses a self-supervised total loss composed of multiple physical substitution supervisions for training. The total loss is a weighted sum of several components, which can be expressed as:
[0073] L_total=λ1·L_rec+λ2·L_anchor+λ3·L_phase+λ4·L_field+λ5·L_lowrank+λ6·L_cross
[0074] Wherein, L_rec is the reconstruction consistency loss, which takes the point-by-point mean square error between X and (V_MHD+S) to ensure that the sum of the two branches restores the original repolarization region window signal; L_anchor is the isoelectric segment anchoring loss, which uses the spatial statistics and amplitude benchmark of the artifact component estimated by the TP segment and PR segment without repolarization activity in the same cardiac cycle, and constrains the direction of m to be consistent with the external field projection direction observed in the isoelectric segment, thereby providing anchoring for the artifact amplitude under the condition of no true value; L_phase is the phase misalignment contrast loss, which takes the sample with the phase aligned between the time envelope e(t) and the hemodynamic substitute signal p(t) as positive examples, and the misaligned sample obtained by manually shifting the phase of p(t) as negative examples, and uses contrastive learning to bring the positive examples closer. 1. Extending negative examples strengthens the locking of artifact branches to the mechanical phase of systole; L_field is the field strength contrast consistency loss, corresponding to the counterfactual field strength consistency constraint, that is, predicting the shape of the repolarization region when the field strength is assumed to be zero with B as a condition and constraining it to be equal to the decoupled myocardial component S; L_lowrank is the spatial low-rank regularization, which applies compression to the spatial components outside m when using a non-strict rank-one relaxation implementation, and the weight of this term can be zero when using the above strict multiplicative generation structure; L_cross is the beat consistency loss, which applies consistency constraints to the spatial mixing vector m of multiple adjacent cardiac cycles, so that the artifact components share a stable spatial orientation within a short time window, while the shape of the myocardial repolarization component is allowed to change beat by beat and is not restricted by this constraint.
[0075] Furthermore, the weights λ of each component are adaptively adjusted based on the magnitude B of the static magnetic field strength: the higher the field strength, the stronger the magnetohydrodynamic interference, thus increasing the weights of L_phase, L_field, and L_anchor related to artifact branches; the weights are correspondingly decreased when the field strength is low to avoid excessive stripping of the true repolarization component under weak artifact conditions. Preferably, the weights are adjusted linearly or piecewise linearly with B, for example, at 1.5T, myocardial branch constraints are dominant, and at 7T, the weights of artifact branch-related losses are increased to approximately 1.5 to 2 times. The training preferably uses an adaptive moment estimation optimizer with an initial learning rate of 1×10⁻⁶. -3 Up to 1×10 -4 The batch size ranged from 32 to 128, and mixed batch sampling was performed on samples with different field strengths and different individual aortic geometries to cover the distribution range of artifact morphology.
[0076] Training sample pairs for counterfactual field strength consistency can be constructed in two ways. First, when records of the same patient exist under different field strengths, directly construct sample pairs where the artifact scales with B while the myocardial component remains unchanged. Second, when only single-field-strength clinical data is available, a three-dimensional magnetohydrodynamic distortion template synthesized by an adversarial generative network, varying with field strength and individual aortic geometry, is scaled according to different B ratios and superimposed on the same real myocardial component. This constructs consistent supervisory sample pairs where the artifact component scales proportionally with the field strength modulus while the myocardial component remains unchanged. This allows the network to learn to assign components that scale with field strength to the artifact branch and components that do not change with field strength to the myocardial branch.
[0077] Beneficial Effects. After adopting the aforementioned field strength-space-time multiplicative generation operator, the physical separability of the magnetohydrodynamic artifact components is directly guaranteed by the analytical structure of the generation model, rather than relying on soft constraints of loss penalties. On the test set, for complex polarization region signals superimposed with known intensity synthetic artifacts, this implementation shows measurable improvements in indicators such as the reconstruction correlation coefficient of the complex polarization region morphology and the ST segment offset estimation error compared to the method of overall artifact removal for the complex polarization region. Especially in samples where real pathological ST segment offsets and magnetoinduced distortions are superimposed in the same region, the overall artifact removal method would smooth both out, causing the ST offset estimation to approach zero, while this implementation can preserve the pathological offset. Since the artifact branch only regresses three low-dimensional physical parameters rather than point-by-point waveforms, the number of parameters and the computational cost during inference are reduced compared to point-by-point generative decoders. Furthermore, it shares the same set of network parameters across different field strengths, avoiding separate model training for each field strength and improving storage and maintenance costs when deploying across field strengths. Furthermore, the multiplicative structure ensures that the artifact components are numerically zeroed when the counterfactual field is strongly zeroed, satisfying zero-field consistency without additional boundary penalties, thus enhancing the numerical stability of the training process.
[0078] Principle Analysis. The physical basis of the aforementioned beneficial effects lies in the threefold separability of the magnetohydrodynamic induced component and the myocardial repolarization component in terms of their origins. The magnetohydrodynamic induced voltage is driven by the Lorentz force experienced by blood, a conductive fluid, moving in a static magnetic field. Its amplitude is proportional to the product of blood flow velocity and magnetic field strength, thus exhibiting first-order homogeneity in terms of field strength modulus. Its projection onto each lead is determined by both the aortic geometry and the orientation of the static magnetic field, resulting in a stable spatial direction when the body position is fixed within a short time window, corresponding to a rank-one structure in the lead dimension. Its temporal shape is determined by the mechanical ejection phase of systolic blood flow, and is phase-locked with the pulse or flow velocity signal. The myocardial repolarization component, on the other hand, is driven by the cardiac electrical dipole. Its spatial projection conforms to the inherent structure of ECG lead transformations, and its temporal phase is locked with QRS electrical activity and does not change with the external magnetic field. The multiplicative generation operator directly encodes the three physical properties of the preceding component—homogeneity with respect to B, rank-one with respect to leads, and temporal envelope coherence with blood flow—into the generation structure itself. Therefore, any component that violates these properties cannot be mathematically represented as the output of this structure and can only fall into the myocardial branch defined by the reconstructed residual and gated by the electrical phase. This explains why this implementation can strip away magnetic induction distortion without erasing the actual pathological repolarization changes: pathological ST-T changes do not scale linearly with field strength, their spatial projection falls into the ECG vector quantum space, and their phase is coherent with cardiac electrical activity—all three of which conflict with the analytical constraints of the artifact branch and are therefore systematically preserved in the myocardial branch. It should be noted that when the proportion of samples with different field strengths or different aortic geometries in the input data is too low, resulting in insufficient distribution coverage for the network's estimation of the spatial mixing vector and temporal envelope, or when the quality of the hemodynamic substitute signal itself is poor and its correlation with systolic mechanochronism is low, the above decoupling effect may be affected. In this case, the additional prior provided by isoelectric segment anchoring and beat consistency constraints can be used to compensate for this.
[0079] like Figure 7 The diagram shows a cross-section of the aortic arch segment, with the vessel wall 201 represented by double solid lines and the lumen indicated by light gray. Blood flow 202 flows along the vessel axis, its velocity denoted by v. The static magnetic field 203, in the direction B0, is perpendicular to the blood flow direction. Charged ions 204 in the blood are subjected to a Lorentz force F = qv × B as they move with the blood flow, causing positive and negative ions to deflect to opposite sides of the vessel wall. Furthermore, the accumulation of positive and negative ions on both sides of the vessel wall leads to charge separation, thereby forming an induced voltage in a direction perpendicular to both the blood flow and the magnetic field. The polarity of this induced voltage is indicated by the positive and negative signs on the upper and lower sides of the vessel wall. This induced voltage is picked up by the surface electrode 205 and superimposed on the surface electrocardiogram signal, constituting a magnetohydrodynamic artifact in the repolarization region. Its amplitude increases with the increase of the static magnetic field strength B, providing a physical basis for applying field strength monotonicity constraints in this invention.
[0080] Example 3
[0081] In another embodiment of the present invention, as an optional alternative, instead of using the decoupling method of separating the complex polarization region signal into two hidden components in the same autoencoder framework, a two-stage scheme of generative counterfactual reconstruction based on field strength combined with explicit physical operator fitting is adopted. This also solves the technical problem that magnetohydrodynamic induced voltage and real pathological ST-T changes are mixed in the same region of the complex polarization region and there is no clean true value available for calibration at the same time.
[0082] The first stage is conditional counterfactual reconstruction. A sequence generation network is constructed with the static magnetic field strength magnitude B and the hemodynamic surrogate signal p(t) as conditions, preferably implemented as a conditional denoising diffusion probability model or a conditional variational autoencoder. The goal of this network is to directly generate the pure myocardial repolarization waveform S that should be presented in the repolarization region window under the counterfactual condition of assuming zero magnetic field strength. When implemented with a conditional diffusion model, the forward process progressively adds noise to the pure myocardial waveform, and the reverse process progressively denoises and reconstructs the waveform with the contaminated observation signal X, the field strength magnitude B, and the hemodynamic surrogate signal p(t) as conditions. The conditions are preferably injected using channel-wise feature modulation, injecting the phase embedding vector of B and p(t) into each layer of the denoising network. The denoising network preferably adopts a one-dimensional convolutional encoder-decoder structure supplemented with temporal attention. The convolutional kernel length is 3 to 7, the number of channels increases from 32 to 256, and the diffusion steps are hundreds during training and reduced to more than ten steps during inference with the help of accelerated sampling to meet the latency requirements of online monitoring. Since there is no clean ECG at the same time in the scanning cavity, the training samples of this network are also constructed by using a three-dimensional magnetohydrodynamic distortion template synthesized by the adversarial generative network, which varies with the field strength and the geometry of the individual aorta: the template is scaled according to the recorded field strength B and superimposed on the real myocardial repolarization waveform to obtain "contaminated observation - pure myocardial waveform" paired samples, thereby achieving supervision of the counterfactual reconstruction network through synthetic pairing.
[0083] The second stage involves explicit physical operator fitting and residual verification. The pure myocardial waveform S generated in the first stage is subtracted from the observed signal X to obtain a preliminary artifact estimate XS. This estimate is then fitted to the field strength-space-time multiplicative form using least squares. Solve for the spatial mixing vector m, the temporal envelope e(t), and the amplitude coefficient a. If the fitting residuals are not rank-one in the lead dimension, or if the systolic cross-correlation between the temporal envelope e(t) and the hemodynamic alternative signal p(t) is lower than a set threshold, it is determined that the S generated in the first stage still contains unremoved artifacts or has mistakenly swallowed real pathological components. The fitting residuals are then fed back to the first stage as additional conditions for regeneration, forming a closed loop of alternating generation and physical fitting. It is preferred to iterate two to three times until the fitting residuals converge. This explicit fitting step allows this alternative scheme to retain analytical verification of the physical structure of artifacts outside the generative framework, avoiding the situation where a pure generative model might mistakenly remove pathological changes as artifact erasure.
[0084] To enhance the modeling of spatial relationships between leads, this implementation preferably introduces a graph attention structure into the first-stage denoising network. Each lead is treated as a node in a graph, and the spatial correlation between leads is considered as an edge. Graph attention aggregates information between leads, replacing the implicit modeling of spatial relationships at the convolutional channel level in Example 2. This different feature extraction method allows the direction estimation of the spatial mixture vector to more directly utilize lead topological priors, which helps stabilize the estimation of spatial projection directions in a twelve-lead system with a large number of leads.
[0085] The training strategy in this implementation differs from that in Example 2. Example 2 uses multiple self-supervised losses, such as reconstruction consistency, isoelectric segment anchoring, phase misalignment contrast, and field strength contrast consistency, to jointly optimize a single decoupled network. This implementation, however, splits the training into two steps. First, it trains the conditional counterfactual reconstruction network with synthetic paired samples, enabling it to learn to generate a zero-field pure waveform under a given field strength. Then, it freezes the network and uses the physical fitting residuals from the second stage as an online self-calibration signal to drive closed-loop iteration, thereby decoupling "learning priors" from "applying physical constraints" in the process. The advantage of this phased strategy is that the counterfactual reconstruction network can be fully pre-trained on large-scale synthetic data containing various field strengths and aortic geometry, while the physical fitting stage does not contain trainable parameters and can perform independent self-calibration for each sample during the inference stage, making it easy to deploy on clinical post-processing platforms lacking online retraining capabilities.
[0086] After completing the above two-stage processing, the verified pure myocardial repolarization waveform S is taken and spliced with the QRS complex outside the repolarization region window and its adjacent intervals to form a complete cardiac cycle signal. The input is a classification network composed of a one-dimensional convolutional residual network superimposed with temporal attention, which outputs arrhythmia categories and repolarization abnormality categories, including ST segment deviations and repolarization abnormality-related arrhythmias that indicate myocardial ischemia. Consistent with Example 2, this implementation also uses the energy proportion of the artifact components obtained from the second-stage fitting as a signal quality indicator and confidence level output. When this proportion exceeds a preset threshold, a low-confidence warning is given for clinical review. As an alternative, when multiple recordings of the same patient under different field strengths are available, the synthesized paired samples can be omitted, and the first-stage counterfactual reconstruction network can be trained directly with real multi-field strength pairs. However, when only a single field strength clinical data is available and the synthesized distortion template differs significantly from the actual artifact morphology of the individual, the second-stage physical fitting of the two-stage scheme can provide correction for the generation bias of the first stage. However, its correction ability is still limited in extreme positions where the artifacts deviate significantly from the rank-multiplicative structure.
[0087] Example 4
[0088] This embodiment provides a deep neural network-based ECG signal feature extraction and classification system to implement the method described in Embodiment 1. Under the strong static magnetic field environment of magnetic resonance imaging (MRI), it decouples magnetohydrodynamic induced voltage artifacts from actual pathological ST-T repolarization changes in the latent space of the deep network, extracting diagnostic features only from the purified myocardial repolarization component and completing the arrhythmia classification. See also... Figure 4 The system includes a data acquisition unit, a decoupling unit, a constraint unit, and a classification unit. The functions of each unit correspond to steps S1 to S4 in Embodiment 1. It can be implemented as a dedicated hardware module, a software module running on a processor, or a combination of both.
[0089] The acquisition unit is used to acquire multi-lead ECG signals from patients within the MRI scanner cavity, simultaneously recording the static magnetic field strength modulus and hemodynamic substitute signals characterizing systolic blood flow. The cardiac cycle is divided based on the R wave, and within each cardiac cycle, a repolarization zone window is defined from the ST segment initiation to the T wave termination. Specifically, the acquisition unit includes MRI-compatible carbon fiber electrodes and a filtering front end, a static magnetic field parameter reading interface, and a hemodynamic substitute signal acquisition channel. The multi-lead section has at least three leads, preferably a standard twelve-lead system or its simplified lead system. The original ECG is resampled to 500Hz and a 0.5Hz to 40Hz bandpass is applied for routine preprocessing. The static magnetic field strength modulus B is directly read from the scanner's main magnetic field parameters or synchronously acquired via the device interface. The hemodynamic substitute signal is preferably a pulse oxygen volume wave, or, in the absence of external signals, a systolic phase envelope estimated from the QRS initiation and ejection phase by the multi-lead ECG. The acquisition unit is also configured to divide the continuous ECG into individual cardiac cycles based on the R wave, define the interval from the start of the ST segment to the end of the T wave as the repolarization zone window and uniformly resample it into a two-dimensional tensor with L=256 points in lead C, while retaining the isoelectric TP segment and PR segment without repolarization activity in the same cardiac cycle as reference intervals, and retaining the QRS complex interval for subsequent splicing and reconstruction.
[0090] The decoupling unit is used to construct a deep network containing a space-time encoder and a dual-branch decoupling module. The space-time encoder extracts spatiotemporal features from the multi-lead signals within the repolarization region window. The dual-branch decoupling module separates these spatiotemporal features into a magnetohydrodynamic artifact latent component and a myocardial repolarization latent component in the latent space. The two waveforms obtained by decoding are added together on each lead to reconstruct the repolarization region window signal. Specifically, the spatial-temporal encoder consists of cascaded one-dimensional convolutional residual blocks and temporal self-attention. It is configured to inject the static magnetic field strength magnitude B as a conditional embedding into the network in a FiLM manner before extracting spatiotemporal features, thereby achieving field strength-conditional feature extraction. This allows the same network to adaptively adapt to different magnetic field strengths such as 1.5T, 3T, and 7T. The artifact branch of the dual-branch decoupling module is configured to output a spatial mixing vector, a temporal envelope, and scalar amplitude coefficients, and assemble the artifact waveform using a multiplicative generation structure. The myocardial repolarization branch is configured to output a myocardial waveform via a transposed convolutional decoder. The two waveforms are added point by point to obtain a reconstruction that approximates the input window.
[0091] The constraint unit is used to apply spatial low-rank constraints, field strength monotonic constraints, and phase-locked constraints to the magnetohydrodynamic artifact latent component, so that its projection on each lead is expressed by the outer product of a spatial mixing vector and a time envelope, its reconstructed waveform energy monotonically increases with the magnitude of the static magnetic field strength, and its time envelope has the maximum coherence with the hemodynamic substitution signal during systole. It also applies lead spatial structure constraints and electrical temporal coherence constraints to the myocardial repolarization latent component, so that its projection falls within the subspace spanned by the ECG lead transformation matrix, and its temporal phase is coherent with the QRS electrical activity of the same cardiac cycle. The constraint unit is further configured to apply cross-beat consistency constraints of the spatial mixing vector to multiple adjacent cardiac cycles and to apply counterfactual field strength consistency constraints. The aforementioned constraints are applied to the network in the form of loss terms and structural parameters during the training phase, and are solidified in the network weights and multiplicative generation structure during the inference phase. During training, the constraint unit is weighted and summed with the equipotential segment anchoring loss, phase misalignment comparison loss, field strength comparison consistency loss and constraint regularization term to form the total loss, and the weight of each loss is adaptively adjusted according to the magnitude of the static magnetic field strength. The higher the field strength, the greater the weight of the constraint corresponding to the artifact branch.
[0092] The classification unit is used to extract diagnostic features from the decoupled myocardial repolarization hidden component and classify arrhythmias. Specifically, the classification unit is configured to concatenate the purified myocardial repolarization component with the QRS complex and its adjacent intervals retained by the acquisition unit to form a complete cardiac cycle signal. The input is a classification depth network composed of a one-dimensional convolutional residual network superimposed with temporal attention. The output is a multi-classification result indicating myocardial ischemia, including ST segment shift, repolarization-related arrhythmias, and normality. Diagnostic features include repolarization region morphology, ST segment shift, T wave polarity and symmetry. The classification unit is also configured to perform a pathological residual retention mechanism, identifying and retaining the reconstructed residuals that are coherent with cardiac electrical activity on the electrical time phase and do not scale with field strength as true pathological components. The proportion of artifact hidden component energy is used as a signal quality indicator and confidence output. When it exceeds a preset threshold, a low confidence prompt is given for clinical review.
[0093] The data flow between units is as follows: the acquisition unit outputs the repolarization region window tensor, static magnetic field strength magnitude, hemodynamic substitution signal, and the retained isoelectric segment and QRS interval, which are then sent to the decoupling unit; the decoupling unit outputs the artifact latent component, myocardial repolarization latent component, and reconstructed signal, one path of which is sent to the constraint unit to apply physical prior constraints (training phase) or to receive the inference output after constraint solidification (inference phase), and the other path sends the purified myocardial repolarization component to the classification unit; the classification unit combines the QRS interval retained by the acquisition unit to complete splicing, feature extraction, and classification, and returns the artifact energy ratio as the confidence level. In terms of hardware deployment environment, the acquisition unit can be implemented as a bedside acquisition front-end and edge computing device compatible with magnetic resonance imaging (MRI). The decoupling unit, constraint unit and classification unit can be deployed on a post-processing server or MRI monitoring workstation equipped with a graphics processor. Training can be completed offline on a server with multiple graphics processors, and inference can be completed in one forward computation on the edge device or monitoring workstation. All devices adopt a general configuration and are not limited to specific brands and models, thereby implementing the above methods on MRI monitoring equipment or post-processing platforms.
[0094] Example 5
[0095] This embodiment illustrates the implementation process and technical effects of the present invention through a specific application case of continuous cardiac monitoring. The case background is as follows: A subject undergoes continuous electrocardiogram (ECG) monitoring while receiving cardiac structural imaging within a 3T MRI scanner. The scan lasts approximately forty minutes, during which real-time monitoring is required to detect ST-segment shifts and repolarization arrhythmias related to myocardial ischemia. The specific difficulty in this case lies in the fact that the magnetohydrodynamic voltage induced in the blood's conductive medium by the strong static magnetic field through the Lorentz force falls into the repolarization region. Its amplitude at 3T can reach levels comparable to or even higher than the actual ST-T changes, and it overlaps with the actual pathological changes within the same time window and frequency band. Furthermore, it is impossible to obtain a clean, interference-free ECG at the same moment within the scanning chamber as the true value for each frame. Conventional methods are inadequate: overall artifact removal methods based on fixed templates or independent component analysis will erase real ischemic and repolarization abnormal pathological changes along with artifacts; discrimination models trained on a single field strength will degrade sharply when the field strength or body position changes; and classifying the waveform of the original repolarization region directly will result in systematic misjudgments due to artifact contamination.
[0096] The implementation process follows steps S1 to S4 of Example 1. In the acquisition stage, a simplified six-lead system is used to acquire intracardiac electrocardiograms and resample to 500Hz. Simultaneously, the static magnetic field strength modulus and pulse oxygen volume wave are recorded. The cardiac cycle is divided based on the R wave, and the repolarization region window is defined, preserving the isoelectric TP, PR segments, and QRS intervals. In the decoupling stage, the repolarization region window tensor, along with the field strength modulus, is input into a self-supervised trained spatial-temporal encoder and a dual-branch decoupling module. A multiplicative generation structure is used to estimate artifact components, and a transposed convolutional decoder is used to estimate myocardial repolarization components. In the constraint stage, artifact components are made to satisfy spatial rank, field strength monotonicity, phase locking, and beat consistency. The inverse fact field strength is set to zero to obtain pure myocardial components. In the classification stage, the purified myocardial repolarization components and QRS intervals are concatenated and input into a classification network. The network outputs the categories of repolarization abnormalities and arrhythmias, and simultaneously outputs the artifact energy percentage as a confidence level.
[0097] To verify the effectiveness, an evaluation set was constructed, including categories such as normal, ST segment shift, and repolarization-related arrhythmias. A three-dimensional magnetohydrodynamic distortion template synthesized by an adversarial generative network, varying with field strength and individual aortic geometry, was superimposed to simulate different levels of contamination. Evaluation metrics included sensitivity, specificity, and macro-average F1 for each category. The relative error of the purified ST-T morphology compared to the absence of a magnetic field reference was also statistically analyzed. Results showed that using the complete scheme of this invention, the macro-average F1 for arrhythmia classification was approximately 0.912, the sensitivity for ST segment shift detection was approximately 0.93, the specificity was approximately 0.94, and the relative error of the purified ST-T morphology was approximately 8.6%.
[0098] like Figure 8 As shown, the horizontal axis represents the grouping of three diagnostic indicators: macro-average F1, ST segment shift detection sensitivity, and ST segment shift specificity. The vertical axis represents the indicator values normalized to the 0-1 range. The complete scheme of this invention, the comparison method based on ICA overall desmearing, and the original waveform direct classification baseline are distinguished by bars filled with diagonal lines, cross lines, and dots, respectively. This invention achieves 0.912, 0.93, and 0.94 in the above three indicators, respectively, which are significantly higher than the comparison method based on ICA overall desmearing (0.742, 0.71, 0.78) and the original waveform direct classification baseline (0.688, 0.66, 0.70).
[0099] In contrast, the existing general method using overall artifact removal and conventional classification based on independent component analysis has a macro-average F1 of approximately 0.742, a ST segment shift detection sensitivity of approximately 0.71, and a relative error of approximately 27% in ST-T morphology after purification, reflecting that it may inadvertently damage real pathological changes while removing artifacts. The baseline method that directly classifies the waveform of the original repolarization region without artifact removal has a macro-average F1 of only approximately 0.688, which further decreases on the high field strength subset. To demonstrate the technical contributions of each innovation, further ablation comparisons were conducted: Removing the multiplicative generation structure and field strength monotonicity constraint, and replacing it with a two-branch decoupling without structure constraints, reduced the macro-average F1 score to approximately 0.851. Furthermore, artifact residue was significant after setting the counterfactual field strength to zero, and the ST-T relative error increased to approximately 14%. Removing the counterfactual field strength consistency constraint reduced the macro-average F1 score to approximately 0.836, indicating decreased consistency of the same myocardial component under different field strengths. Removing the beat consistency constraint reduced the macro-average F1 score to approximately 0.869, with beat-by-beat jitter appearing in artifact spatial orientation estimation. Removing the field strength conditional embedding and training separately for each field strength resulted in a macro-average F1 score of approximately 0.858 on the mixed field strength evaluation set, along with poorer generalization. These data indicate that the multiplicative generation structure and field strength-related constraints, the counterfactual field strength consistency constraint, the beat consistency constraint, and the field strength conditional embedding each contribute measurably to the final performance, and that these innovations complement each other.
[0100] like Figure 9 As shown, the vertical axis represents the names of each ablation configuration, and the horizontal axis represents the macro-average F1, truncated and magnified to the range of 0.80 to 0.92 to highlight the differences. The corresponding values are marked at the endpoints with circles. The baseline of the complete scheme is marked with a vertical dashed line. The macro-average F1 of the complete scheme is 0.912. Removing the multiplicative generating structure and field strength monotonic constraint reduces it to 0.851, removing the counterfactual field strength consistency constraint reduces it to 0.836, removing the beat consistency constraint reduces it to 0.869, and removing the field strength conditional embedding reduces it to 0.858. The results show that all the above innovations contribute positively to the macro-average F1, with the contributions of the multiplicative generating structure and field strength monotonic constraint, and the counterfactual field strength consistency constraint being particularly significant.
[0101] Furthermore, in the high artifact contamination subset, the proportion of samples for which this invention provides low-confidence alerts based on artifact energy percentage is approximately 11%. After clinical review of these samples, the macro-average F1 of the remaining high-confidence samples increases to approximately 0.935, indicating that the confidence mechanism provides safety isolation for highly contaminated samples while preserving reliable interpretation. The macro-average F1 fluctuations among different field strength subsets (1.5T, 3T, 7T) are within approximately 0.02, reflecting the adaptive ability of the same network to different magnetic field strengths after field strength conditioning. The above results demonstrate that, under the stringent condition of continuous monitoring in a strong static magnetic field of magnetic resonance imaging where no clean true value is available for calibration, this invention can effectively isolate magnetic induction distortions while preserving true pathological repolarization changes, achieving reliable ECG feature extraction and arrhythmia classification, demonstrating feasibility and implementability.
[0102] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for feature extraction and classification of electrocardiogram (ECG) signals based on deep neural networks, characterized in that, include: Step S1: Acquire multi-lead ECG signals of the patient in the MRI scan chamber, and simultaneously record the static magnetic field strength modulus and the hemodynamic substitution signal characterizing systolic blood flow. Divide the cardiac cycle with the R wave as the reference and define the repolarization zone window from the ST segment beginning to the T wave end in each cardiac cycle. Step S2: Construct a deep network containing a space-time encoder and a dual-branch decoupling module. The space-time encoder extracts spatiotemporal features from the multi-lead signals within the repolarization region window. The dual-branch decoupling module separates these spatiotemporal features into a magnetohydrodynamic artifact latent component and a myocardial repolarization latent component in the latent space. The two waveforms obtained by decoding are added together on each lead to reconstruct the repolarization region window signal. Step S3: Apply spatial low-rank constraints, field strength monotonic constraints, and phase-locked constraints to the magnetohydrodynamic artifact latent component, so that its projection on each lead is expressed by the outer product of a spatial mixing vector and a time envelope, its reconstructed waveform energy monotonically increases with the magnitude of the static magnetic field strength, and its time envelope is most coherent with the hemodynamic substitution signal during systole; apply lead spatial structure constraints and electrical temporal coherence constraints to the myocardial repolarization latent component, so that its projection falls into the subspace spanned by the ECG lead transformation matrix, and its temporal phase is coherent with the QRS electrical activity of the same cardiac cycle; Step S4: Extract diagnostic features from the decoupled myocardial repolarization hidden component and classify arrhythmias.
2. The method according to claim 1, characterized in that, In step S1, the number of leads in the multi-lead ECG signal is not less than three, and the hemodynamic substitute signal is one of the following: pulse oxygen volume wave, gating flow velocity signal, gating pressure signal, or, in the absence of an external substitute signal, the systolic phase envelope estimated by the multi-lead ECG signal based on the QRS initiation and ejection phase; step S1 also includes retaining the isoelectric TP segment and PR segment within the same cardiac cycle as a reference interval.
3. The method according to claim 1, characterized in that, Step S3 further includes applying the cross-beat consistency constraint of the spatial mixing vector to multiple adjacent cardiac cycles, so that the magnetohydrodynamic artifact latent component shares a stable spatial orientation during multiple adjacent cardiac cycles, while the morphology of the myocardial repolarization latent component changes with each cardiac cycle and is not restricted by the cross-beat consistency constraint.
4. The method according to claim 1, characterized in that, Before extracting the spatiotemporal features, the space-time encoder first uses the static magnetic field strength modulus as a conditional embedding into the deep network to achieve field strength conditional feature extraction.
5. The method according to claim 1, characterized in that, Step S3 further includes a counterfactual field strength consistency constraint: using the static magnetic field strength modulus as a condition, the deep network predicts the shape that the repolarization region window should present under the counterfactual condition that the magnetic field strength is assumed to be zero, and constrains the shape to be equal to the decoupled myocardial repolarization latent component; during training, by superimposing magnetohydrodynamic distortion templates of different field strengths onto the same myocardial repolarization latent component, a consistent supervision sample pair is constructed in which the magnetohydrodynamic artifact latent component scales proportionally with the static magnetic field strength modulus while the myocardial repolarization latent component remains unchanged.
6. The method according to claim 5, characterized in that, The magnetohydrodynamic artifact latent component is parameterized as a multiplicative generation structure of field strength, space, and time. That is, its waveform on each lead is equal to the product of the magnitude of the static magnetic field strength, a scalar amplitude coefficient, the outer product of the spatial mixing vector, and the temporal envelope. This makes the magnetohydrodynamic artifact latent component homogeneous with respect to the magnitude of the static magnetic field strength and rank-one in the lead dimension. The myocardial repolarization latent component is taken as the reconstruction residual of the difference between the repolarization region window signal and the magnetohydrodynamic artifact latent component and is gated by the electrical temporal coherence constraint.
7. The method according to claim 1, characterized in that, Under the condition of a clean ECG free from magnetohydrodynamic interference, the deep network employs self-supervised training. The losses of the self-supervised training include: isopotential segment anchoring loss, which estimates the spatial statistics and amplitude benchmark of the magnetohydrodynamic artifact latent component using isopotential TP and PR segments within the same cardiac cycle; phase misalignment contrast loss, which uses samples aligned with the hemodynamic substitution signal as positive examples and samples with artificial phase misalignment as negative examples; and field strength contrast consistency loss. The above losses are weighted and summed to form a total loss function, which is then used to jointly optimize the spatial-temporal encoder and the dual-branch decoupling module. The weights of each loss are adaptively adjusted according to the magnitude of the static magnetic field strength; the higher the field strength, the greater the weight of the constraint corresponding to the magnetohydrodynamic artifact latent component.
8. The method according to claim 1, characterized in that, Step S4 further includes a pathological residual retention mechanism: when the reconstructed residuals of the myocardial repolarization latent component and its estimated spatial statistics and amplitude reference under the same cardiac cycle is coherent with cardiac electrical activity in electrical phase and does not scale with field strength, the reconstructed residual is determined as a real pathological component and retained in the myocardial repolarization latent component for classification; and the energy ratio of the magnetohydrodynamic artifact latent component is used as a signal quality indicator and confidence output, and a low confidence prompt is given when the energy ratio exceeds a preset threshold.
9. The method according to claim 1, characterized in that, In step S4, the decoupled myocardial repolarization latent component is spliced with the QRS complex outside the repolarization region window and its adjacent intervals to form a cardiac cycle signal. This signal is input into a classification deep network composed of a one-dimensional convolutional residual network and temporal attention, and outputs arrhythmia category and repolarization abnormality category. The training samples of the classification deep network are expanded by superimposing a three-dimensional magnetohydrodynamic distortion template synthesized by an adversarial generative network, which varies with field strength and individual aortic geometry, onto the real myocardial component.
10. A system for extracting and classifying electrocardiogram (ECG) signal features based on deep neural networks, characterized in that, include: The acquisition unit is used to acquire multi-lead electrocardiogram signals of patients in the magnetic resonance scanning cavity, and simultaneously record the static magnetic field strength modulus and the hemodynamic replacement signal characterizing systolic blood flow. The cardiac cycle is divided with the R wave as the reference and the repolarization zone window is defined from the ST segment beginning to the T wave end within each cardiac cycle. A decoupling unit is used to construct a deep network containing a space-time encoder and a dual-branch decoupling module. The space-time encoder extracts spatiotemporal features from the multi-lead signals within the repolarization region window. The dual-branch decoupling module separates the spatiotemporal features into a magnetohydrodynamic artifact latent component and a myocardial repolarization latent component in the latent space. The two waveforms obtained by decoding are added together on each lead to reconstruct the repolarization region window signal. The constraint unit is used to apply spatial low-rank constraints, field strength monotonic constraints, and phase-locked constraints to the magnetohydrodynamic artifact latent component, so that its projection on each lead is expressed by the outer product of a spatial mixing vector and a time envelope, its reconstructed waveform energy increases monotonically with the magnitude of the static magnetic field strength, and its time envelope is most coherent with the hemodynamic substitution signal during systole. The constraint unit also applies lead spatial structure constraints and electrical temporal coherence constraints to the myocardial repolarization latent component, so that its projection falls into the subspace spanned by the ECG lead transformation matrix, and its temporal phase is coherent with the QRS electrical activity of the same cardiac cycle. The classification unit is used to extract diagnostic features from the decoupled myocardial repolarization hidden component and classify arrhythmias.
