Magnetocardiogram analysis method and device based on federated learning, equipment and medium
By using a federated learning architecture and a shared feature backbone network of a masked autoencoder model, combined with incremental optimization of a low-rank adapter module, the problems of data silos and unlabeled data utilization in magnetocardiography analysis are solved. This enables efficient and secure model updates and integration of new tasks, and improves the model's generalization ability and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 杭州极弱磁场国家重大科技基础设施研究院
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-19
AI Technical Summary
Existing magnetocardiogram (MCC) analysis techniques suffer from data silos, resulting in limited data volume at a single center, making it difficult to train deep learning models with strong generalization ability and high robustness. Existing methods cannot effectively utilize massive amounts of unlabeled data, and when adding new disease categories, the entire model needs to be retrained, which consumes huge computational resources and reduces the diagnostic ability of old categories.
A federated learning architecture is adopted, which trains the model using magnetocardiogram data stored locally in multiple medical institutions. The model is trained using unlabeled data as a shared feature backbone network. Independent task heads are configured on the frozen backbone network, and low-rank adapter modules are inserted to perform joint optimization for new tasks, thereby achieving safe incremental updates.
By breaking down data silos and making full use of multi-center data, we can train models with strong generalization ability and high robustness, reduce computational resource consumption, and maintain the diagnostic ability of old categories when introducing new tasks, thus achieving safe and efficient incremental learning.
Smart Images

Figure CN121964178B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of magnetocardiogram (MCG) analysis technology, specifically to a MCG analysis method, apparatus, device, and medium based on federated learning. Background Technology
[0002] Magnetocardiography (MCG), as a highly promising non-contact cardiac function testing technology, has shown significant advantages in precision diagnosis and treatment scenarios such as early identification of arrhythmias, screening for coronary heart disease, and localization of cardiac diseases, thanks to its millisecond-level high temporal resolution and high sensitivity to weak magnetic field activity of myocardial cells.
[0003] However, despite the promising future of MCG technology, the practical application of artificial intelligence for intelligent analysis still faces the following severe technical challenges, which seriously restrict its clinical translation and further improvement of model performance:
[0004] First, medical data is highly sensitive personal privacy information. MCG data between different medical centers (hospitals) cannot be physically aggregated and shared, resulting in data silos. This often leads to a limited amount of data in a single center, making it difficult to train deep learning models with strong generalization ability and high robustness.
[0005] Secondly, in medical image analysis, training high-performance deep learning models typically relies on large amounts of high-quality data manually labeled by experts (i.e., supervised learning). However, MCG signals are complex, and clinical annotation requires meticulous interpretation by experienced cardiovascular experts, which is time-consuming, labor-intensive, and extremely costly. In actual clinical practice, the vast majority of the accumulated MCG data is unlabeled. Existing supervised learning-based intelligent analysis methods struggle to effectively utilize this massive amount of unlabeled data, resulting in insufficient training samples and limiting the model's feature extraction capabilities.
[0006] Finally, the real-world clinical environment is dynamic, with new categories of arrhythmias or case types constantly emerging. However, most existing magnetocardiogram (MCC) analysis models are static, meaning they are fixed once trained. When a new disease category needs to be added, traditional methods must retrain the entire model using both new and old data, which not only consumes enormous computational resources but also leads to a significant decline in the diagnostic ability for older categories during the introduction of new knowledge. Summary of the Invention
[0007] In view of this, this application provides a magnetocardiogram analysis method, apparatus, device, and medium based on federated learning. The main purpose is to solve the current problems of data silos, which often result in limited data volume in a single center, making it difficult to train deep learning models with strong generalization ability and high robustness; existing intelligent analysis methods based on supervised learning cannot effectively utilize massive amounts of unlabeled data, resulting in insufficient training samples for the model and limiting the model's feature extraction ability; and when a new disease category needs to be added, traditional methods must retrain the entire model using both new and old data, which not only consumes huge computational resources but also leads to a significant decline in the diagnostic ability of old categories when introducing new knowledge.
[0008] Firstly, this application provides a magnetocardiogram analysis method based on federated learning, including:
[0009] Acquire magnetocardiogram (MCC) data stored locally by multiple medical institutions, including labeled MCC data and unlabeled MCC data;
[0010] The masked autoencoder model is trained locally using the unlabeled magnetocardiogram data, and the encoder of the trained masked autoencoder model is used as a shared feature backbone network, which is then frozen.
[0011] For the preset arrhythmia analysis task, a corresponding independent task head is configured on the frozen shared feature backbone network, and the independent task head is trained using the labeled magnetocardiogram data. After training, the original logical values output by the independent task head for local representative samples are cached as reference logical values.
[0012] When a new task is introduced, a corresponding new task head is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The new task supervision loss function value is calculated using the new task data, and the forgetting-free loss function value is calculated using the locally synthesized MCG template and the cached reference logic value. Based on the new task supervision loss function value and the forgetting-free loss function value, the inserted low-rank adapter module, the new task head, and the independent task head are jointly optimized.
[0013] The optimized low-rank adapter module parameters, the new task header parameters, and the independent task header parameters are uploaded to the federated coordination server for aggregation and distribution, thereby enabling secure incremental updates of the federated continuous learning model.
[0014] Secondly, this application provides a magnetocardiogram analysis device based on federated learning, comprising:
[0015] The acquisition module is used to acquire magnetocardiogram (MCC) data stored locally by multiple medical institutions, including labeled MCC data and unlabeled MCC data.
[0016] The first training module is used to train the masked autoencoder model locally using the unlabeled magnetocardiogram data, and to use the encoder of the trained masked autoencoder model as a shared feature backbone network, and to freeze the shared feature backbone network.
[0017] The second training module is used to configure corresponding independent task heads on the frozen shared feature backbone network for a preset arrhythmia analysis task, train the independent task heads using the labeled magnetocardiogram data, and cache the original logical values output by the independent task heads for local representative samples as reference logical values after training is completed.
[0018] The update module is used to configure a corresponding new task head for the new task when a new task is introduced, insert a low-rank adapter module into the frozen shared feature backbone network, calculate the new task supervision loss function value using the new task data, calculate the forgetting-free loss function value using the locally synthesized MCG template and the cached reference logic value, and jointly optimize the inserted low-rank adapter module, the new task head, and the independent task head based on the new task supervision loss function value and the forgetting-free loss function value.
[0019] The upload module is used to upload the optimized low-rank adapter module parameters, the new task header parameters, and the independent task header parameters to the federated coordination server for aggregation and distribution processing, thereby enabling secure incremental updates of the federated continuous learning model.
[0020] Thirdly, this application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the computer program to implement the magnetocardiogram analysis method based on federated learning described in the first aspect.
[0021] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the magnetocardiogram analysis method based on federated learning described in the first aspect.
[0022] By employing the above technical solutions, this application provides a magnetocardiogram (MCG) analysis method, apparatus, device, and medium based on federated learning. Compared with existing technologies, this application can acquire MCG data stored locally by multiple medical institutions, including labeled and unlabeled MCG data; train a masked autoencoder model locally using the unlabeled MCG data, and use the encoder of the trained masked autoencoder model as a shared feature backbone network, then freeze the shared feature backbone network; for a preset arrhythmia analysis task, configure corresponding independent task heads on the frozen shared feature backbone network, train the independent task heads using labeled MCG data, and cache the independent task heads after training. The task head uses the original logical values output by the local representative samples as reference logical values. When a new task is introduced, a corresponding new task head is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The new task supervision loss function value is calculated using the new task data, and the forgetting-free loss function value is calculated using the locally synthesized MCG template and the cached reference logical values. The inserted low-rank adapter module, the new task head, and the independent task head are jointly optimized based on the new task supervision loss function value and the forgetting-free loss function value. The optimized parameters of the low-rank adapter module, the new task head, and the independent task head are uploaded to the federated coordination server for aggregation and distribution processing, realizing the safe incremental update of the federated continuous learning model.
[0023] Using the above technical solution, this application adopts a federated learning approach, involving multiple medical institutions. Each medical institution stores its magnetocardiogram (MCC) data locally, which is then aggregated and distributed through a federated coordination server. This approach breaks down data silos, enabling collaborative use of data from different medical institutions. It effectively integrates data resources from multiple centers, thus solving the problem of limited data volume from a single center. This allows for the acquisition of richer and more diverse data for model training, contributing to the development of deep learning models with strong generalization capabilities and high robustness.
[0024] This application utilizes unlabeled magnetocardiogram (MCC) data to locally train a masked autoencoder (MAE) model. A masked autoencoder is a self-supervised learning model that can learn useful feature representations from data without manual annotation. This approach fully leverages the information in massive amounts of unlabeled data, using the encoder of the trained MAE model as a shared feature backbone network. This provides a robust foundation for feature extraction in subsequent tasks, overcoming the problem of existing supervised learning-based intelligent analysis methods struggling to effectively utilize massive amounts of unlabeled data, resulting in insufficient training samples and limited feature extraction capabilities.
[0025] This application targets a predefined arrhythmia analysis task, configuring corresponding independent task heads on a frozen shared feature backbone network, and training the independent task heads using labeled magnetocardiogram data. The shared feature backbone network is responsible for extracting general features, while the independent task heads are fine-tuned for specific tasks. This design ensures that different tasks share a certain feature base while allowing for personalized optimization for each task.
[0026] When a new task is introduced, a corresponding new task header is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The low-rank adapter module is a lightweight module that can adaptively adjust the model to meet the needs of the new task without changing most of the parameters of the shared feature backbone network.
[0027] This approach utilizes new task data, locally synthesized MCG templates, and reference logical values to jointly optimize the inserted low-rank adapter module, the new task header, and the independent task headers, updating the parameters of these components. This avoids the need for retraining the entire model using both old and new data, significantly reducing computational resource consumption. Furthermore, since only the parameters relevant to the new task and some independent task headers are updated, the introduction of new knowledge does not significantly degrade the diagnostic capabilities of older categories, achieving incremental learning for the model.
[0028] The optimized low-rank adapter module parameters, new task header parameters, and independent task header parameters are uploaded to the federated coordination server for aggregation and distribution. Through federated learning, various medical institutions can share model update information, further improving the overall performance and generalization ability of the model, and achieving secure incremental updates of the federated continuous learning model.
[0029] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0030] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0031] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 A flowchart illustrating a magnetocardiogram analysis method based on federated learning, provided for an embodiment of this application;
[0033] Figure 2 A schematic diagram of the overall process of a magnetocardiogram analysis method based on federated learning provided in this application embodiment;
[0034] Figure 3 A core training flowchart of a magnetocardiogram analysis method based on federated learning provided in this application embodiment;
[0035] Figure 4 An overall architecture diagram of a magnetocardiogram analysis method based on federated learning provided in this application embodiment;
[0036] Figure 5 An incremental learning flowchart of a magnetocardiogram analysis method based on federated learning is provided for embodiments of this application;
[0037] Figure 6 An incremental learning flowchart for another magnetocardiogram analysis method based on federated learning provided in this application embodiment;
[0038] Figure 7 This is a schematic diagram of a magnetocardiogram analysis device based on federated learning, provided as an embodiment of this application. Detailed Implementation
[0039] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0040] The following description, with reference to the accompanying drawings, describes a federated learning-based magnetocardiogram analysis method, apparatus, device, and medium according to embodiments of this application.
[0041] This application provides a magnetocardiogram (MCC) analysis method, apparatus, device, and medium based on federated learning. The main purpose is to address the current data silo phenomenon, which often results in limited data volume from a single center, making it difficult to train deep learning models with strong generalization ability and high robustness. It also addresses the technical problems of existing supervised learning-based intelligent analysis methods failing to effectively utilize massive amounts of unlabeled data, leading to insufficient training samples and limiting the model's feature extraction capabilities. Furthermore, when adding new disease categories, traditional methods must retrain the entire model using both new and old data, which not only consumes huge computational resources but also significantly reduces the diagnostic capability for old categories when introducing new knowledge.
[0042] like Figure 1 As shown, embodiments of this application provide a magnetocardiogram (MCG) analysis method based on federated learning. This method employs a federated learning architecture with central coordination and edge computing, consisting of multiple client nodes (medical institutions) and a federated coordination server. Through this method, parameter coordination can be achieved via a secure communication layer, ensuring zero out-of-area transmission of original medical data. It utilizes massive amounts of unlabeled data to train general features and supports secure and efficient incremental updates when adding new disease categories. The method includes:
[0043] Step 101: Obtain magnetocardiogram (MCC) data stored locally by multiple medical institutions. The MCC data includes labeled MCC data and unlabeled MCC data.
[0044] For the embodiments of this application, such as Figure 2 As shown, it can be deployed on each client node in participating medical institutions (such as hospitals A, B, C, etc.) as the core unit for local data processing and model training.
[0045] like Figure 3 As shown, the local data storage module can be used to store the magnetocardiogram (MCG) data collected by the institution. This MCG data can include labeled and unlabeled MCG data. Unlabeled MCG data refers to routine MCG records without clinical diagnostic labels; this typically accounts for over 80% of the total data, is easily accessible, and contains rich cardiac physiological information. Labeled MCG data refers to MCG signals marked with clinical diagnostic labels by professional physicians (e.g., labeled as "right ventricular outflow tract premature ventricular contractions," "atrial fibrillation," "normal," and / or three-dimensional pulse source coordinates for localization tasks).
[0046] Magnetocardiogram data can be in the format of multi-channel time series tensors. ,in, This represents the number of time sampling points (typical values: 512–2048, corresponding to approximately 1–4 seconds of heartbeat cycle). The number of magnetic sensor channels (typical value: 30–64, depending on the MCG device model); all data is anonymized before storage, removing direct identifiers such as patient name, identity information, and examination timestamp, retaining only physiological signals and anonymized identity information.
[0047] Step 102: Train the masked autoencoder model locally using unlabeled magnetocardiogram data, and use the encoder of the trained masked autoencoder model as the shared feature backbone network, and freeze the shared feature backbone network.
[0048] The integrated local masked autoencoder (MAE) model can include an encoder and a decoder.
[0049] The encoder can be based on 1D convolution or Transformer structures to extract potential MCG representations;
[0050] The decoder can be a lightweight network that can be used to reconstruct masked MCG segments.
[0051] For the embodiments of this application, such as Figure 3 As shown, local training of a masked autoencoder model using unlabeled magnetocardiogram data can specifically include:
[0052] To force the model to learn deeper features, unlabeled magnetocardiogram (MCC) data can be randomly masked. This masking can include temporal and / or channel-level masks. Temporal masks can randomly cover a preset percentage (e.g., 75%) of time steps along the time axis, with the masked areas replaced by learnable mask tokens. Channel-level masks can randomly block some sensor channels (e.g., 10-20 channels) to simulate different device configurations and enhance the model's robustness to channel loss. The masking percentage... The default value is 0.75, which can be dynamically adjusted according to the signal-to-noise ratio.
[0053] Unlabeled magnetocardiogram data after generating mask and mask index The masked positions are replaced with learnable [MASK] embedding vectors. The masking operation is performed entirely locally without any external intervention.
[0054] Unlabeled magnetocardiogram data after masking The input encoder can be based on context-aware embedding of visible tokens using multi-layer 1D convolutional blocks (Conv1D + LayerNorm + GELU) or a time-series Transformer. ,in, For the embedding dimension (e.g., 512). The number of tokens to be masked, the extracted unlabeled magnetocardiogram (MCC) data features, the concatenation of the extracted unlabeled MCC data features with the mask tokens to recover the complete sequence length, and then inputting it into the decoder of the masked autoencoder model. The decoder is responsible for reconstructing the masked unlabeled MCC data based on partial features and outputting the reconstructed masked unlabeled MCC data. .
[0055] The architecture hyperparameters (number of layers, number of heads, dimensions) of the encoder and decoder are uniformly distributed by the coordination server to ensure cross-center compatibility.
[0056] Reconstructed unlabeled magnetocardiogram data Compared with the original unlabeled magnetocardiogram data Comparisons are made within the masked regions to calculate the reconstructed unlabeled magnetocardiogram data. Compared with the original unlabeled magnetocardiogram data The reconstruction loss (usually mean squared error, MSE) is calculated between the two sides, and the encoder and decoder parameters are updated using the backpropagation algorithm based on the reconstruction loss to complete the local training of the masked autoencoder model. Local training can be performed using mini-batch (batch size = 16–64), multiple iterations (epochs = 5–20), with the AdamW optimizer, for multiple epochs.
[0057] The specific formula for calculating the reconstruction loss value (only for the masked time-channel position) is shown below:
[0058]
[0059] In the formula, To rebuild the losses, This represents the size of the mask location set (the total number of mask locations). Number of sensor channels For the channel, For a point in time, For the position ( The reconstructed signal value, For the position ( The original signal value.
[0060] To integrate knowledge from different centers, the system can perform federated aggregation operations:
[0061] First, each client can extract encoder parameters after completing one or more rounds of local training. (Without uploading decoder parameters), optionally, differential privacy noise (such as Gaussian mechanism) can be added to the gradient or parameters to satisfy... -DP, where DP stands for Differential Privacy. For privacy loss parameters, If the value is non-negative, the encoder parameters will be... (or its gradient) The data is uploaded to the federal coordination server via a TLS 1.3 encrypted channel. The uploaded content does not contain any patient information, raw signals, or decoder parameters; it only contains encoder weight tensors.
[0062] The federated coordination server can receive encoder parameters from each client. The system then performs weighted average aggregation (such as FedAvg or adaptive weighted aggregation) based on the local data size or reconstruction loss value and its corresponding weights of each client to generate global encoder parameters. .
[0063] The standard FedAvg formula is shown below:
[0064]
[0065] In the formula, These are global encoder parameters. For parameter values, For the encoder parameters of the i-th client.
[0066] Adaptive weighted aggregation (recommended), the specific formula is shown below:
[0067]
[0068] In the formula, Let i be the aggregate weight of client i. For the first The center did not label the amount of data. For the first The center did not label the amount of data. For the local reconstruction loss of client i, As a regulating factor, For the local reconstruction loss of client j, For the encoder parameters of the i-th client.
[0069] After aggregation is complete, the federated coordination server can output the global encoder parameters. The encrypted data is distributed to all clients, and each client can load the global encoder parameters and use them as a shared feature backbone network.
[0070] The encoder of the trained mask autoencoder model is used as the shared feature backbone network, including:
[0071] The locally trained encoder parameters are uploaded to the federated coordination server. The server then performs a weighted average aggregation based on the encoder parameters, the local data size of each client, or the reconstruction loss value and its corresponding weights to generate global encoder parameters. To prevent subsequent training from corrupting the general features learned during pre-training, the parameters of the shared feature backbone network can be set to an untrainable state (i.e., all layers' `requires_grad = False` is frozen). This frozen encoder is denoted as the shared feature backbone network. The decoder module serves as the feature extractor for all subsequent supervised tasks (such as classification and localization); it can be discarded or retained for future pre-training expansion; at this point, the supervised pre-training phase ends, and the system enters the multi-task fine-tuning and incremental learning phase.
[0072] Step 103: For the preset arrhythmia analysis task, configure the corresponding independent task head on the frozen shared feature backbone network, train the independent task head using labeled magnetocardiogram data, and after training, cache the original logical values output by the independent task head for local representative samples as reference logical values.
[0073] After self-supervised pre-training and freezing of the shared feature backbone network Afterward, the system enters the supervised multi-task fine-tuning phase. In this phase, an independent lightweight quantum network ("task head") is configured for each type of clinical arrhythmia analysis task. Fine-tuning is performed using only locally labeled data to ensure the model has accurate diagnostic capabilities while maintaining the universality and stability of the backbone feature extractor. The preset arrhythmia analysis tasks may include ventricular premature beat classification, atrial fibrillation detection, and abnormal beat source localization.
[0074] Each task head is connected to a shared feature backbone network. The output terminal receives the extracted context-aware embedding. in, For embedded dimensions, such as 512, for A 3D real vector space, To input data Input into the shared feature backbone network The output results obtained in the middle and later stages are used to make predictions for specific clinical goals. The specific task header is as follows:
[0075] For the classification task of ventricular premature beats (PVC): Configure the first task head. The first task head is a binary classification head, such as a multilayer perceptron network (MLP, usually with 2 fully connected layers), used to input MCG segments and output binary Logits vectors to determine whether ventricular premature beats exist.
[0076] For atrial fibrillation (AF) detection tasks: Configure a second task head. The second task head is a multi-class head, such as a convolutional neural network (CNN) or a long short-term memory network, used to process the embedding of long-term MCG signals (e.g., 10 seconds) (which can be obtained through global average pooling or Transformer [CLS] tokens), identify persistent or paroxysmal atrial fibrillation rhythms, and output a 2D Logits vector.
[0077] For the task of locating abnormal pulsation sources: Configure a third task head. The third task, a regression network or graph neural network (GNN), operates on a predefined cardiac grid (such as a 256-node endocardial grid), receiving not only the output features of the shared feature backbone network, but also... It can also integrate individualized anatomical priors (e.g., heart size, RVOT angle, from electronic medical record metadata), outputting the coordinates of the abnormal pulsation source on the 3D heart model. or probability distribution on discrete endocardial grid ( ), for A 3D real vector space. The fusion method can be to concatenate the vectors and input them into an MLP (usually 3 fully connected layers), or through FiLM modulation.
[0078] Each client utilizes only locally stored labeled magnetocardiogram data, employing a frozen shared feature backbone network as a feature extractor to perform supervised training on the aforementioned independent task heads. During training, the backbone network parameters remain unchanged; only the task head parameters are updated. The number of parameters for all task heads is controlled to <0.5% of the full model size, typically 10k–50k parameters, facilitating rapid training and communication. Training employs mini-batch stochastic gradient descent (batch size = 8–32), with AdamW as the optimizer and a learning rate of [missing information]. Each task head is trained independently and does not affect the others.
[0079] like Figure 4 As shown, optionally, after training is completed, the performance (such as AUC, localization error) is evaluated on the local validation set, and the results are reported to the server for subsequent aggregation weight calculation.
[0080] To maintain the ability to perform old tasks in subsequent incremental learning, the system performs a caching operation after training is complete:
[0081] For each deployed independent task head, a representative sample set can be selected from the local labeled data. For example, select 20-50 high-confidence samples for each class, or select class center samples using a clustering algorithm.
[0082] Input a representative sample set into the currently trained independent task head to obtain the original output vector of the output layer (Logits without Softmax normalization), as shown in the following formula:
[0083]
[0084] In the formula, This is the reference logical value for the k-th class, and it does not contain sensitive information. This is a desensitized MCG fragment (without patient ID or timestamp). For the k-th task header function, For frozen backbone network functions , Index for cardiac arrhythmia categories.
[0085] The original output vector of the output layer is used as a reference logical value and stored in a local cache (ReferenceCache). The cache is only used for subsequent LwF consistency loss calculation and is not uploaded to the server. The total storage overhead is extremely small (<10 MB / center). This mechanism provides an "anchor point of old task behavior" when introducing new categories, which is a key foundation for achieving forgetting-free incremental learning.
[0086] Step 104: When a new task is introduced, configure a corresponding new task head for the new task, insert a low-rank adapter module into the frozen shared feature backbone network, calculate the new task supervision loss function value using the new task data, and calculate the forgetting-free loss function value using the locally synthesized MCG template and the cached reference logical value. Based on the new task supervision loss function value and the forgetting-free loss function value, jointly optimize the inserted low-rank adapter module, the new task head, and the independent task head.
[0087] like Figure 5 As shown, when clinical needs expand and new tasks need to be introduced (such as adding a "left ventricular summit tachycardia" diagnosis), the system initiates an incremental learning process to efficiently integrate new diagnostic capabilities without compromising the performance of existing tasks. The entire process strictly adheres to privacy protection principles, ensuring that raw data does not leave the domain. This step utilizes low-rank adaptation and an improved forgetting-free mechanism to preserve the capabilities of the old model while integrating new capabilities.
[0088] You can configure a new task header (e.g., a new classification header) for the new task, specifically for outputting the prediction results of the new task.
[0089] To enhance the model's adaptability to new tasks while maintaining low communication overhead, low-rank adapter modules (LoRA Modules) are inserted into the frozen shared feature backbone network.
[0090] Specifically, in key layers of the shared feature backbone network Transformer layer (such as the Transformer's multi-head attention projection matrix) Insert the low-rank adapter module in a bypass manner.
[0091] Its parameters are represented as a low-rank update matrix. , For low-rank update matrix, LoRA matrix , LoRA matrix LoRA is only activated and updated during the incremental learning phase, and the backbone weights... Keep frozen.
[0092] For each target weight matrix Inject a trainable low-rank update matrix:
[0093]
[0094] In the formula, To adapt the weight matrix, For the target weight matrix, For low-rank update matrix, LoRA matrix , LoRA matrix , , , For the original weight dimensions, It is of LoRA rank;
[0095] rank ,set up (Typical value, much smaller) );
[0096] Initialize to all zeros. Random initialization;
[0097] During forward propagation, the actual calculation is as follows:
[0098]
[0099] In the formula, Activate the layer output. Input data for the layer, For the target weight matrix, LoRA matrix , LoRA matrix .
[0100] That is, the main trunk remains unchanged, only the bypass fine-tuning item is added.
[0101] like Figure 6 As shown, the process of generating a locally synthesized MCG template includes:
[0102] Retrieve locally labeled old category magnetocardiogram data;
[0103] R-wave alignment was performed on the old category of magnetocardiogram data;
[0104] Clustering and centering of old-category magnetocardiogram data after R-wave alignment or point-by-point averaging is performed to generate a local synthetic MCG template that cannot be used to infer patient identity.
[0105] To achieve forgetting-free constraints without violating privacy (by not storing real old patient data), the system generates synthetic data:
[0106] First, you can obtain locally labeled old category magnetocardiogram data. (e.g., PVC, AF, normal sinus rhythm);
[0107] R-wave alignment was performed on the old category of magnetocardiogram data, and a fixed length (e.g., 1024 points) was truncated to remove metadata such as patient ID, examination date, and device serial number.
[0108] The old category magnetocardiogram data after R-wave alignment are clustered and centroided (e.g., K-means) or averaged pointwise to generate locally synthesized MCG templates that cannot be used to infer patient identity. These templates represent the typical morphology of the old category and do not contain any personally identifiable information (PHI).
[0109] The point-by-point averaging method can be achieved by averaging all samples at different time points, as shown in the following formula:
[0110]
[0111] In the formula, As a synthesis template for category k, Let k be the number of samples in category k. For sample i in The signal value, Indexed by time and channel, Index for cardiac arrhythmia categories.
[0112] Each old category Generate 1–5 synthesis templates The templates are stored locally in the `synthetic_template_cache / ` directory; file format: .npy or .pt, without any PHI (Protected Health Information). The templates are statistical aggregation results and cannot be restored to any individual patient, thus conforming to the GDPR definition of "anonymized data".
[0113] All labeled data in this application were legally collected and anonymized by our institution; the task head training was completed entirely locally; the MCG fragments in the reference cache were anonymized and could not be used to infer the patient's identity; and no clinical labels or original signals left the local environment.
[0114] Through the aforementioned multi-task-head architecture, the system maintains the generality of the backbone while flexibly supporting various clinical needs, and lays a solid foundation for subsequent safe, efficient, and forget-free incremental model updates. This design combines modularity, scalability, and strong privacy protection, meeting the requirements for medical AI productization.
[0115] The model is jointly trained using new task data, locally synthesized MCG templates, and reference logistic values. Updated objects may include: low-rank adapter module parameters, new task header parameters, and existing independent task header parameters (optionally fine-tuned).
[0116] The specific optimization process is as follows:
[0117] Newly labeled task data can be input into the model, and the prediction results can be output through the new task header. The new task supervision loss function value (such as cross-entropy loss) between the model and the true label can be calculated.
[0118] Input the locally synthesized MCG template into the updated local current training model (including the LoRA module);
[0119] Obtain the current output of the independent task heads (i.e., old task heads) in the model for these synthetic templates;
[0120] Calculate the L2 distance or KL divergence between the current output and the reference logical value cached in step 103, and use it as the value of the forgetting-free loss function. This step forces the model to keep the output of the old category consistent with the original while learning new features.
[0121] A total loss function is constructed by weighting the new task supervision loss function value and the no-forgetting loss function value. This total loss function is then used for backpropagation to update the parameters of the low-rank adapter module, the new task header parameters, and the independent task header parameters.
[0122] Specifically, the client can use the newly labeled data and the synthetic template to jointly optimize the model.
[0123] (1) Data preparation: New task data: Locally labeled “LV summit VT” MCG fragment ;in, Let be the feature vector of the i-th new task sample. Let be the label of the i-th new task sample. This represents the number of samples for the new task.
[0124] Synthesize old templates: ,in, ;in, For the synthesized samples belonging to class k, For the collection of old task categories, It is a premature ventricular contraction. Atrial fibrillation, This is a normal heart rhythm.
[0125] (2) Construction of loss function:
[0126] New task supervision loss function value:
[0127]
[0128] In the formula, The new task supervision loss function value, To represent the forward direction of the main trunk with LoRA adaptation, Let cross-entropy be the loss function. For the new task header function, For sample i of the new category, The true label for sample i.
[0129] LwF Consistency Loss (Improved Forgetting-Free Constraint):
[0130]
[0131] In the formula, For LwF consistency loss, For category The set of composite templates ( (its size) The reference logits for the second-stage cache are calculated using L2 distance (or KL divergence). For the collection of old task categories, To input data The output is obtained by inputting into the LoRA-adapted backbone feed;
[0132] Total loss:
[0133]
[0134] In the formula, The total loss for incremental learning. Losses due to new missions, For those without forgetting constraints Consistency loss, Consistency loss weight Control the strength of forgetting inhibition (default) ).
[0135] (3) Parameter update strategy
[0136] Trainable parameters:
[0137] New task leader All parameters;
[0138] All LoRA modules matrix;
[0139] Old mission head (Optional fine-tuning, if set to trainable);
[0140] Freeze parameters:
[0141] backbone network Original weights ;
[0142] Optimizer: AdamW, Learning Rate Train for 10–30 epochs;
[0143] Early stopping mechanism: based on the performance of the new task verification set.
[0144] Step 105: Upload the optimized low-rank adapter module parameters, new task header parameters, and independent task header parameters to the federated coordination server for aggregation and distribution processing, thereby achieving secure incremental updates of the federated continuous learning model.
[0145] The Federated Orchestrator may include a participant management unit, a model version control unit, and an aggregation scheduling and distribution unit.
[0146] The participant management unit is responsible for the registration, authentication, and access control of medical institutions; maintaining the participant list and recording metadata such as equipment type (e.g., MCG model), data scale, and task support capabilities.
[0147] The model version control unit stores the global model version history and may include: the backbone network. The hash fingerprint (fixed after pre-training); parameter snapshots of each task header; the aggregated version of the LoRA adapter; a unique version number is generated for each aggregation (e.g., v2025.06.MAE-LORA-PVC-AF), supporting rollback and auditing.
[0148] The aggregation scheduling and distribution unit can be used to trigger federated training rounds (e.g., weekly or on-demand); receive updatable parameters uploaded by clients (LoRA matrix and task header only, excluding the backbone); generate new global parameters using an adaptive weighted aggregation algorithm (e.g., based on local validation F1 scores and data volume); and encrypt and distribute the updated LoRA and task header parameters to all clients. The server does not store, process, or access any raw MCG signals, patient IDs, or clinical records; it only processes anonymized model parameters.
[0149] All communication between the client and server is encrypted using the TLS 1.3 protocol to prevent man-in-the-middle attacks; Optional differential privacy (DP) can be enabled: Gaussian noise can be added before uploading the LoRA gradient. ;satisfy -DP guarantees further prevent member inference attacks, among which... It follows a Gaussian distribution. Let V be the variance of the Gaussian distribution. It is the identity matrix. For privacy loss parameters, For non-negative numbers, DP stands for Differential Privacy;
[0150] The communication content includes only: model parameters (LoRA, task header); metadata (such as local validation accuracy, data volume); and absolutely no raw signals, images, text reports, or any PHI (Protected Health Information).
[0151] This system strictly adheres to the requirements of the "Personal Information Protection Law of the People's Republic of China," the "Administrative Measures for Information Security of Medical and Health Institutions," HIPAA, and GDPR, achieving the following: Data remains unchanged, model moves: The original MCG data is always retained locally at the medical institution; Minimum necessity principle: Uploaded content is only model parameters, without patient identification; Auditable and traceable: All training operations are logged and support regulatory review; Right to be forgotten is supported: If an institution withdraws, its contributed LoRA / head can be removed without affecting the global backbone.
[0152] In this embodiment, after incremental training is completed, the client can send the new task header. Parameters, all LoRA modules Matrix and metadata: local new category sample size, validation accuracy; encrypted upload to the coordination server; not uploaded: trunk parameters, old task headers, synthesis templates, and original MCG.
[0153] The federal coordination server can collect data from... Updates to each participating center, affecting LoRA parameters and The adaptive weighted average is applied separately, and the specific formula is shown below:
[0154]
[0155] In the formula, These are the global LoRA parameters obtained after adaptive weighted averaging. LoRA parameters for the i-th participating center Weights in global parameter calculation, For the LoRA parameters obtained by the i-th participating center, Let i be the data size of the i-th participating center. Let i be the performance metric for the i-th participating center model. Let j be the performance metric for the j-th participating center model. Let j be the data size of the j-th participating center. The number of participating centers.
[0156] The federated coordination server can aggregate LoRA+ The encrypted data is distributed to all clients; each client loads the new components and completes the model upgrade; the old task header and trunk remain unchanged, and historical functions are maintained without degradation.
[0157] The original MCG, patient ID, and medical images are always stored locally; the uploaded content is only the model parameters (LoRA + task header), with no identifiable information; the synthesized template is a statistically aggregated signal, which meets the anonymization requirements; differential privacy (DP) perturbation is supported (optional); it complies with HIPAA, GDPR, the Personal Information Protection Law of the People's Republic of China, and the Medical and Health AI Application Specification.
[0158] Through the aforementioned refined incremental learning process, the system achieves a unified approach of high-precision new category support, strong forgetting suppression, low communication overhead, and full-process privacy protection, providing a reliable technical path for the continuous clinical evolution of the magnetocardiogram intelligent analysis system.
[0159] In summary, the magnetocardiogram (MCG) analysis method based on federated learning provided in this application, compared with existing technologies, can obtain MCG data stored locally by multiple medical institutions. This MCG data includes both labeled and unlabeled MCG data. A masked autoencoder model is trained locally using the unlabeled MCG data, and the encoder of the trained masked autoencoder model is used as a shared feature backbone network, which is then frozen. For a preset arrhythmia analysis task, a corresponding independent task head is configured on the frozen shared feature backbone network, and the independent task head is trained using labeled MCG data. After training, the independent task head is cached for local generation. The original logical values of the representative sample outputs are used as reference logical values. When a new task is introduced, a corresponding new task head is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The new task supervision loss function value is calculated using the new task data, and the forgetting-free loss function value is calculated using the locally synthesized MCG template and the cached reference logical values. The inserted low-rank adapter module, the new task head, and the independent task head are jointly optimized based on the new task supervision loss function value and the forgetting-free loss function value. The optimized parameters of the low-rank adapter module, the new task head, and the independent task head are uploaded to the federated coordination server for aggregation and distribution processing, realizing the safe incremental update of the federated continuous learning model.
[0160] Using the above technical solution, this application adopts a federated learning approach, involving multiple medical institutions. Each medical institution stores its magnetocardiogram (MCC) data locally, which is then aggregated and distributed through a federated coordination server. This approach breaks down data silos, enabling collaborative use of data from different medical institutions. It effectively integrates data resources from multiple centers, thus solving the problem of limited data volume from a single center. This allows for the acquisition of richer and more diverse data for model training, contributing to the development of deep learning models with strong generalization capabilities and high robustness.
[0161] This application utilizes unlabeled magnetocardiogram (MCC) data to locally train a masked autoencoder (MAE) model. A masked autoencoder is a self-supervised learning model that can learn useful feature representations from data without manual annotation. This approach fully leverages the information in massive amounts of unlabeled data, using the encoder of the trained MAE model as a shared feature backbone network. This provides a robust foundation for feature extraction in subsequent tasks, overcoming the problem of existing supervised learning-based intelligent analysis methods struggling to effectively utilize massive amounts of unlabeled data, resulting in insufficient training samples and limited feature extraction capabilities.
[0162] This application targets a predefined arrhythmia analysis task, configuring corresponding independent task heads on a frozen shared feature backbone network, and training the independent task heads using labeled magnetocardiogram data. The shared feature backbone network is responsible for extracting general features, while the independent task heads are fine-tuned for specific tasks. This design ensures that different tasks share a certain feature base while allowing for personalized optimization for each task.
[0163] When a new task is introduced, a corresponding new task header is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The low-rank adapter module is a lightweight module that can adaptively adjust the model to meet the needs of the new task without changing most of the parameters of the shared feature backbone network.
[0164] This approach utilizes new task data, locally synthesized MCG templates, and reference logical values to jointly optimize the inserted low-rank adapter module, the new task header, and the independent task headers, updating the parameters of these components. This avoids the need for retraining the entire model using both old and new data, significantly reducing computational resource consumption. Furthermore, since only the parameters relevant to the new task and some independent task headers are updated, the introduction of new knowledge does not significantly degrade the diagnostic capabilities of older categories, achieving incremental learning for the model.
[0165] The optimized low-rank adapter module parameters, new task header parameters, and independent task header parameters are uploaded to the federated coordination server for aggregation and distribution. Through federated learning, various medical institutions can share model update information, further improving the overall performance and generalization ability of the model, and achieving secure incremental updates of the federated continuous learning model.
[0166] Based on the above Figure 1 The specific implementation of the method shown in this embodiment provides a magnetocardiogram analysis device based on federated learning, such as... Figure 7 As shown, the device includes: an acquisition module 31, a first training module 32, a second training module 33, an update module 34, and an upload module 35;
[0167] The acquisition module 31 is used to acquire magnetocardiogram (MCC) data stored locally by multiple medical institutions, including labeled MCC data and unlabeled MCC data.
[0168] The first training module 32 is used to train the masked autoencoder model locally using the unlabeled magnetocardiogram data, and to use the encoder of the trained masked autoencoder model as a shared feature backbone network, and to freeze the shared feature backbone network.
[0169] The second training module 33 is used to configure corresponding independent task heads on the frozen shared feature backbone network for a preset arrhythmia analysis task, train the independent task heads using the labeled magnetocardiogram data, and cache the original logical values output by the independent task heads for local representative samples as reference logical values after training is completed.
[0170] Update module 34 is used to configure a corresponding new task head for the new task when a new task is introduced, insert a low-rank adapter module into the frozen shared feature backbone network, calculate the new task supervision loss function value using the new task data, calculate the forgetting-free loss function value using the locally synthesized MCG template and the cached reference logic value, and jointly optimize the inserted low-rank adapter module, the new task head, and the independent task head based on the new task supervision loss function value and the forgetting-free loss function value.
[0171] Upload module 35 is used to upload the optimized low-rank adapter module parameters, the new task header parameters, and the independent task header parameters to the federated coordination server for aggregation and distribution processing, so as to realize the secure incremental update of the federated continuous learning model.
[0172] In a specific application scenario, the first training module 32 can be used to perform random masking processing on the unlabeled magnetocardiogram data. The masking processing includes randomly covering a preset proportion of time steps along the time axis and / or randomly blocking some sensor channels.
[0173] The masked unlabeled magnetocardiogram data is input into the encoder for feature extraction. The extracted unlabeled magnetocardiogram data features are concatenated with the mask marker and then input into the decoder of the masked autoencoder model to reconstruct the masked unlabeled magnetocardiogram data.
[0174] The reconstruction loss value between the reconstructed unlabeled magnetocardiogram data and the original unlabeled magnetocardiogram data in the masked region is calculated, and the encoder parameters and decoder parameters are updated based on the reconstruction loss value to complete the local training of the masked autoencoder model.
[0175] In a specific application scenario, the first training module 32 can be used to upload the encoder parameters trained locally to the federated coordination server, so that the federated coordination server can perform weighted average aggregation processing based on the encoder parameters, the local data scale of each client or the reconstruction loss value and its corresponding weight to generate global encoder parameters.
[0176] The global encoder parameters are used as the shared feature backbone network, and the parameters of the shared feature backbone network are set to an untrainable state.
[0177] In specific application scenarios, the preset arrhythmia analysis tasks include ventricular premature beat classification tasks, atrial fibrillation detection tasks, and abnormal beat source localization tasks; the second training module 33 can be used to configure a first task head for the ventricular premature beat classification task, wherein the first task head is a multilayer perceptron network.
[0178] For the atrial fibrillation detection task, a second task head is configured, which is a convolutional neural network or a long short-term memory network;
[0179] For the task of locating the abnormal pulsation source, a third task head is configured, which is a regression network or a graph neural network.
[0180] In specific application scenarios, the second training module 33 can be used to select a representative sample set from the local labeled data for each deployed independent task head;
[0181] The representative sample set is input into the currently trained independent task head, the original output vector of the output layer is calculated and stored as a reference logical value, and the reference logical value is stored in the local cache library.
[0182] In specific application scenarios, the update module 34 can be used to obtain locally labeled old category magnetocardiogram data;
[0183] The old category of magnetocardiogram data was processed to perform R-wave alignment;
[0184] The old category magnetocardiogram data after R-wave alignment is clustered and centered or averaged point by point to generate the local synthetic MCG template that cannot be used to infer the patient's identity.
[0185] In specific application scenarios, the update module 34 can be used to calculate the new task supervision loss function value output by the new task head through the new task data;
[0186] The locally synthesized MCG template is input into the updated local current training model to obtain the current output of the independent task head. The L2 distance or KL divergence between the current output and the reference logic value is calculated as the value of the forgetting-free loss function.
[0187] A total loss function is constructed based on the weighted sum of the new task supervision loss function value and the forgetting-free loss function value, in order to jointly optimize the inserted low-rank adapter module, the new task head, and the independent task head.
[0188] It should be noted that other corresponding descriptions of the functional units involved in the federated learning-based magnetocardiogram analysis device provided in this embodiment can be found in [reference needed]. Figure 1 The corresponding descriptions in [the document] will not be repeated here.
[0189] Based on the above, Figure 1 Accordingly, this embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. Figure 1 The method shown.
[0190] Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of this application.
[0191] Based on the above, Figure 1 The method shown, and Figure 7 To achieve the above objectives, the present application also provides an electronic device, comprising a storage medium and a processor; the storage medium for storing a computer program; and the processor for executing the computer program to implement the above-described virtual device embodiments. Figure 1 The method shown.
[0192] Optionally, the aforementioned physical devices may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.
[0193] Those skilled in the art will understand that the physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0194] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned entity device, supporting the operation of the federated learning-based magnetocardiogram (MCG) analysis program and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software in the federated learning-based MCG analysis entity device.
[0195] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms, or it can be implemented by hardware. By applying the solution of this embodiment, compared with the prior art, this application can obtain magnetocardiogram (MCG) data stored locally by multiple medical institutions, including labeled MCG data and unlabeled MCG data; use the unlabeled MCG data to train a masked autoencoder model locally, and use the encoder of the trained masked autoencoder model as a shared feature backbone network, and freeze the shared feature backbone network; for a preset arrhythmia analysis task, configure the corresponding independent task head on the frozen shared feature backbone network, and train the independent task head using labeled MCG data, and after training, cache the original output of the independent task head for local representative samples. The initial logical value is used as a reference logical value. When a new task is introduced, a corresponding new task header is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The new task supervision loss function value is calculated using the new task data, and the forgetting-free loss function value is calculated using the locally synthesized MCG template and the cached reference logical value. The inserted low-rank adapter module, the new task header, and the independent task header are jointly optimized based on the new task supervision loss function value and the forgetting-free loss function value. The optimized parameters of the low-rank adapter module, the new task header, and the independent task header are uploaded to the federated coordination server for aggregation and distribution processing, realizing the safe incremental update of the federated continuous learning model.
[0196] Using the above technical solution, this application adopts a federated learning approach, involving multiple medical institutions. Each medical institution stores its magnetocardiogram (MCC) data locally, which is then aggregated and distributed through a federated coordination server. This approach breaks down data silos, enabling collaborative use of data from different medical institutions. It effectively integrates data resources from multiple centers, thus solving the problem of limited data volume from a single center. This allows for the acquisition of richer and more diverse data for model training, contributing to the development of deep learning models with strong generalization capabilities and high robustness.
[0197] This application utilizes unlabeled magnetocardiogram (MCC) data to locally train a masked autoencoder (MAE) model. A masked autoencoder is a self-supervised learning model that can learn useful feature representations from data without manual annotation. This approach fully leverages the information in massive amounts of unlabeled data, using the encoder of the trained MAE model as a shared feature backbone network. This provides a robust foundation for feature extraction in subsequent tasks, overcoming the problem of existing supervised learning-based intelligent analysis methods struggling to effectively utilize massive amounts of unlabeled data, resulting in insufficient training samples and limited feature extraction capabilities.
[0198] This application targets a predefined arrhythmia analysis task, configuring corresponding independent task heads on a frozen shared feature backbone network, and training the independent task heads using labeled magnetocardiogram data. The shared feature backbone network is responsible for extracting general features, while the independent task heads are fine-tuned for specific tasks. This design ensures that different tasks share a certain feature base while allowing for personalized optimization for each task.
[0199] When a new task is introduced, a corresponding new task header is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The low-rank adapter module is a lightweight module that can adaptively adjust the model to meet the needs of the new task without changing most of the parameters of the shared feature backbone network.
[0200] This approach utilizes new task data, locally synthesized MCG templates, and reference logical values to jointly optimize the inserted low-rank adapter module, the new task header, and the independent task headers, updating the parameters of these components. This avoids the need for retraining the entire model using both old and new data, significantly reducing computational resource consumption. Furthermore, since only the parameters relevant to the new task and some independent task headers are updated, the introduction of new knowledge does not significantly degrade the diagnostic capabilities of older categories, achieving incremental learning for the model.
[0201] The optimized low-rank adapter module parameters, new task header parameters, and independent task header parameters are uploaded to the federated coordination server for aggregation and distribution. Through federated learning, various medical institutions can share model update information, further improving the overall performance and generalization ability of the model, and achieving secure incremental updates of the federated continuous learning model.
[0202] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" or any other variations thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0203] The above are merely specific embodiments of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to these embodiments, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A magnetocardiogram analysis method based on federated learning, characterized in that, The method includes: Acquire magnetocardiogram (MCC) data stored locally by multiple medical institutions, including labeled MCC data and unlabeled MCC data; The masked autoencoder model is trained locally using the unlabeled magnetocardiogram data, and the encoder of the trained masked autoencoder model is used as a shared feature backbone network, which is then frozen. For the preset arrhythmia analysis task, a corresponding independent task head is configured on the frozen shared feature backbone network, and the independent task head is trained using the labeled magnetocardiogram data. After training, the original logical values output by the independent task head for local representative samples are cached as reference logical values. When a new task is introduced, a corresponding new task head is configured for the new task, and a low-rank adapter module is inserted into the frozen shared feature backbone network. The new task supervision loss function value is calculated using the new task data, and the forgetting-free loss function value is calculated using the locally synthesized MCG template and the cached reference logic value. Based on the new task supervision loss function value and the forgetting-free loss function value, the inserted low-rank adapter module, the new task head, and the independent task head are jointly optimized. The optimized low-rank adapter module parameters, the new task header parameters, and the independent task header parameters are uploaded to the federated coordination server for aggregation and distribution, thereby enabling secure incremental updates of the federated continuous learning model.
2. The federated learning based magnetocardiogram analysis method according to claim 1, characterized in that, The step of locally training the masked autoencoder model using the unlabeled magnetocardiogram data includes: The unlabeled magnetocardiogram data is subjected to random masking, which includes randomly covering a preset proportion of time steps along the time axis and / or randomly blocking some sensor channels. The masked unlabeled magnetocardiogram data is input into the encoder for feature extraction. The extracted unlabeled magnetocardiogram data features are concatenated with the mask marker and then input into the decoder of the masked autoencoder model to reconstruct the masked unlabeled magnetocardiogram data. The reconstruction loss value between the reconstructed unlabeled magnetocardiogram data and the original unlabeled magnetocardiogram data in the masked region is calculated, and the encoder parameters and decoder parameters are updated based on the reconstruction loss value to complete the local training of the masked autoencoder model.
3. The federated learning based magnetocardiogram analysis method according to claim 2, characterized in that, The step of using the encoder of the trained mask autoencoder model as a shared feature backbone network includes: The locally trained encoder parameters are uploaded to the federated coordination server, so that the federated coordination server performs weighted average aggregation processing based on the encoder parameters, the local data scale of each client or the reconstruction loss value and its corresponding weight to generate global encoder parameters. The global encoder parameters are used as the shared feature backbone network, and the parameters of the shared feature backbone network are set to an untrainable state. 4.The magnetocardiogram analysis method based on federated learning according to claim 1, wherein, The preset arrhythmia analysis tasks include ventricular premature beat classification, atrial fibrillation detection, and abnormal beat source localization. The configuration of corresponding independent task heads on the frozen shared feature backbone network for the preset arrhythmia analysis task includes: For the ventricular premature beat classification task, a first task head is configured, which is a multilayer perceptron network; For the atrial fibrillation detection task, a second task head is configured, which is a convolutional neural network or a long short-term memory network; For the task of locating the abnormal pulsation source, a third task head is configured, which is a regression network or a graph neural network.
5. The federated learning based magnetocardiogram analysis method according to claim 1, characterized in that, The step of caching the corresponding reference logical values after training is completed includes: For each deployed independent task head, a representative sample set is selected from the local labeled data; The representative sample set is input into the currently trained independent task head, the original output vector of the output layer is calculated and stored as a reference logical value, and the reference logical value is stored in the local cache library.
6. The federated learning based magnetocardiogram analysis method according to claim 1, characterized in that, The process of generating the locally synthesized MCG template includes: Retrieve locally labeled old category magnetocardiogram data; The old category of magnetocardiogram data was processed to perform R-wave alignment; The old category magnetocardiogram data after R-wave alignment is clustered and centered or averaged point by point to generate the local synthetic MCG template that cannot be used to infer the patient's identity.
7. The federated learning based magnetocardiogram analysis method according to claim 1, characterized in that, The process of calculating the new task supervision loss function value using new task data, and calculating the forgetting-free loss function value using the locally synthesized MCG template and the cached reference logic value, and jointly optimizing the inserted low-rank adapter module, the new task header, and the independent task header based on the new task supervision loss function value and the forgetting-free loss function value, includes: Calculate the new task supervision loss function value output by the new task header from the new task data; The locally synthesized MCG template is input into the updated local current training model to obtain the current output of the independent task head. The L2 distance or KL divergence between the current output and the reference logic value is calculated as the value of the forgetting-free loss function. A total loss function is constructed based on the weighted sum of the new task supervision loss function value and the forgetting-free loss function value, in order to jointly optimize the inserted low-rank adapter module, the new task head, and the independent task head. 8.A magnetocardiogram analysis apparatus based on federated learning, characterized by include: The acquisition module is used to acquire magnetocardiogram (MCC) data stored locally by multiple medical institutions, including labeled MCC data and unlabeled MCC data. The first training module is used to train the masked autoencoder model locally using the unlabeled magnetocardiogram data, and to use the encoder of the trained masked autoencoder model as a shared feature backbone network, and to freeze the shared feature backbone network. The second training module is used to configure corresponding independent task heads on the frozen shared feature backbone network for a preset arrhythmia analysis task, train the independent task heads using the labeled magnetocardiogram data, and cache the original logical values output by the independent task heads for local representative samples as reference logical values after training is completed. The update module is used to configure a corresponding new task head for the new task when a new task is introduced, insert a low-rank adapter module into the frozen shared feature backbone network, calculate the new task supervision loss function value using the new task data, calculate the forgetting-free loss function value using the locally synthesized MCG template and the cached reference logic value, and jointly optimize the inserted low-rank adapter module, the new task head, and the independent task head based on the new task supervision loss function value and the forgetting-free loss function value. The upload module is used to upload the optimized low-rank adapter module parameters, the new task header parameters, and the independent task header parameters to the federated coordination server for aggregation and distribution processing, thereby enabling secure incremental updates of the federated continuous learning model.
9. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the magnetocardiogram analysis method based on federated learning as described in any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by the processor, it implements the magnetocardiogram analysis method based on federated learning as described in any one of claims 1 to 7.