A method for dynamic compensation of measurement error of grating ruler

By combining Bayesian hierarchical models and dimensionality reduction techniques, an error compensation network for grating rulers was constructed. The agent was trained using the Q-learning deep reinforcement learning algorithm, which solved the problem of accurate compensation for grating rulers under multiple error factors and achieved error compensation effect that can quickly adapt to different working environments.

CN116108886BActive Publication Date: 2026-05-26GUANGDONG UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG UNIV OF TECH
Filing Date
2023-02-13
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing methods for comprehensive compensation of multiple error factors in grating rulers are difficult to achieve accurate compensation in real-world working environments, and the models are highly complex and consume a lot of computational resources.

Method used

We employ a multi-source task-target task batch transfer learning approach based on a Bayesian hierarchical model, combined with dimensionality reduction techniques, to construct an error compensation network. Error compensation is achieved through a cascaded feature extraction deep network and a code channel sub-pixel level localization network. The agent is trained using the Q-learning deep reinforcement learning algorithm, and the error compensation is dynamically adjusted.

Benefits of technology

It achieves precise compensation for grating ruler measurement errors, reduces model complexity, reduces computational resource consumption, and can quickly adapt to different working environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116108886B_ABST
    Figure CN116108886B_ABST
Patent Text Reader

Abstract

This invention provides a dynamic compensation method for grating ruler measurement errors, comprising the following steps: S1: Constructing an error compensation network; S2: Incorporating interference factors in different working environments, establishing agents based on the error compensation network to compensate for grating ruler measurement errors under different working environments; S3: Selecting neighboring agents based on a preset proximity threshold; S4: Performing transfer learning on the error compensation network in the neighboring agents based on a dimensionality-reduced Bayesian hierarchical model to quickly obtain the target agent for compensating for grating ruler measurement errors under the current working environment, thereby achieving dynamic compensation for grating ruler measurement errors. This invention provides a dynamic compensation method for grating ruler measurement errors, solving the problem that existing methods for comprehensive compensation of multiple error factors are difficult to achieve accurate compensation results in actual working environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of grating rulers, and more specifically, to a method for dynamic compensation of measurement errors of grating rulers. Background Technology

[0002] As a high-precision position sensor, the grating ruler is a core measuring device in micro-nano ultra-precision machining equipment. Extensive research both domestically and internationally has focused on methods for suppressing and compensating for single error factors in grating ruler measurements. However, compensating for only a single error factor cannot guarantee the reliability of the grating ruler's measurement accuracy. This is because the accuracy of the grating ruler is affected by the coupled effects of multiple error factors, including photoelectric system errors, vibration errors, tooling errors, and temperature errors.

[0003] Currently, although there are methods for comprehensive compensation of multiple error factors, there are still shortcomings, such as: (1) Transforming the problem of multiple error compensation of grating rulers into a nonlinear signal processing problem, and using the EMD method to extract the measurement error trend by taking high-frequency components as comprehensive errors in order to suppress the coupling error of multiple interference factors. However, this method does not deeply consider the error coupling mechanism of multiple interference factors of grating rulers, does not incorporate interference factors, and is not universal. (2) However, if the multiple error compensation of grating rulers is carried out entirely from the perspective of signal processing, the interference factors are incorporated without combining the study of error coupling mechanism, which will lead to another problem. The model parameters need to be manually adjusted in different working environments, which greatly increases the complexity of the work. (3) Even if interference factors are incorporated, such as constructing a smart agent for grating ruler measurement error compensation based on multi-source heterogeneous data (code track image and interference factors) to adapt to complex and changeable working environments and solve the problem of grating ruler error compensation under the coupling mechanism of multiple interference factors. Although the measurement compensation matrix for multiple interference coupling factors of grating rulers considers as many working environments as possible during the construction process, it is impossible to cover all actual working environments. When the grating ruler is measuring, if its working environment does not have a corresponding node in the matrix, it can only use the error compensation agent corresponding to the nearest neighbor working environment for error compensation, which will result in poor error compensation effect.

[0004] Therefore, existing methods for comprehensive compensation of multiple error factors are difficult to achieve accurate compensation results in real-world working environments. Summary of the Invention

[0005] To overcome the technical shortcomings of existing methods for comprehensive compensation of multiple error factors, which are difficult to achieve accurate compensation results in actual working environments, this invention provides a dynamic compensation method for grating ruler measurement errors.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:

[0007] A method for dynamic compensation of measurement error of a grating ruler includes the following steps:

[0008] S1: Construct an error compensation network;

[0009] S2: Combining the interference factors of different working environments, establish intelligent agents based on the error compensation network to compensate for the measurement error of the grating ruler under different working environments;

[0010] S3: Select neighboring agents based on a preset proximity threshold;

[0011] S4: Based on the dimensionality-reduced Bayesian hierarchical model, the error compensation network in the neighboring agent is transferred to quickly obtain the target agent for compensating the measurement error of the grating ruler in the current working environment, thereby realizing dynamic compensation of the measurement error of the grating ruler.

[0012] The above scheme incorporates multiple interference factors and uses a Bayesian hierarchical model to perform batch transfer learning of the agent's multi-source task-target task. This allows for timely updates of the agent compensating for grating ruler measurement errors in the current working environment, accurately compensating for grating ruler measurement errors under the current conditions and achieving precise compensation results. Simultaneously, the Bayesian hierarchical model undergoes parameter dimensionality reduction, significantly reducing model complexity and alleviating the problem of excessive computational resource consumption. This enables rapid searching of the optimal measurement error compensation network, allowing for the quick acquisition of the target agent used to compensate for grating ruler measurement errors in the current working environment.

[0013] Preferably, the error compensation network includes a code track subpixel level localization network and a decoding layer; wherein, the code track subpixel level localization network includes a cascaded feature extraction depth network, a code track coarse localization depth network and a code track subpixel level localization depth network.

[0014] In the error compensation network,

[0015] First, the code track image is input into a cascaded feature extraction deep network to obtain multi-scale feature sub-images;

[0016] Next, the multi-scale feature sub-map is input into the code track coarse localization depth network to obtain the coarse code track localization map;

[0017] Then, the coarse code track localization map is input into the code track subpixel level localization depth network to obtain the subpixel code track localization map;

[0018] Finally, the subpixel code track localization map is passed through a decoding layer to obtain the decoding result.

[0019] Preferably, the code track coarse localization depth network uses the MSEloss loss function:

[0020]

[0021] Where W and H are the width and height of the image, respectively. It is the pixel prediction value. It is the actual label value of the pixel.

[0022] Preferably, the code track subpixel level localization depth network utilizes a super-resolution module to achieve super-resolution magnification of the code track image, the super-resolution module including a feature extraction module and an upsampling module;

[0023] The low-resolution image is input into the first convolutional layer of the feature extraction module. This convolutional layer has a kernel size of 5*5 and a number of 64 kernels, followed by a tanh activation function. The weight parameter W1 is C*64*5*5, where C is the number of channels in the input image, resulting in 64 feature maps. Then, the 64 feature maps are input into the second convolutional layer of the feature extraction module. This convolutional layer has a kernel size of 3*3 and a number of 32 kernels, followed by a tanh activation function. The weight parameter W2 is 64*32*3*3, resulting in 32 feature maps.

[0024] The 32 feature maps obtained from the feature extraction module are input into the upsampling module for sub-pixel convolution. The sub-pixel convolution process is as follows:

[0025] I SR =f 3 (I LR =ps(W3*f 2 (I LR )+b3)

[0026] W3 = 32 * r 2 *3*3

[0027] Among them, I SR For the generated high-resolution image, W3 and b3 are the weight parameters and bias of the subpixel convolution, respectively, r is the upsampling ratio, and I... LR For the original low-resolution image, f 3 For sub-pixel convolutional layers, f 2 This is the second convolutional layer of the super-resolution module.

[0028] The operation defined by ps(·) is as follows:

[0029] ps(T) x,y,c =T [x / r],[y / r],C· r· mod(y,r)+C· r· mod(x,r)+c

[0030] Where x, y, c are the coordinates in the high-resolution image; [·] represents the quotient; [x / r], [y / r] represent the planar coordinates in the low-resolution image; C·r·mod(y,r)+C·r·mod(x,r)+c represents the depth coordinates in the vertical depth.

[0031] Preferably, the loss function of the super-resolution module is:

[0032]

[0033] in, For the actual label value, I LR The original low-resolution image, Let W be the width and height of the generated super-resolution image pixels, and H be the width and height of the image, respectively.

[0034] Preferably, the interfering factors include temperature, vibration amplitude, and vibration frequency.

[0035] Preferably, the proximity threshold is preset based on the interference factors in the combined working environment.

[0036] Preferably, the action value function of the agent is trained using the Q-learning deep reinforcement learning algorithm, as follows:

[0037] A1: Construct an n-row, m-column Q-table and initialize all Q-values ​​in the table to 0; where n is the number of states S and m is the number of actions a.

[0038] A2: Based on the current state S t Choose the best action a t Execute a t Afterwards, you receive reward R and a new state S. t+1 ;

[0039] A3: The Q-table is updated using the Time Difference (TD) method. The action value function at adjacent time points is compared based on the Time Difference Error (TD Error), as shown in the following formula:

[0040]

[0041] δ TD =R+γQ(S) t+1 ,a t+1 )-Q(S t ,a t )

[0042] Q new (S t ,α t )=Q(S t ,α t )+αδ TD

[0043] Where, δ TD The time difference error is γ, the linear decay coefficient is Q(S) t ,a t Let Q(S) be the action value function at iteration t. t+1,a t+1 Let Q be the action value function for iteration t+1. new (S t ,α t ) is Q(S t ,α t The updated Q value, where α is the learning rate;

[0044] A4: Determine whether the maximum difference between the Q-values ​​of the Q-table in the current iteration and the Q-values ​​of the Q-table in the previous iteration is less than a preset threshold.

[0045] If so, then the Q table will no longer be updated, and the learning process will end.

[0046] If not, then S t+1 As the current state, return to step A2.

[0047] Preferably, a dimensionality-reduced Bayesian hierarchical model is obtained by performing parameter dimensionality reduction on the Bayesian hierarchical model.

[0048] The parameter dimensionality reduction problem of the Bayesian hierarchical model is transformed into a semidefinite programming problem:

[0049]

[0050] st W T KLKW=I m

[0051] Where W is the transition matrix of the Bayesian hierarchical model, tr(·) is the trace of the matrix, λ is the Lagrange coefficient, K is the kernel function, L is the coefficient matrix, H is the center matrix, and I m It is an identity matrix.

[0052] Preferably, after performing parameter dimensionality reduction on the Bayesian hierarchical model, the method further includes initializing the agent using a refined dimensionality reduction method:

[0053] First, determine the neighborhood size, using k neighborhood samples to linearly represent the target sample, and select the k nearest neighbors of the target sample using Euclidean distance; after finding the target sample X... i After finding the k nearest neighbors, find X. i The linear relationship between the k nearest neighbors is the weighting factor used to find the linear relationship:

[0054] Given N initial n-dimensional sample sets {x1, x2, ..., x...} n}, using the mean squared error as the loss function:

[0055]

[0056] For the weighting coefficient w ij The constraint for normalization is that the weighting coefficients must satisfy...

[0057]

[0058] Weighting coefficient w i Transform into the following formula:

[0059]

[0060] Among them, Z i =(x i -x j ) T (x i -x j ), 1 k Let be a k-dimensional vector of all 1s;

[0061] After obtaining the high-dimensional weight coefficients, in order to preserve the linear relationship corresponding to the weight coefficients in the lower-dimensional result, we define {x1,x2,...,x...} n The corresponding projection in the lower dimension is set as {y1, y2, ..., y}. n The loss function to be minimized is as follows:

[0062]

[0063]

[0064] Where Y is the result of dimensionality reduction of the Bayesian hierarchical model.

[0065] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:

[0066] This invention provides a dynamic compensation method for grating ruler measurement errors. It incorporates multiple interference factors and utilizes a Bayesian hierarchical model for batch transfer learning of multi-source tasks and target tasks by the agent. This allows for timely updates of the agent compensating for grating ruler measurement errors in the current working environment, accurately compensating for the measurement errors under the current conditions and achieving precise compensation. Simultaneously, it reduces the dimensionality of the Bayesian hierarchical model, significantly decreasing model complexity and alleviating the problem of excessive computational resource consumption. This enables rapid searching of the optimal measurement error compensation network, quickly obtaining the target agent for compensating for grating ruler measurement errors in the current working environment. Attached Figure Description

[0067] Figure 1 This is a flowchart illustrating the implementation steps of the technical solution of the present invention;

[0068] Figure 2 This is a schematic diagram of the error compensation network in this invention;

[0069] Figure 3This is a schematic diagram of the code channel sub-pixel level positioning network in this invention;

[0070] Figure 4 This is a schematic diagram of the process for obtaining the target intelligent agent in this invention. Detailed Implementation

[0071] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.

[0072] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;

[0073] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.

[0074] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0075] Example 1

[0076] like Figure 1 As shown, a dynamic compensation method for measurement error of a grating ruler includes the following steps:

[0077] S1: Construct an error compensation network;

[0078] S2: Combining the interference factors of different working environments, establish intelligent agents based on the error compensation network to compensate for the measurement error of the grating ruler under different working environments;

[0079] S3: Select neighboring agents based on a preset proximity threshold;

[0080] The neighboring agent is the agent corresponding to the neighboring work environment;

[0081] S4: Based on the dimensionality-reduced Bayesian hierarchical model, the error compensation network in the neighboring agent is transferred to quickly obtain the target agent for compensating the measurement error of the grating ruler in the current working environment, thereby realizing dynamic compensation of the measurement error of the grating ruler.

[0082] In the specific implementation process, multiple interference factors are incorporated, and batch transfer learning of multi-source tasks and target tasks of the agent is carried out based on the Bayesian hierarchical model. The agent for compensating for grating ruler measurement errors in the current working environment is updated in a timely manner, accurately compensating for grating ruler measurement errors in the current environment and achieving precise compensation effect. At the same time, the parameters of the Bayesian hierarchical model are reduced in dimensionality, which greatly reduces the model complexity, alleviates the problem of consuming a lot of computing resources, and enables rapid search for the optimal measurement error compensation network, so as to quickly obtain the target agent for compensating for grating ruler measurement errors in the current working environment.

[0083] Example 2

[0084] A method for dynamic compensation of measurement error of a grating ruler includes the following steps:

[0085] S1: Construct an error compensation network;

[0086] More specifically, such as Figure 2-3 As shown, the error compensation network (compensation network) includes a code channel subpixel level localization network (subpixel level localization network) and a decoding layer; wherein, the code channel subpixel level localization network includes a cascaded feature extraction depth network, a code channel coarse localization depth network and a code channel subpixel level localization depth network.

[0087] The decoding layer includes an encoding layer and a decoding layer. The encoding layer generates the corresponding code based on the laser etching method of the absolute encoding stripes on the glass substrate. The decoding layer obtains the decoding result, i.e. the measurement result, by looking up a table.

[0088] In the error compensation network,

[0089] First, the code track image is input into a cascaded feature extraction deep network to obtain multi-scale feature sub-images;

[0090] Next, the multi-scale feature sub-map is input into the code track coarse localization depth network to obtain the coarse code track localization map;

[0091] Then, the coarse code track localization map is input into the code track subpixel level localization depth network to obtain the subpixel code track localization map;

[0092] Finally, the subpixel code track localization map is passed through a decoding layer to obtain the decoding result.

[0093] In the specific implementation process, the cascaded feature extraction deep network includes convolutional layers and sampling layers. In order to segment the code channel image in the subsequent process, the feature map obtained after convolution of the code channel image is sampled. In order to obtain rich semantic information, the unsampled feature map is fused with the sampled feature map to obtain a multi-scale feature sub-map.

[0094] The coarse localization deep network for code channels includes convolutional layers, ReLU layers, remodeling layers, and softmax layers. After passing through this network, a coarse localization segmentation image for code channels can be obtained. Here, each pixel is classified, and each pixel is either 0 or 1.

[0095] The code track subpixel level localization depth network includes convolutional sampling layers and deconvolutional layers. After passing through this network, a fine subpixel code track localization segmentation map can be obtained.

[0096] More specifically, the coarse localization depth network of the code track adopts the MSEloss loss function:

[0097]

[0098] Where W and H are the width and height of the image, respectively. It is the pixel prediction value. It is the true label value of the pixel, and the binarized code track image is used as the training true label.

[0099] More specifically, the code track subpixel level localization depth network utilizes a super-resolution module to achieve super-resolution magnification of the code track image, the super-resolution module including a feature extraction module and an upsampling module;

[0100] The low-resolution image is input into the first convolutional layer of the feature extraction module. This convolutional layer has a kernel size of 5*5 and a number of 64 kernels, followed by a tanh activation function. The weight parameter W1 is C*64*5*5, where C is the number of channels in the input image, resulting in 64 feature maps. Then, the 64 feature maps are input into the second convolutional layer of the feature extraction module. This convolutional layer has a kernel size of 3*3 and a number of 32 kernels, followed by a tanh activation function. The weight parameter W2 is 64*32*3*3, resulting in 32 feature maps.

[0101] The 32 feature maps obtained from the feature extraction module are input into the upsampling module for sub-pixel convolution. The sub-pixel convolution process is as follows:

[0102] I SR =f 3 (I LR =ps(W3*f 2 (I LR )+b3)

[0103] W3 = 32 * r 2 *3*3

[0104] Among them, I SR For the generated high-resolution image, W3 and b3 are the weight parameters and bias of the subpixel convolution, respectively, r is the upsampling ratio, and I... LR For the original low-resolution image, f 3 This is a subpixel convolutional layer, the last layer of the super-resolution module network, f 2 This is the second convolutional layer of the super-resolution module.

[0105] The above formula essentially extracts pixels from the n3 feature maps in the third layer (the convolution process within the parentheses), then performs a pixel shuffle operation using the PS operator, and finally outputs I. SR ;

[0106] The operation defined by ps(·) is as follows:

[0107] ps(T) x,y,c=T [x / r],[y / r],C· r· mod(y,r)+C· r· mod(x,r)+c

[0108] Where x, y, c are the coordinates in the high-resolution image; [·] represents the quotient; [x / r], [y / r] represent the planar coordinates in the low-resolution image; C·r·mod(y,r)+C·r·mod(x,r)+c represents the depth coordinates in the vertical depth.

[0109] More specifically, the loss function of the super-resolution module is:

[0110]

[0111] in, For the actual label value, I LR The original low-resolution image, Let W be the width and height of the generated super-resolution image pixels, and H be the width and height of the image, respectively.

[0112] S2: Combining the interference factors of different working environments, establish intelligent agents based on the error compensation network to compensate for the measurement error of the grating ruler under different working environments;

[0113] More specifically, the interfering factors include temperature, vibration amplitude, and vibration frequency.

[0114] In the specific implementation process, because the working environment is different when measuring with a grating ruler, in order to enable the error compensation network to make corresponding adjustments according to different working environments, this embodiment incorporates interference factors (temperature, vibration amplitude and vibration frequency) and establishes a smart agent for grating ruler measurement error compensation for multi-source heterogeneous data (grating ruler code track image data, temperature data and vibration data).

[0115] S3: Select neighboring agents based on a preset proximity threshold;

[0116] The neighboring agent is the agent corresponding to the neighboring work environment;

[0117] More specifically, the proximity threshold is preset based on the interference factors in the combined working environment.

[0118] S4: Based on the dimensionality-reduced Bayesian hierarchical model, the error compensation network in the neighboring agent is transferred to quickly obtain the target agent for compensating the measurement error of the grating ruler in the current working environment, thereby realizing dynamic compensation of the measurement error of the grating ruler.

[0119] More specifically, such as Figure 4 As shown, the Q-learning deep reinforcement learning algorithm is used to train the action value function of the agent, as detailed below:

[0120] A1: Construct an n-row, m-column Q-table and initialize all Q-values ​​in the table to 0; where n is the number of states S and m is the number of actions a.

[0121] A2: Based on the current state S t Choose the best action a t Execute a t Afterwards, you receive reward R and a new state S. t+1 ;

[0122] A3: The Q-table is updated using the Time Difference (TD) method. The action value function at adjacent time points is compared based on the Time Difference Error (TD Error), as shown in the following formula:

[0123]

[0124] δ TD =R+γQ(S) t+1 ,a t+1 )-Q(S t ,a t )

[0125] Q new (S t ,α t )=Q(S t ,α t )+αδ TD

[0126] Where, δ TD The time difference error is γ, the linear decay coefficient is Q(S) t ,a t Let Q(S) be the action value function at iteration t. t+1 ,a t+1 Let Q be the action value function for iteration t+1. new (S t ,α t ) is Q(S t ,α t The updated Q value, where α is the learning rate; R is obtained by comparing and encoding the laser interferometer measurement data and the decoded data.

[0127] A4: Determine whether the maximum difference between the Q-values ​​of the Q-table in the current iteration and the Q-values ​​of the Q-table in the previous iteration is less than a preset threshold.

[0128] If so, then the Q table will no longer be updated, and the learning process will end.

[0129] If not, then S t+1 As the current state, return to step A2.

[0130] In this implementation, the Q-learning deep reinforcement learning algorithm is used to retrain and iterate the action value function of the grating ruler measurement error compensation agent. The state-action value function, Q(S,a), represents the expected reward of taking action a at a given state S. The environment provides a corresponding reward R based on the agent's action. Therefore, the main idea of ​​the algorithm is to construct a Q-table (Q_table) to store Q values, and then select the action that maximizes the reward based on the Q values. In this grating ruler measurement error compensation agent, the state refers to the error compensation network parameters, and the action refers to the error compensation network model. The reward R, simply put, represents the degree to which the grating ruler measurement error is suppressed. After a certain number of iterations, the optimal action value is found, and then the decision is updated by copying the current optimal state to the error compensation network, resulting in the target error compensation network. This yields the target agent used to compensate for the grating ruler measurement error in the current working environment.

[0131] More specifically, a dimensionality-reduced Bayesian hierarchical model is obtained by performing parameter dimensionality reduction on the Bayesian hierarchical model.

[0132] When performing transfer learning from a multi-source task to a target task based on a Bayesian hierarchical model, it is difficult to directly apply the model to a grating ruler for dynamic error compensation due to the large number of parameters in practice. Therefore, parameter dimensionality reduction is necessary, which is essentially a minimization problem. Thus, this embodiment transforms the parameter dimensionality reduction problem of the Bayesian hierarchical model into a semidefinite programming problem:

[0133]

[0134] st W T KLKW=I m

[0135] Where W is the transition matrix of the Bayesian hierarchical model, tr(·) is the trace of the matrix, λ is the Lagrange coefficient, K is the kernel function (usually a Gaussian kernel), L is the coefficient matrix, H is the center matrix, and I... m It is an identity matrix.

[0136] In practical implementation, semidefinite programming is a generalization of linear programming. It is the problem of maximizing (minimizing) a linear function under the constraint that "the affine combination of symmetric matrices is positive semidefinite". This constraint is nonlinear, non-smooth, and convex, thus semidefinite programming is a non-smooth convex optimization problem. By solving the above semidefinite programming problem using the Lagrange duality method, W can be obtained. The number of zero elements in W increases significantly, that is, the rank of W decreases significantly. Therefore, the complexity of the Bayesian hierarchical model is greatly reduced, and the computational resource consumption is greatly reduced, enabling the new grating ruler measurement error compensation agent to quickly adapt to the actual working environment.

[0137] Example 3

[0138] A method for dynamic compensation of measurement error of a grating ruler includes the following steps:

[0139] S1: Construct an error compensation network;

[0140] More specifically, the error compensation network includes a code track subpixel level localization network and a decoding layer; wherein, the code track subpixel level localization network includes a cascaded feature extraction depth network, a code track coarse localization depth network and a code track subpixel level localization depth network.

[0141] The decoding layer includes an encoding layer and a decoding layer. The encoding layer generates the corresponding code based on the laser etching method of the absolute encoding stripes on the glass substrate. The decoding layer obtains the decoding result, i.e. the measurement result, by looking up a table.

[0142] In the error compensation network,

[0143] First, the code track image is input into a cascaded feature extraction deep network to obtain multi-scale feature sub-images;

[0144] Next, the multi-scale feature sub-map is input into the code track coarse localization depth network to obtain the coarse code track localization map;

[0145] Then, the coarse code track localization map is input into the code track subpixel level localization depth network to obtain the subpixel code track localization map;

[0146] Finally, the subpixel code track localization map is passed through a decoding layer to obtain the decoding result.

[0147] More specifically, the coarse localization depth network of the code track adopts the MSEloss loss function:

[0148]

[0149] Where W and H are the width and height of the image, respectively. It is the pixel prediction value. It is the true label value of the pixel, and the binarized code track image is used as the training true label.

[0150] More specifically, the code track subpixel level localization depth network utilizes a super-resolution module to achieve super-resolution magnification of the code track image, the super-resolution module including a feature extraction module and an upsampling module;

[0151] The low-resolution image is input into the first convolutional layer of the feature extraction module. This convolutional layer has a kernel size of 5*5 and a number of 64 kernels, followed by a tanh activation function. The weight parameter W1 is C*64*5*5, where C is the number of channels in the input image, resulting in 64 feature maps. Then, the 64 feature maps are input into the second convolutional layer of the feature extraction module. This convolutional layer has a kernel size of 3*3 and a number of 32 kernels, followed by a tanh activation function. The weight parameter W2 is 64*32*3*3, resulting in 32 feature maps.

[0152] The 32 feature maps obtained from the feature extraction module are input into the upsampling module for sub-pixel convolution. The sub-pixel convolution process is as follows:

[0153] I SR =f 3 (I LR =ps(W3*f 2 (I LR )+b3)

[0154] W3 = 32 * r 2 *3*3

[0155] Among them, I SR For the generated high-resolution image, W3 and b3 are the weight parameters and bias of the subpixel convolution, respectively, r is the upsampling ratio, and I... LR For the original low-resolution image, f 3 This is a subpixel convolutional layer, the last layer of the super-resolution module network, f 2 This is the second convolutional layer of the super-resolution module.

[0156] The operation defined by ps(·) is as follows:

[0157] ps(T) x,y,c =T [x / r],[y / r],C·r· mod(y,r)+C· r· mod(x,r)+c

[0158] Where x, y, c are the coordinates in the high-resolution image; [·] represents taking the quotient; [x / r], [y / r] represent the planar coordinates in the low-resolution image; C·r·mod(y,r)+C·r·mod(x,r)+c represents the depth coordinates in the vertical depth.

[0159] More specifically, the loss function of the super-resolution module is:

[0160]

[0161] in, For the actual label value, I LR The original low-resolution image, Let W be the width and height of the generated super-resolution image pixels, and H be the width and height of the image, respectively.

[0162] S2: Combining the interference factors of different working environments, establish intelligent agents based on the error compensation network to compensate for the measurement error of the grating ruler under different working environments;

[0163] More specifically, the interfering factors include temperature, vibration amplitude, and vibration frequency.

[0164] S3: Select neighboring agents based on a preset proximity threshold;

[0165] The neighboring agent is the agent corresponding to the neighboring work environment;

[0166] More specifically, the proximity threshold is preset based on the interference factors in the combined working environment.

[0167] S4: Based on the dimensionality-reduced Bayesian hierarchical model, the error compensation network in the neighboring agent is transferred to quickly obtain the target agent for compensating the measurement error of the grating ruler in the current working environment, thereby realizing dynamic compensation of the measurement error of the grating ruler.

[0168] More specifically, the Q-learning deep reinforcement learning algorithm is used to train the action value function of the agent, as follows:

[0169] A1: Construct an n-row, m-column Q-table and initialize all Q-values ​​in the table to 0; where n is the number of states S and m is the number of actions a.

[0170] A2: Based on the current state S t Choose the best action a t Execute a t Afterwards, you receive reward R and a new state S. t+1 ;

[0171] A3: The Q-table is updated using the Time Difference (TD) method. The action value function at adjacent time points is compared based on the Time Difference Error (TD Error), as shown in the following formula:

[0172]

[0173] δ TD =R+γQ(S) t+1 ,a t+1 )-Q(S t ,a t)

[0174] Q new (S t ,α t )=Q(S t ,α t )+αδ TD

[0175] Where, δ TD The time difference error is γ, the linear decay coefficient is Q(S) t ,a t Let Q(S) be the action value function at iteration t. t+1 ,a t+1 Let Q be the action value function for iteration t+1. new (S t ,α t ) is Q(S t ,α t The updated Q value, where α is the learning rate; R is obtained by comparing and encoding the laser interferometer measurement data and the decoded data.

[0176] A4: Determine whether the maximum difference between the Q-values ​​of the Q-table in the current iteration and the Q-values ​​of the Q-table in the previous iteration is less than a preset threshold.

[0177] If so, then the Q table will no longer be updated, and the learning process will end.

[0178] If not, then S t+1 As the current state, return to step A2.

[0179] More specifically, a dimensionality-reduced Bayesian hierarchical model is obtained by performing parameter dimensionality reduction on the Bayesian hierarchical model.

[0180] The parameter dimensionality reduction problem of the Bayesian hierarchical model is transformed into a semidefinite programming problem:

[0181]

[0182] st W T KLKW=I m

[0183] Where W is the transition matrix of the Bayesian hierarchical model, tr(·) is the trace of the matrix, λ is the Lagrange coefficient, K is the kernel function (usually a Gaussian kernel), L is the coefficient matrix, H is the center matrix, and I... m It is an identity matrix.

[0184] More specifically, after performing parameter dimensionality reduction on the Bayesian hierarchical model, the process also includes initializing the agent using a refined dimensionality reduction method:

[0185] First, determine the neighborhood size, using k neighborhood samples to linearly represent the target sample, and select the k nearest neighbors of the target sample using Euclidean distance; after finding the target sample X... i After finding the k nearest neighbors, find X. i Finding the linear relationship between the k nearest neighbors, or the weighting coefficients of this linear relationship, is clearly a regression problem. In this embodiment, the mean squared error is used as the loss function for the regression problem.

[0186] Given N initial n-dimensional sample sets {x1, x2, ..., x...} n}, using the mean squared error as the loss function:

[0187]

[0188] For the weighting coefficient w ij The constraint for normalization is that the weighting coefficients must satisfy...

[0189]

[0190] Weighting coefficient w i Transform into the following formula:

[0191]

[0192] Among them, Z i =(x i -x j ) T (x i -x j ), 1 k Let be a k-dimensional vector of all 1s;

[0193] After obtaining the high-dimensional weight coefficients, in order to preserve the linear relationship corresponding to the weight coefficients in the lower-dimensional result, we define {x1,x2,...,x...} n The corresponding projection in the lower dimension is set as {y1, y2, ..., y}. n The loss function to be minimized is as follows:

[0194]

[0195]

[0196] Where Y is the result of dimensionality reduction of the Bayesian hierarchical model.

[0197] In the specific implementation process, the model is further optimized by adopting a fine dimensionality reduction method that does not change the consistency of the linear relationship of parameters, which further accelerates the construction of a deep reinforcement learning model based on multi-source task-target task transfer learning, and establishes a dynamic compensation mechanism for grating ruler measurement error, thus solving the problem of rapid and intelligent compensation of grating ruler measurement error under different environments.

[0198] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for dynamic compensation of measurement error of a grating ruler, characterized in that, Includes the following steps: S1: Construct an error compensation network; S2: Combining the interference factors of different working environments, establish intelligent agents based on the error compensation network to compensate for the measurement error of the grating ruler under different working environments; S3: Select neighboring agents based on a preset proximity threshold; S4: Based on the dimension-reduced Bayesian hierarchical model, the error compensation network in the neighboring agent is transferred to quickly obtain the target agent for compensating the measurement error of the grating ruler in the current working environment, thereby realizing dynamic compensation of the measurement error of the grating ruler. The error compensation network includes a code track subpixel level localization network and a decoding layer; wherein, the code track subpixel level localization network includes a cascaded feature extraction depth network, a code track coarse localization depth network and a code track subpixel level localization depth network. In the error compensation network, First, the code track image is input into a cascaded feature extraction deep network to obtain multi-scale feature sub-images; Next, the multi-scale feature sub-maps are input into the code track coarse localization depth network to obtain the coarse code track localization map; Then, the coarse track localization map is input into the track subpixel localization depth network to obtain the subpixel track localization map; Finally, the subpixel code track localization map is passed through a decoding layer to obtain the decoding result.

2. The method for dynamic compensation of measurement error of a grating ruler according to claim 1, characterized in that, The code track coarse positioning depth network adopts MSEloss Loss function: in, W and H These are the width and height of the image, respectively. It is the pixel prediction value. It is the actual label value of the pixel.

3. The method for dynamic compensation of measurement error of a grating ruler according to claim 1, characterized in that, The code track subpixel level localization depth network utilizes a super-resolution module to achieve super-resolution magnification of the code track image. The super-resolution module includes a feature extraction module and an upsampling module. The low-resolution image is input into the first convolutional layer of the feature extraction module. The kernel size of the first convolutional layer is 5*5, and the number of kernels is 64. It is then followed by a tanh activation function. The weight parameters are... C represents the number of input image channels, resulting in 64 feature maps. These 64 feature maps are then input into the second convolutional layer of the feature extraction module. The second convolutional layer has a 3x3 kernel size and 32 kernels, followed by a tanh activation function. The weight parameters are then... 32 feature maps were obtained; The 32 feature maps obtained from the feature extraction module are input into the upsampling module for sub-pixel convolution. The sub-pixel convolution process is as follows: in, For the generated high-resolution image, and These represent the weight parameters and biases of the subpixel convolution, respectively. r It is the upsampling ratio. The original low-resolution image, It is a sub-pixel convolutional layer. This is the second convolutional layer of the super-resolution module. The operation defined by ps(·) is as follows: in, x , y , c These are the coordinates in a high-resolution image; [·] indicates taking the quotient; x / r ],[ y / r ] represents planar coordinates in a low-resolution image; Represents the depth coordinates in the vertical direction.

4. The method for dynamic compensation of measurement error of a grating ruler according to claim 3, characterized in that, The loss function of the super-resolution module is: in, The actual label value. The original low-resolution image, For the generated super-resolution map pixels, W and H These are the width and height of the image, respectively.

5. The method for dynamic compensation of measurement error of a grating ruler according to claim 1, characterized in that, The interfering factors include temperature, vibration amplitude, and vibration frequency.

6. The method for dynamic compensation of measurement error of a grating ruler according to claim 5, characterized in that, The proximity threshold is preset based on the interference factors in the combined working environment.

7. The method for dynamic compensation of measurement error of a grating ruler according to claim 1, characterized in that, The action value function of the agent is trained using the Q-learning deep reinforcement learning algorithm, as follows: A1: Construct an n-row, m-column Q-table and initialize all Q-values ​​in the table to 0; where n is the number of states S and m is the number of actions a; A2: Based on the current state Choose the best action ,implement Afterwards, you will receive reward R and a new state. ; A3: The Q-table is updated using the Time Difference (TD) method. The action value function at adjacent time points is compared based on the Time Difference Error (TD Error), as shown in the following formula: in, For time difference error, The linear decay coefficient is... Let be the action value function at iteration t. Let be the action value function for iteration t+1. for The updated Q value, The learning rate; A4: Determine whether the maximum difference between the Q-values ​​of the Q-table in the current iteration and the Q-values ​​of the Q-table in the previous iteration is less than a preset threshold. If so, then the Q table will no longer be updated, and the learning process will end. If not, then As the current state, return to step A2.

8. The method for dynamic compensation of measurement error of a grating ruler according to claim 1, characterized in that, A dimensionality-reduced Bayesian hierarchical model is obtained by performing parameter dimensionality reduction on the Bayesian hierarchical model. The parameter dimensionality reduction problem of the Bayesian hierarchical model is transformed into a semidefinite programming problem: Where W is the transition matrix of the Bayesian hierarchical model, tr(·) is the trace of the matrix, λ is the Lagrange coefficient, K is the kernel function, and L is the coefficient matrix. It is an identity matrix.