Lightweight abnormal heart rhythm detection method

By employing inverted residual structures and hybrid feature extraction techniques, along with a hybrid feature modulation attention module and a multi-task learning framework, this approach addresses the issues of insufficient local temporal feature capture and unidirectional guidance from knowledge distillation in existing lightweight abnormal heart rhythm detection models, thereby achieving efficient abnormal heart rhythm detection.

CN120959755APending Publication Date: 2025-11-18GUANGDONG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511250253.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-03
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

In existing lightweight abnormal heart rhythm detection models, the attention module fails to effectively capture the local temporal features of ECG signals, the one-way guidance of knowledge distillation technology limits the improvement of student network performance, and the lack of dynamic evaluation mechanism in ensemble learning affects detection accuracy and computational efficiency.

Method used

An inverted residual structure and a hybrid feature modulation attention module are used to extract local, non-local, and global information. Combined with a multi-task learning and ensemble learning knowledge distillation framework, the student network is optimized through dynamic weight fusion and imitation loss.

Benefits of technology

It significantly improves the accuracy and computational efficiency of abnormal heart rhythm detection, reduces floating-point operations, enhances the quality of feature representation, and balances detection accuracy and computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120959755A_ABST
    Figure CN120959755A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight abnormal heart rhythm detection method, which comprises the following steps of: preprocessing a data set, including data consistency processing and noise removal processing; in a single classification task stage, the provided ECGEMO-Net needs to be trained, local, non-local and global information of the ECG is effectively modulated and mixed through an inverted residual structure and a mixed feature modulation attention module, key features of abnormal heart rhythms are highlighted, and redundant information is weakened. In the multi-task stage, an auxiliary task of reconstructing a 12-lead signal by a 3-lead signal is introduced while abnormal heart rhythm detection is carried out in the training stage, and the performance gap between the 12-lead ECG and a few-lead model is reduced. In the model compression stage, a three-lead input model under a multi-task framework is used as a teacher model, model simplification is performed on the teacher model to construct a student model, knowledge of the teacher model is taught to the student model, and the calculation complexity is reduced while the classification performance of the student model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of abnormal heart rhythm detection, and particularly relates to a lightweight abnormal heart rhythm detection method. BACKGROUND

[0002] The attention modules such as SE, MLCA and GRN added in the existing lightweight abnormal heart rhythm detection model only consider the overall relationship between channels, and fail to capture the local timing features inside each channel. MLCA introduces local timing information through local pooling, and is further divided into global and local branches, thereby making up for the limitations of SE to some extent. However, the local branch of MLCA is redundant, and both MLCA and SE only contain first-order information, without utilizing the second-order information in the ECG signal which is more representative. GRN is used to solve the competition problem between feature channels caused by lateral inhibition, and the features are aggregated and uniformly processed through L2 norm, but the L2 norm decoupling may form a channel attention with stronger representation ability.

[0003] The existing knowledge distillation technologies such as multi-label knowledge distillation MLD based on logical output and knowledge distillation NORM based on many-to-one feature matching, MLD performs distillation by minimizing the difference between the logits of the teacher and student networks, but may cause the student network to excessively imitate the teacher output and ignore the class distinguishability of abnormal heart rhythms. NORM can effectively transfer the rich features of the teacher network through fine-grained alignment through feature matching, but excessively relies on the guidance of the teacher features and fails to utilize the potential guiding role of the feature maps of the student network itself. Both of them only guide the student network from the teacher network in a single direction, and cannot fully utilize the feature correlation between the teacher network and the student network. The existing related ensemble learning technologies only simply add or linearly combine the network output features through weighting, which cannot fully exploit the complex nonlinear relationship between the features and lacks a dynamic evaluation mechanism for the importance of the features, thereby limiting the effect of knowledge fusion. SUMMARY

[0004] To solve the above technical problems, the present application provides a lightweight abnormal heart rhythm detection method, which reduces the number of ECG leads while considering the calculation efficiency and detection accuracy.

[0005] To achieve the above purpose, the present application provides a lightweight abnormal heart rhythm detection method, which comprises the following steps:

[0006] The input ECG signal is preprocessed, including resampling to 100Hz, unifying the signal length, removing noise interference, and selecting I, II and V1 leads as input;

[0007] The ECG features are extracted through an inverted residual structure, in which a hybrid feature modulation attention module is inserted, which performs the following operations:

[0008] S1. Extract local information from the electrocardiogram signal through local average pooling;

[0009] S2. Divide local information into global branches and non-local branches;

[0010] S3. Perform global average pooling on global branches and calculate variance on non-local branches to extract second-order information.

[0011] S4. Multiply the local information with the second-order information to generate modulation features, and then fuse them with the global information through anti-pooling.

[0012] Multi-task learning is performed on a shared encoder: the primary task is abnormal rhythm classification, and the secondary task is to reconstruct a 3-lead signal into a 12-lead signal.

[0013] Based on the ensemble learning knowledge distillation framework, the multi-task model is used as the teacher network, and the student network is constructed by halving the number of channels.

[0014] The feature transformation module projects student network features into a high-dimensional space, and dynamically weights and fuses them with teacher network features through the knowledge integration module.

[0015] The student network is optimized using a combination of imitation loss and classification loss.

[0016] Optionally, the data preprocessing process includes:

[0017] Baseline drift was removed using a dual median filter with a first filter window of 200ms and a second filter window of 600ms.

[0018] IIR digital bandstop filters are used to eliminate power frequency interference, with stopband cutoff frequencies of 49Hz and 51Hz.

[0019] A 5-level wavelet transform was applied to suppress electromyographic artifacts, with the wavelet basis function being bior4.4.

[0020] Optional, in the hybrid feature modulation attention module:

[0021] The variance calculation amplifies nonlocal information through linear upsampling;

[0022] The anti-pooling fusion employs global average pooling after channel splicing, and generates dynamic weights through a fully connected layer containing ReLU and Sigmoid.

[0023] Optional, multi-task learning:

[0024] The output features of each stage of the shared encoder are skipped between the decoder and the encoder.

[0025] The decoder employs depthwise separable convolutions, including pointwise convolutions and 1×7 axial depthwise convolutions, with the following formula:

[0026] X BN =BN(PW(X));

[0027] X DW =X BN +DW 1×7 (X BN );

[0028] Y = GELU(PW(X) DW )).

[0029] Optionally, multi-task learning optimization using the FairGrad algorithm includes:

[0030] By maximizing the utility function Dynamically adjust gradient weights;

[0031] Among them, g i Here, is the gradient of the i-th task, d is the update direction vector, α is the parameter for adjusting the fair policy, and B is the gradient of the i-th task. ∈ It is the set of constraints for the update direction, and K is the total number of tasks.

[0032] Optional, the knowledge integration module operations include:

[0033] Feature splicing is performed between student network feature maps and teacher network feature maps;

[0034] Perform global average pooling on the spliced ​​features;

[0035] A dynamic weight matrix is ​​generated through two fully connected layers;

[0036] The enhanced feature representation is obtained by weighting and fusing teacher and student features based on the weight matrix.

[0037] Technical advantages of this invention: This invention proposes a lightweight abnormal heart rhythm detection model, ECGEMO-Net, with a simple main architecture and no complex operators. Simultaneously, the novel lightweight attention module MFMA utilizes three branches to extract subtle features of abnormal heart rhythms from different angles of the ECG signal, efficiently modulating and mixing local, non-local, and global temporal dependency information of the ECG signal. Inspired by GRN, simulating the paralateral inhibition effect of neurons, the L2 norm of the feature channels is decomposed into two global statistics, variance and expectation, which are processed separately to form a channel attention with stronger representational capabilities, enhancing the contrast and selectivity of feature channels. Furthermore, second-order global information normalization is introduced to replace the original channel concatenation and one-dimensional convolution operations of MLCA, significantly reducing floating-point computation while improving the generalization ability of the detection model. ECGEMO-Net significantly reduces floating-point computation, balancing efficiency and accuracy, and reducing computational complexity while ensuring detection accuracy. This invention proposes a knowledge distillation framework based on ensemble learning. The main structure consists of a teacher network and a student network, each extracting its output feature maps. These feature maps are then fused using a KE module to obtain a hybrid feature that simultaneously incorporates feature maps from both the teacher and student networks. The KE module enhances feature selectivity through a dynamic weight allocation mechanism, using learnable weight coefficients to strengthen the preservation of key features for abnormal heart rhythm detection while suppressing interference from noise and irrelevant features, significantly improving the quality of feature representation. Finally, the hybrid feature is matched and aligned with the student network features, transferring knowledge from the teacher network to the student network. This knowledge transfer allows the student network to acquire richer and more comprehensive teacher knowledge in addition to its existing knowledge, thereby improving the performance of the student model. Attached Figure Description

[0038] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0039] Figure 1 This is a schematic flowchart of a lightweight abnormal heart rhythm detection method according to an embodiment of the present invention;

[0040] Figure 2 This is a schematic diagram of the model structure of the shared encoder ECGEMO-Net according to an embodiment of the present invention, wherein (a) is the main structure of ECGEMO-Net, (b) is the main structure of iRMB, (c) is the main structure of iRMB combined with MFMA, and (d) is the MFMA architecture.

[0041] Figure 3 This is a schematic diagram of the main structure of the knowledge distillation framework based on ensemble learning in an embodiment of the present invention. Detailed Implementation

[0042] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0043] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0044] like Figure 1 As shown, this embodiment provides a lightweight method for detecting abnormal heart rhythms, including:

[0045] The dataset is preprocessed, including data consistency processing and noise removal.

[0046] In the single classification task stage, the proposed ECGEMO-Net needs to be trained. Through the inverted residual mobile block (iRMB) and the proposed mixed feature-modulated attention (MFMA) module, the local, non-local and global information of ECG is effectively modulated and mixed to highlight the key features of abnormal heart rhythms and reduce redundant information.

[0047] In the multi-task phase, while performing abnormal heart rhythm detection during the training phase, an auxiliary task of reconstructing 12-lead signals from 3-lead signals is introduced to reduce the performance gap between 12-lead ECG and models with fewer leads.

[0048] In the model compression stage, the 3-lead input model under the multi-task framework is used as the teacher model, and it is simplified to construct the student model. The knowledge of the teacher model is transferred to the student model, which improves the classification performance of the student model while reducing the computational complexity.

[0049] Specifically, the implementation process of this embodiment includes the following steps:

[0050] Step 1: Data Preparation

[0051] The dataset used was the Tianchi Hefei High-tech Cup dataset (hereinafter referred to as the HF dataset) and the 2018 China Physiological Signal Challenge dataset (hereinafter referred to as the CPSC dataset). The HF dataset covers 34 different disease categories, with a total of 29,995 8-lead ECG records. Each signal in this dataset was sampled at a frequency of 500Hz, and the recording duration was 10 seconds. The CPSC dataset covers 9 different disease categories, with a total of 6,877 12-lead ECG records. Each signal in this dataset was also sampled at a frequency of 500Hz, but the recording duration varied, with the longest record being 60 seconds and the shortest being 6 seconds. All ECG records were randomly divided into training, validation, and test sets in a ratio of 8:1:1. The ECG records for the training, validation, and test sets were collected from different subjects.

[0052] Step 2: Data Preprocessing

[0053] Preprocess the HF dataset and CPSC dataset prepared in step 1.

[0054] Step 2.1: Data Resampling

[0055] All ECG recordings were resampled to 100Hz using Fast Fourier Transform.

[0056] Step 2.2: Data Consistency Processing

[0057] To ensure the completeness and consistency of the experimental data, the duration of each ECG record in the CPSC dataset was standardized to 10 seconds. ECG records shorter than 10 seconds were padded with zeros, while those longer than 10 seconds were cropped. For the HF dataset, the original 8-lead data was converted to 12-lead data according to the official calculation formula, as follows:

[0058] III = II - I;

[0059]

[0060] Step 2.3: Data noise removal

[0061] To eliminate baseline drift, power frequency interference, and EMG artifacts in the signal, a dual median filtering method was used to remove baseline drift. The window length of the first filter was set to 200 ms, and the window length of the second filter was set to 600 ms. An IIR digital bandstop filter was designed using the bilinear transform method to remove power frequency interference from the signal, with stopband cutoff frequencies of 49 Hz and 51 Hz. A 5-level wavelet transform was used to suppress EMG artifacts, with the wavelet basis function being bior4.4.

[0062] Step 2.4: ECG Lead Selection

[0063] Select leads I, II, and V1 as model inputs.

[0064] Step 3: Training and Preparation of ECGEMO-Net

[0065] Step 3.1: ECGEMO-Net Main Structure Design

[0066] The main structure of ECGEMO-Net consists of iRMB, MFMA, and a classification layer, such as Figure 2 As shown in (a). Specifically, firstly, the network performs segment encoding on the preprocessed ECG, then extracts rich feature information through four stages of modules composed of iRMB and MFMA to support different downstream tasks, and finally obtains the output through a classification layer. For iRMB, as shown in (a). Figure 2 As shown in (b), this structure allows for the insertion of various efficient operators F. Through this structure, the MFMA proposed in this invention is inserted, cleverly combining iRMB and MFMA, as follows: Figure 2 As shown in (c), this backbone network significantly improves feature representation capabilities while further reducing computational complexity. The specific feature extraction process of iRMB is as follows, processing input features X∈R. C×N C represents the number of channels, and N represents the sequence length. The input feature map is processed by a point convolution group Conv with a channel input / output ratio of λ. e To expand the dimensions and increase the richness of feature information, the formula is as follows:

[0067] X e =Conv e (X)∈R λ×C×N ;

[0068] Then, the efficient operator F is used for deep feature extraction, as shown in the following formula:

[0069] X f =F(X) e )∈R λ×C×N ;

[0070] Finally, it is passed through a group of point convolutions with an inverted channel input / output ratio of λ. s By shrinking the channel dimension, we can enhance important features while reducing parameters and improving computational efficiency, as shown in the following formula:

[0071] X s =Conv s (X f )∈R C×N ;

[0072] Finally, these features are passed to the next stage for in-depth feature extraction.

[0073] Step 3.2: Design of the Hybrid Feature Modulation Attention Module

[0074] MFMA architecture such as Figure 2 As shown in (d), it mainly consists of three branches. The first branch extracts local ECG information through local average pooling. Based on this, the second branch extracts global ECG information through global average pooling. The third branch introduces second-order information of the ECG, that is, obtains non-local ECG information through variance calculation. Specifically, given an input ECG feature map X... in ∈R C×N Where C represents the number of channels and N represents the sequence length. First, X in Local information F is extracted using local average pooling. LAP ∈R C×ks , where ks represents the number of segments in sequence length N. Next, we will examine F... LAP Perform channel splitting operation:

[0075] {F NL ,F GL}=S(||F LAP ||2);

[0076] Where S(·) represents the channel splitting operation, F NL As input for variance calculation, F GL As input for global average pooling. Let F LAP =z i +μ, for ||F LAP The specific formula is as follows:

[0077]

[0078] and so:

[0079]

[0080] That is, F LAP The L2 norm can be divided into F LAP Standard deviation and F LAP The average value of F. Next, F will be... GL Global information F is extracted through global average pooling followed by one-dimensional convolution and depooling. GAP ∈R C×1 F NL After variance calculation σ 2 (F LAP The nonlocal information F is obtained by amplifying it through a linear upsampling operation. VAR In order to modulate local and non-local information, FVAR and F LAP Multiplication yields the modulation feature F M Ultimately, the modulation feature F M With global information F GAP The output feature X is obtained by fusing the features through unpooling. OUT ∈R C×N .

[0081] Step 3.3: Design of ECGEMO-Net Loss Function

[0082] In multi-label classification tasks, given a sample, the model needs to predict a set of classes. The loss function used to train ECGEMO-Net is BCEWithLogitsLoss, which combines the sigmoid activation function and the binary cross-entropy (BCE) loss function. This loss function can independently evaluate the probability of each label, and its formula is as follows:

[0083]

[0084] Where N is the total number of samples, y i x is the true label of the i-th sample. i σ(x) is the original output prediction value of the i-th sample before the Sigmoid activation function is applied to the model. i This is the output after applying the Sigmoid activation function. The Adam optimizer is used during training, trained via backpropagation.

[0085] Step 4: Training and preparation of the ECG lead reconstruction framework based on multi-task learning

[0086] Step 4.1: Main Structure Design of ECG Lead Reconstruction Framework Based on Multi-Task Learning

[0087] The main architecture of the ECG lead reconstruction framework based on multi-task learning is a shared encoder-decoder architecture, such as... Figure 1As shown, the task is divided into an ECG classification task and a lead reconstruction task. During the training phase, an auxiliary task of reconstructing a 12-lead signal from a 3-lead signal is introduced while detecting abnormal heart rhythms. In the lead reconstruction stage, a lightweight decoder is introduced to assist in reconstructing the 12-lead ECG. This decoder can be removed during the inference phase, effectively avoiding additional computational load. The shared encoder is ECGEMO-Net mentioned in step 3, with each stage acting as an encoder and skipping connections to the decoder. The output features of each stage of ECGEMO-Net are skipped connections. The decoder recovers the feature resolution through upsampling, and then uses skip connections to directly transmit the high-resolution features in the encoder to the corresponding layer of the decoder, effectively compensating for the loss of subtle features during feature extraction at each stage of ECGEMO-Net. This multi-task learning framework adopts the principle of depthwise separable convolution, mainly using point convolution and 1×7 axial depthwise convolution, as shown in the following formula:

[0088] X BN =BN(PW(X));

[0089] X DW =X BN +DW 1×7 (X BN );

[0090] Y = GELU(PW(X) DW ));

[0091] Here, X represents the input feature, Y represents the output feature, and PW, BN, DW, and GELU are the pointwise convolution, batch normalization, depthwise convolution, and GELU activation functions, respectively. The use of depthwise convolution reduces the training cost of the model, and the wide receptive field of a 1×7 depthwise convolution is particularly suitable for capturing subtle ECG features. Through this strategy, even relying on only three leads, knowledge transfer between tasks is achieved through a shared encoder, enabling the learning of complete multi-view information of the ECG. This significantly improves the performance of the few-lead ECG model in handling abnormal heart rhythm detection tasks without sacrificing operational convenience and computational efficiency.

[0092] Step 4.2: Design and Optimization of Loss Function for ECG Lead Reconstruction Framework Based on Multi-Task Learning

[0093] Lead reconstruction can be viewed as a regression problem, where the goal is to predict or reconstruct an accurate ECG signal. This invention uses the mean squared error loss function to measure the accuracy of the predicted ECG signal, as shown in the following formula:

[0094]

[0095] Where n refers to the number of samples, y iIt represents the true value of the i-th sample. This is the model's prediction for the i-th data point. The specific formula for the total cost function of the lead reduction method based on multi-task learning is as follows:

[0096]

[0097] In multi-task learning, gradient conflict is a common problem. To address this, this invention employs the FairGrad algorithm, a multi-task optimization algorithm. The algorithm aims to maximize the utility function by dynamically adjusting the gradient weights of each task to achieve fair resource allocation. The specific formula is as follows:

[0098]

[0099] Among them, g i Here, is the gradient of the i-th task, d is the update direction vector, α is the parameter for adjusting the fair policy, and B is the gradient of the i-th task. ∈ It is the set of constraints for the update direction, and K is the total number of tasks.

[0100] Step 5: Training and preparation of the knowledge distillation framework based on ensemble learning

[0101] Step 5.1: Design of the main structure of the knowledge distillation framework based on ensemble learning

[0102] The main structure of the knowledge distillation framework based on ensemble learning consists of a teacher network and a student network, such as... Figure 3 As shown, the teacher network uses the ECGEMO-Net obtained in step 4, but its channel count is halved to serve as the student network. During training, a Feature Transform (FT) module is inserted after the last convolutional layer of the student network. The FT module consists of two linear layers. The first linear layer projects the representation of the student network into a feature space with N times the number of feature channels as the teacher network. The second linear layer then compresses the expanded output back into the original feature space. The specific formula for the FT module is as follows:

[0103] F se =W se *F s ;

[0104] F sc =W sc *F se ;

[0105] Among them, F s It is the output feature map of the student network, F se It is the feature after passing through the first linear layer (expanded layer), F scIt is a feature after passing through the second linear layer (contraction layer), W se and W sc These are two linear transformation matrices. On the other hand, the expanded feature map F is obtained. te The expanded student network feature map F se With F te Adaptive knowledge fusion is performed using the Knowledge Ensemble Module (KE) to obtain a hybrid feature F that simultaneously contains student network feature maps and teacher network feature maps. fused The workflow of the KE module is as follows:

[0106] First, the student network feature map F se Teacher network feature graph F te First, feature concatenation is performed. Second, the concatenated features are compressed using global average pooling. Next, an activation network with two fully connected layers (using ReLU activation in the middle layer and Sigmoid activation in the output layer) is used to perform a non-linear transformation on the compressed features, generating dynamic weight matrices W1 and W2 representing the importance of the features. Finally, teacher and student features are weighted and fused according to the weight matrices to obtain the enhanced feature representation F. fused .

[0107] F gap =GAP(CAT(F) se F te ));

[0108] F fused =σ(W2δ(W1F) gap ));

[0109] Where CAT(·) represents the matrix concatenation operator, GAP(·) represents global average pooling, σ and δ represent the Sigmoid and ReLU activation functions, respectively, and W1 and W2 are the weight matrices of the two fully connected layers. F fused It contains richer knowledge, prompting students to develop network feature graphs F se With mixed features F avg Feature matching is performed to transfer the knowledge of the teacher network to the student network, thereby achieving knowledge transfer. In addition to mastering its own original knowledge, the student network further acquires richer and more comprehensive teacher knowledge, thus improving the performance of the student model.

[0110] Step 5.2: Loss Function Design and Optimization for Knowledge Distillation Framework Based on Ensemble Learning

[0111] The loss function used in this invention combines imitation loss and classification loss. Imitation loss, by measuring the deviation between the student network output and the teacher network output, guides the student network to more accurately replicate the teacher network's decision-making behavior. The specific formula is as follows:

[0112]

[0113] in, F is the i-th segment of the characteristics of the student network. fused It is a mixture of features from both the student and teacher network feature maps, where n is the number of segments. On the other hand, the classification loss focuses on the student network's own learning and understanding of the given task. The specific formula for the total cost function of the knowledge distillation framework based on ensemble learning is as follows:

[0114]

[0115] Experimental results and analysis of the present invention:

[0116] (1) To verify the classification performance and lightweight characteristics of the proposed ECGEMO-Net, ECGEMO-Net was compared with the best lightweight ECG classification models available today. ECGEMO-Net was trained on the HF and CPSC datasets using 3-lead and 12-lead ECG, respectively. The F1 score, recall, accuracy, inference latency, floating-point computation, and parameter count of each model are shown in Tables 1 and 2. As can be seen from the tables, ECGEMO-Net achieved F1 scores of 89.57% and 85.71% on the HF and CPSC datasets respectively using 12-lead ECG, and 89.76% and 84.27% on the 3-lead ECG. Compared to models trained under the same conditions, ECGEMO-Net achieved the best classification performance in both cases. On the other hand, ECGEMO-Net's inference latency on the HF and CPSC datasets using 12-lead ECG was 5.423 ms and 5.333 ms, respectively, while the inference latency using 3-lead ECG was 5.166 ms, 5.333 ms, and 5.163 ms, respectively. ECGEMO-Net achieved the lowest inference latency with 3-lead ECG input. Although ECGEMO-Net underperformed ECG-BNN with 12-lead ECG input, its classification performance was significantly lower, demonstrating that ECGEMO-Net maintains high classification performance while keeping inference time and computational complexity low.

[0117] Table 1

[0118]

[0119] Table 2

[0120]

[0121]

[0122] (2) To verify the classification performance and lightweight nature of the attention module MFMA proposed in this invention, MFMA was compared with current top-tier attention modules, and experiments without the attention module were also compared. Specific results are shown in Tables 3 and 4. The results show that MFMA achieved the highest F1 scores, at 89.76% and 84.27%, respectively. Furthermore, the F1 scores obtained with MFMA compared to ECGEMO-Net without the attention module improved by 0.49% and 0.35% on both datasets, respectively, indicating that ECGEMO-Net with the attention module significantly improved classification performance. On the other hand, MFMA has the lowest computational complexity among all results, which sufficiently demonstrates its lightweight nature.

[0123] Table 3

[0124]

[0125] Table 4

[0126]

[0127]

[0128] (3) To mitigate the negative effects of gradient conflicts in multi-task learning, this invention applies various multi-task optimization strategies to the ECG lead reconstruction framework based on multi-task learning, and compares the classification and reconstruction performance. Specific experimental results are shown in Tables 5 and 6. As can be seen from the tables, the FairGard multi-task optimization algorithm achieves the best classification performance among other multi-task optimization algorithms on the ECG lead reconstruction framework based on multi-task learning, obtaining F1 scores of 90.08% and 84.45% on the HF and CPSC datasets, respectively. Simultaneously, the reconstruction performance is also the best. On the other hand, compared to the single-task results with only a classification task, the F1 score obtained by the ECG lead reconstruction framework based on multi-task learning is improved by 0.32% and 0.18%, respectively. This demonstrates that the ECG lead reconstruction framework based on multi-task learning proposed in this invention can effectively balance classification and reconstruction tasks.

[0129] Table 5

[0130]

[0131] Table 6

[0132]

[0133]

[0134] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A lightweight method for detecting abnormal heart rhythms, characterized in that, include: The input ECG signal is preprocessed, including resampling to 100Hz, standardizing signal duration, removing noise interference, and selecting leads I, II, and V1 as input; ECG features are extracted using an inverted residual structure, into which a hybrid feature modulation attention module is inserted. This module performs the following operations: S1. Extract local information from the electrocardiogram signal through local average pooling; S2. Divide local information into global branches and non-local branches; S3. Perform global average pooling on global branches and calculate variance on non-local branches to extract second-order information. S4. Multiply the local information with the second-order information to generate modulation features, and then fuse them with the global information through anti-pooling. Multi-task learning is performed on a shared encoder: the primary task is abnormal rhythm classification, and the secondary task is to reconstruct a 3-lead signal into a 12-lead signal. Based on the ensemble learning knowledge distillation framework, the multi-task model is used as the teacher network, and the student network is constructed by halving the number of channels. The feature transformation module projects student network features into a high-dimensional space, and dynamically weights and fuses them with teacher network features through the knowledge integration module. The student network is optimized using a combination of imitation loss and classification loss.

2. The lightweight abnormal heart rhythm detection method as described in claim 1, characterized in that, The data preprocessing process includes: Baseline drift was removed using a dual median filter with a first filter window of 200ms and a second filter window of 600ms. IIR digital bandstop filters are used to eliminate power frequency interference, with stopband cutoff frequencies of 49Hz and 51Hz. A 5-level wavelet transform was applied to suppress electromyographic artifacts, with the wavelet basis function being bior4.

4.

3. The lightweight abnormal heart rhythm detection method as described in claim 1, characterized in that, In the hybrid feature modulation attention module: The variance calculation amplifies nonlocal information through linear upsampling; The anti-pooling fusion employs global average pooling after channel splicing, and generates dynamic weights through a fully connected layer containing ReLU and Sigmoid.

4. The lightweight abnormal heart rhythm detection method as described in claim 1, characterized in that, Multi-task learning in progress: The output features of each stage of the shared encoder are skipped between the decoder and the encoder. The decoder employs depthwise separable convolutions, including pointwise convolutions and 1×7 axial depthwise convolutions, with the following formula: X BN =BN(PW(X)); X DW =X BN +DW 1×7 (X BN ); Y=GROUND(PW(X DW ))。 5. The lightweight abnormal heart rhythm detection method as described in claim 1, characterized in that, Multi-task learning optimization using the FairGrad algorithm includes: By maximizing the utility function Dynamically adjust gradient weights; Among them, g i Here, is the gradient of the i-th task, d is the update direction vector, α is the parameter for adjusting the fair policy, and B is the gradient of the i-th task. ∈ It is the set of constraints for the update direction, and K is the total number of tasks.

6. The lightweight abnormal heart rhythm detection method as described in claim 1, characterized in that, The knowledge integration module operation includes: Feature splicing is performed between student network feature maps and teacher network feature maps; Perform global average pooling on the spliced ​​features; A dynamic weight matrix is ​​generated through two fully connected layers; The enhanced feature representation is obtained by weighting and fusing teacher and student features based on the weight matrix.