Voltage prediction method and device for tunnel magnetoresistive sensor, equipment and storage medium

By processing the sensor data of the tunnel magnetoresistance sensor using the long short-term memory model (LSTM), the problem of low prediction accuracy of the tunnel magnetoresistance sensor output voltage is solved, higher fitting degree and prediction accuracy are achieved, and the impact of temperature drift and device fatigue is reduced.

CN120705830APending Publication Date: 2025-09-26SOUTHERN POWER GRID DIGITAL GRID RESEARCH INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510744926.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In the prior art, the output voltage prediction accuracy of the tunnel magnetoresistive sensor is poor, and there are problems such as temperature offset and poor stability during repeated operations.

Method used

The long short-term memory model (LSTM) is used to predict the voltage of the tunnel magnetoresistance sensor. Sensor data is acquired through a preset sliding window, and data conversion and gating processing are performed. A double-layer LSTM network is used for voltage prediction. The model is trained with the training sample set to improve the fit and prediction accuracy.

Benefits of technology

The output voltage prediction accuracy of the tunnel magnetoresistive sensor is improved, the errors caused by temperature drift and device fatigue are reduced, and the accuracy and stability of the prediction are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705830A_ABST
    Figure CN120705830A_ABST
Patent Text Reader

Abstract

The invention relates to a voltage prediction method and device for a tunnel magnetoresistive sensor, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring sensor data of a tunnel magnetoresistive sensor at a plurality of historical moments by using a preset sliding window, performing data conversion on the sensor data to obtain target sensor data, and inputting the target sensor data into a long-short-term memory model, the method comprises the following steps: performing gating processing on target sensor data through an input layer to obtain a hidden state, performing gating processing on the hidden state through a hidden layer to obtain a gating processing result, and mapping the gating processing result through an output layer to obtain a voltage prediction result of the tunnel magnetoresistive sensor at the current moment. By adopting the method, the prediction precision of the output voltage of the tunnel magnetoresistive sensor can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of sensor technology, and in particular to a voltage prediction method, apparatus, computer equipment, computer-readable storage medium, and computer program product for a tunnel magnetoresistive sensor. Background Art

[0002] With the continuous improvement of hardware technology, various types of sensors have begun to be widely used in various industries. Sensors can change their output data due to environmental changes, and users can deduce environmental changes based on changes in output data.

[0003] Taking the tunnel magnetoresistance (TMR) sensor as an example, when the external magnetic field changes, its resistance changes, thereby changing the output voltage of the tunnel magnetoresistance sensor. Tunnel magnetoresistance sensors are widely used due to their sensitivity and low power consumption. However, tunnel magnetoresistance sensors also have problems such as temperature drift and poor stability during repeated operation. This makes it difficult to establish a reliable physical model to characterize the operating principle, response characteristics, and relationship between the tunnel magnetoresistance sensor and the measured physical quantity.

[0004] In conventional technology, the physical model of a tunnel magnetoresistive sensor is usually modeled by linear regression. However, the fitting curve obtained in this way has the problem of poor prediction accuracy of the output voltage of the tunnel magnetoresistive sensor. Summary of the Invention

[0005] Based on this, it is necessary to provide a voltage prediction method, device, computer equipment, computer-readable storage medium and computer program product for a tunnel magnetoresistive sensor that can improve the prediction accuracy of the output voltage of the tunnel magnetoresistive sensor to address the above technical problems.

[0006] In a first aspect, the present application provides a voltage prediction method for a tunnel magnetoresistive sensor, comprising:

[0007] Using a preset sliding window, the sensor data of the tunnel magnetoresistive sensor at multiple historical moments is obtained;

[0008] Performing data conversion on each sensor data to obtain target sensor data;

[0009] Target sensor data is input into a long short-term memory model, the target sensor data is gated through an input layer included in the long short-term memory model to obtain a hidden state, the hidden state is gated through a hidden layer included in the long short-term memory model to obtain a gating processing result, and the gating processing result is mapped through an output layer included in the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistance sensor at the current moment; the multiple historical moments are continuous with the current moment in time series.

[0010] In one embodiment, the method further comprises:

[0011] Get the actual output voltage of the tunnel magnetoresistive sensor at the current moment;

[0012] Correcting the actual output voltage based on the output voltage prediction result to obtain a corrected output voltage;

[0013] The environmental magnetic field data corresponding to the tunnel magnetoresistive sensor is determined according to the corrected output voltage.

[0014] In one embodiment, the sensor data includes at least one of temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment; and performing data conversion on each sensor data to obtain target sensor data includes:

[0015] Build a matrix based on the data of each sensor, the number of rows of the matrix is ​​the same as the size of the sliding window, and the number of columns of the matrix is ​​the same as the number of data types of the sensor data;

[0016] The matrix is ​​normalized to obtain the target sensor data.

[0017] In one embodiment, gate processing is performed on target sensor data through an input layer of a long short-term memory model to obtain a hidden state, including:

[0018] Deleting the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through the forget gate included in the input layer, and writing the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through the input gate included in the input layer;

[0019] The output gate included in the input layer performs a hyperbolic tangent function calculation based on the updated unit state of the input layer to obtain the hidden state of the input layer.

[0020] In one embodiment, performing gating processing on the hidden state through the hidden layer included in the long short-term memory model to obtain the gating processing result includes:

[0021] Deleting a unit state of the hidden layer based on a hidden state of the input layer through a forget gate included in the hidden layer, and writing a unit state of the hidden layer based on the hidden state of the input layer through an input gate included in the hidden layer;

[0022] The output gate included in the hidden layer performs a hyperbolic tangent function calculation based on the updated unit state of the hidden layer to obtain a gated processing result.

[0023] In one embodiment, the method further comprises:

[0024] Acquire a training sample set, where the training sample set includes multiple training samples, each training sample including sample sensor data of a sample tunnel magnetoresistive sensor at a historical moment and label data corresponding to the sample sensor data;

[0025] The long short-term memory model to be trained is trained according to each sample sensor data and label data to obtain a long short-term memory model.

[0026] In one embodiment, performing model training on a long short-term memory model to be trained based on each sample sensor data and label data includes:

[0027] For each training sample, a sliding window is used to select multiple target sample sensor data from each sample sensor data; the historical moments corresponding to each target sample sensor data are continuous in time series;

[0028] A sample matrix is ​​constructed based on each target sample sensor data; the number of rows of the sample matrix is ​​the same as the size of the sliding window, and the number of columns of the sample matrix is ​​the same as the number of data types of the target sample sensor data;

[0029] The sample matrix is ​​input into the long short-term memory model to be trained to perform voltage prediction to obtain sample prediction results, and the model parameters are adjusted according to the label data corresponding to the sample matrix and the sample prediction results.

[0030] In a second aspect, the present application further provides a voltage prediction device for a tunnel magnetoresistive sensor, comprising:

[0031] A sensor data acquisition module is used to acquire sensor data of the tunnel magnetoresistive sensor at multiple historical moments using a preset sliding window;

[0032] A sensor data conversion module is used to convert the data of each sensor to obtain the target sensor data;

[0033] The voltage prediction module is used to input the target sensor data into the long short-term memory model, perform gate processing on the target sensor data through the input layer included in the long short-term memory model to obtain a hidden state, perform gate processing on the hidden state through the hidden layer included in the long short-term memory model to obtain a gate processing result, and map the gate processing result through the output layer included in the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistive sensor at the current moment, where multiple historical moments are continuous in time sequence with the current moment.

[0034] 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 the processor implements the steps of the method described in the first aspect when executing the computer program.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when executed by a processor.

[0036] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements the steps of the method described in the first aspect when executed by a processor.

[0037] The above-mentioned tunnel magnetoresistive sensor voltage prediction method, apparatus, computer device, computer-readable storage medium, and computer program product obtain sensor data of the tunnel magnetoresistive sensor at multiple historical moments through a preset sliding window, predict the output voltage of the tunnel magnetoresistive sensor based on the sensor data, perform data conversion on the multiple sensor data to obtain target sensor data, convert the multiple sensor data into one target sensor data, input the target sensor data into a long short-term memory model, and perform voltage prediction using a long short-term memory network in the long short-term memory model. First, the target sensor data is gated through the input layer of the long short-term memory model to obtain a hidden state. Then, the hidden state is gated through the hidden layer of the long short-term memory module to obtain a gated processing result. Finally, the gated processing result is mapped through the output layer of the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistive sensor at a current moment that is temporally continuous with the multiple historical moments. The long short-term memory model includes two layers of long short-term memory networks, which makes the long short-term memory model fit the physical model of the tunnel magnetoresistive sensor more closely. The output voltage of the tunnel magnetoresistive sensor is predicted using the long short-term memory model with a higher fit, thereby improving the prediction accuracy of the output voltage of the tunnel magnetoresistive sensor. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. 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 any creative work.

[0039] Figure 1 A diagram illustrating an application environment of a voltage prediction method for a tunnel magnetoresistive sensor according to an embodiment;

[0040] Figure 2 1 is a flow chart of a method for predicting voltage of a tunnel magnetoresistive sensor according to an embodiment;

[0041] Figure 3 Schematic diagram of a process for training a long short-term memory model in one embodiment;

[0042] Figure 4 Schematic diagram of the model architecture of a long short-term memory model in one embodiment;

[0043] Figure 5 302 is a flowchart of an embodiment;

[0044] Figure 6 204 is a flow chart of step 204 in one embodiment;

[0045] Figure 7 Schematic diagram of the operation flow of the input layer in step 206 in one embodiment;

[0046] Figure 8 206 is a schematic diagram of the operation flow of the hidden layer in one embodiment;

[0047] Figure 9 1 is a flow chart of a voltage calibration step of a tunnel magnetoresistive sensor in one embodiment;

[0048] Figure 10 is a schematic flow chart of a voltage prediction method for a tunnel magnetoresistive sensor in another embodiment;

[0049] Figure 11 Schematic diagram of the full range and amplified prediction curve of the output voltage of a tunnel magnetoresistive sensor in one embodiment;

[0050] Figure 12 is a schematic diagram of a full range and an amplified prediction curve of the output voltage of a tunnel magnetoresistive sensor in another embodiment;

[0051] Figure 13 FIG1 is a schematic diagram showing a comparison of sensor mean square errors of different models under five repeated training runs in one embodiment;

[0052] Figure 14 is a structural block diagram of a voltage prediction device for a tunnel magnetoresistive sensor in one embodiment;

[0053] Figure 15 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0055] It should be noted that the terms "first", "second", etc. used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "including" and "having" used in this application and any variations thereof are intended to cover non-exclusive inclusions. The term "plurality" used in this application refers to two or more. The term "and / or" used in this application refers to one of the solutions or any combination of multiple solutions.

[0056] The voltage prediction method of the tunnel magnetoresistive sensor provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the application environment at least includes: a server 101 and a long short-term memory model 101-1.

[0057] Server 101 is configured to acquire sensor data from a tunnel magnetoresistive sensor at multiple historical moments using a preset sliding window, convert the sensor data into target sensor data, input the target sensor data into a long-short-term memory model 101-1, and obtain a voltage prediction result of the tunnel magnetoresistive sensor at the current moment output by long-short-term memory model 101-1. Server 101 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.

[0058] Long-short-term memory model 101-1 is configured to receive target sensor data sent by server 101, perform gated processing on the target sensor data via the input layer to obtain a hidden state, perform gated processing on the hidden state via the hidden layer to obtain a gated processing result, and map the gated processing result via the output layer to obtain a voltage prediction result for the tunnel magnetoresistive sensor. Long-short-term memory model 101-1 can be deployed as a functional module within server 101; alternatively, long-short-term memory model 101-1 can be deployed independently of server 101 and communicate with server 101 via a network.

[0059] In addition, the implementation environment may also include a tunnel magnetoresistance sensor 102, which can be a sensor device made based on the tunnel magnetoresistance effect. The tunnel magnetoresistance sensor 102 can be deployed in a real environment to monitor the magnetic field data of the environment. The tunnel magnetoresistance sensor 102 can communicate with the server 101 through the network.

[0060] In an exemplary embodiment, Figure 2 As shown, a voltage prediction method for a tunnel magnetoresistive sensor is provided. Figure 1 The server in is used as an example to illustrate, including the following steps 202 to 206.

[0061] Step 202 : Using a preset sliding window, obtain sensor data of the tunnel magnetoresistive sensor at multiple historical moments.

[0062] In practical applications, a sliding window is an algorithmic technique used to process array or sequence data. By maintaining a virtual data window (data range) that slides from one end of the sequence to the other to select data, the sliding window can effectively reduce time complexity. In this application, a preset sliding window size is used to select sensor data from multiple historical moments in recorded tunnel magnetoresistive sensor data. The sliding window size refers to the number of data elements covered by the data window and can be fixed or variable.

[0063] In the present application, sensor data refers to environmental data of the environment in which the tunnel magnetoresistance sensor is located and / or deployed, and may also be status data of the tunnel magnetoresistance sensor itself. The tunnel magnetoresistance sensor may determine the output voltage based on the environmental data, or the tunnel magnetoresistance sensor may determine the output voltage based on its own status data. For example, if the tunnel magnetoresistance sensor is deployed in a distribution network, the magnetic field in the distribution network may change due to the current and / or frequency of the transmitted alternating current, and the sensor data may be the magnetic field strength of the environment. For another example, if the tunnel magnetoresistance sensor is deployed in a distribution network, and its own Hall resistance changes due to changes in the external magnetic field, the sensor data may be its own Hall resistance.

[0064] In addition, the sensor data may also include other environmental data and / or other status data, such as temperature, magnetic field strength, Hall resistance, transverse resistance, and / or longitudinal resistance. Optionally, the sensor data includes at least one of the temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment. When the sensor data includes two or more data types, the sensor data may exist in the form of a data set and / or a matrix. Optionally, the sensor data includes any two or a combination of any two or more of the temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment.

[0065] During implementation, the server uses a preset sliding window size to select sensor data of multiple historical moments before the current moment from the sensor data record of the tunnel magnetoresistive sensor; wherein the multiple historical moments are sequentially continuous with the current moment.

[0066] During execution, the tunnel magnetoresistive sensor sensor data can be sorted in a data sequence, specifically in chronological order. Specifically, the data sequence corresponding to the tunnel magnetoresistive sensor sensor data can be used to record sensor data at each historical moment in chronological order, and a preset sliding window can be used to select multiple sensor data corresponding to a specific length of time before the current moment. For example, if the preset sliding window size is 20, then sensor data for the 20 historical moments (time steps) preceding the current moment in the tunnel magnetoresistive sensor sensor data record can be obtained.

[0067] Step 204: Perform data conversion on each sensor data to obtain target sensor data.

[0068] During the implementation process, the server performs data conversion on each sensor data, converting multiple sensor data into one target sensor data to reduce data redundancy.

[0069] During the execution process, a matrix may be constructed based on multiple sensor data, the sensor data may be converted into feature data, and the multiple sensor data may be spliced ​​into a data sequence and / or data set.

[0070] In step 206, the target sensor data is input into the long short-term memory model, the target sensor data is gated through the input layer included in the long short-term memory model to obtain a hidden state, the hidden state is gated through the hidden layer included in the long short-term memory model to obtain a gating processing result, and the gating processing result is mapped through the output layer included in the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistance sensor at the current moment.

[0071] In practical applications, Long Short-Term Memory (LSTM) as a recurrent neural network can be used to solve the problem of gradient vanishing and / or exploding encountered by traditional recurrent neural networks when processing long time series data; in this application, the sensor data can be a time series with a long time span. For time series with a long time span, a two-layer LSTM network can be used to make predictions based on the sensor data. The two-layer LSTM network is configured into the LSTM model, and the output voltage of the tunnel magnetoresistance sensor is predicted by the LSTM model with stronger modeling capabilities, thereby improving the accuracy of voltage prediction. At the same time, the LSTM model is used for quick calculation, thereby improving the efficiency of voltage prediction. Furthermore, the LSTM model is used as software to predict voltage based on sensor data, thereby avoiding errors caused by sensor device fatigue and / or temperature drift, thereby improving the accuracy of voltage prediction.

[0072] During the implementation process, the server inputs the target sensor data into the long short-term memory model. The long short-term memory model passes the target sensor data to the first layer LSTM (input layer) for gating processing to obtain the hidden state. The long short-term memory model passes the hidden state to the second layer LSTM (hidden layer) for gating processing to obtain the gating processing result. The long short-term memory model then passes the gating processing result to the output layer (linear layer) for mapping to obtain the voltage prediction result of the tunnel magnetoresistance sensor at the current moment.

[0073] In the process of performing gating processing through the input layer, gating processing can be first performed based on the target sensor data through the forget gate of the input layer, then gating processing can be performed based on the target sensor data through the input gate of the input layer, and finally gating processing can be performed through the output gate of the input layer to obtain the hidden state.

[0074] In the process of performing gating processing through the hidden layer, gating processing can be first performed through the forget gate of the input layer based on the hidden state output by the input layer, and then gating processing can be performed through the input gate of the input layer based on the hidden state output by the input layer, and finally gating processing can be performed through the output gate of the input layer to obtain the gated processing result.

[0075] In the above-mentioned gating processing process, gating processing through the forget gate can be to determine the cell state that needs to be deleted and / or retained in the LSTM through the forget gate, gating processing through the input gate can be to determine the cell state that needs to be written in the LSTM and / or the value of the written cell state through the input gate, and gating processing through the output gate can be to calculate the hidden state and / or output data based on the cell state.

[0076] In the above-mentioned tunnel magnetoresistive sensor voltage prediction method, sensor data of the tunnel magnetoresistive sensor at multiple historical moments is obtained through a preset sliding window, the output voltage of the tunnel magnetoresistive sensor is predicted based on the sensor data, data conversion is performed on the multiple sensor data to obtain target sensor data, the multiple sensor data are converted into one target sensor data, the target sensor data is input into a long short-term memory model, and voltage prediction is performed using a long short-term memory network in the long short-term memory model. First, the target sensor data is gated through the input layer of the long short-term memory model to obtain a hidden state, and then the hidden state is gated through the hidden layer of the long short-term memory module to obtain a gated processing result. Finally, the gated processing result is mapped through the output layer of the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistive sensor at the current moment that is temporally continuous with the multiple historical moments. The long short-term memory model includes two layers of long short-term memory networks, so that the long short-term memory model has a higher degree of fit with the physical model of the tunnel magnetoresistive sensor. The output voltage of the tunnel magnetoresistive sensor is predicted using the long short-term memory model with a higher degree of fit, thereby improving the prediction accuracy of the output voltage of the tunnel magnetoresistive sensor.

[0077] Based on the above exemplary embodiment, the following provides a voltage prediction method for a tunnel magnetoresistive sensor in one or more exemplary embodiments, wherein the method is applied to Figure 1 The server in is used as an example to illustrate the details, including the following.

[0078] During the execution process, the long short-term memory model may also be trained first, and the voltage of the tunnel magnetoresistance sensor may be predicted by the trained long short-term memory model; during the training process, the sensor data may be used as a sample, the output voltage of the tunnel magnetoresistance sensor may be used as a label, the sensor data may be input into the long short-term memory model to be trained, the calculation result may be output, the calculation result may be compared with the label, and the long short-term memory model to be trained may be corrected according to the comparison result. The output voltage as the label may be the calculated theoretical output voltage or the real output voltage may be obtained. Similarly, the long short-term memory model to be trained may be trained using the above-mentioned training method until the difference between the output voltage calculated by the long short-term memory model to be trained and the output voltage as the label converges. The training of the long short-term memory model is then completed. The training of the long short-term memory model may be performed on a cloud server or offline. In an optional implementation manner provided by the present application, if Figure 3 As shown, the training process of the long short-term memory model includes steps 301 to 302:

[0079] Step 301: Obtain a training sample set.

[0080] The training sample set includes multiple training samples, each of which includes sample sensor data of a sample tunnel magnetoresistive sensor at a historical moment and label data corresponding to the sample sensor data. In this application, the sample sensor data can be real sensor data of a real tunnel magnetoresistive sensor at multiple historical moments, and accordingly, the label data corresponding to the sample sensor data can be the output voltage of the real tunnel magnetoresistive sensor corresponding to the real sensor data. In addition, the sample sensor data can also be set theoretical data, and the sample sensor data can be preset theoretical sensor data. Accordingly, the label data corresponding to the sample sensor data can be the theoretical output voltage calculated based on the working principle of the tunnel magnetoresistive sensor (tunnel magnetoresistive effect). Optionally, the sample sensor data includes real sample sensor data and / or theoretical sample sensor data.

[0081] Furthermore, in order to avoid the problems of temperature drift and repetitive fatigue generated by real tunnel magnetoresistive sensors during operation, sample sensor data corresponding to each temperature segment can be set, and multiple identical sample sensor data can be repeatedly set. By setting samples with different temperatures and / or repetitive tests, the long-short-term memory model can learn the model capabilities under temperature drift and / or repetitive tests.

[0082] It should be noted that the training sample set may include both real sample sensor data and theoretical sample sensor data. The versatility of the trained model can be improved by mixing real values ​​and theoretical values. Sample sensor data in temperature segments where temperature drift does not occur and / or sample sensor data where repetitive fatigue does not occur can be set as real sample sensor data, and sample sensor data in temperature segments where temperature drift may occur and / or sample sensor data where repetitive fatigue may occur can be set as theoretical sample sensor data.

[0083] During the implementation process, the server can obtain a training sample set of the long-short-term memory model to be trained, where the training sample set contains multiple training samples, and each training sample includes sample sensor data of the sample tunnel magnetoresistance sensor at a historical moment and label data corresponding to the sample sensor data at the historical moment; wherein the label data can be the output voltage output by the real sample tunnel magnetoresistance sensor based on the sample sensor data, or it can be the output voltage calculated according to the sample sensor data based on the working principle of the tunnel magnetoresistance sensor.

[0084] Step 302 : Perform model training on the long short-term memory model to be trained based on each sample sensor data and label data to obtain a long short-term memory model.

[0085] During the implementation process, the server can input sensor data into the long short-term memory model to be trained, output calculation results, compare the calculation results with the labels and modify the long short-term memory model to be trained based on the comparison results, and so on until the comparison results converge.

[0086] The long short-term memory model used in this application can be constructed with reference to the following example; for example, Figure 4 As shown, the long short-term memory model can adopt a two-layer LSTM network, each layer can contain 128 hidden units, and use the gating mechanism to dynamically control the information flow and memory state, so that it can effectively model the long-term dependencies in the multivariate input. After stacking the LSTM layers, a fully connected linear layer maps the output to a scalar value for prediction. This architecture is relatively lightweight while maintaining strong time modeling capabilities and high fitting accuracy, making it particularly suitable for the regression task of the non-stationary series of tunnel magnetoresistive sensors.

[0087] In an optional implementation provided by the present application, a long short-term memory model is trained using sample sensor data of a sample tunnel magnetoresistive sensor at a historical moment and label data corresponding to the sample sensor data, thereby specifically training the model to have the ability to predict the output voltage of the tunnel magnetoresistive sensor, thereby improving the effectiveness of model training.

[0088] During the training process of the long short-term memory model, a plurality of sample sensor data may be selected from the training sample set through a sliding window, and the plurality of sample sensor data may be converted into a sample matrix, so that the long short-term memory model can effectively learn the trend of signal changes through the sample matrix, thereby improving the reliability of the trained long short-term memory model; In an optional embodiment provided by the present application, if Figure 5 As shown, step 302 includes steps 501 to 503.

[0089] Step 501 : For each training sample, a plurality of target sample sensor data are selected from each sample sensor data using a sliding window.

[0090] The historical moments corresponding to the sensor data of each target sample are continuous in time series.

[0091] During the implementation process, the server selects (boxes) a plurality of time-series continuous target sample sensor data from the sample sensor data included in the training sample set according to the size of the preset sliding window.

[0092] Step 502: construct a sample matrix based on the sensor data of each target sample.

[0093] The number of rows of the sample matrix is ​​the same as the size of the sliding window, and the number of columns of the sample matrix is ​​the same as the number of data types of the target sample sensor data.

[0094] During the implementation process, the server sorts multiple target sample sensor data in time sequence, writes the sample sensor data into the columns of the sample matrix according to the sorting results, and obtains the sample matrix; among them, the number of rows of the sample matrix is ​​the size of the sliding window, which is also the number of target sample sensor data, and the number of rows of the sample matrix is ​​the amount of data contained in each target sample sensor data.

[0095] It should be noted that the label corresponding to the sample matrix is ​​the label data corresponding to the sample sensor data at the next moment after the last sample sensor data in the target sample sensor data; for example, if the sample matrix contains sample sensor data from moments 1 to 20, the label data corresponding to the sample matrix is ​​the output voltage of the tunnel magnetoresistance sensor at the 21st moment.

[0096] Furthermore, the sample matrix can be normalized to improve the convergence speed and stability.

[0097] Step 503: Input the sample matrix into the long short-term memory model to be trained to perform voltage prediction to obtain sample prediction results, and adjust the model parameters according to the label data corresponding to the sample matrix and the sample prediction results.

[0098] During the implementation process, the server inputs the sample matrix into the long short-term memory model to be trained for voltage prediction, obtains the sample prediction results output by the long short-term memory model to be trained, calculates the training loss based on the sample prediction results and the label data corresponding to the sample matrix, and adjusts the parameters of the long short-term memory model to be trained based on the training loss.

[0099] In an optional implementation provided by this embodiment, by converting multiple sample sensor data into a sample matrix, local dynamic characteristics are retained, so that the long short-term memory model to be trained can effectively learn the trend of signal changes, thereby improving the training effectiveness of the long short-term memory model, and increasing the fitting degree of the long short-term memory model for the tunnel magnetoresistance sensor, thereby improving the reliability of the output voltage of the long short-term memory model for the tunnel magnetoresistance sensor.

[0100] In the process of sensor data conversion, the sensor data at multiple historical moments can be converted into a matrix, and the matrix is ​​operated by the long short-term memory network included in the long short-term memory model, and the voltage is predicted by the time-related data, thereby improving the prediction precision and accuracy; In an optional implementation manner provided by this embodiment, if Figure 6 As shown, step 204 includes steps 601 and 602 .

[0101] Step 601: construct a matrix based on the data of each sensor.

[0102] The number of rows of the matrix is ​​the same as the size of the sliding window, and the number of columns of the matrix is ​​the same as the number of data types of the sensor data; the sensor data includes the temperature, magnetic field strength, Hall resistance, transverse resistance and / or longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment.

[0103] During the implementation process, the server sorts multiple sensor data in time sequence, and writes the sample sensor data into the columns of the sample matrix according to the sorting results to obtain the sample matrix; among them, the number of rows of the sample matrix is ​​the size of the sliding window, which is also the number of sensor data, and the number of rows of the sample matrix is ​​the amount of data contained in each sensor data, which is also the number of sensor data types.

[0104] Step 602: Normalize the matrix to obtain target sensor data.

[0105] During the implementation process, the data in the matrix is ​​normalized according to the maximum and minimum values ​​in the matrix, and the normalized matrix is ​​used as the target sensor data.

[0106] In an optional implementation provided by this embodiment, multiple sensor data are converted into a matrix so that the long short-term memory model can process time-dependent data, thereby improving the accuracy of tunnel magnetoresistive sensor voltage prediction.

[0107] The present application establishes a double-layer long short-term memory network, so that the long short-term memory network can effectively and accurately process data with strong time dependence in long time series, adapting to the characteristics of the tunnel magnetoresistive sensor. The double-layer long short-term memory network can accurately and highly accurately predict the output voltage of the tunnel magnetoresistive sensor. There are certain differences in the calculation process of each layer of the long short-term memory network; in an optional embodiment provided by the present application, in step 206, the target sensor data is gated by the input layer included in the long short-term memory model to obtain a hidden state, such as Figure 7 As shown, it includes steps 701 to 702.

[0108] In step 701, the cell state of the input layer is deleted based on the target sensor data and the hidden state in the previous voltage prediction process through the forget gate included in the input layer, and the cell state of the input layer is written based on the target sensor data and the hidden state in the previous voltage prediction process through the input gate included in the input layer.

[0109] In this application, each layer of the long short-term memory network may include an input gate, a forget gate, an output gate and / or a unit state. The gating processing of each gate is described below.

[0110] During implementation, the long short-term memory network (input layer) may first determine whether to retain the previous cell state through a forget gate, calculate the degree of retention of the previous cell state based on the target sensor data and the hidden state during the previous voltage prediction process, delete the cell state that is not retained, and then determine the proportion of new information in the cell state and the value of the updated cell state through the input gate, calculate the proportion of new information in the written cell state and the value of the updated cell state based on the target sensor data and the hidden state during the previous voltage prediction process.

[0111] For example, for the gate control processing of the forget gate, the long short-term memory network first determines whether to retain the previous unit state through the forget gate; this can be determined by the following formula (1):

[0112] Formula (1);

[0113] in, is the output of the forget gate, which controls the previous cell state C t-1 The degree of retention, σ is the Sigmoid activation function, x t is the input target sensor data, h t-1 is the hidden state in the last voltage prediction process; the gating process of the input gate is used to control how the current input updates the memory state, which can be determined according to the following formula (2):

[0114] Formula (2);

[0115] Among them, i t is the output of the input gate, which determines the new information C ̃ to be written into the cell state t The ratio of C ̃ t A nonlinear mapping representing the current input and the previous hidden state, used as the memory to be added to the cell memory, thus affecting the generation of memory update content; the new information written to the cell state C ̃ t Calculated using formula (3):

[0116] Formula (3);

[0117] Then, the new information C ̃ of the cell state t Updated through the input gate and combined with the forget gate output to update the final unit state; the unit state update formula is shown in the following formula (4):

[0118] Formula (4).

[0119] Step 702 : A hyperbolic tangent function is calculated based on the updated unit state of the input layer through the output gate included in the input layer to obtain the hidden state of the input layer.

[0120] During the implementation process, the long short-term memory network calculates the vector output by the output gate based on the final updated unit state through the input gate, which is used as the weight of the output gate, and the hidden state of the input layer is calculated based on the output vector.

[0121] For example, the hidden state of the input layer is calculated by the following formulas (5) and (6).

[0122] Formula (5);

[0123] Formula (6);

[0124] Among them, h t is the hidden state of the input gate.

[0125] In an optional implementation provided by this embodiment, the time dependence in the tunnel magnetoresistor output is effectively captured through a gating mechanism, thereby improving the stability of the tunnel magnetoresistor under environmental influences and avoiding the temperature drift and / or repeatability test impact of the tunnel magnetoresistor.

[0126] In an optional implementation provided by the present application, in step 206, the hidden state is gated by the hidden layer included in the long short-term memory model to obtain a gated processing result, such as Figure 8 As shown, it includes steps 801 to 802.

[0127] Step 801: Deleting a unit state of the hidden layer based on the hidden state of the input layer through a forget gate included in the hidden layer, and writing a unit state of the hidden layer based on the hidden state of the input layer through an input gate included in the hidden layer.

[0128] During the implementation process, the hidden layer serves as the next layer of the input layer, and its input data is the hidden state output by the input layer. Gating processing is performed based on the hidden state through the forget gate of the hidden layer, and gating processing is performed based on the input gate of the hidden layer based on the hidden state to update the unit state of the hidden layer. The specific operation process can refer to the operation of the above-mentioned input layer and will not be repeated here.

[0129] In step 802 , a hyperbolic tangent function is calculated based on the updated unit state of the hidden layer through the output gate included in the hidden layer to obtain a gated processing result.

[0130] During the implementation process, the hidden layer can perform hyperbolic tangent function calculation based on the updated unit state to obtain the output gate processing result. The specific output gate calculation process can refer to the output gate calculation process of the input layer above, which will not be repeated here.

[0131] It should be noted that the hidden state output by the hidden layer can be used as the hidden state input by the input layer in the next voltage prediction process.

[0132] In an optional embodiment provided by the present application, the voltage prediction of the tunnel magnetoresistance sensor is performed through a double-layer long short-term memory neural network, which can simulate the nonlinear drift caused by temperature changes and ensure the consistency of repeated measurements, thereby improving the accuracy of voltage prediction and the reliability of the predicted output voltage.

[0133] During the implementation process, after obtaining the voltage prediction result output by the long-short-term memory model, the environmental magnetic field data in the environment can be calculated based on the voltage prediction result. That is: the long-short-term memory model can be used to replace the real tunnel magnetoresistive sensor to monitor and / or convert environmental data, and the errors caused by temperature drift, device aging, etc. of the tunnel magnetoresistive sensor can be avoided by replacing hardware with software, thereby improving the accuracy of magnetic field change monitoring and magnetic field change calculation.

[0134] In practical applications, a real tunnel magnetoresistive sensor can also be deployed to monitor magnetic field data. The voltage prediction result of the long short-term memory model can be used as a reference to correct the actual output voltage of the real tunnel magnetoresistive sensor, and the accuracy of magnetic field change monitoring and magnetic field change calculation can be further improved by combining software and hardware. In an optional embodiment provided by the present application, if Figure 9 As shown, the method further includes steps 901 to 903.

[0135] Step 901: Obtain the actual output voltage of the tunnel magnetoresistive sensor at the current moment.

[0136] In this embodiment, the actual output voltage refers to the output voltage of a real tunnel magnetoresistive sensor deployed in a real environment; for example, the tunnel magnetoresistive sensor is configured in a power distribution network environment. Changes in the parameters of the current transmitted by the distribution network will cause changes in the magnetic field. The tunnel magnetoresistive sensor determines the actual output voltage based on the changes in the magnetic field.

[0137] During the implementation process, the tunnel magnetoresistance sensor is deployed in a real environment, and the server obtains the actual output voltage of the tunnel magnetoresistance sensor at the current moment.

[0138] For example, tunnel magnetoresistance sensors are deployed in the distribution network to monitor the changes in the magnetic field caused by current frequency fluctuations in the distribution network. The tunnel magnetoresistance sensors are connected to the voltage monitoring equipment, and the server obtains the actual output voltage of the tunnel magnetoresistance sensor at the current moment by obtaining the voltage monitoring equipment.

[0139] Step 902 : Correcting the actual output voltage based on the output voltage prediction result to obtain a corrected output voltage.

[0140] During the implementation process, the server corrects the actual output voltage according to the predicted output voltage prediction result to obtain a corrected output voltage.

[0141] During the execution process, as the temperature rises, the tunnel magnetoresistance effect will weaken, causing the output voltage of the tunnel magnetoresistance sensor to be smaller. The server can adjust the actual output voltage to obtain a corrected output voltage based on the predicted output voltage prediction result. In addition, with the repeated use of the tunnel magnetoresistance sensor, the device of the tunnel magnetoresistance sensor may age or have poor contact, causing the output voltage of the tunnel magnetoresistance sensor to be smaller. The server can adjust the actual output voltage to obtain a corrected output voltage based on the predicted output voltage prediction result.

[0142] Step 903 : determining the environmental magnetic field data corresponding to the tunnel magnetoresistive sensor according to the corrected output voltage.

[0143] In practical applications, tunnel magnetoresistive sensors are used to monitor changes in the magnetic field in the environment. When tunnel magnetoresistive sensors are applied to power distribution networks, changes in the magnetic field can be used to characterize parameter changes in the current transmitted by the power distribution network.

[0144] During the implementation process, the server calculates the environmental magnetic field data corresponding to the tunnel magnetoresistance sensor based on the corrected output voltage of the tunnel magnetoresistance sensor through the tunnel magnetoresistance effect; wherein the environmental magnetic field data may include: environmental magnetic field intensity, environmental magnetic flux, environmental magnetic induction intensity, environmental magnetic dipole moment and / or environmental magnetic field gradient.

[0145] This embodiment uses a combination of a real tunnel magnetoresistance sensor and a long short-term memory model to adjust the actual output voltage of the real tunnel magnetoresistance sensor based on the output voltage prediction result output by the long short-term memory model. The reliability of the output result of the tunnel magnetoresistance sensor is improved through a combination of software and hardware, thereby improving the effectiveness of environmental magnetic field monitoring and the accuracy of environmental magnetic field data.

[0146] In one embodiment, see Figure 10 , which shows a flow chart of a voltage prediction method of a tunnel magnetoresistive sensor provided by an embodiment of the present application. The voltage prediction method of the tunnel magnetoresistive sensor can be applied to Figure 1 As shown in the server. Figure 10 As shown, the voltage prediction method of the tunnel magnetoresistive sensor may include the following steps.

[0147] Step 1001: Using a preset sliding window, obtain sensor data of a tunnel magnetoresistive sensor at multiple historical moments.

[0148] Here, the sensor data includes at least one of the temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment.

[0149] Step 1002: construct a matrix based on the data of each sensor.

[0150] Step 1003: normalize the matrix to obtain target sensor data.

[0151] Step 1004 : input the target sensor data into the long short-term memory model, and delete the unit state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through the forget gate included in the input layer.

[0152] Step 1005 : Writing the cell state of the input layer is performed based on the target sensor data and the hidden state in the last voltage prediction process through the input gate included in the input layer.

[0153] Step 1006 , performing a hyperbolic tangent function calculation based on the updated unit state of the input layer through the output gate included in the input layer to obtain the hidden state of the input layer.

[0154] Step 1007: Deleting the unit state of the hidden layer based on the hidden state of the input layer through the forget gate included in the hidden layer, and writing the unit state of the hidden layer based on the hidden state of the input layer through the input gate included in the hidden layer.

[0155] Step 1008 , performing a hyperbolic tangent function calculation based on the updated cell state of the hidden layer through the output gate included in the hidden layer to obtain a gating processing result, and mapping the gating processing result through the output layer to obtain an output voltage prediction result of the tunnel magnetoresistive sensor.

[0156] Step 1009 : Acquire the actual output voltage of the tunnel magnetoresistive sensor at the current moment, and perform correction processing on the actual output voltage based on the output voltage prediction result to obtain a corrected output voltage.

[0157] Step 1010 : Determine the environmental magnetic field data corresponding to the tunnel magnetoresistive sensor according to the corrected output voltage.

[0158] It should be noted that any one of steps 1001 to 1010 or any combination of multiple steps can be selected from steps 202 to 206 provided in the above embodiment to form a new implementation method according to the needs of implementation deployment; and any one or multiple technical features in the technical scheme composed of steps 1001 to 1010 can also be selected from any one or multiple technical features in the technical scheme composed of steps 202 to 206 to form a new implementation method according to the needs of actual deployment, or the technical features in one or more optional implementation methods provided in one or more embodiments above can be selected to combine into a new implementation method, which will not be repeated here.

[0159] In an exemplary embodiment, experimental data for voltage prediction of a tunnel magnetoresistive sensor based on a long short-term memory model is also provided for evaluating baseline performance, as shown below.

[0160] To evaluate the effectiveness of the proposed LSTM-based TMR sensor output voltage modeling method, a series of experiments were conducted on two datasets: temperature drift data and repeatability test data. These experiments aimed to assess baseline performance, compare it with two popular traditional models, and evaluate the model's robustness under repeated testing. Their performance serves as a reference, highlighting the relative advantages of the LSTM architecture in capturing complex dynamic features.

[0161] Dataset Description: The experimental dataset consists of time series sensor recordings from a TMR (tunnel magnetoresistance) sensor under two conditions: temperature variation and fixed-condition repeatability. Each sample records five physical features: temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance. The regression target is the output voltage of the tunnel magnetoresistance sensor. Input Construction: To implement temporal modeling, a sliding window of length w = 20 is used to construct the input sequence. Each sample consists of a 20 × 5 matrix representing the past 20 time steps, and the output is the output voltage of the tunnel magnetoresistance sensor at the next time step. All features are normalized to the range [0, 1] using the maximum and minimum values. The training and testing split is set to 80 / 20. Model Configuration: The LSTM model consists of two stacked layers, each with 128 hidden units, followed by a full linear connection layer for regressing the output. Dropout is set to 0.2. The model is trained using the Adam optimizer with a learning rate of 1 × 10−3, a batch size of 8, and 300 epochs.

[0162] To validate the effectiveness of the LSTM framework, we compared it with two widely used non-sequential baseline models: 1. Linear Regression: a simple least squares model with a flat windowed input, and 2. XGBoost: a tree-based ensemble method optimized for regression tasks.

[0163] The performance of each model was evaluated on the temperature drift and repeatability datasets. Table 1 presents the performance comparison on the temperature drift and repeatability datasets, showing the mean squared error (MSE) of each method.

[0164] Table 1

[0165] Serial number method MSE 1 Linear regression 7.561e-3 2 XGBoost 6.084e-3 3 LSTM 2.901e-3

[0166] like Figure 11 and Figure 12As shown, the prediction curves of the three methods include a zoomed view of the region [30,60] to highlight the local prediction quality. The prediction performance of LSTM, XGBoost and linear regression are compared on the dataset. Figure 11 (a) and Figure 11 (b) shows the predictions of the full range and zoomed-in range of the data set for the output voltage of the tunnel magnetoresistive sensor. Figure 12 (a) and Figure 12 (b) shows the prediction of the full range and amplified range of the output voltage of the tunnel magnetoresistive sensor.

[0167] The results show that the LSTM model has better overall fitting accuracy and local consistency, and is very close to the true value curve. The shaded area (sample index 30-60) highlights a zoomed-in area that reveals the differences in local prediction smoothness and stability between the models.

[0168] To evaluate the consistency and robustness of different models under repeated training conditions, we performed five independent training runs for each model on the reproducible dataset. Each run was initialized with a different random seed and data shuffling sequence to reflect the natural variations in training dynamics. For each sensor, the mean squared error (MSE) across the five runs was calculated and compared across three models: linear regression, XGBoost, and LSTM.

[0169] like Figure 13 As shown in the figure, the LSTM model consistently achieves lower MSE values ​​on almost all sensor metrics compared to the other two models. The color-coded 3D bar graph shows that the LSTM (green) not only maintains high prediction accuracy but also exhibits higher stability in repeated experiments. Figure 13 Each bar in represents the average MSE for a specific sensor in the experiment.

[0170] These results show that LSTM is more robust to initialization and training variability, which is critical for real-world deployment in sensor-based systems where model reproducibility is important. In contrast, linear regression and XGBoost show higher error fluctuations across sensors, indicating potential sensitivity to training conditions.

[0171] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless clearly stated herein, the execution of these steps is not strictly limited in order, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps. It is understandable that the various steps in different embodiments can be freely combined as needed, and the various non-contradictory schemes formed by the combination all fall within the scope of protection of this application.

[0172] Based on the same inventive concept, embodiments of the present application also provide a tunnel magnetoresistive sensor voltage prediction device for implementing the aforementioned tunnel magnetoresistive sensor voltage prediction method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more tunnel magnetoresistive sensor voltage prediction device embodiments provided below can be found in the aforementioned limitations of the tunnel magnetoresistive sensor voltage prediction method and are not further elaborated here.

[0173] In an exemplary embodiment, Figure 14 As shown, a voltage prediction device for a tunnel magnetoresistive sensor is provided, comprising: a sensor data acquisition module 1401, a sensor data conversion module 1402 and a voltage prediction module 1403, wherein:

[0174] The sensor data acquisition module 1401 is used to acquire sensor data of the tunnel magnetoresistive sensor at multiple historical moments using a preset sliding window;

[0175] The sensor data conversion module 1402 is used to convert the sensor data to obtain target sensor data;

[0176] The voltage prediction module 1403 is used to input the target sensor data into the long short-term memory model, perform gate processing on the target sensor data through the input layer included in the long short-term memory model to obtain a hidden state, perform gate processing on the hidden state through the hidden layer included in the long short-term memory model to obtain a gate processing result, and map the gate processing result through the output layer included in the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistive sensor at the current moment; multiple historical moments are continuous in time sequence with the current moment.

[0177] In one embodiment, the device further includes: an actual output voltage acquisition module, a voltage correction module, and an ambient magnetic field data acquisition module, wherein:

[0178] The actual output voltage acquisition module is used to obtain the actual output voltage of the tunnel magnetoresistive sensor at the current moment;

[0179] A voltage correction module is used to correct the actual output voltage based on the output voltage prediction result to obtain a corrected output voltage;

[0180] The environmental magnetic field data acquisition module is used to determine the environmental magnetic field data corresponding to the tunnel magnetoresistive sensor according to the corrected output voltage.

[0181] In one embodiment, the sensor data includes at least one of temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment; the sensor data conversion module 1402 includes a matrix construction unit and a normalization unit, wherein:

[0182] A matrix construction unit, configured to construct a matrix based on the sensor data; the number of rows of the matrix is ​​the same as the size of the sliding window, and the number of columns of the matrix is ​​the same as the number of data types of the sensor data;

[0183] The normalization unit is used to perform normalization processing on the matrix to obtain target sensor data.

[0184] In one embodiment, the voltage prediction module 1403 includes a unit state updating unit of the input layer and a hidden state acquiring unit of the input layer, wherein:

[0185] a cell state updating unit of the input layer, configured to delete the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through a forget gate included in the input layer, and to write the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through an input gate included in the input layer;

[0186] The hidden state acquisition unit of the input layer is used to calculate the hyperbolic tangent function based on the updated unit state of the input layer through the output gate included in the input layer to obtain the hidden state of the input layer.

[0187] In one embodiment, the voltage prediction module 1403 includes a hidden layer unit state updating unit and a hidden layer gate control processing result obtaining unit, wherein:

[0188] a unit state updating unit of the hidden layer, configured to delete the unit state of the hidden layer based on the hidden state of the input layer via a forget gate included in the hidden layer, and to write the unit state of the hidden layer based on the hidden state of the input layer via an input gate included in the hidden layer;

[0189] The gate control processing result acquisition unit of the hidden layer is used to calculate the hyperbolic tangent function based on the updated unit state of the hidden layer through the output gate included in the hidden layer to obtain the gate control processing result.

[0190] In one embodiment, the apparatus further comprises: a training sample set acquisition module and a model training module, wherein:

[0191] A training sample set acquisition module is used to acquire a training sample set, where the training sample set includes multiple training samples, each training sample includes sample sensor data of a sample tunnel magnetoresistive sensor at a historical moment and label data corresponding to the sample sensor data;

[0192] The model training module is used to perform model training on the long short-term memory model to be trained based on the sample sensor data and label data to obtain the long short-term memory model.

[0193] In one embodiment, the model training module includes an input sample acquisition unit, a sample matrix construction unit, and a model parameter adjustment unit, wherein:

[0194] An input sample acquisition unit is used to select a plurality of target sample sensor data from each sample sensor data using a sliding window for each training sample; the historical moments corresponding to each target sample sensor data are continuous in time series;

[0195] A sample matrix construction unit is used to construct a sample matrix based on each target sample sensor data; the number of rows of the sample matrix is ​​the same as the size of the sliding window, and the number of columns of the sample matrix is ​​the same as the number of data types of the target sample sensor data;

[0196] The model parameter adjustment unit is used to input the sample matrix into the long short-term memory model to be trained to perform voltage prediction to obtain sample prediction results, and adjust the model parameters according to the label data corresponding to the sample matrix and the sample prediction results.

[0197] Each module in the aforementioned tunnel magnetoresistive sensor voltage prediction device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or stored in a computer device memory in software form, allowing the processor to call and execute the corresponding operations of each module.

[0198] 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. Figure 15As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and 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 computer program in the non-volatile storage medium. The database of the computer device is used to store XX data. 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 voltage prediction method for a tunnel magnetoresistance sensor is implemented.

[0199] Those skilled in the art will understand that Figure 15 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 shown in the figure, or combine certain components, or have a different component arrangement.

[0200] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0201] Using a preset sliding window, the sensor data of the tunnel magnetoresistive sensor at multiple historical moments is obtained;

[0202] Performing data conversion on each sensor data to obtain target sensor data;

[0203] Target sensor data is input into a long short-term memory model, the target sensor data is gated through an input layer included in the long short-term memory model to obtain a hidden state, the hidden state is gated through a hidden layer included in the long short-term memory model to obtain a gating processing result, and the gating processing result is mapped through an output layer included in the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistance sensor at the current moment; the multiple historical moments are continuous with the current moment in time series.

[0204] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0205] Get the actual output voltage of the tunnel magnetoresistive sensor at the current moment;

[0206] Correcting the actual output voltage based on the output voltage prediction result to obtain a corrected output voltage;

[0207] The environmental magnetic field data corresponding to the tunnel magnetoresistive sensor is determined according to the corrected output voltage.

[0208] In one embodiment, the sensor data includes at least one of temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at a historical moment; and when the processor executes the computer program, the following steps are specifically implemented:

[0209] Build a matrix based on the data of each sensor, the number of rows of the matrix is ​​the same as the size of the sliding window, and the number of columns of the matrix is ​​the same as the number of data types of the sensor data;

[0210] The matrix is ​​normalized to obtain the target sensor data.

[0211] In one embodiment, when the processor executes the computer program, the following steps are specifically implemented:

[0212] Deleting the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through the forget gate included in the input layer, and writing the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through the input gate included in the input layer;

[0213] The output gate included in the input layer performs a hyperbolic tangent function calculation based on the updated unit state of the input layer to obtain the hidden state of the input layer.

[0214] In one embodiment, when the processor executes the computer program, the following steps are specifically implemented:

[0215] Deleting a unit state of the hidden layer based on a hidden state of the input layer through a forget gate included in the hidden layer, and writing a unit state of the hidden layer based on the hidden state of the input layer through an input gate included in the hidden layer;

[0216] The output gate included in the hidden layer performs a hyperbolic tangent function calculation based on the updated unit state of the hidden layer to obtain a gated processing result.

[0217] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0218] Acquire a training sample set, where the training sample set includes multiple training samples, each training sample including sample sensor data of a sample tunnel magnetoresistive sensor at a historical moment and label data corresponding to the sample sensor data;

[0219] The long short-term memory model to be trained is trained according to each sample sensor data and label data to obtain a long short-term memory model.

[0220] In one embodiment, when the processor executes the computer program, the following steps are specifically implemented:

[0221] For each training sample, a sliding window is used to select multiple target sample sensor data from each sample sensor data; the historical moments corresponding to each target sample sensor data are continuous in time series;

[0222] A sample matrix is ​​constructed based on each target sample sensor data; the number of rows of the sample matrix is ​​the same as the size of the sliding window, and the number of columns of the sample matrix is ​​the same as the number of data types of the target sample sensor data;

[0223] The sample matrix is ​​input into the long short-term memory model to be trained to perform voltage prediction to obtain sample prediction results, and the model parameters are adjusted according to the label data corresponding to the sample matrix and the sample prediction results.

[0224] 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.

[0225] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0226] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0227] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. 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 above-mentioned embodiments. Among them, any reference to memory, database or other media used in the embodiments provided in this 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. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, artificial intelligence (AI) processors, and the like.

[0228] The technical features of the above embodiments can be combined arbitrarily. In order 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.

[0229] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A method for predicting voltage of a tunnel magnetoresistive sensor, characterized in that: The method comprises: Using a preset sliding window, the sensor data of the tunnel magnetoresistive sensor at multiple historical moments is obtained; Performing data conversion on each of the sensor data to obtain target sensor data; The target sensor data is input into a long short-term memory model, the target sensor data is gated through an input layer included in the long short-term memory model to obtain a hidden state, the hidden state is gated through a hidden layer included in the long short-term memory model to obtain a gating processing result, and the gating processing result is mapped through an output layer included in the long short-term memory model to obtain an output voltage prediction result of the tunnel magnetoresistive sensor at a current moment, wherein the multiple historical moments are continuous in time sequence with the current moment.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining an actual output voltage of the tunnel magnetoresistive sensor at the current moment; Correcting the actual output voltage based on the output voltage prediction result to obtain a corrected output voltage; Environmental magnetic field data corresponding to the tunnel magnetoresistive sensor is determined according to the corrected output voltage.

3. The method according to claim 1, characterized in that The sensor data includes at least one of the temperature, magnetic field strength, Hall resistance, transverse resistance, and longitudinal resistance of the tunnel magnetoresistive sensor at the historical moment; and converting the sensor data to obtain target sensor data includes: constructing a matrix based on each of the sensor data, wherein the number of rows of the matrix is ​​the same as the size of the sliding window, and the number of columns of the matrix is ​​the same as the number of data types of the sensor data; Normalizing the matrix to obtain the target sensor data.

4. The method according to claim 1, wherein The step of performing gating processing on the target sensor data through the input layer of the long short-term memory model to obtain a hidden state includes: Deleting the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through a forget gate included in the input layer, and writing the cell state of the input layer based on the target sensor data and the hidden state in the previous voltage prediction process through an input gate included in the input layer; The output gate included in the input layer performs a hyperbolic tangent function calculation based on the updated unit state of the input layer to obtain the hidden state of the input layer.

5. The method according to claim 1, wherein The gate processing is performed on the hidden state by the hidden layer included in the long short-term memory model to obtain a gate processing result, including: Deleting a unit state of the hidden layer based on the hidden state of the input layer through a forget gate included in the hidden layer, and writing a unit state of the hidden layer based on the hidden state of the input layer through an input gate included in the hidden layer; The gate control processing result is obtained by performing a hyperbolic tangent function calculation based on the updated unit state of the hidden layer through the output gate included in the hidden layer.

6. The method according to claim 1, characterized in that The training process of the long short-term memory model includes: Acquire a training sample set, the training sample set including a plurality of training samples, each of the training samples including sample sensor data of a sample tunnel magnetoresistive sensor at a historical moment and label data corresponding to the sample sensor data; Model training is performed on the long short-term memory model to be trained according to each of the sample sensor data and the label data to obtain the long short-term memory model.

7. The method according to claim 6, characterized in that The performing model training on the long short-term memory model to be trained according to each of the sample sensor data and the label data includes: For each of the training samples, a plurality of target sample sensor data are selected from the sample sensor data using the sliding window, wherein the historical moments corresponding to the target sample sensor data are continuous in time series; constructing a sample matrix based on each of the target sample sensor data, wherein the number of rows of the sample matrix is ​​the same as the size of the sliding window, and the number of columns of the sample matrix is ​​the same as the number of data types of the target sample sensor data; The sample matrix is ​​input into the long short-term memory model to be trained to perform voltage prediction to obtain a sample prediction result, and model parameters are adjusted according to the label data corresponding to the sample matrix and the sample prediction result.

8. A voltage prediction device for a tunnel magnetoresistive sensor, characterized in that: The device comprises: A sensor data acquisition module is used to acquire sensor data of the tunnel magnetoresistive sensor at multiple historical moments using a preset sliding window; A sensor data conversion module, configured to convert the sensor data to obtain target sensor data; A voltage prediction module is configured to input the target sensor data into a long short-term memory model, perform gate processing on the target sensor data through an input layer included in the long short-term memory model to obtain a hidden state, perform gate processing through a hidden layer included in the long short-term memory model to obtain a gated processing result, and map the gated processing result through an output layer included in the long short-term memory model to obtain a voltage prediction result of the tunnel magnetoresistive sensor at a current moment, wherein the multiple historical moments are sequentially continuous with the current moment.

9. 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 7 are implemented.

10. 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 7 are implemented.