Method, device, computer equipment and readable storage medium for denoising magnetic cardiogram signals

By adopting the denoising method of self-attention and cross-attention mechanism in the processing of magnetic core signal, the problem of low denoising accuracy of central magnetic signals in the prior art is solved, and a high-precision and high-rootty denoising effect is achieved.

CN119235317BActive Publication Date: 2025-03-25ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411765957.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-03-25
Estimated Expiration
2044-12-04

AI Technical Summary

Technical Problem

The denoising accuracy of central magnetic signals in the prior art is low, and it is impossible to effectively remove complex noise in the living environment, resulting in loss of waveform characteristics of magnetic core signals, affecting analysis and application.

Method used

A magnetic core signal denoising method is adopted to obtain the magnetic core signal and noise signal to be processed, and perform encoding and denoising processing to generate target condition signals and target prior knowledge. Then, based on the self-attention and cross-attention mechanism, global dependency feature information is extracted and decoded to obtain the denoised cardiac signal.

Benefits of technology

It realizes the high-precision and high-rootability denoising effect of magnetic core signal, effectively improves the accuracy of magnetic core signal denoising, retains important characteristics of magnetic core signal, and reduces noise interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119235317B_ABST
    Figure CN119235317B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, computer equipment and readable storage medium for denoising a cardiomagnetic signal; obtaining a cardiomagnetic signal to be processed and a noise signal; encoding the cardiomagnetic signal to be processed to obtain a target condition signal; denoising the noise signal to generate target prior knowledge; performing self-attention learning based on the target condition signal to determine a first global dependency feature information; performing cross-attention learning based on the first global dependency feature information and the target prior knowledge to determine a second global dependency feature information; performing decoding processing based on the target condition signal and the second global dependency feature information to obtain a denoised cardiomagnetic signal; based on this, a high-precision and high-robustness denoising effect is achieved, and the accuracy of the cardiomagnetic signal denoising is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of denoising technology, and in particular to a method, device, computer equipment and readable storage medium for denoising a magnetocardiogram signal. Background Art

[0002] Magnetocardiography is a non-invasive, contactless imaging method that measures the magnetic field generated by the electrical activity of the human heart near the torso. However, the noise components of magnetocardiograms collected in the living environment are very complex. Simple denoising may result in incomplete noise removal or excessive signal filtering, resulting in the loss of magnetocardiogram signal waveform characteristics, which has an adverse effect on the analysis and application of magnetocardiography.

[0003] There is currently no effective solution to the problem of low precision in denoising magnetic cardiogram signals in the prior art. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, computer equipment and readable storage medium for denoising a magnetic cardiogram signal in order to solve the above technical problems.

[0005] In a first aspect, the present application provides a method for denoising a magnetic cardiogram signal, the method comprising:

[0006] Acquire the magnetic cardiotonic signal and noise signal to be processed;

[0007] encoding the magnetocardiographic signal to be processed to obtain a target condition signal;

[0008] De-noising the noise signal to generate target prior knowledge; the dimension of the noise signal is the same as the dimension of the target condition signal;

[0009] Performing self-attention learning based on the target condition signal to determine first global dependent feature information;

[0010] Perform cross-attention learning based on the first global dependency feature information and the target prior knowledge to determine second global dependency feature information;

[0011] Decoding is performed based on the target condition signal and the second global dependent feature information to obtain a denoised magnetocardiographic signal.

[0012] In one embodiment, the denoising process is performed on the noise signal to generate target prior knowledge, including:

[0013] The noise signal is denoised by using a priori knowledge reconstruction module in a trained magnetocardiographic signal denoising model to generate target priori knowledge.

[0014] In one embodiment, performing self-attention learning according to the target condition signal to determine the first global dependency feature information includes:

[0015] Position encoding is performed on the target conditional signal through the global time series feature denoising module in the trained magnetocardiographic signal denoising model to obtain a position-encoded conditional signal;

[0016] Self-attention learning is performed based on the position-encoded conditional signal to obtain first global dependency feature information.

[0017] In one embodiment, the training process of the trained magnetocardiographic signal denoising model includes:

[0018] Obtain the labeled magnetic cardiotonic signal and the noisy magnetic cardiotonic signal;

[0019] According to the labeled magnetocardiographic signal and the noisy magnetocardiographic signal, a first-stage training is performed on a first target module in the magnetocardiographic signal denoising model until a target loss function satisfies a preset condition, thereby obtaining a trained first target module;

[0020] Under the condition that the model parameters of the trained first target module remain unchanged, performing a second stage of training on the second target module in the magnetic cardiogram signal denoising model according to the labeled magnetic cardiogram signal and the noisy magnetic cardiogram signal, until the target loss function satisfies the preset condition, thereby obtaining a trained second target module;

[0021] A trained magnetocardiographic signal denoising model is determined according to the trained first target module and the trained second target module.

[0022] In one embodiment, the first target module includes an encoding module, a priori knowledge extraction module, a global temporal feature denoising module and a decoder; the first stage training of the first target module in the magnetic cardiotonic signal denoising model according to the label magnetic cardiotonic signal and the noisy magnetic cardiotonic signal includes:

[0023] By means of the encoding module, the tag magnetic cardio signal is encoded to obtain first characteristic information;

[0024] By means of the encoding module, the noisy magnetic cardiotonic signal is encoded to obtain second feature information;

[0025] By means of the prior knowledge extraction module, feature extraction is performed based on the first feature information and the second feature information to obtain first prior knowledge;

[0026] By means of the global temporal feature denoising module, self-attention learning is performed based on the second feature information to obtain third global dependency feature information;

[0027] By means of the global temporal feature denoising module, cross-attention learning is performed based on the third global dependency feature information and the first priori knowledge to obtain fourth global dependency feature information;

[0028] The decoder performs decoding processing based on the second feature information and the fourth global dependent feature information to obtain a first target magnetocardiographic signal.

[0029] In one embodiment, the second target module includes a priori knowledge reconstruction module, a global temporal feature denoising module and a decoder; the trained first target module includes a trained encoding module and a trained priori knowledge extraction module; and the second target module in the magnetic cardiogram signal denoising model is trained in the second stage according to the label magnetic cardiogram signal and the noisy magnetic cardiogram signal while the model parameters of the trained first target module remain unchanged, including:

[0030] The trained encoding module is used to encode the label magnetic cardiotonic signal to obtain third feature information;

[0031] encoding the noisy magnetic cardiotonic signal using the trained encoding module to obtain fourth feature information;

[0032] By using the trained prior knowledge extraction module, feature extraction is performed based on the third feature information and the fourth feature information to obtain second prior knowledge;

[0033] The second prior knowledge is subjected to noise adding processing by the prior knowledge reconstruction module to obtain intermediate feature information;

[0034] The prior knowledge reconstruction module performs reverse denoising processing on the intermediate feature information to obtain third prior knowledge;

[0035] By means of the global temporal feature denoising module, self-attention learning is performed based on the fourth feature information to obtain fifth global dependency feature information;

[0036] Perform cross attention learning based on the fifth global dependency feature information and the third priori knowledge to obtain sixth global dependency feature information;

[0037] The decoder performs decoding processing according to the fourth feature information and the sixth global dependency feature information to obtain a second target magnetocardiographic signal.

[0038] In a second aspect, the present application also provides a device for denoising a magnetic cardiogram signal, the device comprising:

[0039] An acquisition module, used for acquiring the magnetic cardiotonic signal and noise signal to be processed;

[0040] An encoding module, used for encoding the magnetocardiographic signal to be processed to obtain a target condition signal;

[0041] A generating module, used for performing denoising processing on the noise signal to generate target prior knowledge; the dimension of the noise signal is the same as the dimension of the target condition signal;

[0042] A self-attention learning module, used to perform self-attention learning according to the target condition signal to determine first global dependent feature information;

[0043] a cross-attention learning module, configured to perform cross-attention learning according to the first global dependency feature information and the target prior knowledge, and determine second global dependency feature information;

[0044] A decoding module is used to perform decoding processing according to the target condition signal and the second global dependency feature information to obtain a denoised magnetocardiographic signal.

[0045] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the method described in any one of the embodiments of the first aspect when executing the computer program.

[0046] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the method described in any one of the embodiments of the first aspect above are implemented.

[0047] In a fifth aspect, the present application further provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the steps of the method described in any one of the embodiments of the first aspect above are implemented.

[0048] The above-mentioned method, device, computer equipment and readable storage medium for denoising the magnetic cardiogram signal can effectively remove redundant information and retain the main features of the magnetic cardiogram signal by acquiring the magnetic cardiogram signal to be processed and the noise signal; encode the magnetic cardiogram signal to be processed to obtain the target condition signal, thereby ensuring that the denoising process can be performed more efficiently and accurately; generate high-quality target prior knowledge by denoising the noise signal, thereby providing reliable prior knowledge for the magnetic cardiogram signal denoising process; further, based on the self-attention mechanism, generate the first global dependency feature information, thereby effectively extracting the temporal dependency relationship of the magnetic cardiogram signal to be processed; Based on the cross-attention mechanism, the second global dependent feature information is generated by combining the first global dependent feature information and the target prior knowledge, which can accurately capture the difference between the noise signal characteristics and the characteristics of the magnetocardiogram signal to be processed, thereby effectively enhancing the robustness of the feature information; finally, the target conditional signal and the second global dependent feature information are decoded and processed to obtain the denoised magnetocardiogram signal, which can not only restore the original form of the magnetocardiogram signal, but also retain the important features of the magnetocardiogram signal and effectively remove the noise interference; based on this, a high-precision and high-robust denoising effect is achieved, which effectively improves the accuracy of magnetocardiogram signal denoising. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A diagram showing an application environment of a method for denoising a central magnetic signal in an embodiment;

[0051] Figure 2 A schematic diagram of a flow chart of a method for denoising a centroidal magnetic signal in an embodiment;

[0052] Figure 3 FIG. 1 is a flowchart of a training process of a trained magnetocardiographic signal denoising model in an embodiment;

[0053] Figure 4 It is a flowchart of the first stage training process of the centroidal magnetic signal denoising model in one embodiment;

[0054] Figure 5 A schematic diagram of the first stage training process of a centroidal magnetic signal denoising model in an embodiment;

[0055] Figure 6 It is a flowchart of the second stage training process of the centroidal magnetic signal denoising model in one embodiment;

[0056] Figure 7 A schematic diagram of the second stage training process of a centroidal magnetic signal denoising model in one embodiment;

[0057] Figure 8 A schematic diagram of the inference process of a trained magnetocardiographic signal denoising model in an embodiment;

[0058] Fig. 9 It is a structural block diagram of a central magnetic signal denoising device in one embodiment;

[0059] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0061] Compared with the electrocardiogram, the magnetocardiogram can minimize the influence of conducted tissue noise, has low distortion and higher spatial resolution. This feature can improve the accuracy of cardiac source localization and is beneficial to the diagnosis of cardiovascular diseases. For example, the magnetocardiogram can detect weak electrophysiological changes in the early stage of ischemia that cannot be detected by the electrocardiogram, and has higher sensitivity in the examination of ischemic myocardium and other diseases. At the same time, the magnetocardiogram is a vector signal, which is a direct reflection of the distribution and flow of current. It has important advantages in accurately locating the lesion site and tracking the flow of cardiac current in the chest cavity.

[0062] However, there are earth magnetic fields and household appliances in the living environment, and the magnetocardiogram signal itself is weak, about one millionth of the magnitude of the earth's magnetic field. The magnetocardiogram signal measured in the living environment / non-magnetic shielding environment (using a portable magnetocardiogram measurement device) is easily covered or distorted by environmental noise, and the signal-to-noise ratio is very low. Therefore, the magnetocardiogram usually needs to be measured in a shielded environment or the noise needs to be removed by signal processing in order to obtain accurate waveform characteristics. The traditional magnetic shielding room is made of low magnetic permeability alloy, which can effectively isolate the room from the environmental magnetic field, but its high cost limits the application of magnetocardiogram in clinical testing. The collected magnetocardiogram signal is similar to the electrocardiogram signal. They are both periodic signals, mainly including baseline drift noise, power frequency noise, and Gaussian white noise. The noise components of the magnetocardiogram collected in the living environment are very complex. Simple denoising processing may make the noise removal incomplete or filter out too many signals, resulting in the loss of the waveform characteristics of the magnetocardiogram signal, which has an adverse effect on the analysis and application of the magnetocardiogram. Based on this, the embodiment of the present application aims to propose a method for denoising a cardiomagnetic signal to solve the problem of low accuracy of denoising a cardiomagnetic signal in the above-mentioned prior art.

[0063] The method for denoising a magnetic cardiogram signal provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, tablet computers, and portable wearable devices; the server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0064] In an exemplary embodiment, Figure 2 As shown, Figure 2 : This is a flow chart of a method for denoising a magnetic centroid signal in an embodiment; this embodiment uses the method applied to a terminal as an example for illustration, and it is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0065] Step S201, obtaining a magnetocardiographic signal and a noise signal to be processed.

[0066] The to-be-processed magnetocardiogram signal is a noisy magnetocardiogram signal; the to-be-processed magnetocardiogram signal may be, but is not limited to, collected by a portable magnetocardiogram measuring device or a non-magnetic shielding magnetocardiogram measuring device. The noise signal may be a Gaussian noise.

[0067] It can be understood that the noise signal and the to-be-processed magnetic cardio signal are two independent signals. The noise signal is used to generate target prior knowledge to assist the to-be-processed magnetic cardio signal in denoising.

[0068] Step S202: Encode the magnetocardiographic signal to be processed to obtain a target condition signal.

[0069] Among them, the target condition signal includes the local features corresponding to the to-be-processed magnetic heart signal, i.e., the main features. It can be understood that encoding the to-be-processed magnetic heart signal can convert the to-be-processed magnetic heart signal into a low-dimensional feature representation, that is, encoding the to-be-processed magnetic heart signal into a latent space to remove redundant information and extract a more abstract feature representation, thus laying a foundation for the denoising processing of the magnetic heart signal.

[0070] It should be noted that by encoding the magnetocardiogram signal to be processed, not only can the signal length be compressed and the multi-scale feature information of the magnetocardiogram signal be extracted, but also the selective retention of the magnetocardiogram features or the filtering of the noise features can be achieved, so as to achieve the purpose of suppressing the noise features and enhancing the magnetocardiogram signal features.

[0071] Among them, the multi-scale feature information includes timing features and frequency features; the timing features include detailed information of different timing stages in the heart cycle, for example, the order of P wave, QRS wave group, T wave, etc.; the frequency features include the frequency characteristics of the magnetic heart signal at different scales, for example, the frequency range of P wave is about 0.5-10Hz, the frequency range of QRS wave group is about 10-50Hz, and the frequency range of T wave is about 0.5-5Hz. It can be understood that the target condition signal carries multi-scale feature information.

[0072] Step S203, denoising the noise signal to generate target prior knowledge.

[0073] It should be noted that the dimension of the noise signal is the same as that of the target condition signal, so as to provide an accurate reference for the subsequent magnetocardiographic signal denoising process.

[0074] The target prior knowledge includes the recoverable information corresponding to the noisy MCG signal, the frequency domain features and time domain features of the clean MCG signal, and the mapping relationship between the noisy MCG features and the clean MCG features. It should be noted that based on the target prior knowledge, additional contextual information can be provided to assist the MCG signal denoising to ensure the accuracy of the MCG signal denoising.

[0075] Step S204: performing self-attention learning based on the target condition signal to determine the first global dependency feature information.

[0076] In an exemplary embodiment, a method for determining first global dependent feature information by performing self-attention learning based on a target condition signal may be: generating an attention weight matrix based on the target condition signal; and generating first global dependent feature information based on the target condition signal and the attention weight matrix.

[0077] It can be understood that based on the self-attention mechanism, the temporal dependencies between different time steps of the magnetocardiographic signals to be processed can be accurately captured.

[0078] Step S205, performing cross-attention learning based on the first global dependency feature information and target prior knowledge to determine the second global dependency feature information.

[0079] The second global dependency feature information can be used to describe the difference between the noise signal feature and the magnetocardiographic signal feature to be processed.

[0080] In an exemplary embodiment, cross-attention learning is performed based on the first global dependency feature information and the target prior knowledge, and the method for determining the second global dependency feature information may be: generating a cross-attention weight matrix based on the first global dependency feature information and the target prior knowledge; generating the second global dependency feature information based on the target prior knowledge and the cross-attention weight matrix.

[0081] It can be understood that based on the target prior knowledge, additional contextual information can be introduced, and then by adopting the cross-attention mechanism to generate the second global dependent feature information, the difference between the noise signal characteristics and the magnetocardiographic signal characteristics to be processed can be accurately captured, thereby effectively enhancing the robustness of the feature information.

[0082] Step S206: performing decoding processing based on the target condition signal and the second global dependent feature information to obtain a denoised magnetocardiographic signal.

[0083] Among them, the target condition signal and the second global dependency feature information are both low-dimensional feature information.

[0084] It can be understood that by decoding the target condition signal and the second global dependent feature information, the low-dimensional feature information can be gradually decompressed back to a high dimension, which not only ensures the gradual restoration of the signal, but also retains the key features and timing information extracted during encoding, thereby achieving effective denoising of the processed magnetic cardiotonic signal.

[0085] In an exemplary embodiment, a method for obtaining a denoised magnetic cardio signal based on decoding processing of the target condition signal and the second global dependent feature information may be: performing feature fusion on the target condition signal and the second global dependent feature information to obtain an intermediate fusion feature; and decoding processing on the intermediate fusion feature to obtain a denoised magnetic cardio signal.

[0086] In this embodiment, by acquiring the to-be-processed magnetic heart signal and the noise signal; encoding the to-be-processed magnetic heart signal to obtain the target condition signal, the redundant information can be effectively removed, the main features of the magnetic heart signal are retained, and the denoising process can be ensured to be performed more efficiently and accurately; by denoising the noise signal, high-quality target prior knowledge is generated, and reliable prior knowledge is provided for the magnetic heart signal denoising process; further, based on the self-attention mechanism, the first global dependency feature information is generated, and the temporal dependency relationship of the to-be-processed magnetic heart signal can be effectively extracted; based on the cross-attention mechanism, the first global dependency feature information and the target prior knowledge are combined to generate the second global dependency feature information, which can accurately capture the difference between the noise signal feature and the to-be-processed magnetic heart signal feature, thereby effectively enhancing the robustness of the feature information; finally, decoding is performed according to the target condition signal and the second global dependency feature information to obtain the denoised magnetic heart signal, which can not only restore the original form of the magnetic heart signal, but also retain the important features of the magnetic heart signal, and effectively remove the noise interference; based on this, a high-precision and high-robustness denoising effect is achieved, and the accuracy of the magnetic heart signal denoising is effectively improved.

[0087] In one embodiment, the noise signal is denoised to generate target prior knowledge, including:

[0088] The noise signal is denoised through the prior knowledge reconstruction module in the trained magnetocardiographic signal denoising model to generate target prior knowledge.

[0089] The trained magnetocardiographic signal denoising model includes a priori knowledge reconstruction module, wherein the priori knowledge reconstruction module includes an implicit diffusion model. It should be noted that the priori knowledge reconstruction module in this embodiment is a trained priori knowledge reconstruction module obtained through model training.

[0090] It should be noted that the trained implicit diffusion model has excellent generation ability, that is, based on the implicit diffusion model, it can accurately generate high-quality target prior knowledge according to the noise signal, laying the foundation for improving the denoising accuracy of magnetic cardiotonic signals.

[0091] In this embodiment, based on the prior knowledge reconstruction module in the trained MCG signal denoising model, high-quality and reliable target prior knowledge can be generated. Based on the target prior knowledge, the denoising ability of the model and the model's understanding of the MCG signal can be effectively improved, thereby improving the MCG signal denoising accuracy.

[0092] In one embodiment, performing self-attention learning according to the target condition signal to determine the first global dependency feature information includes the following steps:

[0093] Step 1: Position-encode the target conditional signal through the global temporal feature denoising module in the trained magnetocardiographic signal denoising model to obtain the position-encoded conditional signal.

[0094] Step 2: Perform self-attention learning based on the position-encoded conditional signal to obtain the first global dependency feature information.

[0095] Among them, the trained magnetocardiographic signal denoising model includes a global temporal feature denoising module; it should be noted that the global temporal feature denoising module in this embodiment is a trained global temporal feature denoising module obtained through model training.

[0096] Among them, the global temporal feature denoising module includes a Transformer model. The Transformer model includes a self-attention layer and a cross-attention layer; wherein, the input of the self-attention layer is the target conditional signal, and the output of the self-attention layer is the first global dependency feature information; the input of the cross-attention layer includes the first global dependency feature information output by the self-attention layer and the target prior knowledge output by the prior knowledge reconstruction module. It should be noted that in the cross-attention layer, due to the introduction of target prior knowledge, additional contextual information can be provided to the Transformer model, laying the foundation for improving the denoising accuracy of the magnetic heart signal. At the same time, taking into account the significant time dependence of the magnetic heart signal, this embodiment enhances the model's perception of sequential dependence by adding position encoding to the Transformer model.

[0097] Preferably, performing cross-attention learning based on the first global dependency feature information and target prior knowledge to determine the second global dependency feature information comprises the following steps:

[0098] Step 1: Positionally encode the target prior knowledge through the global temporal feature denoising module in the trained magnetocardiographic signal denoising model to obtain the encoded prior knowledge;

[0099] Step 2: Perform cross-attention learning based on the first global dependency feature information and the encoded prior knowledge to determine the second global dependency feature information.

[0100] Exemplarily, through the global temporal feature denoising module in the trained magnetocardiographic signal denoising model, that is, through the self-attention layer of the trained Transformer model, the target conditional signal is position-encoded to obtain the position-encoded conditional signal to enhance the model's perception of sequential dependency; then self-attention learning is performed based on the position-encoded conditional signal to obtain the first global dependency feature information; further, the first global dependency feature information and the target prior knowledge are input into the cross-attention layer of the trained Transformer model for cross-attention learning to generate the second global dependency feature information.

[0101] In this embodiment, based on the target prior knowledge, additional contextual information can be provided for the global temporal feature denoising module, i.e., the Transformer model, in the trained magnetic cardiotonic signal denoising model, laying the foundation for improving the accuracy of magnetic cardiotonic signal denoising; based on the global temporal feature denoising module in the trained magnetic cardiotonic signal denoising model, the first global dependency feature information and the second global dependency feature information can be accurately generated, based on which the temporal dependency relationship of the magnetic cardiotonic signal to be processed can be effectively extracted, and the difference between the noise signal characteristics and the magnetic cardiotonic signal characteristics to be processed can be accurately captured, effectively enhancing the robustness and accuracy of the feature information.

[0102] In one embodiment, Figure 3 As shown, Figure 3 FIG. 1 is a flow chart of a training process of a trained magnetocardiographic signal denoising model in an embodiment; the training process of a trained magnetocardiographic signal denoising model includes the following steps:

[0103] Step S301, obtaining a tag magnetocardiographic signal and a noisy magnetocardiographic signal.

[0104] The labelled magnetocardiogram signal is a clean magnetocardiogram signal without environmental noise. For example, in a magnetically shielded room, a portable / non-magnetically shielded magnetocardiogram measuring device is used to collect the magnetocardiogram signal of the subject to obtain the labelled magnetocardiogram signal. Furthermore, the labelled magnetocardiogram signal is used as a label for training the magnetocardiogram signal denoising model and is randomly divided into a training set and a test set.

[0105] The noisy magnetocardiographic signal is a magnetocardiographic signal with environmental noise. Exemplarily, the method for obtaining the noisy magnetocardiographic signal may be: based on common life noise collected in various common life environments, the tag magnetocardiographic signal is controlled to be destroyed according to a certain signal-to-noise ratio to obtain the noisy magnetocardiographic signal.

[0106] It should be noted that the labeled magnetic cardiotonic signals and the noisy magnetic cardiotonic signals are aligned in time series, so they can be used as paired training data sets.

[0107] Step S302, performing a first-stage training on a first target module in a magnetic cardiogram signal denoising model according to the labeled magnetic cardiogram signal and the noisy magnetic cardiogram signal, until a target loss function satisfies a preset condition, thereby obtaining a trained first target module.

[0108] Among them, the target loss function is used to measure the difference between the model prediction result and the actual target, which is convenient for network learning. The preset conditions need to be set according to the actual training requirements of the model, and are not specifically limited here.

[0109] Step S303, when the model parameters of the trained first target module remain unchanged, the second target module in the magnetocardiographic signal denoising model is trained in the second stage according to the labeled magnetocardiographic signal and the noisy magnetocardiographic signal until the target loss function meets the preset conditions, thereby obtaining a trained second target module.

[0110] The model parameters of the trained first target module remain unchanged, which means freezing the model parameters of the trained first target module to perform the second stage training on the second target module in the magnetic cardio signal denoising model. The model parameters may include, but are not limited to, weight parameters.

[0111] Step S304: Determine a trained magnetocardiographic signal denoising model according to the trained first target module and the trained second target module.

[0112] In an exemplary embodiment, in view of the periodicity of the magnetic cardiotonic signal and the large low-frequency interference, the target loss functions used in the model training process of this embodiment include Huber loss (HuberLoss) and cosine similarity loss (CosSimLoss) to reduce the distortion in the denoised magnetic cardiotonic signal.

[0113] Among them, Huber loss is a loss function that combines the advantages of mean square error (MSE) and absolute error (MAE). The specific calculation method of Huber loss is shown in formula (1).

[0114] (1)

[0115] Among them, r represents the error, , represents a hyperparameter that controls the switching point.

[0116] The specific calculation method of cosine similarity loss is shown in formula (2).

[0117] (2)

[0118] Among them, a and b are two vectors composed of the label magnetic cardiotonic signal and the denoised magnetic cardiotonic signal.

[0119] According to formulas (1) and (2), the target loss function is obtained as shown in formula (3).

[0120] (3)

[0121] in, is an adjustable weight coefficient.

[0122] In this embodiment, by training different modules of the MCG signal denoising model in stages, not only can the learning efficiency and generalization ability of the model be improved, but also the final trained MCG signal denoising model can be ensured to have higher accuracy and robustness, effectively remove noise interference, and improve the quality and availability of MCG signals.

[0123] In one embodiment, the first target module includes an encoding module, a priori knowledge extraction module, a global temporal feature denoising module, and a decoder. Figure 4 As shown, Figure 4 The figure is a flowchart of the first stage training process of the MCG signal denoising model in one embodiment; the first stage training of the first target module in the MCG signal denoising model is performed according to the label MCG signal and the noisy MCG signal, including the following steps:

[0124] Step S401: Encode the tag magnetocardiographic signal through an encoding module to obtain first characteristic information.

[0125] Step S402: encoding the noisy magnetic cardiotonic signal through an encoding module to obtain second feature information.

[0126] The encoding module includes a first encoder and a second encoder; wherein the first encoder and the second encoder have the same structure. The first encoder is used to encode the label magnetic cardiomyopathy signal to obtain the first characteristic information; wherein the first characteristic information is a prompt signal; the second encoder is used to encode the noisy magnetic cardiomyopathy signal to obtain the second characteristic information; wherein the second characteristic information is a conditional signal. wherein the first characteristic information has the same dimension as the second characteristic information.

[0127] It can be understood that the first feature information, i.e., the prompt signal, is a feature extracted from the label magnetic heart signal by the first encoder. Since the label magnetic heart signal is a clean magnetic heart signal, as an ideal reference standard, the first feature information, i.e., the prompt signal, contains the key features of the clean magnetic heart signal, such as time domain features, frequency domain features, etc., which can be used to guide the model to learn the features of the clean magnetic heart signal. The second feature information, i.e., the conditional signal, is a feature extracted from the noisy magnetic heart signal by the second encoder. The second feature information, i.e., the conditional signal, reflects the noise characteristics in the magnetic heart signal and the potential magnetic heart signal characteristics. By analyzing the second feature information, the model can understand what types of noise exist in the actual input signal and how these noises affect the magnetic heart signal.

[0128] For example, the first encoder is used as an example. The first encoder is composed of three gated convolutional layers, which can effectively compress the signal length and extract the multi-scale feature information of the magnetic heart signal. It can be understood that the second encoder is also composed of three gated convolutional layers. Based on the first encoder and the second encoder, the local features in the magnetic heart signal can be effectively captured for subsequent denoising. The calculation method of each gated convolutional layer is shown in formula (4).

[0129] (4)

[0130] in, is the point-by-point multiplication of the linear and nonlinear outputs of each layer, is the Sigmoid activation function. Each convolution layer controls the information flow through a simple gating mechanism of the traditional nonlinear activation convolution output. The gating mechanism allows the model to suppress irrelevant or unimportant features, achieve selective retention of magnetocardiogram features or filter noise features, achieve the purpose of suppressing noise features and enhancing signal features, thereby preliminarily improving the signal-to-noise ratio.

[0131] Among them, Conv1D is a one-dimensional convolution; by setting the stride parameter of the convolution layer, the input is downsampled to a certain extent, the size of the feature signal is reduced, and the depth of the feature is increased, so as to extract a more abstract representation, that is, to encode the magnetic cardiotonic signal into the latent space.

[0132] It should be noted that after convolution and nonlinear activation function After that, we get the coefficient between 0 and 1, and then multiply Si by the convolution to get When the model learns that the feature of a certain segment of the magnetocardiographic signal is a noise feature, the output of Si for this segment is close to 0; when the model learns that the feature of a certain segment of the magnetocardiographic signal is a magnetocardiogram feature, the output of Si for this segment is close to 1. Therefore, the weight of the noise feature is small, that is, the noise feature is filtered; while the weight of the magnetocardiogram feature is large, that is, the magnetocardiogram feature will be retained, thereby achieving the purpose of suppressing noise and enhancing signal features.

[0133] It should be noted that the specific implementation method of the second encoder is the same as the implementation principle of the first encoder recorded in the above embodiment, and will not be repeated here.

[0134] Step S403: performing feature extraction based on the first feature information and the second feature information through a priori knowledge extraction module to obtain first priori knowledge.

[0135] For example, see Figure 5, the label magnetic cardio signal is encoded and processed by the first encoder to obtain the first feature information; the noisy magnetic cardio signal is encoded and processed by the second encoder to obtain the second feature information. The first feature information is recorded as the prompt signal Z, and the second feature information is recorded as the conditional signal C. The prompt signal Z and the conditional signal C are channel-joined to obtain a mixed signal, and the mixed signal is input into the prior knowledge extraction module for feature extraction to obtain the first prior knowledge Z'. The first prior knowledge includes the recoverable information of the noisy magnetic cardio signal, the frequency domain features and time domain features of the label magnetic cardio signal, and the mapping relationship between the features of the noisy magnetic cardio signal and the features of the label magnetic cardio signal.

[0136] Among them, the prior knowledge extraction module is composed of a residual network layer and a linear layer stacked together, with the purpose of fusing the features of different channels through convolution kernels. Multiple convolution kernels convolve the input signal, slide between different channels to extract local features, and gradually establish the association between channels in this process to achieve feature extraction. The data after the prior knowledge extraction module is called prior knowledge. This step does not change the data length, but the number of channels is halved. The first prior knowledge Z' obtained has the same length and number of channels as the second feature information, namely the conditional signal C.

[0137] It should be noted that, using convolutional neural networks, according to the characteristics of magnetic cardio features, a priori knowledge extraction module is designed to extract and fuse the features of the two signals (i.e., the prompt signal Z and the conditional signal C) to obtain the corresponding priori knowledge. This priori knowledge is one of the key information for denoising in the subsequent global temporal feature denoising module, and is also the label for the magnetic cardio denoising model to generate priori knowledge during the second stage of training. Based on this, it can provide more comprehensive paired feature information of clean and noisy signals for the learning of the magnetic cardio signal denoising model.

[0138] Step S404: self-attention learning is performed based on the second feature information through a global temporal feature denoising module to obtain third global dependency feature information.

[0139] Step S405: Through the global temporal feature denoising module, cross-attention learning is performed based on the third global dependency feature information and the first priori knowledge to obtain fourth global dependency feature information.

[0140] The global temporal feature denoising module includes a Transformer model. The Transformer model includes a self-attention layer and a cross-attention layer;

[0141] Exemplarily, the second feature information is recorded as the conditional signal C. In the Transformer model, the first prior knowledge Z' is first positionally encoded, the signal is fixedly encoded using sinusoidal coding, and time series information is added to the first prior knowledge to help the model identify the relative order of each time point in the signal. The second feature information, i.e., the conditional signal C, is positionally encoded in the same way.

[0142] Next, under the self-attention mechanism of Transformer, the conditional signal C with added position information is modeled through the self-attention layer, so that the model can capture the temporal dependencies between different conditional blocks. Specifically, the linear layer is used to transform the conditional signal C with added position information into the query matrix Q, the key matrix K, and the value matrix V respectively; then, the attention score is calculated based on the query matrix Q and the key matrix K at each time step, as shown in formula (5).

[0143] (5)

[0144] in, is the dimension of the key vector; finally, the obtained attention weight is applied to the value matrix V to obtain an output containing global dependency information, that is, the third global dependency feature information is obtained.

[0145] Cross attention is applied between the third global dependency feature information and the first prior knowledge Z', and the connection between the third global dependency feature information and the first prior knowledge Z' is established through the cross attention layer. Specifically, the third global dependency feature information is converted into a query matrix Q1 through a linear layer, and the first prior knowledge Z' with added position information is converted into a key matrix K1 and a value matrix V1 through a linear layer; the cross attention score is calculated using formula (6). Finally, the obtained cross attention output is applied to the value matrix V1 to obtain an output containing global cross-learning dependency information, that is, the fourth global dependency feature information is obtained.

[0146] (6)

[0147] It should be noted that the first prior knowledge Z' is a fusion of the conditional signal C and the prompt signal Z, which can provide supplementary information for subsequent denoising processing, help the model better understand and process the original signal, and thus improve the signal denoising ability of the model. Based on the multi-layer Transformer module, through the stacked self-attention and cross-attention mechanism, the temporal information and the relationship between the signal and the prior are gradually learned and integrated, which can enhance the model's understanding and modeling capabilities of the characteristics of the magnetic cardio signal.

[0148] It should be noted that the existing denoising method is to use only the noisy signal input network for denoising, while the present embodiment is to input the label magnetic cardio signal into the network to obtain prior knowledge. Compared with the existing denoising method, the prior knowledge belongs to additional context information. Prior knowledge can provide key features including recoverable information of noisy magnetic cardio signals, frequency domain features and time domain features of clean magnetic cardio information, and the mapping relationship between noisy magnetic cardio signal features and clean magnetic cardio signal features. This key feature is used as the magnetic cardio signal prior knowledge and as the input of the prior knowledge reconstruction module in the second stage of training. The excellent generation ability of the prior knowledge reconstruction module is used to generate the prior distribution of such magnetic cardio signal features through the noisy signal features, including time series and frequency features; in the cross-attention layer of the Transformer model, due to the introduction of prior knowledge such as the time series features and frequency features of the magnetic cardio signal, additional context information can be provided for the Transformer model to achieve the purpose of auxiliary denoising.

[0149] Step S406: performing decoding processing based on the second feature information and the fourth global dependent feature information through a decoder to obtain a first target magnetocardiographic signal.

[0150] Among them, the decoder is composed of a preset number of layers of transposed convolutional neural network with residual connections; wherein the preset number needs to be set according to the actual decoding requirements, for example, 3 layers, which is not specifically limited here. Through transposed convolution, the feature vector obtained after the second feature information and the fourth global dependent feature information are concatenated can be restored, and the generated low-dimensional potential representation can be gradually decompressed back to a high dimension. Among them, transposed convolution increases the spatial dimension of the feature map by performing the inverse operation of convolution on the feature map, and restores a larger feature map layer by layer. Through multiple layers of transposed convolution, a feature map with the same size as the original input is finally restored.

[0151] It can be understood that, through the decoder, decoding processing is performed based on the second feature information and the fourth global dependent feature information. The whole process ensures the gradual restoration of the signal, can obtain the first target magnetic cardio signal, and effectively retains the key features and timing information extracted during encoding, thereby realizing effective reconstruction of the input signal.

[0152] The first target magnetocardiographic signal is a denoised magnetocardiographic signal.

[0153] For example, see Figure 5The first target module includes an encoding module, a priori knowledge extraction module, a global temporal feature denoising module and a decoder; according to the label magnetocardiographic signal and the noisy magnetocardiographic signal, the first target module in the magnetocardiographic signal denoising model, namely the encoding module, the priori knowledge extraction module, the global temporal feature denoising module and the decoder, is trained in the first stage until the target loss function meets the preset conditions to obtain a trained first target module; the trained first target module includes a trained encoding module and a trained priori knowledge extraction module; the specific training process has been recorded in the above embodiment and will not be repeated here.

[0154] In this embodiment, according to the labeled magnetic cardiotonic signal and the noisy magnetic cardiotonic signal, the encoding module, the prior knowledge extraction module, the global temporal feature denoising module and the decoder in the magnetic cardiotonic signal denoising model are trained in the first stage to obtain the trained encoding module and the prior knowledge extraction module; this joint training can not only improve the robustness of the model, but also ensure the coordinated optimization of each module in complex signal processing tasks, which is helpful to achieve more accurate signal denoising and analysis.

[0155] In one embodiment, the second target module includes a priori knowledge reconstruction module, a global temporal feature denoising module and a decoder; the trained first target module includes a trained encoding module and a trained priori knowledge extraction module; Figure 6 As shown, Figure 6 The flowchart of the second stage training process of the MCG signal denoising model in one embodiment is as follows; when the model parameters of the trained first target module remain unchanged, the second target module in the MCG signal denoising model is trained in the second stage according to the label MCG signal and the noisy MCG signal, including the following steps:

[0156] Step S601: Encode the label magnetocardiographic signal through the trained encoding module to obtain third feature information.

[0157] Among them, the third characteristic information is a prompt signal.

[0158] Step S602: encoding the noisy magnetic cardiotonic signal using the trained encoding module to obtain fourth feature information.

[0159] Among them, the fourth characteristic information is a conditional signal.

[0160] Step S603: Perform feature extraction based on the third feature information and the fourth feature information through the trained prior knowledge extraction module to obtain second prior knowledge.

[0161] It should be noted that the specific implementation method of step S601 to step S603 is the same as the implementation method described in the above embodiment and will not be repeated here.

[0162] Step S604: performing noise processing on the second prior knowledge through a priori knowledge reconstruction module to obtain intermediate feature information.

[0163] Step S605: Perform reverse denoising processing on the intermediate feature information through a priori knowledge reconstruction module to obtain third priori knowledge.

[0164] Among them, the prior knowledge reconstruction module includes an implicit diffusion model. It should be noted that the trained implicit diffusion model has excellent generation ability, that is, based on the implicit diffusion model, it can accurately generate high-quality target prior knowledge based on the noise signal, laying the foundation for improving the denoising accuracy of magnetic cardio signals.

[0165] For example, the second prior knowledge is recorded as , the fourth feature information is recorded as conditional signal C. The training of implicit diffusion model mainly includes two steps, namely, noise addition process and denoising process. Among them, the noise addition process is to add the second prior knowledge Gradually add noise to obtain intermediate feature information; specifically, suppose is the data at the tth time step. The noise adding process can be regarded as a Markov chain, which is defined as shown in formula (7).

[0166] (7)

[0167] in, is a parameter that controls the noise intensity, where , is the noise sampled from a standard normal distribution. As t increases, gradually decreases, the proportion of noise gradually increases, and finally Consists almost entirely of noise.

[0168] Among them, the denoising process is the key part of implicit diffusion model learning. The model attempts to restore the original data by gradually removing the noise. This process is achieved by sampling through a neural network. Based on the intermediate feature information, starting from the T-th step signal obtained by the noise addition process, the model gradually reduces the noise through the reverse process and restores the original data. The denoising process is also defined by the Markov chain, as shown in formula (8).

[0169] (8)

[0170] in, is a neural network based on the current , time step t and the fourth feature information, namely the conditional signal C, are used to predict the denoised samples The mean of . is a fixed variance, is the noise sampled from a standard normal distribution.

[0171] In the denoising process, the model corrects the generated intermediate samples by predicting the noise and making adjustments, so that the final generated result is closer to the original noise-free data, that is, the implicit diffusion model finally generates Closer to second prior knowledge Among them, the intermediate sample refers to the intermediate state of gradually denoising the noisy features and restoring the clean magnetic heart feature prompts.

[0172] It is understandable that after multiple denoising steps, the model finally generates It is the original data, that is, the second prior knowledge By learning how to denoise, the model can generate high-quality prior knowledge under the conditional signal prompt of the fourth feature information, which is used to guide the subsequent denoising process of the magnetic cardiogram signal based on the global temporal feature denoising module. That is, implicit diffusion model training is introduced in the second stage training to train the implicit diffusion model learning so that it generates prior knowledge that is consistent with the prior knowledge distribution obtained by the prior knowledge extraction module in the first stage, so as to guide the denoising process based on the global temporal feature denoising module.

[0173] Step S606: Perform self-attention learning based on the fourth feature information through the global temporal feature denoising module to obtain fifth global dependency feature information.

[0174] Step S607, performing cross-attention learning based on the fifth global dependency feature information and the third prior knowledge to obtain the sixth global dependency feature information.

[0175] Step S608: performing decoding processing by a decoder according to the fourth feature information and the sixth global dependency feature information to obtain a second target magnetocardiographic signal.

[0176] The second target magnetocardiographic signal is a denoised magnetocardiographic signal.

[0177] It should be noted that the specific implementation method of step S606 to step S608 is the same as the implementation method described in the above embodiment and will not be repeated here.

[0178] For example, see Figure 7, the second target module includes a priori knowledge reconstruction module, a global temporal feature denoising module and a decoder; the trained first target module includes a trained encoding module and a trained priori knowledge extraction module; when the model parameters of the trained first target module remain unchanged, that is, when the model parameters corresponding to the trained encoding module and the trained prior knowledge extraction module are frozen, the second target module in the magnetic cardiotonic signal denoising model is trained in the second stage according to the labeled magnetic cardiotonic signal and the noisy magnetic cardiotonic signal until the target loss function meets the preset conditions to obtain the trained second target module; wherein the trained second target module includes a trained priori knowledge reconstruction module, a trained global temporal feature denoising module and a trained decoder; further, according to the trained first target module and the trained second target module, the trained magnetic cardiotonic signal denoising model can be determined.

[0179] For further information, see Figure 8 In the inference process, based on the trained MCG signal denoising model, that is, using the trained model parameters, directly inputting a Gaussian signal of the same dimension as the target conditional signal into the denoising process of the trained implicit diffusion model, and inputting the pre-processed MCG signal to be processed into the second encoder, the denoised MCG signal can be obtained. It should be understood that in practical applications, the trained implicit diffusion model has excellent generation capabilities and can directly generate high-quality target prior knowledge based on the noise signal (e.g., Gaussian noise) to achieve the purpose of auxiliary noise reduction.

[0180] In this embodiment, when the model parameters corresponding to the trained encoding module and the prior knowledge extraction module are frozen, the second stage training of the second target module in the magnetocardiographic signal denoising model can be implemented, which improves the flexibility and efficiency of model training, ensures the performance of the trained magnetocardiographic signal denoising model, and improves the denoising ability of the trained magnetocardiographic signal denoising model.

[0181] In the above-mentioned method for denoising the magnetic heart signal, in the first aspect, the magnetic heart signal to be processed and the noise signal are obtained; the magnetic heart signal to be processed is encoded and processed to obtain the target condition signal, which can effectively remove redundant information, retain the main features of the magnetic heart signal, and ensure that the denoising process can be performed more efficiently and accurately; by denoising the noise signal, high-quality target prior knowledge is generated, which provides reliable prior knowledge for the denoising process of the magnetic heart signal; further, based on the self-attention mechanism, the first global dependency feature information is generated, which can effectively extract the temporal dependency relationship of the magnetic heart signal to be processed; based on the cross-attention mechanism, the first global dependency feature information and the target prior knowledge are combined to generate the second global dependency feature information, which can accurately capture the difference between the noise signal feature and the magnetic heart signal feature to be processed, thereby effectively enhancing the robustness of the feature information; finally, the target condition signal and the second global dependency feature information are decoded and processed to obtain the denoised magnetic heart signal, which can not only restore the original form of the magnetic heart signal, but also retain the important features of the magnetic heart signal, and effectively remove the noise interference; based on this, a high-precision and high-robustness denoising effect is achieved, and the accuracy of magnetic heart signal denoising is effectively improved. Secondly, based on the prior knowledge reconstruction module in the trained MCG signal denoising model, high-quality and reliable target prior knowledge can be generated. Based on the target prior knowledge, the denoising ability of the model and the model's understanding of the MCG signal can be effectively improved, thereby improving the accuracy of the MCG signal denoising. Thirdly, based on the target prior knowledge, additional contextual information can be provided to the global temporal feature denoising module, i.e., the Transformer model, in the trained MCG signal denoising model, laying the foundation for improving the accuracy of the MCG signal denoising. Based on the global temporal feature denoising module in the trained MCG signal denoising model, the first global dependency feature information and the second global dependency feature information can be accurately generated. Based on this, the temporal dependency of the MCG signal to be processed can be effectively extracted, and the difference between the noise signal feature and the MCG signal feature to be processed can be accurately captured, effectively enhancing the robustness and accuracy of the feature information. Fourthly, by training different modules of the MCG signal denoising model in stages, not only can the learning efficiency and generalization ability of the model be improved, but also the final trained MCG signal denoising model can be guaranteed to have higher accuracy and robustness, effectively remove noise interference, and improve the quality and availability of MCG signals.

[0182] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0183] Based on the same inventive concept, the embodiment of the present application also provides a device for implementing the method for implementing the above-mentioned method for implementing the above-mentioned method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations of one or more embodiments of the device for implementing the above-mentioned method can refer to the limitations of the method for implementing the above-mentioned method, and will not be repeated here.

[0184] In an exemplary embodiment, Fig. 9 As shown, Fig. 9 9 is a structural block diagram of a device for denoising a magnetic heart signal in one embodiment; the device for denoising a magnetic heart signal includes an acquisition module 901, an encoding module 902, a generation module 903, a self-attention learning module 904, a cross-attention learning module 905, and a decoding module 906;

[0185] An acquisition module 901 is used to acquire a magnetocardiographic signal and a noise signal to be processed;

[0186] An encoding module 902 is used to encode the magnetocardiographic signal to be processed to obtain a target condition signal;

[0187] A generating module 903 is used to perform denoising processing on the noise signal to generate target prior knowledge; the dimension of the noise signal is the same as the dimension of the target condition signal;

[0188] A self-attention learning module 904, configured to perform self-attention learning according to the target condition signal to determine first global dependent feature information;

[0189] A cross attention learning module 905 is used to perform cross attention learning according to the first global dependency feature information and target prior knowledge to determine the second global dependency feature information;

[0190] The decoding module 906 is used to perform decoding processing according to the target condition signal and the second global dependent feature information to obtain a denoised magnetocardiographic signal.

[0191] The above-mentioned magnetic cardio signal denoising device obtains the magnetic cardio signal to be processed and the noise signal; encodes the magnetic cardio signal to be processed to obtain the target condition signal, which can effectively remove redundant information and retain the main features of the magnetic cardio signal, ensuring that the denoising process can be performed more efficiently and accurately; by denoising the noise signal, high-quality target prior knowledge is generated, which provides reliable prior knowledge for the magnetic cardio signal denoising process; further, based on the self-attention mechanism, the first global dependency feature information is generated, which can effectively extract the temporal dependency relationship of the magnetic cardio signal to be processed; based on the cross-attention mechanism, the first global dependency feature information and the target prior knowledge are combined to generate the second global dependency feature information, which can accurately capture the difference between the noise signal feature and the magnetic cardio signal feature to be processed, thereby effectively enhancing the robustness of the feature information; finally, decoding is performed according to the target condition signal and the second global dependency feature information to obtain the denoised magnetic cardio signal, which can not only restore the original form of the magnetic cardio signal, but also retain the important features of the magnetic cardio signal, and effectively remove the noise interference; based on this, a high-precision and high-robustness denoising effect is achieved, and the accuracy of magnetic cardio signal denoising is effectively improved.

[0192] In one embodiment, the generating module 903 is further used to

[0193] The noise signal is denoised through the prior knowledge reconstruction module in the trained magnetocardiographic signal denoising model to generate target prior knowledge.

[0194] In one embodiment, the self-attention learning module 904 is also used to

[0195] The target conditional signal is position-encoded by the global time series feature denoising module in the trained magnetic cardiogram signal denoising model to obtain the position-encoded conditional signal;

[0196] Self-attention learning is performed based on the conditional signal after position encoding to obtain the first global dependency feature information.

[0197] In one embodiment, the device for denoising magnetic cardiogram signals further includes: a model training module; the model training module is used to

[0198] Obtain the labeled magnetic cardiotonic signal and the noisy magnetic cardiotonic signal;

[0199] According to the labeled magnetocardiographic signal and the noisy magnetocardiographic signal, the first target module in the magnetocardiographic signal denoising model is trained in the first stage until the target loss function meets the preset conditions, thereby obtaining the trained first target module;

[0200] Under the condition that the model parameters of the trained first target module remain unchanged, the second target module in the magnetic cardiogram signal denoising model is trained in the second stage according to the labeled magnetic cardiogram signal and the noisy magnetic cardiogram signal until the target loss function meets the preset conditions, thereby obtaining the trained second target module;

[0201] A trained magnetocardiographic signal denoising model is determined according to the trained first target module and the trained second target module.

[0202] In one embodiment, the first target module includes an encoding module, a priori knowledge extraction module, a global temporal feature denoising module and a decoder; the model training module is also used to

[0203] The tag magnetic cardiotoc signal is encoded by the encoding module to obtain the first characteristic information;

[0204] The noisy magnetic cardiogram signal is encoded by the encoding module to obtain the second characteristic information;

[0205] By using a priori knowledge extraction module, feature extraction is performed based on the first feature information and the second feature information to obtain first priori knowledge;

[0206] Through the global temporal feature denoising module, self-attention learning is performed based on the second feature information to obtain the third global dependency feature information;

[0207] Through the global temporal feature denoising module, cross-attention learning is performed based on the third global dependency feature information and the first prior knowledge to obtain fourth global dependency feature information;

[0208] The decoder performs decoding processing based on the second feature information and the fourth global dependent feature information to obtain a first target magnetocardiographic signal.

[0209] In one embodiment, the second target module includes a priori knowledge reconstruction module, a global temporal feature denoising module and a decoder; the trained first target module includes a trained encoding module and a trained priori knowledge extraction module; the model training module is also used

[0210] The label magnetic cardiotoc signal is encoded and processed through the trained encoding module to obtain the third feature information;

[0211] The noisy magnetic cardiogram signal is encoded by the trained encoding module to obtain the fourth feature information;

[0212] The trained prior knowledge extraction module is used to extract features based on the third feature information and the fourth feature information to obtain second prior knowledge;

[0213] The second prior knowledge is subjected to noise processing through a priori knowledge reconstruction module to obtain intermediate feature information;

[0214] Through the prior knowledge reconstruction module, the intermediate feature information is subjected to reverse denoising to obtain the third prior knowledge;

[0215] Through the global temporal feature denoising module, self-attention learning is performed based on the fourth feature information to obtain the fifth global dependency feature information;

[0216] Perform cross-attention learning based on the fifth global dependency feature information and the third prior knowledge to obtain the sixth global dependency feature information;

[0217] The decoder performs decoding processing according to the fourth feature information and the sixth global dependent feature information to obtain a second target magnetocardiographic signal.

[0218] Each module in the above-mentioned magnetic cardiogram signal denoising device can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0219] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data related to the denoising of the magnetic heart signal. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for denoising the magnetic heart signal is implemented.

[0220] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0221] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0222] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0223] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0224] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0225] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0226] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for denoising a magnetic cardiogram signal, characterized in that: The method comprises: Acquire a to-be-processed magnetic cardiotonic signal and a noise signal; the noise signal and the to-be-processed magnetic cardiotonic signal are independent of each other; encoding the magnetocardiographic signal to be processed to obtain a target condition signal; De-noising the noise signal to generate target prior knowledge; the dimension of the noise signal is the same as the dimension of the target condition signal; the target prior knowledge includes recoverable information corresponding to the noisy magnetic cardiotonic signal, frequency domain features and time domain features of the clean magnetic cardiotonic signal, and a mapping relationship between the noisy magnetic cardiotonic features and the clean magnetic cardiotonic features; Performing self-attention learning based on the target condition signal to determine first global dependent feature information; Perform cross-attention learning based on the first global dependency feature information and the target prior knowledge to determine second global dependency feature information; Decoding is performed based on the target condition signal and the second global dependent feature information to obtain a denoised magnetocardiographic signal.

2. The method according to claim 1, characterized in that The denoising process is performed on the noise signal to generate target prior knowledge, including: The noise signal is denoised by using a priori knowledge reconstruction module in a trained magnetocardiographic signal denoising model to generate target priori knowledge.

3. The method according to claim 1, characterized in that The performing self-attention learning according to the target condition signal to determine the first global dependency feature information includes: Position encoding is performed on the target conditional signal through the global time series feature denoising module in the trained magnetocardiographic signal denoising model to obtain a position-encoded conditional signal; Self-attention learning is performed based on the position-encoded conditional signal to obtain first global dependency feature information.

4. The method according to claim 2 or claim 3, characterized in that: The training process of the trained magnetic cardiology signal denoising model includes: Obtain the labeled magnetic cardiotonic signal and the noisy magnetic cardiotonic signal; According to the labeled magnetocardiographic signal and the noisy magnetocardiographic signal, a first-stage training is performed on a first target module in the magnetocardiographic signal denoising model until a target loss function satisfies a preset condition, thereby obtaining a trained first target module; Under the condition that the model parameters of the trained first target module remain unchanged, performing a second stage of training on the second target module in the magnetic cardiogram signal denoising model according to the labeled magnetic cardiogram signal and the noisy magnetic cardiogram signal, until the target loss function satisfies the preset condition, thereby obtaining a trained second target module; A trained magnetocardiographic signal denoising model is determined according to the trained first target module and the trained second target module.

5. The method according to claim 4, characterized in that The first target module includes an encoding module, a priori knowledge extraction module, a global temporal feature denoising module and a decoder; the first stage training of the first target module in the magnetic cardiogram signal denoising model according to the label magnetic cardiogram signal and the noisy magnetic cardiogram signal includes: By means of the encoding module, the tag magnetic cardio signal is encoded to obtain first characteristic information; By means of the encoding module, the noisy magnetic cardiotonic signal is encoded to obtain second feature information; By means of the prior knowledge extraction module, feature extraction is performed based on the first feature information and the second feature information to obtain first prior knowledge; By means of the global temporal feature denoising module, self-attention learning is performed based on the second feature information to obtain third global dependency feature information; By means of the global temporal feature denoising module, cross-attention learning is performed based on the third global dependency feature information and the first priori knowledge to obtain fourth global dependency feature information; The decoder performs decoding processing based on the second feature information and the fourth global dependent feature information to obtain a first target magnetocardiographic signal.

6. The method according to claim 5, characterized in that The second target module includes a priori knowledge reconstruction module, a global temporal feature denoising module and a decoder; the trained first target module includes a trained encoding module and a trained priori knowledge extraction module; the second target module in the magnetic cardiogram signal denoising model is trained in the second stage according to the label magnetic cardiogram signal and the noisy magnetic cardiogram signal while the model parameters of the trained first target module remain unchanged, including: The trained encoding module is used to encode the label magnetic cardiotonic signal to obtain third feature information; encoding the noisy magnetic cardiotonic signal using the trained encoding module to obtain fourth feature information; By using the trained prior knowledge extraction module, feature extraction is performed based on the third feature information and the fourth feature information to obtain second prior knowledge; The second prior knowledge is subjected to noise adding processing by the prior knowledge reconstruction module to obtain intermediate feature information; The prior knowledge reconstruction module performs reverse denoising processing on the intermediate feature information to obtain third prior knowledge; By means of the global temporal feature denoising module, self-attention learning is performed based on the fourth feature information to obtain fifth global dependency feature information; Perform cross attention learning based on the fifth global dependency feature information and the third priori knowledge to obtain sixth global dependency feature information; The decoder performs decoding processing according to the fourth feature information and the sixth global dependency feature information to obtain a second target magnetocardiographic signal.

7. A device for denoising a magnetic cardiogram signal, characterized in that: The device comprises: An acquisition module, used for acquiring a to-be-processed magnetocardiographic signal and a noise signal; the noise signal and the to-be-processed magnetocardiographic signal are independent of each other; An encoding module, used for encoding the magnetocardiographic signal to be processed to obtain a target condition signal; A generating module, configured to perform denoising processing on the noise signal to generate target prior knowledge; the dimension of the noise signal is the same as the dimension of the target condition signal; the target prior knowledge includes recoverable information corresponding to the noisy magnetic cardio signal, frequency domain features and time domain features of the clean magnetic cardio signal, and a mapping relationship between the noisy magnetic cardio features and the clean magnetic cardio features; A self-attention learning module, used to perform self-attention learning according to the target condition signal to determine first global dependent feature information; a cross-attention learning module, configured to perform cross-attention learning according to the first global dependency feature information and the target prior knowledge, and determine second global dependency feature information; A decoding module is used to perform decoding processing according to the target condition signal and the second global dependency feature information to obtain a denoised magnetocardiographic signal.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Hyperspectral image denoising method and system based on implicit noise prior

    CN118396879A

  • Reducing noise of intracardiac electrocardiograms using an autoencoder and utilizing and refining intracardiac and body surface electrocardiograms using deep learning training loss functions

    US20210378597A1