Model construction method, gyroscope data compensation method and device and electronic equipment
By constructing a temperature drift estimation model, combining the gyroscope and temperature data samples in a stationary state, the problem of the gyroscope zero deviation error is affected by temperature, and the precise compensation of gyroscope data and the improvement of camera anti-shake effect is achieved.
Patent Information
- Application Number
- CN202510404531.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the zero deviation error of the microelectromechanical system gyroscope in the terminal is affected by temperature sensitivity, resulting in poor anti-shake effect of the camera, and the polynomial model cannot adapt to the rapidly changing actual working environment in time, resulting in inaccurate compensation of temperature drift data.
By obtaining the gyroscope and temperature data samples in the rest state, a temperature drift estimation model considering the temperature difference is constructed, and combining the first model and the second model, the gyroscope temperature drift data is accurately estimated and compensated.
It improves the accuracy of gyroscope data, improves the anti-shake effect of the camera, and achieves accurate compensation of gyroscope data.
Smart Images

Figure CN120403702A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of electronic devices, and particularly relates to a model construction method, a gyroscope data compensation method, a device and an electronic device. Background Art
[0002] With the increasing popularity of intelligent terminals (abbreviation: terminals), users have more and more requirements for functions such as taking pictures and videos using the cameras in the terminals. However, the zero-bias error of the image gyroscope (abbreviation: gyroscope) in the terminal affects the anti-shake effect of taking pictures and videos. Among them, the smaller the zero-bias error, the better the anti-shake effect; on the contrary, the worse the anti-shake effect.
[0003] Due to the volume and cost limitations of the terminal, generally, a Micro-Electro-Mechanical Systems (MEMS) type of gyroscope is used. The zero-bias data of this type of gyroscope is very sensitive to temperature, that is, temperature will greatly affect the zero-bias data of this gyroscope, and further greatly affect the anti-shake effect of the camera.
[0004] In the related art, mainly the least squares method is used to establish a zero-bias temperature compensation model. Through this zero-bias temperature compensation model, the functional relationship between the gyroscope data and the temperature data is fitted, and the gyroscope temperature drift data corresponding to the current temperature data is estimated using this model. Then, based on the estimated gyroscope temperature drift data, the newly measured gyroscope data is compensated for temperature drift.
[0005] However, since the actual working environment of the gyroscope in the terminal (such as temperature range, vibration interference, etc.) is dynamically changing in real time, while the input data (such as temperature data) of the polynomial model is usually static or slowly changing, therefore, this polynomial model may not be able to adapt to the rapidly changing actual working environment in time, resulting in the gyroscope temperature drift data estimated by this polynomial model may not be accurate enough, and further unable to accurately compensate the gyroscope data. Summary of the Invention
[0006] The purpose of the embodiments of this application is to provide a model construction method, a gyroscope data compensation method, a device and an electronic device, which can improve the accuracy of the gyroscope temperature drift data, and further accurately compensate the gyroscope data.
[0007] In a first aspect, an embodiment of the present application provides a model construction method, which includes: obtaining at least two data samples, each data sample including a gyroscope data sample and a temperature data sample at the same moment, and each data sample being collected when the terminal where the gyroscope is located is in a stationary state; inputting the temperature data sample in each data sample into a first model respectively to obtain the gyroscope temperature drift data corresponding to each temperature data sample; determining first model parameters based on the gyroscope data sample in each data sample, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; and obtaining a second model based on the first model parameters; constructing a temperature drift estimation model based on the first model and the second model.
[0008] In a second aspect, an embodiment of the present application provides a gyroscope data compensation method, which includes: obtaining second gyroscope data and second temperature data at a second moment; inputting the second temperature data into the temperature drift estimation model; obtaining third gyroscope temperature drift data corresponding to the second temperature data based on the first model in the temperature drift estimation model and the second temperature data; obtaining fourth gyroscope temperature drift data corresponding to the second temperature data based on the second model in the temperature drift estimation model and the difference between the second temperature data and the temperature data at the previous moment; outputting second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is the sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; compensating the second gyroscope data based on the second target gyroscope temperature drift data to obtain compensated gyroscope data.
[0009] In a third aspect, an embodiment of the present application provides a model construction device, which includes: an obtaining module, a processing module, and a construction module; the obtaining module is used to obtain at least two data samples, each data sample including a gyroscope data sample and a temperature data sample at the same moment, and each data sample being collected when the terminal where the gyroscope is located is in a stationary state; the processing module inputs the temperature data sample in each data sample obtained by the obtaining module into a first model respectively to obtain the gyroscope temperature drift data corresponding to each temperature data sample; determines first model parameters based on the gyroscope data sample in each data sample obtained by the obtaining module, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; obtains a second model based on the first model parameters; the construction module is used to construct a temperature drift estimation model based on the first model and the second model obtained by the processing module.
[0010] Fourthly, an embodiment of the present application provides a gyroscope data compensation device, which includes: an acquisition module for acquiring second gyroscope data and second temperature data at a second moment; a processing module for inputting the second temperature data acquired by the acquisition module into a temperature drift estimation model; based on a first model in the temperature drift estimation model and the second temperature data, obtaining third gyroscope temperature drift data corresponding to the second temperature data; based on a second model in the temperature drift estimation model and the difference between the second temperature data and the temperature data at the previous moment, obtaining fourth gyroscope temperature drift data corresponding to the second temperature data; outputting second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is the sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; and compensating the second gyroscope data acquired by the acquisition module based on the second target gyroscope temperature drift data to obtain compensated gyroscope data.
[0011] Fifthly, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the method described in the first aspect or the second aspect are implemented.
[0012] Sixthly, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect or the second aspect are implemented.
[0013] Seventhly, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect or the second aspect.
[0014] Eighthly, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect or the second aspect.
[0015] In an embodiment of the present application, at least two data samples are obtained. Each data sample includes a gyroscope data sample and a temperature data sample at the same moment, and each data sample is collected when the terminal where the gyroscope is located is in a stationary state; the temperature data samples in each data sample are respectively input into a first model to obtain gyroscope temperature drift data corresponding to each temperature data sample. The first model can consider the influence of all temperature data samples and obtain relatively accurate gyroscope temperature drift data estimated preliminarily; based on the gyroscope data samples in each data sample, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment, the first model parameters are determined, and according to the first model parameters, a second model is obtained; based on the first model and the second model, a temperature drift estimation model is constructed. In this solution, since the temperature difference between adjacent temperature data samples is referred to in the process of constructing the second model, the temperature drift estimation model constructed based on the second model can estimate relatively accurate target gyroscope temperature drift data, so that the electronic device can accurately compensate the gyroscope data based on the relatively accurate gyroscope temperature drift data, thereby improving the accuracy of the gyroscope data. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is one of the flow diagrams of the model construction method provided by an embodiment of the present application;
[0017] Figure 2 is another flow diagram of the model construction method provided by an embodiment of the present application;
[0018] Figure 3 is yet another flow diagram of the model construction method provided by an embodiment of the present application;
[0019] Figure 4 is still another flow diagram of the model construction method provided by an embodiment of the present application;
[0020] Figure 5 is a schematic diagram of the relationship between temperature data and gyroscope zero bias data provided by an embodiment of the present application;
[0021] Figure 6 is yet another flow diagram of the model construction method provided by an embodiment of the present application;
[0022] Figure 7 is still another flow diagram of the model construction method provided by an embodiment of the present application;
[0023] Figure 8 is one of the flow diagrams of the model correction process provided by an embodiment of the present application;
[0024] Figure 9It is the second flowchart of the model correction process provided by the embodiments of the present application;
[0025] Figure 10 It is the flowchart of the gyroscope data compensation method provided by the embodiments of the present application;
[0026] Figure 11 It is the schematic diagram of the data compensation effect after adopting the gyroscope data compensation method provided by the embodiments of the present application;
[0027] Figure 12 It is one of the structural diagrams of the model construction device provided by the embodiments of the present application;
[0028] Figure 13 It is the second structural diagram of the model construction device provided by the embodiments of the present application;
[0029] Figure 14 It is the structural diagram of the gyroscope data compensation device provided by the embodiments of the present application;
[0030] Figure 15 It is the structural diagram of the electronic device provided by the embodiments of the present application;
[0031] Figure 16 It is the hardware structural diagram of the electronic device provided by the embodiments of the present application. Detailed implementation manners
[0032] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0033] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. generally belong to the same category, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally represents an "or" relationship between the associated objects before and after.
[0034] The terms "at least one (item)", "at least one of", etc. in the description and claims of this application refer to any one, any two or more combinations of the objects it contains. For example, at least one (item) of a, b, and c can represent: "a", "b", "c", "a and b", "a and c", "b and c", and "a, b, and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" means two or more, and its meaning is similar to that of "at least one (item)".
[0035] The following will combine the accompanying drawings and through specific embodiments and their application scenarios, elaborate in detail on the model construction method, gyroscope data compensation method, device, and electronic device provided by the embodiments of this application.
[0036] The model construction method and gyroscope data compensation method provided by the embodiments of this application can be applied to scenarios such as taking pictures and videos using the camera in a terminal.
[0037] In the embodiments of this application, in the gyroscope data compensation method, obtain the second gyroscope data and the second temperature data at the second moment; input the second temperature data into the above-mentioned temperature drift estimation model; based on the first model in the temperature drift estimation model and the second temperature data, obtain the third gyroscope temperature drift data corresponding to the second temperature data; based on the second model in the temperature drift estimation model and the difference between the second temperature data and the temperature data of the previous moment, obtain the fourth gyroscope temperature drift data corresponding to the second temperature data; output the second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is the sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; based on the second target gyroscope temperature drift data, compensate the second gyroscope data to obtain the compensated gyroscope data. In this solution, since the temperature difference between the temperature data samples at adjacent moments is referred to in the process of constructing the second model, the temperature drift estimation model constructed based on this second model can estimate the target gyroscope temperature drift data with higher accuracy, so that the electronic device can accurately compensate the gyroscope data based on this higher-accuracy gyroscope temperature drift data, thereby improving the accuracy of the gyroscope data.
[0038] Based on this, when the user uses the camera in the terminal to take pictures and videos, the target gyroscope temperature drift data with higher accuracy can be output based on the temperature data at the current moment and the temperature drift estimation model, and then the temperature drift compensation can be performed on the gyroscope data at the current moment to obtain the compensated gyroscope data, minimizing the gyroscope zero-offset data and maximizing the anti-shake effect of the camera to enhance the image anti-shake experience.
[0039] It should be noted that for the model construction method provided in the embodiments of the present application, the execution subject can be a model construction device, an electronic device, or a functional module in an electronic device, etc. In some embodiments of the present application, the example of an electronic device executing the model construction method is used to illustrate the model construction method provided in the embodiments of the present application.
[0040] Figure 1 FIG. shows a schematic flowchart of the model construction method provided in the embodiments of the present application. As Figure 1 shown, the model construction method provided in the embodiments of the present application may include the following steps 101 to 104.
[0041] Step 101: The electronic device acquires at least two data samples.
[0042] In the embodiments of the present application, each of the at least two data samples includes a gyroscope data sample and a temperature data sample at the same moment.
[0043] In the embodiments of the present application, the above-mentioned gyroscope data sample refers to the gyroscope data collected by the gyroscope. Generally, the above-mentioned gyroscope data contains the angular velocity values on three axes, namely the X-axis, Y-axis, and Z-axis.
[0044] In the embodiments of the present application, the above-mentioned temperature data sample refers to the temperature data collected by the temperature sensor, which is used to characterize the current ambient temperature or internal temperature of the terminal where the gyroscope is located.
[0045] It should be noted that each of the at least two data samples is collected when the terminal where the gyroscope is located is in a stationary state. It can be understood that the above-mentioned "the terminal where the gyroscope is located is in a stationary state" means that there is no large jump in the gyroscope data at a preset number of consecutive moments.
[0046] It should be noted that the above-mentioned "large jump" is a threshold set according to the actual situation of the terminal, which is used to determine whether the terminal is in a stationary state.
[0047] Exemplarily, assume that the electronic device acquires 10 s of gyroscope data, with one second corresponding to one gyroscope data, that is, 10 gyroscope data are acquired. If the jump between any adjacent 2 s of gyroscope data is less than the above-mentioned threshold, it means that there is no large jump in these 10 gyroscope data, and further it means that the terminal is in a stationary state; otherwise, it means that the terminal is not in a stationary state, that is, the terminal has been moved during the process of collecting data samples. At this time, the gyroscope data samples collected by the electronic device will be mixed with the movement data of the terminal, seriously affecting the accuracy of the model construction process and resulting in an inaccurate temperature drift estimation model constructed subsequently.
[0048] The specific method for obtaining at least two data samples will be elaborated in detail in the following embodiments. To avoid repetition, it will not be elaborated here.
[0049] In some embodiments of the present application, in combination with Figure 1 , such as Figure 2 shown, the above step 101 can be specifically implemented by the following step 101a and step 101b.
[0050] Step 101a: The electronic device obtains a first candidate data sample set.
[0051] In the embodiments of the present application, the above first candidate data sample set includes first candidate data samples at multiple moments within a preset time period. Each first candidate data sample includes a first candidate gyroscope data sample and a first candidate temperature data sample. Among them, the above preset time period refers to a preset time period, which is the duration of data sample collection. Each moment within this duration corresponds to a first candidate data sample.
[0052] In the embodiments of the present application, the electronic device can collect first candidate data samples at multiple moments within a preset time period, and construct a first candidate data sample set based on all candidate data samples for subsequent processing.
[0053] Step 101b: When the first candidate data sample set meets the first condition and the second condition, the electronic device uses all the first candidate data samples in the first candidate data sample set as data samples.
[0054] In the embodiments of the present application, the first candidate data sample set meeting the first condition includes: the jump between the first candidate gyroscope data samples at any adjacent moments in the first candidate data sample set is less than a preset jump threshold, and the temperature difference between the maximum first candidate temperature data sample and the minimum first candidate temperature data sample in the first candidate data sample set is less than a preset temperature difference threshold.
[0055] In the embodiments of the present application, the first candidate data sample set meeting the second condition includes: the number of first candidate gyroscope data samples or first candidate temperature data samples in the first candidate data sample set is greater than or equal to a preset quantity threshold.
[0056] In an embodiment of the present application, when the electronic device determines that the first candidate data sample set meets the first condition, if the jump between any adjacent first candidate gyroscope data samples in the first candidate data sample set is less than a preset jump threshold, it indicates that there is no doping of terminal movement data in all the first candidate gyroscope data, and the accuracy is relatively high. At the same time, if the temperature difference between the maximum first candidate temperature data sample and the minimum first candidate temperature data sample in the first candidate data sample set is less than a preset temperature difference threshold, it indicates that the change amount of all the first candidate temperature data samples within the preset duration is small. In this way, the influence on the accuracy of the first candidate gyroscope data samples caused by excessive temperature changes can be effectively reduced. At this time, it can be determined that the first candidate data sample set meets the first condition.
[0057] In an embodiment of the present application, when the electronic device determines that the first candidate data sample set meets the second condition, since the multiple first candidate gyroscope data samples and the multiple first candidate temperature data samples in the first candidate data sample set are in one-to-one correspondence, it is only necessary to determine that the number of the first candidate gyroscope data samples or the number of the first candidate temperature data samples is greater than or equal to a preset number threshold. At this time, it can be determined that the first candidate data sample set meets the second condition. In this way, while ensuring that the first candidate data sample set contains sufficient information, the data processing process is also simplified, and the judgment efficiency of the second condition is effectively improved.
[0058] In an embodiment of the present application, when the first candidate data sample set meets both the first condition and the second condition, the first candidate data sample set can be directly used as the data sample, and this data sample has relatively high accuracy and integrity, providing data support for constructing the temperature drift estimation model.
[0059] In some embodiments of the present application, in combination with Figure 2 , as Figure 3 shown, after the above step 101a, the model construction method provided by the embodiment of the present application may further include the following step 101c.
[0060] Step 101c: When the candidate data sample set does not meet the first condition and / or does not meet the second condition, the electronic device continues to obtain a second candidate data sample set.
[0061] Wherein, the above second candidate data sample set includes second candidate data samples at multiple moments within a preset duration, and each second candidate data sample includes a second candidate gyroscope data sample and a second candidate temperature data sample.
[0062] In an embodiment of the present application, when the electronic device determines that the first candidate data sample set does not meet the first condition, if the jump between any adjacent first candidate gyroscope data samples in the first candidate data sample set is greater than or equal to a preset jump threshold, it indicates that the terminal movement data is mixed in all the first candidate gyroscope data, and the accuracy is not high; and / or, if the temperature difference between the maximum first candidate temperature data sample and the minimum first candidate temperature data sample in the first candidate data sample set is greater than or equal to a preset temperature difference threshold, it indicates that the temperature change of the terminal within a preset duration is too large, which will have a certain impact on the accuracy of the candidate gyroscope data samples. At this time, it can be determined that the first candidate data sample set does not meet the first condition.
[0063] In an embodiment of the present application, when the electronic device determines that the first candidate data sample set does not meet the second condition, since the multiple first candidate gyroscope data samples and the multiple first candidate temperature data samples in the first candidate data sample set are in one-to-one correspondence, it is only necessary to determine the relationship between the number of the first candidate gyroscope data samples or the number of the first candidate temperature data samples and a preset number threshold. If the number is less than or equal to the preset number threshold, it indicates that the first candidate data sample set does not contain sufficient information. At this time, it can be determined that the first candidate data sample set does not meet the second condition.
[0064] In an embodiment of the present application, when the first candidate data sample set does not meet the first condition and / or does not meet the second condition, it indicates that the accuracy and integrity of the first candidate data sample set are insufficient. At this time, the electronic device can discard the first candidate data sample set and continue to obtain a new candidate data sample set, that is, the second candidate data sample set. Then, the electronic device can determine whether the second candidate data sample set meets the first condition and meets the second condition until the finally obtained second candidate data sample set meets both the first condition and the second condition, and use the finally obtained second candidate data sample set as the data sample to provide data support for constructing the temperature drift estimation model.
[0065] Step 102: The electronic device inputs the temperature data samples in each of the at least two data samples into the first model respectively to obtain the gyroscope temperature drift data corresponding to each temperature data sample.
[0066] In an embodiment of the present application, the above first model is used to predict the temperature drift data of the gyroscope under the input temperature data sample.
[0067] In an embodiment of the present application, the electronic device inputs the temperature data sample in a data sample into the first model for temperature drift data prediction to obtain the gyroscope temperature drift data corresponding to the temperature data sample.
[0068] In the embodiments of the present application, the above gyroscope temperature drift data refers to the offset data of the gyroscope output caused by the change of temperature data samples.
[0069] In the embodiments of the present application, the above first model can be called a rough function, which is used to express the global optimal solution of the temperature drift evaluation process. This means that the first model considers the influence of all temperature data samples as a whole and tries to find an optimal solution to minimize the influence of temperature data on the gyroscope zero-bias data. Among them, the gyroscope zero-bias data can be understood as the gyroscope data collected when the gyroscope is in a stationary state.
[0070] In the embodiments of the present application, the above first model can adopt the first formula: Expression.
[0071] Among them, represents the gyroscope temperature drift data corresponding to the temperature data sample; f(·) represents an activation function, which can perform nonlinear processing on N represents the total number of all temperature data samples, x i represents the i-th temperature data sample among all temperature data samples, w i represents the weight corresponding to the i-th temperature data sample, and a represents the target parameter.
[0072] It should be noted that in the above first formula, the weight w i and the target parameter a are known, and other parameters are unknown. Among them, the weight w i determines the contribution degree of the i-th independent variable (i.e., the i-th temperature data sample) to the predicted value (i.e., the gyroscope zero-bias data corresponding to the i-th temperature data sample); the target parameter a is used to adjust or compensate for N the influence of the independent variables on the predicted value.
[0073] In some embodiments of the present application, in combination with Figure 1 , as Figure 4 shown, after the above step 101 and before step 102, the model construction method provided by the embodiments of the present application may further include the following step 201 and step 202.
[0074] Step 201: The electronic device determines the second model parameters based on the temperature data sample in each of the above at least two data samples and the gyroscope zero-bias data.
[0075] In the embodiments of the present application, the above gyroscope zero-bias data corresponds to some temperature data samples.
[0076] It can be understood that the temperature change can be determined from the above partial temperature data samples, and the gyroscope zero bias data is the deviation data between the output of the gyroscope caused by the temperature change and the ideal zero position.
[0077] It should be noted that the above partial temperature data samples refer to the temperature data samples at a preset number of consecutive moments.
[0078] In the embodiment of the present application, the above second model parameters include, but are not limited to: the weight w corresponding to each temperature data sample, and the target parameter a.
[0079] Step 202, the electronic device obtains the first model based on the second model parameters.
[0080] In the embodiment of the present application, the electronic device can determine the second model parameters based on the temperature data samples in each of the above at least two data samples and the gyroscope zero bias data, aiming to minimize the prediction error and improve the prediction accuracy of the first model. Then, the second model parameters are input into the third model to obtain a new third model, and then the new third model is non-linearly processed to obtain the first model, so that the temperature drift data of the gyroscope can be evaluated more comprehensively and accurately.
[0081] In the embodiment of the present application, the electronic device can determine the second model parameters through the second formula and combine the third formula to obtain a first model with higher accuracy.
[0082] Exemplarily, the above second formula can be: It is also the modeling expression of the gyroscope zero bias data and the temperature data; u(x) represents N the gyroscope zero bias data corresponding to a temperature data sample.
[0083] Exemplarily, the above third formula can be:
[0084] It should be noted that the above third formula is used to represent the functional relationship between the gyroscope temperature drift data and the temperature data samples.
[0085] It should be noted that in the above second formula, the weight w i and the target parameter a are unknown, and other parameters are known. That is to say, in the process of determining the first model, the electronic device can substitute the known temperature data samples, the number of known temperature data samples, and the known gyroscope zero bias data into the above second formula to obtain the weight w i and the target parameter a. At this time, substituting into the above first formula again, the first model is obtained.
[0086] Exemplarily, such as Figure 5As shown, it is a schematic diagram of the relationship between temperature data and gyroscope zero bias data provided by an embodiment of the present application. From Figure 5 it can be seen that: Figure 5 It includes two curves, namely curve 1 corresponding to the gyroscope zero bias data collected by gyroscope 1 and curve 2 corresponding to the gyroscope zero bias data collected by gyroscope 2. Among them, the gyroscope zero bias data collected by gyroscope 1 is the gyroscope data collected by gyroscope 1 in a stationary state, and the gyroscope zero bias data collected by gyroscope 2 is the gyroscope data collected by gyroscope 2 in a stationary state. The abscissa of these two curves is temperature data, with the unit of degrees Celsius (°C). Among them, the temperature range of the temperature data is (34.5°C, 39°C), and the interval is 0.5°C; the ordinate of these two curves is gyroscope data, with the unit of the number of millions of bits transmitted per second (million bits per second, mdps). Among them, the range of the gyroscope data is (0, 800 mdps), and the interval is 100 mdps.
[0087] It should be noted that whether it is curve 1 or curve 2, it shows that as the temperature increases, the gyroscope data shows an increasing trend. That is, the gyroscope data is very sensitive to temperature data and is in a non-linear relationship.
[0088] Step 103: The electronic device determines the first model parameter based on the gyroscope data sample in each of the at least two data samples, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; and based on the first model parameter, obtains a second model.
[0089] In an embodiment of the present application, the above-mentioned second model is used to predict the temperature drift data of the gyroscope based on the temperature difference between adjacent temperature data samples.
[0090] It can be understood that the above-mentioned second model can be called a fine function, which is used to express the local optimal solution of the temperature drift evaluation process. This means that to some extent, this second model is more focused on the details of the data than the first model and attempts to find the best solution within a smaller data range.
[0091] Exemplarily, the above-mentioned second model can adopt the fourth formula: for expression.
[0092] Wherein, g(x) represents the gyroscope temperature drift data corresponding to the temperature data sample output by the second model; Δx represents the difference between the temperature data sample and the temperature data sample at the previous moment; Δx↑ represents a temperature increase; Δx↓ represents a temperature decrease; b represents the residual value of the temperature data sample under the trend of temperature increase; c represents the correction parameter when the temperature increases; d represents the residual value of the temperature data sample under the trend of temperature decrease; e represents the correction parameter when the temperature decreases.
[0093] It should be noted that in the above fourth formula, the correction parameter b, the correction parameter c, the correction parameter d, and the correction parameter e are known, and other parameters are unknown.
[0094] In some embodiments of the present application, the above at least two data samples at least include a first data sample and a second data sample. The first data sample includes a first gyroscope data sample and a first temperature data sample, and the second data sample includes a second gyroscope data sample and a second temperature data sample. Combining Figure 1 , as Figure 6 shown, the above step 103 can be specifically implemented by the following steps 103a to 103c.
[0095] Step 103a: The electronic device determines a first difference between the first gyroscope data sample and the gyroscope temperature drift data corresponding to the first temperature data sample, and a second difference between the second gyroscope data sample and the gyroscope temperature drift data corresponding to the second temperature data sample.
[0096] Step 103b: The electronic device determines a first model parameter based on the first difference, the second difference, a third difference between the first temperature data sample and the temperature data sample at the previous moment, and a fourth difference between the second temperature data sample and the temperature data sample at the previous moment.
[0097] In an embodiment of the present application, the electronic device can batch subtract all gyroscope data samples from the above third formula to obtain a fifth formula, and combine the difference between each temperature data sample and the temperature data sample at the previous moment, and determine the first model parameter through a sixth formula, thereby obtaining a second model.
[0098] It should be noted that when the electronic device inputs the collected temperature data sample into the above third formula, the gyroscope temperature drift data corresponding to the temperature data sample can be obtained; then, the electronic device subtracts each collected gyroscope data sample from the gyroscope temperature drift data corresponding to the temperature data sample respectively, to achieve batch subtraction between all gyroscope data samples and the above third formula .
[0099] Exemplarily, the above fifth formula is:
[0100] Exemplarily, the above sixth formula is as follows:
[0101] Where y represents the gyroscope data sample; g(x) represents the difference between the gyroscope data sample and the corresponding temperature data sample and the temperature data sample at the previous moment.
[0102] It should be noted that in the above sixth formula, the correction parameters b, c, d, and e are unknown, and other parameters are known. That is to say, in the process of determining the second model, the electronic device can substitute the difference between each known temperature data sample and the temperature data sample at the previous moment, and the known gyroscope temperature drift data corresponding to each temperature data sample into the above sixth formula to obtain the correction parameters b, c, d, and e. At this time, substitute these four correction parameters into the above sixth formula to obtain the second model.
[0103] Step 104: The electronic device constructs a temperature drift estimation model based on the first model and the second model.
[0104] Among them, the above temperature drift estimation model is used to estimate the target gyroscope temperature drift data corresponding to the newly collected temperature data. It can be understood that since the temperature drift estimation model refers to the temperature difference between the temperature data samples at adjacent moments, the target gyroscope temperature drift data estimated by this temperature drift estimation model is a relatively accurate estimated value.
[0105] Exemplarily, the above temperature drift estimation model can adopt the seventh formula: Expressed as. Where represents the target gyroscope temperature drift data.
[0106] In some embodiments of the present application, after the electronic device constructs a temperature drift estimation model including the first model and the second model, it can further update the temperature drift estimation model by combining the gyroscope data and temperature data at the current moment.
[0107] In some embodiments of the present application, in combination with Figure 1 , as Figure 7 shown, after the above step 104, the model construction method of the present application may further include the following steps 301 to 306.
[0108] Step 301: The electronic device obtains the first gyroscope data and the first temperature data at the first moment, and the first gyroscope data and the first temperature data are collected when the terminal is in a stationary state.
[0109] In the embodiments of the present application, the above first moment is the current moment.
[0110] Step 302: The electronic device inputs the first temperature data into the temperature drift estimation model.
[0111] Step 303: The electronic device obtains the first gyroscope temperature drift data corresponding to the first temperature data based on the first model in the temperature drift estimation model and the first temperature data.
[0112] Step 304: The electronic device obtains the second gyroscope temperature drift data corresponding to the first temperature data based on the second model in the temperature drift estimation model and the difference between the first temperature data and the temperature data at the previous moment.
[0113] Step 305: The electronic device outputs the first target gyroscope temperature drift data, where the first target gyroscope temperature drift data is the sum of the first gyroscope temperature drift data and the second gyroscope temperature drift data.
[0114] Step 306: The electronic device updates the model parameters of the temperature drift estimation model based on the difference between the first gyroscope data and the first target gyroscope temperature drift data to obtain an updated temperature drift estimation model.
[0115] It should be noted that the above-mentioned first moment is any moment after the terminal is in a stationary state.
[0116] In the embodiment of the present application, the electronic device obtains the first gyroscope data and the first temperature data at the first moment when the terminal is in a stationary state; then, the electronic device inputs the first temperature data into the temperature drift estimation model, and through the first model (i.e., the first formula) in the temperature drift estimation model, calculates and processes the first temperature data to obtain the first gyroscope temperature drift data corresponding to the first temperature data, realizing preliminary temperature drift compensation; then determines the difference between the first temperature data and the temperature data at the previous moment, and through the second model (i.e., the fourth formula) in the temperature drift estimation model, calculates and processes the difference to obtain the second gyroscope temperature drift data corresponding to the first temperature data. By considering the rate of temperature change (i.e., the temperature difference), the future temperature drift trend is predicted through difference calculation, enhancing the real-time performance and accuracy of temperature drift compensation; further, the electronic device sums the first gyroscope temperature drift data and the second gyroscope temperature drift data, and outputs the sum result as the first target gyroscope temperature drift data; finally, the electronic device subtracts each first target gyroscope temperature drift data from the first gyroscope data, and updates the model parameters of the temperature drift estimation model according to the difference to obtain an updated temperature drift estimation model. The above entire process realizes real-time correction of the temperature drift estimation model, and further realizes real-time temperature drift compensation for gyroscope data.
[0117] In the embodiment of the present application, the difference between the first gyroscope data and the first target gyroscope temperature drift data can be calculated by using a residual estimation function.
[0118] Exemplarily, the residual estimation function is as follows:
[0119] where x' represents the first temperature data; h(x') represents the difference between the first gyroscope data and the first target gyroscope temperature drift data; y raw (x') represents the first gyroscope data; represents the first target gyroscope temperature drift data.
[0120] It should be noted that this application embodiment does not limit the execution order of the determination process of the above first gyroscope temperature drift data and the determination process of the second gyroscope temperature drift data.
[0121] In some embodiments of this application, in combination with Figure 7 , as Figure 8 shown, the above step 306 can be specifically implemented through the following steps 306a to 306c.
[0122] Step 306a: The electronic device determines the difference between the first gyroscope data and the first target gyroscope temperature drift data through the residual estimation function based on the first gyroscope data and the first target gyroscope temperature drift data.
[0123] Step 306b: The electronic device determines whether the difference is less than a preset residual threshold. If so, continue to execute step 306b; if not, re - execute step 301.
[0124] Step 306c: The electronic device enters the algorithm training process, that is, updates the model parameters of the temperature drift estimation model to obtain an updated temperature drift estimation model.
[0125] In the above - mentioned whole process, the electronic device can use the residual estimation function, take the first gyroscope data and the first target gyroscope temperature drift data as inputs, output the difference between the first gyroscope data and the first target gyroscope temperature drift data, and then the electronic device determines the relationship between this difference and the preset residual threshold. If the difference is less than the preset residual threshold, it means that the difference between the first gyroscope data and the first target gyroscope temperature drift data is small. At this time, the algorithm training process can be directly entered. On the contrary, it means that the difference between the first gyroscope data and the first target gyroscope temperature drift data is large. At this time, a new round of model construction is required.
[0126] In the embodiments of this application, the electronic device compares the difference between the first gyroscope data and the first target gyroscope temperature drift data with the preset residual threshold, which can adjust the model parameters in real - time, make the updated temperature drift estimation model more accurate, and improve the adaptive ability of the temperature drift estimation model.
[0127] The model construction method provided by this application will be exemplarily described below.
[0128] Figure 9 The flowchart of the model construction method provided by the embodiment of this application is shown. As Figure 9 shown, the model construction method provided by the embodiment of this application may include the following steps 401 to 408.
[0129] Step 401: The electronic device obtains a first candidate data sample set, which includes first candidate data samples at multiple moments within a preset time period. Each first candidate data sample includes a first candidate gyroscope data sample and a first candidate temperature data sample.
[0130] Step 402: The electronic device determines whether the first candidate data sample set meets the first condition. If it meets, step 403 is continued; if it does not meet, step 401 is executed again.
[0131] Step 403: The electronic device starts to save the first candidate data sample set.
[0132] Step 404: The electronic device continuously determines whether the first candidate data sample set meets the second condition. If it meets, step 405 is continued; if it does not meet, step 401 is executed again.
[0133] Step 405: The electronic device determines the first candidate data sample set as the data sample and saves multiple data samples.
[0134] Step 406: The electronic device determines second model parameters based on the temperature data sample in each data sample and the gyroscope zero bias data, where the gyroscope zero bias data corresponds to some temperature data samples; and obtains a first model based on the second model parameters.
[0135] Exemplarily, the electronic device inputs the temperature data sample x in each collected data sample and the gyroscope zero bias data u(x) into the above second formula and the above third formula to obtain the weight w i and the target parameter a, and further obtains the specific expression of the first formula to obtain the first model.
[0136] Step 407: The electronic device makes a batch difference between the gyroscope data sample in each data sample and the first model to obtain a fifth formula, and combines the difference between each temperature data sample and the temperature data sample at the previous moment to determine the first model parameters, and then obtains a second model based on the first model parameters.
[0137] Exemplarily, the electronic device subtracts the gyroscope data sample y in each data sample from the first model in batches. Obtain the fifth formula. Combine with the sixth formula. Obtain the correction parameter b, the correction parameter c, the correction parameter d, and the correction parameter e. At this time, substitute these four correction parameters into the above sixth formula to obtain the second model.
[0138] Step 408: The electronic device constructs a temperature drift estimation model based on the first model and the second model.
[0139] It should be noted that in the production line process, the production line tool will turn on the camera in the terminal where the gyroscope is located and record videos when the terminal is in a stationary state. In this way, it can simulate the process of temperature increase and the gyroscope temperature drift phenomenon in the terminal during the user's use of the camera. At this time, the electronic device can execute the above steps 401 to 408. Among them, in step 405, the camera can also be exited.
[0140] In the embodiment of the present application, during the entire model construction process, through the constructed first model and the second model constructed based on the temperature difference, a temperature drift estimation model with relatively high accuracy can be obtained to prepare for outputting relatively accurate gyroscope temperature drift data subsequently, thereby improving the compensation effect of the gyroscope data.
[0141] In the embodiment of the present application, at least two data samples are obtained. Each data sample includes a gyroscope data sample and a temperature data sample at the same moment. Each data sample is collected when the terminal where the gyroscope is located is in a stationary state; the temperature data samples in each data sample are respectively input into the first model to obtain the gyroscope temperature drift data corresponding to each temperature data sample. The first model can consider the influence of all temperature data samples and obtain relatively accurate gyroscope temperature drift data estimated initially; based on the gyroscope data sample in each data sample, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment, determine the first model parameters, and then obtain the second model; construct a temperature drift estimation model based on the first model and the second model. In this solution, since the temperature difference between adjacent temperature data samples is referred to during the construction of the second model, the temperature drift estimation model constructed based on the second model can estimate relatively accurate target gyroscope temperature drift data, so that the electronic device can accurately compensate the gyroscope data based on the relatively accurate gyroscope temperature drift data, thereby improving the accuracy of the gyroscope data.
[0142] It should be noted that for the gyroscope data compensation method provided in the embodiments of the present application, the execution subject may be a gyroscope data compensation device, an electronic device, or a functional module in the electronic device, etc. In some embodiments of the present application, the example where the electronic device executes the gyroscope data compensation method is used to illustrate the gyroscope data compensation method provided in the embodiments of the present application.
[0143] Figure 10 The flowchart of the gyroscope data compensation method provided in the embodiments of the present application is shown. As Figure 10 shown, the gyroscope data compensation method provided in the embodiments of the present application may include the following steps 501 to step 506.
[0144] Step 501, obtain the second gyroscope data and the second temperature data at the second moment.
[0145] It should be noted that the acquisition of the second gyroscope data and the second temperature data does not need to consider whether the terminal where the gyroscope is located is in a stationary state.
[0146] Step 502, input the second temperature data into the temperature drift estimation model.
[0147] Among them, the temperature drift estimation model may be constructed based on the Figure 1 model construction method shown, or may be constructed by other model construction methods, which is not specifically limited here.
[0148] Step 503, based on the first model in the temperature drift estimation model and the second temperature data, obtain the third gyroscope temperature drift data corresponding to the second temperature data.
[0149] Step 504, based on the second model in the temperature drift estimation model and the difference between the second temperature data and the temperature data at the previous moment, obtain the fourth gyroscope temperature drift data corresponding to the second temperature data.
[0150] Step 505, output the second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is the sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data.
[0151] Step 506, based on the second target gyroscope temperature drift data, compensate the second gyroscope data to obtain the compensated gyroscope data.
[0152] After the electronic device obtains the second gyroscope data and the second temperature data at the first moment, it inputs the second temperature data into the temperature drift estimation model. Through the first model (i.e., the above first formula) in the temperature drift estimation model, the second temperature data is calculated and processed to obtain the third gyroscope temperature drift data corresponding to the second temperature data, realizing preliminary temperature drift compensation. Then, it determines the difference between the second temperature data and the temperature data at the previous moment, and through the second model (i.e., the above fourth formula) in the temperature drift estimation model, the difference is calculated and processed to obtain the fourth gyroscope temperature drift data corresponding to the second temperature data. By considering the rate of temperature change and calculating the difference to predict the future temperature drift trend, the real-time performance and accuracy of temperature drift compensation are enhanced. Further, the electronic device sums the third gyroscope temperature drift data and the fourth gyroscope temperature drift data, and outputs the sum result as the second target gyroscope temperature drift data. Finally, the electronic device subtracts the second target gyroscope temperature drift data from the second gyroscope data to compensate the second gyroscope data and obtain the compensated gyroscope data, that is, the gyroscope data without temperature drift. Next, the electronic device can send the compensated gyroscope data to the camera. Since the camera obtains ultra-high-precision gyroscope data, it can improve the anti-shake effect of the image.
[0153] Exemplarily, the difference between the second gyroscope data and the second target gyroscope temperature drift data can be calculated using the difference formula.
[0154] Among them, the difference formula is:
[0155] x” represents the second temperature data; y cali (x”) represents the difference between the second gyroscope data and the second target gyroscope temperature drift data, and this difference is a kind of gyroscope data without temperature drift; y raw (x”) represents the second gyroscope data; represents the second target gyroscope temperature drift data.
[0156] It should be noted that the execution order of the process for determining the second gyroscope temperature drift data and the process for determining the second gyroscope temperature drift data is not limited.
[0157] Exemplarily, as Figure 11 shown, it is a schematic diagram of the data compensation effect provided by the embodiment of the present application after adopting the gyroscope data compensation method. As can be seen from Figure 11 : Figure 11 contains Figure 5The shown Curve 1 and Curve 2 also include Curve 3 obtained by compensating the gyro zero bias data on Curve 1, and Curve 4 obtained by compensating the gyro zero bias data on Curve 2. Among them, Curve 3 and Curve 4 show a non-linear upward trend. Generally speaking, Curve 3 and Curve 4 are more stable and have a smaller fluctuation range. Figure 11 The shown Curve 3 and Curve 4 indicate that the above gyro data compensation method offsets the influence of temperature data on gyro data to a certain extent, that is, effectively reduces the influence of temperature data on gyro data and improves the compensation effect of gyro data.
[0158] In the embodiment of the present application, after obtaining the second gyro data and the second temperature data at the first moment, the second temperature data is input into the temperature drift estimation model. Through the first model in the temperature drift estimation model, the second temperature data is calculated and processed to obtain the third gyro temperature drift data corresponding to the second temperature data, realizing preliminary temperature drift compensation; then, the difference between the second temperature data and the temperature data at the previous moment is determined, and through the second model in the temperature drift estimation model, the difference is calculated and processed to obtain the fourth gyro temperature drift data corresponding to the second temperature data. By considering the rate of temperature change, the future temperature drift trend is predicted through difference calculation, enhancing the real-time performance and accuracy of temperature drift compensation; further, the third gyro temperature drift data and the fourth gyro temperature drift data are summed, and the summation result is output as the second target gyro temperature drift data; finally, the second gyro data is subtracted from the second target gyro temperature drift data to compensate the second gyro data and obtain the compensated gyro data, that is, the gyro data without temperature drift, for subsequent improving the anti-shake effect of the camera.
[0159] It should be noted that each of the above method embodiments, or each possible implementation manner in each method embodiment, can be executed alone, or, on the premise of no contradiction, can also be executed in combination with each other, which can be specifically determined according to actual usage requirements, and the embodiments of the present application do not limit this.
[0160] For the model construction method provided by the embodiment of the present application, the execution subject can be a model construction device. In the embodiment of the present application, taking the model construction device executing the model construction method as an example, the model construction device provided by the embodiment of the present application is described.
[0161] Figure 12 The structural schematic diagram of the model construction device provided by the embodiment of the present application is shown. As Figure 12 shown, the model construction device provided by the embodiment of the present application may include: an acquisition module 601, a processing module 602, and a construction module 603.
[0162] An acquisition module 601, configured to acquire at least two data samples, each data sample including a gyroscope data sample and a temperature data sample at the same moment, and each of the data samples being acquired when the terminal where the gyroscope is located is in a stationary state;
[0163] A processing module 602, configured to respectively input the temperature data samples in each of the data samples acquired by the acquisition module 601 into a first model to obtain gyroscope temperature drift data corresponding to each temperature data sample; determine first model parameters based on the gyroscope data samples in each of the data samples acquired by the acquisition module 601, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; and obtain a second model based on the first model parameters;
[0164] A construction module 603, configured to construct a temperature drift estimation model based on the first model and the second model obtained by the processing module 602.
[0165] In some embodiments of the present application, in combination with Figure 12 , as Figure 13 shown, the model construction device provided by the embodiments of the present application may include: a training module 604;
[0166] The processing module 602 is further configured to determine second model parameters based on the temperature data samples in each of the data samples and gyroscope zero bias data, and the gyroscope zero bias data corresponds to some of the temperature data samples;
[0167] The training module 604 is configured to obtain the first model based on the second model parameters obtained by the processing module 602.
[0168] In some embodiments of the present application, the at least two data samples at least include a first data sample and a second data sample, the first data sample includes a first gyroscope data sample and a first temperature data sample, and the second data sample includes a second gyroscope data sample and a second temperature data sample;
[0169] The processing module 602 is specifically configured to: determine a first difference between the first gyroscope data sample and the gyroscope temperature drift data corresponding to the first temperature data sample, and a second difference between the second gyroscope data sample and the gyroscope temperature drift data corresponding to the second temperature data sample; determine first model parameters based on the first difference, the second difference, a third difference between the first temperature data sample and the temperature data sample at the previous moment, and a fourth difference between the second temperature data sample and the temperature data sample at the previous moment.
[0170] In some embodiments of the present application, the acquisition module 601 is further configured to acquire first gyroscope data and first temperature data at a first moment, where the first gyroscope data and the first temperature data are collected when the terminal is in a stationary state;
[0171] The processing module 602 is further configured to input the first temperature data acquired by the acquisition module 601 into the temperature drift estimation model; based on the first model in the temperature drift estimation model and the first temperature data, obtain first gyroscope temperature drift data corresponding to the first temperature data; based on the second model in the temperature drift estimation model and the difference between the first temperature data and the temperature data at the previous moment, obtain second gyroscope temperature drift data corresponding to the first temperature data; output first target gyroscope temperature drift data, where the first target gyroscope temperature drift data is the sum of the first gyroscope temperature drift data and the second gyroscope temperature drift data; based on the difference between the first gyroscope data acquired by the acquisition module 601 and the first target gyroscope temperature drift data, update the model parameters of the temperature drift estimation model to obtain an updated temperature drift estimation model.
[0172] In some embodiments of the present application, the acquisition module 601 is specifically configured to: acquire a first candidate data sample set, where the first candidate data sample set includes first candidate data samples at multiple moments within a preset duration, and each first candidate data sample includes a first candidate gyroscope data sample and a first candidate temperature data sample; when the first candidate data sample set meets the first condition and the second condition, use all the first candidate data samples in the first candidate data sample set as the data samples; where meeting the first condition includes: the jump between any adjacent first candidate gyroscope data samples in the first candidate data sample set is less than a preset jump threshold, and the temperature difference between the maximum first candidate temperature data sample and the minimum first candidate temperature data sample in the first candidate data sample set is less than a preset temperature difference threshold; the second condition includes: the number of first candidate gyroscope data samples or first candidate temperature data samples in the first candidate data sample set is greater than or equal to a preset number threshold.
[0173] In some embodiments of the present application, the processing module 602 is further configured to: when the candidate data sample set does not meet the first condition and / or does not meet the second condition, continue to acquire a second candidate data sample set; where the second candidate data sample set includes second candidate data samples at multiple moments within the preset duration, and each second candidate data sample includes a second candidate gyroscope data sample and a second candidate temperature data sample.
[0174] In an embodiment of the present application, an acquisition module 601 acquires at least two data samples. Each data sample includes a gyroscope data sample and a temperature data sample at the same moment, and each data sample is acquired when the terminal where the gyroscope is located is in a stationary state. A processing module 602 inputs the temperature data sample in each data sample acquired by the acquisition module 601 into a first model respectively, and obtains gyroscope temperature drift data corresponding to each temperature data sample. The first model can consider the influence of all temperature data samples and obtain relatively accurate gyroscope temperature drift data estimated preliminarily. Based on the gyroscope data sample in each data sample acquired by the acquisition module 601, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment, first model parameters are determined; and based on the first model parameters, a second model is obtained; based on the first model and the second model obtained by the processing module 602, a temperature drift estimation model is constructed. In this solution, since the temperature difference between adjacent temperature data samples is referred to in the process of constructing the second model, the temperature drift estimation model constructed based on the second model can estimate target gyroscope temperature drift data with relatively high accuracy, so that the electronic device can accurately compensate the gyroscope data based on the relatively accurate gyroscope temperature drift data, thereby improving the accuracy of the gyroscope data.
[0175] For the gyroscope data compensation method provided by an embodiment of the present application, the execution subject may be a gyroscope data compensation device. In an embodiment of the present application, taking the gyroscope data compensation device as an example to execute the gyroscope data compensation method, the gyroscope data compensation device provided by an embodiment of the present application is described.
[0176] Figure 14 The structural schematic diagram of the gyroscope data compensation device provided by an embodiment of the present application is shown. As Figure 14 shown, the gyroscope data compensation device provided by an embodiment of the present application may include: an acquisition module 701 and a processing module 702.
[0177] The acquisition module 701 is configured to acquire second gyroscope data and second temperature data at a second moment;
[0178] A processing module 702 is configured to input the second temperature data obtained by an acquisition module 701 into a temperature drift estimation model; based on a first model in the temperature drift estimation model and the second temperature data, obtain third gyroscope temperature drift data corresponding to the second temperature data; based on a second model in the temperature drift estimation model and a difference between the second temperature data and the temperature data at the previous moment, obtain fourth gyroscope temperature drift data corresponding to the second temperature data; output second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is a sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; and based on the second target gyroscope temperature drift data, compensate the second gyroscope data obtained by the acquisition module 701 to obtain compensated gyroscope data.
[0179] In an embodiment of the present application, through the constructed first model and the second model based on the temperature difference, gyroscope temperature drift data with relatively high accuracy can be output, thereby improving the compensation effect of the gyroscope data.
[0180] The model construction device and the gyroscope data compensation device in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than a terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It may also be a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0181] The model construction device and the gyroscope data compensation device in the embodiments of the present application may be devices with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.
[0182] The model construction device provided in the embodiments of the present application can implement Figures 1 to 9 each process implemented by the method embodiments. To avoid repetition, details are not described herein again.
[0183] The gyroscope data compensation device provided by the embodiments of the present application can implement Figure 10 each process implemented by the method embodiments. To avoid repetition, details are not described herein again.
[0184] As Figure 15 shown, the embodiments of the present application further provide an electronic device 1500, including a processor 1501 and a memory 1502. A program or instruction that can run on the processor 1501 is stored on the memory 1502. When the program or instruction is executed by the processor 1501, it implements each step of the above-mentioned model construction method or the gyroscope data compensation method embodiments, and can achieve the same technical effects. To avoid repetition, details are not described herein again.
[0185] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0186] Figure 16 FIG. is a schematic hardware structure diagram of an electronic device for implementing an embodiment of the present application.
[0187] The electronic device 1600 includes, but is not limited to: a radio frequency unit 1601, a network module 1602, an audio output unit 1603, an input unit 1604, a sensor 1605, a display unit 1606, a user input unit 1607, an interface unit 1608, a memory 1609, and a processor 1610 and other components.
[0188] Those skilled in the art can understand that the electronic device 1600 may further include a power source (such as a battery) for supplying power to each component. The power source can be logically connected to the processor 1610 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 16 The structure of the electronic device shown in FIG. does not limit the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which are not described herein again.
[0189] Among them, the processor 1610 is used to obtain at least two data samples, each data sample including a gyroscope data sample and a temperature data sample at the same moment, and each of these data samples is collected when the terminal where the gyroscope is located is in a stationary state; input the temperature data samples in each data sample into the first model respectively to obtain the gyroscope temperature drift data corresponding to each temperature data sample; determine the first model parameters based on the gyroscope data samples in each of these data samples, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; and obtain the second model based on the first model parameters; construct a temperature drift estimation model based on the first model and the second model.
[0190] Optionally, the processor 1610 is further used to determine the second model parameters based on the temperature data samples in each of these data samples and the gyroscope zero bias data, where the gyroscope zero bias data corresponds to some of the temperature data samples; obtain the first model based on the second model parameters.
[0191] Optionally, the at least two data samples include at least a first data sample and a second data sample. The first data sample includes a first gyroscope data sample and a first temperature data sample, and the second data sample includes a second gyroscope data sample and a second temperature data sample; the processor 1610 is further used to determine a first difference between the first gyroscope data sample and the gyroscope temperature drift data corresponding to the first temperature data sample, and a second difference between the second gyroscope data sample and the gyroscope temperature drift data corresponding to the second temperature data sample; determine the first model parameters based on the first difference, the second difference, a third difference between the first temperature data sample and the temperature data sample at the previous moment, and a fourth difference between the second temperature data sample and the temperature data sample at the previous moment.
[0192] Optionally, the processor 1610 is further used to obtain a first gyroscope data and a first temperature data at the first moment, where the first gyroscope data and the first temperature data are collected when the terminal is in a stationary state; input the first temperature data into the temperature drift estimation model; obtain the first gyroscope temperature drift data corresponding to the first temperature data based on the first model in the temperature drift estimation model and the first temperature data; obtain the second gyroscope temperature drift data corresponding to the first temperature data based on the second model in the temperature drift estimation model and the difference between the first temperature data and the temperature data at the previous moment; output the first target gyroscope temperature drift data, where the first target gyroscope temperature drift data is the sum of the first gyroscope temperature drift data and the second gyroscope temperature drift data; update the model parameters of the temperature drift estimation model based on the difference between the first gyroscope data and the first target gyroscope temperature drift data to obtain an updated temperature drift estimation model.
[0193] Optionally, the processor 1610 is specifically configured to obtain a first candidate data sample set, where the first candidate data sample set includes first candidate data samples at multiple moments within a preset time period, and each first candidate data sample includes a first candidate gyroscope data sample and a first candidate temperature data sample; when the first candidate data sample set meets the first condition and the second condition, all the first candidate data samples in the first candidate data sample set are used as the data samples; where, meeting the first condition includes: the jump between the first candidate gyroscope data samples at any adjacent moments in the first candidate data sample set is less than a preset jump threshold, and the temperature difference between the maximum first candidate temperature data sample and the minimum first candidate temperature data sample in the first candidate data sample set is less than a preset temperature difference threshold; the second condition includes: the number of first candidate gyroscope data samples or first candidate temperature data samples in the first candidate data sample set is greater than or equal to a preset quantity threshold.
[0194] Optionally, the processor 1610 is further configured to continue to obtain a second candidate data sample set when the candidate data sample set does not meet the first condition and / or does not meet the second condition; where the second candidate data sample set includes second candidate data samples at multiple moments within the preset time period, and each second candidate data sample includes a second candidate gyroscope data sample and a second candidate temperature data sample.
[0195] In the embodiment of the present application, the processor 1610 obtains at least two data samples, each data sample includes a gyroscope data sample and a temperature data sample at the same moment, and each data sample is collected when the terminal where the gyroscope is located is in a stationary state; the temperature data sample in each data sample is respectively input into a first model to obtain the gyroscope temperature drift data corresponding to each temperature data sample, and the first model can consider the influence of all temperature data samples to obtain a relatively accurate gyroscope temperature drift data estimated preliminarily; based on the gyroscope data sample in each data sample, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment, the first model parameters are determined; and based on the first model parameters, a second model is obtained; based on the first model and the second model, a temperature drift estimation model is constructed. In this solution, since the temperature difference between the temperature data samples at adjacent moments is referred to in the process of constructing the second model, the temperature drift estimation model constructed based on the second model can estimate the target gyroscope temperature drift data with higher accuracy, so that the electronic device can accurately compensate the gyroscope data based on the gyroscope temperature drift data with higher accuracy, thereby improving the accuracy of the gyroscope data.
[0196] Among them, the processor 1610 is configured to obtain second gyroscope data and second temperature data at a second moment; input the second temperature data into a temperature drift estimation model; based on a first model in the temperature drift estimation model and the second temperature data, obtain third gyroscope temperature drift data corresponding to the second temperature data; based on a second model in the temperature drift estimation model and a difference between the second temperature data and temperature data at a previous moment, obtain fourth gyroscope temperature drift data corresponding to the second temperature data; output second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is a sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; and based on the second target gyroscope temperature drift data, compensate the second gyroscope data to obtain compensated gyroscope data.
[0197] In an embodiment of the present application, by constructing a first model and a second model based on a temperature difference, gyroscope temperature drift data with relatively high accuracy can be output, thereby improving the compensation effect of gyroscope data.
[0198] It should be understood that in an embodiment of the present application, the input unit 1604 may include a Graphics Processing Unit (GPU) 16041 and a microphone 16042. The graphics processor 16041 processes image data of a static picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1606 may include a display panel 16061, and the display panel 16061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1607 includes at least one of a touch panel 16071 and other input devices 16072. The touch panel 16071 is also referred to as a touch screen. The touch panel 16071 may include two parts: a touch detection device and a touch controller. The other input devices 16072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated herein.
[0199] The memory 1609 can be used to store software programs and various data. The memory 1609 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 1609 may include volatile memory or non-volatile memory, or the memory 1609 may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 1609 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.
[0200] The processor 1610 may include one or more processing units; optionally, the processor 1610 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 1610.
[0201] The embodiments of the present application also provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above-mentioned model construction method or the gyroscope data compensation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0202] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs.
[0203] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above model construction method or gyroscope data compensation method, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0204] It should be understood that the chip mentioned in the embodiments of the present application can also be referred to as a system-on-chip, system chip, chip system, or system-on-chip.
[0205] The embodiments of the present application provide a computer program product. The program product is stored in a storage medium and is executed by at least one processor to implement each process of the above model construction method or gyroscope data compensation method embodiments, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0206] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the method or device in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0207] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present application.
[0208] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative rather than restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. A model building method, characterized in that, Including: Obtain at least two data samples, each of the data samples including a gyroscope data sample and a temperature data sample at the same moment, and each of the data samples being collected when the terminal where the gyroscope is located is in a stationary state; Input the temperature data sample in each of the data samples into the first model respectively to obtain the gyroscope temperature drift data corresponding to each temperature data sample; Determine the first model parameters based on the gyroscope data sample in each of the data samples, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; and obtain the second model based on the first model parameters; Construct a temperature drift estimation model based on the first model and the second model.
2. The model construction method according to claim 1, wherein Before inputting the temperature data sample in each of the data samples into the first model respectively to obtain the gyroscope temperature drift data corresponding to each temperature data sample, the method further includes: Determine the second model parameters based on the temperature data sample in each of the data samples and the gyroscope zero bias data, the gyroscope zero bias data corresponding to some of the temperature data samples; Obtain the first model based on the second model parameters.
3. The model construction method according to claim 1, characterized in that The at least two data samples at least include a first data sample and a second data sample, the first data sample including a first gyroscope data sample and a first temperature data sample, and the second data sample including a second gyroscope data sample and a second temperature data sample; The determining the first model parameters based on the gyroscope data sample in each of the data samples, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment includes: Determine a first difference between the first gyroscope data sample and the gyroscope temperature drift data corresponding to the first temperature data sample, and a second difference between the second gyroscope data sample and the gyroscope temperature drift data corresponding to the second temperature data sample; Determine the first model parameters based on the first difference, the second difference, a third difference between the first temperature data sample and the temperature data sample at the previous moment, and a fourth difference between the second temperature data sample and the temperature data sample at the previous moment.
4. The model construction method according to any one of claims 1-3, characterized in that After constructing the temperature drift estimation model based on the first model and the second model, the method further includes: Obtain a first gyroscope data and a first temperature data at a first moment, the first gyroscope data and the first temperature data being collected when the terminal is in a stationary state; Input the first temperature data into the temperature drift estimation model; Obtain the first gyroscope temperature drift data corresponding to the first temperature data based on the first model in the temperature drift estimation model and the first temperature data; Obtain the second gyroscope temperature drift data corresponding to the first temperature data based on the second model in the temperature drift estimation model and the difference between the first temperature data and the temperature data at the previous moment; Output the first target gyroscope temperature drift data, where the first target gyroscope temperature drift data is the sum of the first gyroscope temperature drift data and the second gyroscope temperature drift data; Based on the difference between the first gyroscope data and the first target gyroscope temperature drift data, update the model parameters of the temperature drift estimation model to obtain an updated temperature drift estimation model.
5. The model construction method according to claim 1, wherein The obtaining at least two data samples includes: Obtain a first candidate data sample set, where the first candidate data sample set includes first candidate data samples at multiple moments within a preset time period, and each first candidate data sample includes a first candidate gyroscope data sample and a first candidate temperature data sample; When the first candidate data sample set meets the first condition and the second condition, use all the first candidate data samples in the first candidate data sample set as the data samples; Among them, meeting the first condition includes: the jump between any adjacent first candidate gyroscope data samples in the first candidate data sample set is less than a preset jump threshold, and the temperature difference between the maximum first candidate temperature data sample and the minimum first candidate temperature data sample in the first candidate data sample set is less than a preset temperature difference threshold; The second condition includes: the number of first candidate gyroscope data samples or first candidate temperature data samples in the first candidate data sample set is greater than or equal to a preset number threshold.
6. The model construction method according to claim 5, wherein After obtaining the candidate data sample set, the method further includes: When the candidate data sample set does not meet the first condition and / or does not meet the second condition, continue to obtain a second candidate data sample set; Among them, the second candidate data sample set includes second candidate data samples at multiple moments within the preset time period, and each second candidate data sample includes a second candidate gyroscope data sample and a second candidate temperature data sample.
7. A gyroscope data compensation method, characterized in that, Includes: Obtain the second gyroscope data and the second temperature data at the second moment; Input the second temperature data into the temperature drift estimation model; Based on the first model in the temperature drift estimation model and the second temperature data, obtain the third gyroscope temperature drift data; Based on the second model in the temperature drift estimation model and the difference between the second temperature data and the temperature data at the previous moment, obtain the fourth gyroscope temperature drift data; Output the second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is the sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; Based on the second target gyroscope temperature drift data, compensate the second gyroscope data to obtain compensated gyroscope data.
8. A model construction device, characterized in that, Includes: An acquisition module, a processing module, and a construction module; The acquisition module is used to obtain at least two data samples, and each data sample includes a gyroscope data sample and a temperature data sample at the same moment, and each data sample is collected when the terminal where the gyroscope is located is in a stationary state; The processing module is configured to respectively input the temperature data samples in each data sample acquired by the acquisition module into a first model to obtain gyroscope temperature drift data corresponding to each temperature data sample; determine first model parameters based on the gyroscope data samples in each data sample acquired by the acquisition module, the gyroscope temperature drift data corresponding to each temperature data sample, and the difference between each temperature data sample and the temperature data sample at the previous moment; and obtain a second model based on the first model parameters. The construction module is configured to construct a temperature drift estimation model based on the first model and the second model obtained by the processing module.
9. A gyroscope data compensation device, characterized in that, Comprising: An acquisition module, configured to acquire second gyroscope data and second temperature data at a second moment. The processing module is configured to input the second temperature data acquired by the acquisition module into the temperature drift estimation model; obtain third gyroscope temperature drift data corresponding to the second temperature data based on the first model in the temperature drift estimation model and the second temperature data; obtain fourth gyroscope temperature drift data corresponding to the second temperature data based on the second model in the temperature drift estimation model and the difference between the second temperature data and the temperature data at the previous moment; output second target gyroscope temperature drift data, where the second target gyroscope temperature drift data is the sum of the third gyroscope temperature drift data and the fourth gyroscope temperature drift data; and compensate the second gyroscope data acquired by the acquisition module based on the second target gyroscope temperature drift data to obtain compensated gyroscope data.
10. An electronic device, characterized in that, Comprising a processor and a memory, where the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, it implements the steps of the model construction method according to any one of claims 1-6, or the steps of the gyroscope data compensation method according to claim 7.
11. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, it implements the steps of the model construction method according to any one of claims 1-6, or the steps of the gyroscope data compensation method according to claim 7.