A magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model

By using a variational autoencoder and bidirectional gated recurrent unit (VAE-BiGRU) hybrid model, combined with unsupervised learning and magnetic dipole theory, the problem of insufficient data in magnetic anomaly detection is solved, and efficient magnetic anomaly recognition is achieved.

CN119577652BActive Publication Date: 2025-10-17INST OF ELECTRONICS & INFORMATION ENG OF UESTC IN GUANGDONG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411722214.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-10-17
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

Existing technologies require a large amount of magnetic anomaly data for training in magnetic anomaly detection. The simulated data cannot reflect the actual situation and it is difficult to handle magnetic targets with irregular motion trajectories, resulting in poor detection results.

Method used

A variational autoencoder and bidirectional gated recurrent unit (VAE-BiGRU) hybrid model is adopted. Through unsupervised learning, VAE is combined to process local features and BiGRU to process global features. A magnetic anomaly detection method is constructed, and semi-simulated signals are generated for training using magnetic dipole theory.

Benefits of technology

In the absence of magnetic anomaly samples, it can accurately identify whether there is magnetic anomaly in the magnetic signal, improve the detection accuracy, and is suitable for situations where magnetic anomaly samples are insufficient or unbalanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119577652B_ABST
    Figure CN119577652B_ABST
Patent Text Reader

Abstract

The application discloses a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit (VAE-BiGRU) hybrid model. The method first collects the geomagnetic background signal of the detection point, and performs band-pass filtering and standardization processing to form a training data set; then a VAE-BiGRU hybrid model is constructed, and the VAE model is trained using the data of the training set to obtain hidden variable data, and then the BiGRU model is trained using the hidden variable data; the simulation magnetic anomaly signal and the geomagnetic background signal are combined together, and the sliding window method is used to determine the magnetic anomaly detection threshold value using the trained VAE-BiGRU model; after the detection magnetic signal is subjected to the same band-pass filtering and standardization processing, the trained VAE-BiGRU model is input, and whether the magnetic anomaly exists in the detection magnetic signal is judged according to the magnetic anomaly degree output by the model. The VAE-BiGRU hybrid model constructed by the application combines the advantages of VAE processing local features and BiGRU processing global features, and is trained in an unsupervised manner, so that a large number of magnetic anomaly data samples are not required in the training process, the problems of difficulty in obtaining magnetic anomaly data samples and imbalance between positive and negative samples during model training are solved, and the accuracy of magnetic anomaly detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of magnetic signal data processing and magnetic anomaly detection, and particularly relates to a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model. BACKGROUND

[0002] The geomagnetic field on the earth's surface is relatively stable, and ferromagnetic objects made of iron, cobalt, nickel and the like can be magnetized by the geomagnetic field, which will cause changes in the geomagnetic field around these objects, which is called magnetic anomaly. The method of detecting ferromagnetic objects by using this phenomenon is called magnetic anomaly detection. Magnetic anomaly detection has many advantages, such as strong concealment, less affected by weather environment, and can be detected all day long, and has more applications in military and civilian fields.

[0003] In recent years, machine learning and deep learning techniques have shown their unique advantages and great potential in many practical applications. Some scholars regard magnetic anomaly detection as a binary classification problem, and use supervised learning methods to learn the features of magnetic anomaly signals and geomagnetic noise from a large number of training data sets, establish a classification model, and then detect and judge the magnetic anomaly. Since this method requires a large amount of magnetic anomaly data, collecting magnetic anomaly data in actual work will consume a lot of manpower, material resources and time, researchers turn to use simulation algorithms to generate magnetic anomaly data, which will have two problems: first, the simulated magnetic anomaly data cannot reflect the real situation, and the trained model may not be as good as expected for classifying real data. The second is that when the relative motion trajectory of the magnetic target is irregular or the motion state is unknown, it is difficult to simulate the corresponding magnetic anomaly data accurately.

[0004] Unsupervised learning as a training method of machine learning can find the statistical characteristics of the data itself without labeled training data, which can avoid the problem of difficulty in obtaining magnetic anomaly data when establishing an identification model. The application discloses a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model (VAE-BiGRU). The method can complete the training of the model without a large amount of anomaly data. The hybrid model in the method combines the advantages of VAE in processing local features and BiGRU in processing global features, and can accurately identify whether there is a magnetic anomaly in the collected magnetic signal data, thereby improving the accuracy of magnetic anomaly detection. SUMMARY

[0005] The application aims to provide a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model, which is used to train the model in the case of insufficient magnetic anomaly samples and complete the detection of magnetic anomaly signals.

[0006] To achieve the above object, the application provides a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model, comprising the following steps:

[0007] Step 1: Collect the geomagnetic background signal at the detection point to form a training data set;

[0008] Step 2: Perform band-pass filtering on the collected data to remove high-frequency noise and extremely low-frequency noise, and then perform standardization processing to make the data mean value 0 and standard deviation 1;

[0009] Step 3: Construct a variational autoencoder-bidirectional gated recurrent unit (VAE-BiGRU) hybrid model; wherein the variational autoencoder (VAE) model is composed of an encoder and a decoder; the VAE encoder and the decoder are both composed of multiple layers of neural networks; the encoder gradually reduces the dimension of the original sample data X={x1, x2, x3...x n} through multiple layers of neural networks into low-dimensional hidden variable data with mean μ and variance σ 2 , and the decoder restores the hidden variable data through multiple layers of neural networks to generate sample data similar to the original sample data

[0010] Step 4: Train the VAE model in step 3 using the training set data processed in step 2;

[0011] Step 5: Use the VAE encoder trained in step 4 to reduce the dimension of the training set data processed in step 2 to obtain hidden variable data Z={z1, z2, z3...z n}, and then train the bidirectional gated recurrent unit (BiGRU) model using the hidden variable data;

[0012] Step 6: Embed the BiGRU model trained in step 5 between the encoder and the decoder of the VAE model trained in step 4 to form a VAE-BiGRU hybrid model;

[0013] Step 7: Generate simulated magnetic anomaly signals according to the magnetic dipole theory model, and mix the simulated magnetic anomaly signals with the measured geomagnetic background signals at the detection point to form semi-simulated magnetic anomaly signals;

[0014] Step 8: Use the VAE-BiGRU hybrid model obtained in step 6 to determine a prediction error threshold using the semi-simulated signals generated in step 7;

[0015] Step 9: Perform the same filtering and standardization processing on the data to be detected as in step 2;

[0016] Step 10: The detected data in step 9 is sent to the VAE-BiGRU hybrid model obtained in step 6, and if the magnetic anomaly degree output by the model is greater than the prediction error threshold determined in step 8, it is judged that there is a magnetic anomaly in the detected signal, otherwise it is judged that there is no magnetic anomaly in the detected signal.

[0017] In the above steps, the BiGRU model in step 3 uses two independent gated recurrent units (GRU) to realize bidirectional processing: one layer of GRU processes data forward in time sequence, and the other layer processes data backward in time sequence. The two layers of GRU capture forward and backward information of the sequence respectively, and finally their outputs are combined to generate the final output; wherein each layer of GRU is composed of 3 built-in interaction layers:

[0018] The first interaction layer is the update gate, and the calculation formula of the update gate signal at the t-th moment is:

[0019] z t =σ(W z ·[h t-1 ,x t ])

[0020] Where σ is the sigmoid function, h t-1 is the historical hidden state, x t represents the input data at the t-th moment, and W z is the weight matrix; the size of the update gate signal value determines the memory degree of the candidate hidden state;

[0021] The second interaction layer is the reset gate, and the calculation formula of the reset gate signal at the t-th moment is:

[0022] r t =σ(W r ·[h t-1 ,x t ])

[0023] Where W r is the weight matrix; the greater the reset gate signal value, the more historical information needs to be remembered;

[0024] The third interaction layer is the output layer, and under the action of the update gate z t and the reset gate r t , the update formula of the current moment hidden output state h t is:

[0025]

[0026] Where, is the candidate hidden state, and its calculation formula is:

[0027]

[0028] Candidate hidden state The information features of the current input xt and the historical implicit state ht-1 controlled by the reset gate rt are integrated; then, the final unit state h at the current moment t Through the forget gate mechanism (1-z t ) and h t-1 The product of z t and The product of is used to memorize new candidate state information, thereby ensuring that the information is updated while maintaining the balance between historical and current information.

[0029] When the VAE-BiGRU hybrid model is trained in steps 4 and 5, the VAE model and the BiGRU model are trained separately, and the hybrid model is composed of models corresponding to the minimum values ​​of their respective loss functions; wherein the loss function of the VAE model training consists of two parts: the reconstruction loss function and the potential loss function, and the calculation formula is:

[0030] loss VAE =MSE+αKL

[0031] Where MSE is the reconstruction loss function, KL is the potential loss function, and α is the weight coefficient of KL divergence;

[0032] In the loss function, the calculation formula of the reconstruction loss function MSE is:

[0033]

[0034] Where q is the total number of windows, w is the total number of samples in the window, and x ij is the jth original sample value in the i-th window, Generate sample value for the jth in the i-th window;

[0035] In the loss function, the potential loss function KL is expressed as the KL divergence between the distribution of generated samples and the ideal Gaussian distribution, and the calculation formula is:

[0036]

[0037] where σ i is the standard deviation of the samples generated by the i-th window, μ i is the mean of the samples generated by the i-th window;

[0038] The loss function of BiGRU model training is the prediction error of the latent variable before and after being processed by the BiGRU model. The calculation formula is:

[0039]

[0040] where n is the hidden variable length, z i is the hidden variable of the i-th window data obtained by VAE encoding, which is used as the input of the BiGRU model, is z i the hidden variable obtained after BiGRU processing, i.e., the predicted hidden variable.

[0041] The method for determining the prediction error threshold in step 8 is as follows:

[0042] Step 8.1: Perform band-pass filtering and standardization processing on the semi-anomaly magnetic signal generated in step 7 according to step 2, and mark the time when the magnetic anomaly exists as 1 and the time when the magnetic anomaly does not exist as 0.

[0043] Step 8.2: Perform sliding window processing on the data processed in step 8.1, and input the data in the window into the VAE-BiGRU hybrid model constructed in step 6.

[0044] Step 8.3: The hidden variable z is input into the BiGRU model, and the generated hidden variable z of the k+1-th window is predicted by the BiGRU model, where k represents the k-th window.

[0045] Step 8.4: Use the VAE decoder to decode the generated hidden variable z

[0046] Step 8.5: Perform the processing of steps 8.2 to 8.4 on the data of each window, and take the prediction error of each window data as the magnetic anomaly degree of the window data, i.e., the magnetic anomaly degree A i of the i-th window.

[0047]

[0048] where X k+i-w is the original data of the k+i-w-th window, is the predicted data of the k+i-w-th window.

[0049] Step 8.6: Set different thresholds in the range of the maximum error value, and then compare the magnetic anomaly degree obtained in step 8.5 with the set threshold. If the magnetic anomaly degree of the window data is greater than the threshold, it is considered that the data in the window exists magnetic anomaly, otherwise it is considered that the data in the window does not exist magnetic anomaly.

[0050] Step 8.7: Calculate the F1 score corresponding to each threshold, and the calculation formula is as follows:

[0051]

[0052] wherein p is precision, r is recall;

[0053] The calculation formula of p in the F1 score calculation formula is:

[0054]

[0055] wherein TP is the number of true positive data, and FP is the number of false positive;

[0056] The calculation formula of r in the F1 score calculation formula is:

[0057]

[0058] wherein FN is the number of false negative;

[0059] Step 8.8: Calculate the F1 score corresponding to all threshold values, and take the threshold value with the maximum F1 score as the finally determined prediction error threshold value.

[0060] Beneficial effects: The application discloses a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model, compared with the prior art, the advantages of the application include: an unsupervised training method is adopted, no labeled training data is needed, statistical characteristics inside data are spontaneously found, the model can be trained and magnetic anomaly detection can be completed in the case that magnetic anomaly samples are lacking or the number of normal and abnormal samples is extremely unbalanced; VAE is adopted to perform dimension reduction and compression on data in a window, so that the model learns the internal structure and characteristics of the data, and the learning effect of local characteristics in the window is good; the BiGRU structure is adopted to bidirectionally consider data information, time sequence characteristics and dependency in data are comprehensively captured through a gating system, and this is helpful for the model to learn global characteristics in a long time. BRIEF DESCRIPTION OF DRAWINGS

[0061] Figure 1 is a flowchart of the magnetic anomaly detection method of the application.

[0062] Figure 2 is a structural schematic diagram of the VAE-BiGRU hybrid model.

[0063] Figure 3 is a collected geomagnetic background signal waveform.

[0064] Figure 4 is a preprocessed geomagnetic background signal waveform.

[0065] Figure 5 is a waveform of a simulated magnetic anomaly signal and a semi-simulated magnetic signal.

[0066] Figure 6is the preprocessed signal waveform to be measured.

[0067] Figure 7 is the prediction error of the data to be measured.

[0068] Figure 8 is the magnetic anomaly detection result. DETAILED DESCRIPTION

[0069] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with specific examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application. Based on the examples in the present application, all other examples obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0070] The present application discloses a magnetic anomaly detection method based on a variational autoencoder and a bidirectional gated recurrent unit hybrid model, and the steps of the method are as follows:

[0071] Step 1: Collect the geomagnetic background signal at the detection point to form a training data set, and the collected data is as shown in Figure 3 .

[0072] Step 2: Perform band-pass filtering on the collected data to remove high-frequency noise and extremely low-frequency noise, and then perform standardization processing to make the data mean value 0 and standard deviation 1, and the processed result is as shown in Figure 4 .

[0073] Step 3: Construct a variational autoencoder-bidirectional gated recurrent unit (VAE-BiGRU) hybrid model, and the VAE encoder of the hybrid model in the present embodiment includes three one-dimensional convolutional layers, a Flatten layer, and a fully connected layer, the VAE decoder is similar to the encoder in structure and has a similar mirror symmetry relationship, including a fully connected layer and four one-dimensional convolutional layers, and the BiGRU model includes an input layer, an output layer, and two GRU layers in forward and reverse directions, and the structure is as shown in Figure 2 .

[0074] The variational autoencoder (VAE) model is composed of an encoder and a decoder; the VAE encoder and the decoder are both composed of multiple layers of neural networks; the encoder gradually reduces the dimension of the original sample data X={x1, x2, x3...x n} through multiple layers of neural networks to become low-dimensional hidden variable data with mean μ and variance σ 2 , and the decoder restores the generated sample data similar to the original sample data

[0075] The BiGRU model adopts two independent gate recurrent units (GRUs) to realize bidirectional processing: one layer of GRU processes data in the forward direction according to time sequence, and the other layer processes data in the reverse direction according to time sequence, and the two layers of GRU capture forward and backward information of the sequence respectively, and finally the outputs thereof are combined to generate the final output; wherein each layer of GRU is composed of three built-in interaction layers:

[0076] The first interaction layer is an update gate, and the calculation formula of the update gate signal at the t-th moment is:

[0077] z t =σ(W z ·[h t-1 ,x t ])

[0078] Wherein, σ is a sigmoid function, h t-1 is a historical hidden state, x t represents input data at the t-th moment, and W z is a weight matrix; the size of the update gate signal value determines the memory degree of the candidate hidden state;

[0079] The second interaction layer is a reset gate, and the calculation formula of the reset gate signal at the t-th moment is:

[0080] r t =σ(W r ·[h t-1 ,x t ])

[0081] Wherein, W r is a weight matrix; the greater the reset gate signal value, the more historical information needs to be remembered;

[0082] The third interaction layer is an output layer, and under the action of the update gate z t and the reset gate r t , the update formula of the current moment hidden output state h t is:

[0083]

[0084] Wherein, is a candidate hidden state, and the calculation formula thereof is:

[0085]

[0086] The candidate hidden state fuses the information features of the current input xt and the historical hidden state ht-1 regulated by the reset gate rt; then, the final unit state h t at the current moment is updated through the forgetting gate mechanism (1-z t ) and ht-1 The product of the two parts realizes the forgetting of part of the historical information while utilizing z t to remember new candidate state information, thereby ensuring information updating while maintaining the balance between historical and current information.

[0087] Step 4: Train the VAE model in step 3 using the training set data processed in step 2, wherein the output of the VAE encoder is the latent variable data Z = {z1, z2, z3...z n};

[0088] The loss function of the VAE model training is composed of two parts, a reconstruction loss function and a latent loss function, and the calculation formula is:

[0089] loss VAE = MSE + aKL

[0090] wherein MSE is the reconstruction loss function, KL is the latent loss function, a is the weight coefficient of the KL divergence, and generally takes 1; in the loss function, the calculation formula of the reconstruction loss function MSE is:

[0091]

[0092] wherein q is the total number of windows, w is the total number of samples in the window, x ij is the jth original sample value in the ith window, and x is the jth generated sample value in the ith window.

[0093] In the loss function, the latent loss function KL is represented by the KL divergence between the distribution of the generated sample and the ideal Gaussian distribution, and the calculation formula is:

[0094]

[0095] wherein σ i is the standard deviation of the generated sample in the ith window, and μ i is the mean of the generated sample in the ith window.

[0096] Step 5: Use the VAE encoder trained in step 4 to perform dimensionality reduction processing on the training set data processed in step 2 to obtain latent variable data Z = {z1, z2, z3...z n}, and then use the latent variable data to train the bidirectional gated recurrent unit model;

[0097] The loss function of the BiGRU model training is the prediction error of the latent variable before and after being processed by the BiGRU model, and the calculation formula is:

[0098]

[0099] where n is the hidden variable length, z i is the hidden variable of the i-th window data obtained by VAE encoding, which is used as the input of the BiGRU model, is the hidden variable z i obtained after BiGRU processing, that is, the predicted hidden variable.

[0100] Step 6: Embed the BiGRU model trained in step 5 between the encoder and the decoder of the VAE model trained in step 4 to form a VAE-BiGRU hybrid model.

[0101] Step 7: Generate a simulated magnetic anomaly signal according to the magnetic dipole theory model, and mix the simulated magnetic anomaly signal with the measured geomagnetic background signal at the detection point to form a semi-simulated magnetic anomaly signal. The waveforms of the simulated magnetic anomaly signal and the generated semi-simulated signal are shown in Figure 5 , where the black dashed line represents the waveform of the simulated magnetic anomaly signal, the magnetic field strength coordinate is on the right side of the graph, the gray solid line represents the waveform of the generated semi-simulated magnetic anomaly signal, the magnetic field strength coordinate is on the left side of the graph, and the horizontal coordinate represents the time of the two signals.

[0102] Step 8: Use the VAE-BiGRU hybrid model obtained in step 6 to determine a prediction error threshold using the semi-simulated signal generated in step 7, which is specifically:

[0103] Step 8.1: Perform band-pass filtering and standardization processing on the semi-simulated magnetic anomaly signal generated in step 7 according to step 2, and mark the time when the magnetic anomaly exists as 1 and the time when the magnetic anomaly does not exist as 0;

[0104] Step 8.2: Perform sliding window processing on the data processed in step 8.1, and input the data in the window into the VAE-BiGRU hybrid model constructed in step 6;

[0105] Step 8.3: The hidden variable z obtained after VAE encoding is used as the input of the BiGRU model, and the generated hidden variable z of the k+1-th window is predicted by the BiGRU model, where k represents the k-th window.

[0106] Step 8.4: Use the VAE decoder to decode the generated hidden variable z

[0107] Step 8.5: Perform steps 8.2 to 8.4 on the data of each window, and use the prediction error of each window data as the magnetic anomaly degree of the window data, and the magnetic anomaly degree of the i-th window is A iThe calculation formula is:

[0108]

[0109] wherein X k+i-w is the original data of the k+i-wth window, is the predicted data of the k+i-wth window.

[0110] Step 8.6: Set different thresholds in the range of the maximum error value in turn, and then compare the magnetic anomaly degree obtained in step 8.5 with the set threshold. If the magnetic anomaly degree of the window data is greater than the threshold, it is considered that the data in the window exists magnetic anomaly, otherwise it is considered that the data in the window does not exist magnetic anomaly.

[0111] Step 8.7: Calculate the F1 score corresponding to each threshold, and the calculation formula is:

[0112]

[0113] wherein p is the precision, and r is the recall.

[0114] The calculation formula of p in the F1 score calculation formula is:

[0115]

[0116] wherein TP is the number of true positive data, and FP is the number of false positive.

[0117] The calculation formula of r in the F1 score calculation formula is:

[0118]

[0119] wherein FN is the number of false negative.

[0120] Step 8.8: Calculate the F1 score corresponding to all thresholds, and take the threshold with the maximum F1 score as the final determined prediction error threshold.

[0121] Step 9: Perform the same filtering and standardization processing on the to-be-detected data as step 2, and the processed result is as shown in Figure 6 .

[0122] Step 10: Send the to-be-detected data processed in step 9 into the VAE-BiGRU hybrid model obtained in step 6 to obtain the prediction error, as shown in Figure 7 . If the magnetic anomaly degree output by the model is greater than the prediction error threshold determined in step 8, it is judged that there exists magnetic anomaly in the to-be-detected signal, otherwise it is judged that there does not exist magnetic anomaly in the to-be-detected signal, and the detection result is as shown in Figure 8 .

[0123] So far, the present embodiment has been described in detail in combination with the drawings, and based on the above description, those skilled in the art should have a relatively clear understanding of the magnetic anomaly detection method disclosed in the present application based on the variational autoencoder and the bidirectional gated recurrent unit hybrid model, and the above embodiments do not limit the protection scope of the present application in any form, and any technical solution obtained by equivalent replacement or the like belongs to the protection scope of the present application.

Claims

1. A magnetic anomaly detection method based on a hybrid model of variational autoencoder and bidirectional gated recurrent unit, characterized in that: The following steps are involved: Step 1: Collect geomagnetic background signals at the detection point to form a training data set; Step 2: Band-pass filter the collected data to remove high-frequency noise and very low-frequency noise, and then standardize the data to make the mean of the data 0 and the standard deviation 1; Step 3: Construct a variational autoencoder-bidirectional gated recurrent unit VAE-BiGRU hybrid model, where the variational autoencoder VAE model consists of two parts: encoder and decoder; both the VAE encoder and decoder are composed of multi-layer neural networks. The encoder converts the original sample data X = {x1, x2, x3...x n }Through the multi-layer neural network, the dimension is gradually reduced to a mean of μ and a variance of σ 2 The decoder uses a multi-layer neural network to increase the dimension of the latent variable data and restore it to generated sample data similar to the original sample data. Step 4: Use the training set data processed in step 2 to train the VAE model in step 3; Step 5: Use the VAE encoder trained in step 4 to perform dimensionality reduction on the training set data processed in step 2 to obtain the latent variable data Z = {z1,z2,z3...z n }, and then use the latent variable data to train the bidirectional gated recurrent unit BiGRU model; Step 6: Embed the BiGRU model trained in step 5 between the encoder and decoder of the VAE model trained in step 4 to form a VAE-BiGRU hybrid model; Step 7: Generate a simulated magnetic anomaly signal based on the magnetic dipole theory model, and mix the simulated magnetic anomaly signal with the geomagnetic background signal measured at the detection point to form a semi-simulated magnetic anomaly signal; Step 8: Using the VAE-BiGRU hybrid model obtained in step 6, determine a prediction error threshold using the semi-simulated signal generated in step 7; Step 9: Perform the same filtering and normalization processing on the data to be tested as in step 2; Step 10: The data to be detected processed in step 9 is fed into the VAE-BiGRU hybrid model obtained in step 6. If the magnetic anomaly degree output by the model is greater than the prediction error threshold determined in step 8, it is judged that there is a magnetic anomaly in the signal to be detected; otherwise, it is judged that there is no magnetic anomaly in the signal to be detected.

2. The magnetic anomaly detection method based on a hybrid model of a variational autoencoder and a bidirectional gated recurrent unit according to claim 1 is characterized in that: In the VAE-BiGRU hybrid model constructed in step 3, the BiGRU model uses two independent layers of gated recurrent units (GRUs) to implement bidirectional processing: one layer of GRU processes data in the forward direction of the time series, and the other layer processes data in the reverse direction of the time series. These two layers of GRU capture the forward and backward information of the sequence respectively, and finally merge their outputs to generate the final output; each layer of GRU is composed of three built-in interaction layers: The first interaction layer is the update gate. The calculation formula of the update gate signal at time t is: z t =σ(W z ·[h t-1 ,x t ]) Where σ is the sigmoid function, h t-1 is the historical implicit state, x t Represents the input data at time t, W z is the weight matrix; the size of the update gate signal value determines the memory degree of the candidate hidden state; The second interaction layer is the reset gate. The calculation formula of the reset gate signal at time t is: r t =σ(W r ·[h t-1 ,x t ]) Among them, W r is the weight matrix; the larger the reset gate signal value is, the more historical information needs to be remembered; The third interactive layer is the output layer, which updates the gate z t and reset gate r t Under the action of t The update formula is: in, is the candidate hidden state, and its calculation formula is: Where W h is the weight matrix.

3. The magnetic anomaly detection method based on a hybrid model of a variational autoencoder and a bidirectional gated recurrent unit according to claim 1 is characterized in that: When the VAE-BiGRU hybrid model is trained in steps 4 and 5, the VAE model and the BiGRU model are trained separately, and the hybrid model is composed of models corresponding to the minimum values ​​of their respective loss functions; wherein the loss function of the VAE model training consists of two parts: the reconstruction loss function and the potential loss function, and the calculation formula is: loss VAE =MSE+αKL Where MSE is the reconstruction loss function, KL is the potential loss function, and α is the weight coefficient of KL divergence; In the loss function, the calculation formula of the reconstruction loss function MSE is: Where q is the total number of windows, w is the total number of samples in the window, and x ij is the jth original sample value in the i-th window, Generate sample value for the jth in the i-th window; In the loss function, the potential loss function KL is expressed as the KL divergence between the distribution of generated samples and the ideal Gaussian distribution, and the calculation formula is: where σ i is the standard deviation of the samples generated by the i-th window, μ i is the mean of the samples generated by the i-th window; The loss function of BiGRU model training is the prediction error of the latent variable before and after being processed by the BiGRU model. The calculation formula is: Where n is the length of the hidden variable, z i is the hidden variable obtained by VAE encoding of the i-th window data, which serves as the input of the BiGRU model. It is z i The hidden variables obtained after BiGRU processing are the predicted hidden variables.

4. The magnetic anomaly detection method based on a hybrid model of a variational autoencoder and a bidirectional gated recurrent unit according to claim 1 is characterized in that: The method for determining the prediction error threshold in step 8 is: Step 8.1: Perform the bandpass filtering and normalization processing of step 2 on the semi-simulated magnetic anomaly signal generated in step 7, and mark the moment when the magnetic anomaly exists as 1, and the moment when the magnetic anomaly does not exist as 0; Step 8.2: Perform sliding windowing on the data processed in step 8.1 and input the data in the window into the VAE-BiGRU hybrid model constructed in step 6; Step 8.3: Encode the latent variables obtained by VAE As the input of the BiGRU model, the generated latent variable of the k+1th window is predicted by the BiGRU model Where k represents the kth window; Step 8.4: Use the VAE decoder to decode the generated latent variable of the k+1th window obtained in step 8.3 to obtain the predicted data of the k+1th window Step 8.5: Process the data of each window in steps 8.2 to 8.4, and use the prediction error of each window data as the magnetic anomaly degree of the window data. The magnetic anomaly degree A of the i-th window is i The calculation formula is: where X k+i-w is the original data of the k+iwth window, is the predicted data of the k+iwth window; Step 8.6: Set different thresholds in sequence within the maximum error value range, and then compare the magnetic anomaly obtained in step 8.5 with the set threshold. If the magnetic anomaly of the window data is greater than the threshold, it is considered that the data in the window has a magnetic anomaly; otherwise, it is considered that the data in the window does not have a magnetic anomaly; Step 8.7: Calculate the F1 score corresponding to each threshold using the following formula: Where p is the precision rate and r is the recall rate; The calculation formula for p in the F1 score calculation formula is: Where TP is the number of true positive data, and FP is the number of false positive data; The calculation formula for r in the F1 score calculation formula is: Where FN is the number of false negatives; Step 8.8: Count the F1 scores corresponding to all thresholds, and use the threshold with the largest F1 score as the final prediction error threshold.

Citation Information

Patent Citations

  • Abnormal electronic reconnaissance data intelligent detection and classification method

    CN115659219A

  • Industrial control system data anomaly detection method

    CN115903741A