A method for intelligent subdivision of grating moiré fringes
By adopting the dual-channel moiré stripe intelligent subdivision model based on LSTM-TAM in the field of micro displacement measurement, the problem that the single-channel model cannot distinguish the difference in input and output samples is solved, and higher measurement accuracy and computing efficiency are achieved.
Patent Information
- Application Number
- CN202410777630.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-06-17
AI Technical Summary
The single-channel model is used in the existing micro displacement measurement field, which cannot distinguish the differences in input and output samples, resulting in low accuracy in measuring displacement values of grating sensors.
Using the dual-channel moiré stripe intelligent segmentation model based on LSTM-TAM, the data set is constructed through segmentation functions and the model is deployed in the FPGA to realize intelligent segmentation of the one-dimensional data of the grating moiré stripe.
It effectively reduces measurement errors, improves the reliability of measurement results, and realizes efficient calculations and lightweight applications.
Smart Images

Figure CN118799868B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of grating sensor measurement, and in particular to a grating moiré fringe intelligent subdivision method. Background Art
[0002] The photolithography machine uses the principles of optical irradiation and chemical reaction to produce micron and nanometer-scale precision devices. The photolithography machine is an indispensable key equipment in the manufacture of microelectronic devices, which requires high-precision position control and motion tracking. Grating displacement measurement technology is a technology that monitors the position and displacement of the photolithography machine worktable to achieve real-time motion state monitoring and control signal feedback to ensure accurate position control and motion tracking of the worktable. This technology is crucial to maintaining the manufacturing accuracy and production efficiency of the photolithography machine.
[0003] Grating moiré fringes are formed by the interference phenomenon produced when light passes through the grating. Their shape and spacing are closely related to the displacement of the target object. By accurately measuring the changes in these fringes, precise positioning and dynamic tracking of micron- and nanometer-scale device structures can be achieved.
[0004] A single-channel model is currently used in the field of micro-displacement measurement. However, the single-channel model cannot distinguish the differences between input and output samples, and the accuracy of the displacement value measured by the grating sensor is low. Summary of the invention
[0005] The object of the present invention is to provide a grating moiré fringe subdivision method to solve the technical problem of low accuracy of displacement value measured by grating sensors in the prior art.
[0006] The present invention provides a grating moiré fringe intelligent segmentation method, comprising the following steps: constructing a data set by adopting a piecewise function; establishing a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM, training the dual-channel moiré fringe intelligent segmentation model by using the data set to obtain a trained dual-channel moiré fringe intelligent segmentation model; and deploying the dual-channel moiré fringe intelligent segmentation model in an FPGA.
[0007] Furthermore, a dual-channel moiré fringe intelligent segmentation model is constructed on the basis of eight segmentation modules, taking the piecewise function and the corresponding displacement value as input and output respectively; the method of constructing a data set using the piecewise function specifically includes: (1) interval division: using the piecewise function to equally divide the data in one period into eight intervals, and obtaining the corresponding constructor value according to the different inputs to improve the linearity; (2) data induction: according to the piecewise function values and displacement values displayed in the eight intervals, the data with the same characteristics are summarized together to construct the corresponding data set.
[0008] Furthermore, the dual-channel moiré fringe intelligent segmentation model uses [P, S] as the input and output of the training sample, where P is a piecewise function, and the formula is as follows:
[0009]
[0010] Wherein, θ is the angle between the fixed-scale grating and the moving-scale grating, and its value range is [0,90°), A is the intensity or contrast of the grating fringes, and A≥0.
[0011] S represents the corresponding displacement value, and the formula is as follows:
[0012]
[0013] Where ω is the grating pitch of the grating sensor, θ is the angle between the fixed-scale grating and the moving-scale grating, and the value range is [0,90°).
[0014] The displacement value is calculated using the above formula.
[0015] Furthermore, a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM is established, and the dual-channel moiré fringe intelligent segmentation model is trained using the data set. The method for obtaining the trained dual-channel moiré fringe intelligent segmentation model specifically includes: (1) special relationship capture: in the algorithm modeling stage, the special relationship between input and output data in different intervals is captured by the dual-channel moiré fringe intelligent segmentation model; (2) parameter adjustment: after training and parameter adjustment on the host computer, the parameters with the best training effect are obtained and verified on the host computer; (3) parameter preservation: the segmentation model is trained on the host computer, and its weights and thresholds are saved.
[0016] Furthermore, the TAM model is used after the LSTM model to obtain the LSTM-TAM model; the LSTM-TAM model is introduced in two channels respectively to obtain a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM; the TAM model contains local and global attention modules to improve the prediction ability of time series data; the LSTM model extracts features from the data, the local attention module focuses on the dynamic changes within a short time range, and the global attention module focuses on the long-term dependency of the entire time series; the extracted features are aggregated and the final result is generated through the prediction layer; the target loss evaluates the difference between the prediction and the true label, and guides the model optimization to enhance the prediction performance.
[0017] Furthermore, the dual-channel moiré fringe intelligent segmentation model is deployed in the FPGA through the Verilog hardware description language; the content structure of the FPGA accelerator includes a control unit, a storage unit and a segmentation model acceleration unit; the control unit is responsible for coordinating and managing internal operations, the storage unit is used for data and instruction storage, and the segmentation model acceleration unit is used to accelerate specific computing tasks; the control unit is used to manage the operation process of the entire hardware acceleration system, manage the input and output data flow, control the reading and writing of weight data, and control the calculation process; the storage unit includes multiple ram_unit modules and multiple altera_ram modules; the altera_ram module is used for data storage and reading, and each module Configured as 16width and 1024 depth; the ram_unit module combines multiple altera_ram modules, and multiple ram_unit modules and multiple altera_ram modules work in parallel connection; the segmentation model acceleration unit includes a matrix-vector multiplication module and an Element-wise module; the matrix-vector multiplication module calculates the input data and weights through parallel calculation, and the output result is used for subsequent processing; the Element-wise module performs multiplication and addition operations of vector elements and applies activation functions; the modules are connected through input and output data streams and control signals to jointly complete the calculation tasks of the intelligent segmentation model.
[0018] Furthermore, FPGA uses a fixed-point quantization method to represent floating-point data with a low bit width; FPGA uses a truncation operation to limit the data bit width.
[0019] Furthermore, the grating moiré fringe intelligent segmentation method uses the matrix-vector multiplication module and the element-wise module in the segmentation model acceleration unit in the FPGA to perform parallel calculations and activation function operations; the control unit manages the data flow and calculation status to ensure the efficient completion of the calculation task; the method finally obtains the predicted displacement value after the calculation, and realizes the intelligent segmentation of the one-dimensional data of the grating moiré fringes.
[0020] This application solves the problem that the single-channel model in the field of micro-displacement measurement cannot distinguish the differences between input and output samples, and proposes a dual-channel moiré fringe intelligent segmentation model. This model effectively reduces the measurement error and improves the reliability of the measurement results by integrating the LSTM and attention mechanism. However, while achieving high precision, speed limitations become a challenge. Therefore, this application deploys the model in FPGA and makes full use of the programmable logic and parallel computing capabilities of FPGA to achieve efficient computing and lightweight applications.
[0021] The grating moiré fringe subdivision method provided in the present application can improve the accuracy of displacement values measured by the grating sensor, while also achieving efficient calculation and lightweight application.
[0022] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 The design steps of the grating moiré fringe intelligent subdivision model of an embodiment of the present invention are demonstrated.
[0025] Figure 2 The waveform diagrams of |sinθ|, |cosθ| and a constructor of one embodiment of the present invention are shown.
[0026] Figure 3 The sine function and the fitting straight line of the constructor according to one embodiment of the present invention are shown.
[0027] Figure 4 The data samples of the grating moiré fringe intelligent subdivision model according to one embodiment of the present invention are shown.
[0028] Figure 5 A structural diagram of a grating moiré fringe intelligent subdivision model according to an embodiment of the present invention is shown.
[0029] Figure 6 A neuron structure diagram of an LSTM model according to an embodiment of the present invention is shown.
[0030] Figure 7 A schematic diagram showing the global and local attention mechanisms of an embodiment of the present invention.
[0031] Figure 8 The diagram shows the architecture of an accelerator according to an embodiment of the present invention.
[0032] Fig. 9 A state diagram of a control unit of one embodiment of the present invention is shown.
[0033] Fig.10 The RTL circuit diagram of a memory cell according to an embodiment of the present invention is shown.
[0034] Fig.11 The flowchart of the operation of the grating moiré fringe intelligent subdivision model acceleration unit according to one embodiment of the present invention is shown.
[0035] Fig.12 The RTL circuit diagram of the matrix-vector multiplication module of one embodiment of the present invention is shown.
[0036] Fig.13 A structural diagram of an Element-wise module according to an embodiment of the present invention is shown.
[0037] Fig.14 A schematic diagram showing a fixed-point number according to an embodiment of the present invention.
[0038] Fig.15 A schematic diagram showing a truncation operation according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art.
[0040] The present invention relates to a grating moiré fringe intelligent segmentation method, which is implemented by using a field programmable gate array (FPGA). The core of the method is to adopt a dual-channel intelligent segmentation model, which combines a long short-term memory network (LSTM) and a temporal attention mechanism (TAM). This combination can effectively capture and analyze the temporal characteristics of displacement data, thereby improving the accuracy and stability of measurement. The model is deployed in FPGA through Verilog hardware description language (HDL), and the advantages of FPGA parallel computing capabilities are fully utilized by using modules such as a control unit and a storage unit, thereby achieving efficient computing and lightweight applications.
[0041] In a specific embodiment of the present invention, a grating moiré fringe intelligent segmentation method is provided, comprising the following steps: constructing a data set using a piecewise function; establishing a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM, training the dual-channel moiré fringe intelligent segmentation model using the data set to obtain a trained dual-channel moiré fringe intelligent segmentation model; and deploying the dual-channel moiré fringe intelligent segmentation model in an FPGA.
[0042] Optionally, a dual-channel moiré fringe intelligent segmentation model is constructed on the basis of eight segmentation modules, and the piecewise function and the corresponding displacement value are used as input and output respectively; the method of constructing a data set using a piecewise function specifically includes: (1) interval division: using a piecewise function to equally divide the data in a cycle into eight intervals, and obtaining corresponding constructor values according to different inputs to improve linearity; (2) data induction: according to the piecewise function values and displacement values displayed in the eight intervals, data with the same characteristics are summarized together to construct a corresponding data set.
[0043] Optionally, the method uses [P, S] as the input and output of the training sample, where P is a piecewise function, and the formula is as follows:
[0044]
[0045] Wherein, θ is the angle between the fixed-scale grating and the moving-scale grating, and its value range is [0,90°), A is the intensity or contrast of the grating fringes, and A≥0.
[0046] S represents the corresponding displacement value, and the formula is as follows:
[0047]
[0048] Where ω is the grating pitch of the grating sensor, θ is the angle between the fixed-scale grating and the moving-scale grating, and the value range is [0,90°).
[0049] Optionally, a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM is established, and the dual-channel moiré fringe intelligent segmentation model is trained using a data set. The method for obtaining the trained dual-channel moiré fringe intelligent segmentation model specifically includes:
[0050] (1) Capturing special relationships: In the algorithm modeling stage, the special relationships between input and output data in different intervals are captured through the dual-channel moiré fringe intelligent segmentation model;
[0051] (2) Parameter adjustment: After training and parameter adjustment on the host computer, the parameters with the best training effect are obtained and verified on the host computer;
[0052] (3) Parameter preservation: Train the intelligent segmentation model in the host computer and save its weights and thresholds.
[0053] Optionally, a TAM model is used after the LSTM model to obtain an LSTM-TAM model;
[0054] The LSTM-TAM model was introduced into the two channels respectively, and a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM was obtained;
[0055] The TAM model contains local and global attention modules to improve the prediction ability of time series data. First, the LSTM model extracts features from the data. The local attention module focuses on the dynamic changes in a short time range, and the global attention module focuses on the long-term dependencies of the entire time series. Then, these features are aggregated and the final result is generated through the prediction layer. The target loss evaluates the difference between the prediction and the true label and guides the model optimization to enhance the prediction performance.
[0056] Optionally, the dual-channel moiré fringe intelligent segmentation model is deployed in the FPGA through the Verilog hardware description language; the content structure of the FPGA accelerator includes a control unit, a storage unit, and a segmentation model acceleration unit; the control unit is responsible for coordinating and managing internal operations, the storage unit is used for data and instruction storage, and the segmentation model acceleration unit is specially designed to accelerate specific computing tasks. The synergy of these components enables FPGA to have flexible hardware configuration and efficient parallel computing capabilities.
[0057] The control unit includes functions such as data flow management, weight data reading and writing, and calculation process control. Its main function is to manage the calculation process of the entire hardware acceleration system. It is responsible for managing input and output data flows, controlling the reading and writing of weight data, and controlling the calculation process.
[0058] The storage unit includes 7 ram_unit modules and 8 altera_ram modules. The altera_ram module is used for data storage and reading, and each module is configured with 16 width and 1024 depth; the ram_unit module combines multiple altera_ram modules, which work in parallel to improve data access speed and processing efficiency, while expanding storage capacity and increasing data throughput.
[0059] The segmentation model acceleration unit includes a matrix-vector multiplication module and an element-wise module. The matrix-vector multiplication module operates the input data and weights through parallel calculations, and the output results are used for subsequent processing. The element-wise module performs multiplication and addition operations on vector elements and applies activation functions (such as sigmoid and tanh). The modules are connected through input and output data streams and control signals to jointly complete the calculation tasks of the intelligent segmentation model and improve the calculation speed and efficiency.
[0060] Optionally, the FPGA uses a fixed-point quantization method to represent the floating-point data with a low bit width; the FPGA uses a truncation operation to limit the data bit width.
[0061] Optionally, the method uses a matrix-vector multiplication module and an Element-wise module in a subdivision model acceleration unit in an FPGA to perform parallel computing and activation function operations; the control unit manages data flow and computing status to ensure efficient completion of computing tasks; the method ultimately obtains a predicted displacement value after the operation to achieve intelligent subdivision of one-dimensional data of grating moiré fringes.
[0062] The present invention provides a grating moiré fringe intelligent segmentation method for a displacement measurement system, which includes the following steps: (1) Constructing a data set: In order to solve the problem of poor linearity of the output signal of the grating sensor, a piecewise function is used to construct a data set, and the data set is reasonably divided. (2) Model training phase: The data set is constructed based on the piecewise function, and a grating moiré fringe intelligent segmentation model is further constructed based on eight segmentation modules to capture the special relationship between input and output data in different intervals. (3) Grating moiré fringe intelligent segmentation model deployment phase: The intelligent segmentation model is deployed using FPGA, including a control unit, a storage unit, and a segmentation model acceleration unit, to improve the calculation speed and execution efficiency of the model.
[0063] The present application provides a piecewise function for improving the linearity of the output signal of a grating sensor. The use of the piecewise function to construct a data set includes: (1) interval division: the model construction module of the intelligent segmentation model is based on the eight segmentation modules. The piecewise function can equally divide the data in one cycle into eight intervals, and obtain the corresponding constructor value according to the different inputs. (2) Data induction: according to the piecewise functions and displacement values displayed in the eight intervals, the data with the same characteristics are summarized together to construct the corresponding data set.
[0064] The following is an example of how to group data with the same characteristics together: a period is evenly divided into eight intervals, and the corresponding degree range of each interval is (0, 45°), (45°, 90°)...; then, taking (0, 45°) as an example, the corresponding model input is the value calculated by the piecewise function P, and the model output is the displacement value corresponding to S. This is the corresponding input and output of the model, and the corresponding image is Figure 1 The first picture in .
[0065] A dual-channel intelligent segmentation model based on LSTM-TAM is established, including: (1) Special relationship capture: In the algorithm modeling stage, the dual-channel intelligent segmentation model is used to capture the special relationship between input and output data in different intervals. (2) Parameter adjustment: After training and parameter adjustment on the host computer, the parameters with the best training effect are obtained and verified on the host computer to ensure that the model can accurately simulate the dynamic characteristics of the displacement measurement system and improve the accuracy and stability of displacement measurement. (3) Parameter preservation: The grating moiré fringe intelligent segmentation model is trained in the host computer, and its weights and thresholds are saved to facilitate subsequent implementation in the FPGA.
[0066] The implementation of the grating moiré fringe intelligent segmentation model based on FPGA includes: (1) The accelerator consists of three main components: a control unit, a storage unit, and a segmentation model acceleration unit, which work together to achieve efficient calculation of input data. (2) After being successfully deployed on the FPGA, the model shows superiority in both processing speed and resource utilization. (3) In order to reduce resource consumption and memory access overhead, the fixed-point quantization method is used to represent floating-point data with low bit width. (4) The truncation operation is used to limit the data bit width, prevent data overflow, and adapt to hardware resource limitations to ensure data accuracy.
[0067] A grating moiré fringe intelligent subdivision method is provided to improve the accuracy of displacement value measured by a grating sensor. The method includes the following three steps:
[0068] (1) When constructing the training set, the piecewise function P is used to improve the linearity of the signal. Since the segmentation model is based on eight segmentation modules, the piecewise function and the corresponding displacement value are used as input and output, respectively, and displayed in eight intervals. The data with the same characteristics are grouped together to construct the corresponding data set.
[0069] When using a grating sensor for measurement, its output signal is similar to four sinusoidal signals with a phase difference of 90°. However, the signal actually measured shows poor linearity, especially near the peak, where the signal change is not obvious. This nonlinear characteristic may lead to large errors, so it is necessary to construct a new function with good linearity based on the original signal to fundamentally solve this problem. To this end, the present invention uses the piecewise function P as the input of the training model, and P can be expressed as:
[0070]
[0071] Wherein, θ is the angle between the fixed-scale grating and the moving-scale grating, and its value range is [0,90°), A is the intensity or contrast of the grating fringes, and A≥0.
[0072] The sine function, the constructor and its corresponding fitted line image were used to perform regression analysis on the observed data and calculate R 2 The value of R 2 It is the ratio of the total variance explained by the fitting model to the total variance of the observed data, reflecting the degree to which the fitting line explains the observed data. 2 The calculation formula is as follows:
[0073]
[0074] Among them, SSR is the predicted data The original data mean The sum of the squares of the differences is as follows:
[0075]
[0076] SST is the original data y i Difference from the mean The sum of squares is as follows:
[0077]
[0078] In the interval [0,90°], the R of the sine function 2 is 0.9576, while the R 2 is 0.9913. R close to 1 2 It shows that the fitted straight line explains the differences of the observed data well and has high linearity. Therefore, the constructor P used in the present invention has higher linearity, better fits the observed data, and reduces the error caused by data nonlinearity. Accordingly, the constructor P used can effectively solve the problem of poor linearity of the grating sensor output signal, thereby improving the reliability of the data.
[0079] Therefore, on this basis, the present invention adopts a dual-channel grating moiré fringe intelligent algorithm model, which uses [P, S] as the input and output of the training sample. In this model, P is a piecewise function, and S represents the corresponding micro-displacement value, as shown below:
[0080]
[0081] Where ω is the grating pitch of the grating sensor, θ is the angle between the fixed-scale grating and the moving-scale grating, and the value range is [0,90°).
[0082] According to the characteristics of different angle ranges in each cycle, a piecewise function is defined for each interval based on eight subdivisions, and the data in one cycle is evenly divided into eight equal parts. Subsequently, these piecewise functions are applied to the input data to obtain the corresponding output results. Through careful analysis of the data characteristics of different regions, it is found that the corresponding [P, S] in intervals 1, 3, 5, and 7 are consistent, and in the remaining four intervals, [P, S] also shows consistency. This representation method based on piecewise functions can better understand the structure and properties of the data, thereby achieving more accurate model training and prediction.
[0083] (2) In the algorithm modeling stage, the present invention uses the LSTM-TAM structure to construct an intelligent segmentation model to solve the problem that the displacement value with a pitch less than 2.5μm cannot be measured. Considering that there are two special relationships between input and output data in different intervals, an LSTM-TAM dual-channel moiré fringe intelligent segmentation model is constructed and trained on the host computer, focusing on adjusting the parameters of the model while retaining the weights and thresholds. Before the model is deployed to the FPGA, strict model verification and testing are carried out to ensure the stability and efficiency of subsequent experiments.
[0084] According to the characteristics of the sample data of the two channels, the LSTM-TAM model was introduced in each channel to better capture the data characteristics in the two channels. The LSTM network has memory units and gating mechanisms inside, which can process and memorize information with different time steps and effectively capture the characteristics of the training data. At the same time, TAM is used after the LSTM model, so that the model can focus more on key parts and adapt to the characteristics of the time series data in the channel, so as to achieve better prediction results.
[0085] LSTM is designed to solve the problems of gradient explosion and gradient vanishing in RNN models, thereby significantly enhancing the network's ability to handle long-term dependencies and reducing the difficulty of training. By introducing gating units, LSTM can better control the flow of information, thereby having better performance when processing time series data. Under the action of gating units such as input gates and forget gates, LSTM can selectively remember or ignore input information, thereby effectively processing long-term dependencies without being restricted by time.
[0086] Forget gate T It is a gating mechanism used to control whether to discard previous memory information in LSTM. Its calculation depends on the input and the previous hidden state, and generates a value between 0 and 1, which indicates the proportion of the previous memory retained. T The expression is:
[0087] f T=σ(W f ·[h T-1 ,X T ]+b f )
[0088] Among them, σ is the activation function, W f is the weight, b f For bias.
[0089] Input gate T The role of is to control some input information in the current time step to be added to the cell state, and the weighted operation of the input and hidden layer is obtained, and an activation function is used to generate a value between 0 and 1. By adjusting the value of the input gate, LSTM can adapt to different input sequence features and contexts, so as to better handle long-term dependencies. The state of the input gate i is calculated by tanh T , the new vector Update cell status C T , as shown below:
[0090] i T =σ(W i ·[h T-1 ,X T ]+b i )
[0091]
[0092] Among them, W i , W C is the weight, b i 、b C is the bias, i T The meaning is the state of the input gate, σ is the sigmoid activation function, h T-1 is the output state of the previous state, X T is the input at the current moment, C T The updated status. is the new vector obtained after the operation.
[0093] Output gate T Output the information that determines the output at the current moment. o T 、h T The expression is as follows.
[0094] o T =σ(W o ·[h T-1 ,X T ]+b o )
[0095] hT =o T *tanh(C T )
[0096] Among them, W o is the weight, b o is the bias, o T The meaning is the state of the output gate, σ is the sigmoid activation function, h T-1 is the output state of the previous state, X T is the input at the current moment, C T The updated status.
[0097] In order to further improve the intelligent segmentation model's ability to understand time series data, TAM is introduced into the LSTM model, so that the model can dynamically adjust its attention according to the importance of different time points in the time series, thereby more accurately capturing the key information in the sequence. The design principle of TAM is to allocate attention to different time steps in the sequence data by calculating attention weights. In order to improve the model's concentration on specific data, it is necessary to determine the correlation between vectors and key values to obtain the desired results. The relationship between effect weight and performance is shown below:
[0098]
[0099] Among them, q represents the query vector, (K, V) represents the matrix of input information, K represents the key information used to calculate the attention distribution, V represents the value information used to calculate the aggregate information, and s(k n ,q) represents the scoring function, att(K,V) is the relationship between effect weight and performance, used for weighted calculation, a n is the weighted output vector of the nth attention, v n The meaning is the value vector corresponding to the nth attention head.
[0100] In the present invention, both global and local attention mechanisms are used to achieve a comprehensive understanding and modeling of the grating displacement input data. The local attention mechanism refers to the attention calculation performed in a local range, which only considers the time points in the time series that are close to the current time step, and is used to focus on local details or specific sub-regions of the data; while the global attention mechanism takes all time steps in the sequence into account, and is used to focus on the global context and important features.
[0101] (3) When deploying the intelligent segmentation model to the FPGA, the control unit, storage unit, and segmentation model acceleration unit are used to effectively improve the calculation speed of the model forward transmission stage, optimize the execution efficiency of the model, and process input data faster. At the same time, fixed-point quantization and truncation operations are used to fully utilize FPGA resources and prevent potential problems such as overflow while ensuring calculation accuracy.
[0102] After the intelligent segmentation model is trained in the host computer and its weights and thresholds are saved, this study deploys it in FPGA to realize the function of computing acceleration. The FPGA accelerator consists of three main components: control unit, storage unit and segmentation model acceleration unit, which work together to achieve efficient calculation of input data.
[0103] The main task of the control unit is to process the signals of the random access memory (RAM) and coordinate the distribution of input data, weight data and intermediate calculation results during the entire calculation process. In addition, the control unit is also responsible for the control of the overall accelerator calculation logic. The storage unit includes the global cache on the chip and the local cache inside the processing unit. The purpose of the global cache is to store commonly used data in it, and it can efficiently store commonly used data. The local cache is located inside the processing unit and is mainly used for the storage of temporary data and intermediate calculation results. The subdivision model acceleration unit consists of a matrix-vector multiplication module and an Element-wise module. Through the above architecture, the hardware accelerator can efficiently perform the calculation tasks of the subdivision model and improve the calculation speed and efficiency.
[0104] The control unit is the core component of the subdivision model accelerator, and its main function is to manage the operation process of the entire hardware acceleration system. Specifically, the control unit is responsible for managing the input and output data flow, controlling the reading and writing of weight data, and controlling the calculation process.
[0105] The storage unit designed by the present invention provides necessary data storage and reading support for the implementation of the subdivision model in FPGA, and introduces two storage modules and their functions and applications in detail. First, altera_ram is a configurable RAM unit, which is mainly used for data storage and reading. The storage bit width WIDTH of the altera_ram module is set to 16, that is, each storage unit can store 16-bit data; and its storage depth DEPTH is 1024, which means that it can store 1024 16-bit data. Through the altera_ram module, the experiment can store data in RAM and then read it for subsequent processing and analysis. Secondly, the ram_unit storage module combines multiple altera_ram modules into a larger RAM unit, and uses its parallel processing to improve data processing efficiency. Such a design can expand storage capacity and improve data throughput, so that the subdivision model can effectively access and process data, which helps to achieve effective management and processing of complex data. The storage unit designed by the present invention includes 7 ram_unit modules and 8 altera_ram modules.
[0106] The forward calculation of the grating moiré fringe intelligent segmentation model mainly includes key operations such as matrix-vector multiplication and element-wise calculation. First, the input data and weights are calculated through the matrix-vector multiplication module. Secondly, in the gating mechanism, a series of element-wise calculations are performed, such as multiplying the input value with the gating signal, to control the flow and memory of information, and use element-wise_cnt to determine whether the calculation of the module is completed. Finally, according to the current input and the implicit state of the previous time step, the new implicit state is calculated to pass it to the next layer or output layer. These operations work together at the level of the network to realize the processing and information extraction of the input sequence. At the same time, the number of times of the input data Time_cnt is used to loop the overall segmentation module to ensure the complete processing of the entire sequence.
[0107] 1) Matrix-vector multiplication module
[0108] The present invention utilizes the pipeline structure and parallel computing capability of FPGA to design a matrix-vector multiplication module in the segmentation model. In the calculation of matrix-vector multiplication, the input vector is multiplied by the weight matrix and accumulated to finally generate an output vector. In this module, the input data is represented in matrix form, and the weight coefficient is also stored in matrix form. When the start signal (first) is high, the matrix-vector multiplication module starts to execute the calculation process.
[0109] When the data input enable signal (din_en) is high, the module receives and processes the data input (din). The specific operations include: calculating the product result (dot_wi) between the input data (din) and the input weight (w_ih) and the product result (dot_wh) between the hidden state (prev_h) and the hidden weight (w_hh) at the previous moment. These multiplication results are stored in the multiplication result register. The data is extracted from the multiplication result register and operated with the previously accumulated result, and then the calculated result (dot_sum) is stored in the accumulation register. After the operation is completed, dot_sum is added to the bias (w_b), and the final output result (output) is stored in the output result register.
[0110] 2) Operation of activation function
[0111] In the process of calculation, the activation functions mainly include sigmoid and tanh, but the disadvantage is that calculating the values of these nonlinear activation functions on FPGA will consume a lot of hardware computing resources. Among them, sigmoid is used to control the opening and closing degree of the forget gate, input gate and output gate, and tanh is used to generate candidate values. The calculation formulas of sigmoid and tanh activation functions are as follows:
[0112]
[0113] Among them, e is a mathematical constant, x∈{1,2,3...}.
[0114]
[0115] Among them, e is a mathematical constant, x∈{1,2,3...}.
[0116] When calculating the tanh function value, the input data is first processed from signed to unsigned, and then the absolute value operation and sign bit inversion are performed according to the sign bit of the input data. Next, the result of the operation is used as input to query the matching approximate value in the lookup table. Then, multiplication and addition operations are used to obtain the final approximate value. This process achieves the goal of efficiently calculating the approximate value of the tanh function on the FPGA by using a lookup table and simplified mathematical operations. For the value calculated by the tanh function, the corresponding sigmoid function value can be calculated using the following formula, thereby reusing the existing calculation results and improving the calculation efficiency.
[0117]
[0118] Where x∈{1,2,3...}.
[0119] 3) Element-wise module
[0120] As an important component for processing the output vector of the matrix-vector multiplication module, the Element-wise module covers the functions of performing multiplication and addition operations on vector elements. This module consists of multiple sub-modules, including sigmoid and tanh activation functions, adders and multipliers. In order to effectively utilize hardware resources, the Element-wise module adopts a time-division multiplexing method, which means that the same set of activation function modules takes turns to process different vector elements to reduce the number of modules and save resources. Only two activation functions, sigmoid and tanh, an adder and a multiplier are needed to complete the reuse of the computing unit in three states.
[0121] In order to achieve high-performance and efficient computing, this study uses fixed-point representation and calculation methods in FPGA accelerator design. Although FPGA supports fixed-point and floating-point representation, in order to reduce resource consumption and memory access overhead, a fixed-point quantization method is used to represent floating-point data with low bit width. The number of decimal places in a fixed-point number is fixed. By selecting an appropriate fixed-point number bit width for quantization, it is possible to reduce resource consumption while maintaining high accuracy. Assuming there are n digits after the decimal point, the fixed-point number can be represented as Qn.
[0122] In the present invention, the selection of the number of quantization bits is determined by the following strategy: first determine the total bit width to be 16 bits, and then determine the decimal bit width according to the value range of the weights of each layer of the training model. Since the coefficient range of all layers of the model is between (-1,1), a fixed-point number in Q15 format is selected for weight quantization. However, due to the limited resources of the selected chip EP4CE10F17C8, in order to support the deployment of the dual-channel moiré fringe intelligent segmentation model, 4 decimal places are reduced during the dequantization process, and a fixed-point number in Q11 format is selected. This fixed-point quantization method reduces the complexity of floating-point operations while reducing the demand for storage resources, thereby improving the performance and efficiency of the accelerator.
[0123] In the calculation process of the forward reasoning algorithm of the subdivision model, the truncation operation is used to limit the data bit width, prevent data overflow, and adapt to hardware resource limitations to ensure data accuracy. The truncation module designed by the present invention defines that the bit width of the input data is 34, of which 20 bits are the decimal part, and the output data bit width is 16, of which 7 bits are the decimal part. When the input data exceeds the output data bit width, this module will perform a truncation operation to truncate the data and truncate the high-order data to the output data bit width. If the input data does not overflow, the bit width of the output data remains unchanged to ensure data integrity.
[0124] like Figure 1, which shows the design steps of the grating moiré fringe intelligent segmentation model of an embodiment of the present invention. The figure shows the various stages of model design, from initial conception to final implementation, and the specific steps include building a data set, algorithm modeling, and hardware implementation. The figure clearly shows the design process of the intelligent segmentation model, ensuring the efficiency and accuracy of the model.
[0125] like Figure 2 As shown, the waveform diagram of |sinθ|, |cosθ| and the constructor of one embodiment of the present invention is shown. The figure shows the law of the change of the values of the three signals with the angle θ, which shows that the model can effectively capture the periodic change of the input angle.
[0126] like Figure 3 As shown, the sine function and the fitting straight line of the constructor of one embodiment of the present invention are shown. By comparing the waveform diagrams of the sine function and the fitting straight line, it can be seen that the constructor can well fit the changing trend of the sine function and has higher linearity.
[0127] like Figure 4 As shown, a data sample of the grating moiré fringe intelligent segmentation model of an embodiment of the present invention is shown. The figure constructs the input data for training and testing the model based on the constructor P, and the corresponding displacement value S is the output value of the model, showing the law of the change of the model input value with the angle. These sample data are used to verify the generalization ability and accuracy of the model. Moreover, according to the eight intervals (0, 45°), (45°, 90°), (90°, 135°) in a divided cycle, the image on the left can be obtained by calculating the value of [P, S] in the corresponding 1st, 3rd, 5th, and 7th intervals, and the image on the right can be obtained by calculating the value of [P, S] in the 2nd, 4th, 6th, and 8th intervals.
[0128] like Figure 5 FIG. 1 shows a structural diagram of a grating moiré fringe intelligent segmentation model according to an embodiment of the present invention. The figure describes in detail the various components of the model and their interrelationships, including the input layer, hidden layer, and output layer. This shows that the structural design of the model is reasonable, which helps to improve the calculation efficiency and the accuracy of the results.
[0129] like Figure 6 As shown, a neuron structure diagram of an LSTM model of an embodiment of the present invention is shown. The figure shows the detailed structure of the LSTM neuron, including an input gate, a forget gate, an output gate, and a memory unit. This shows that the LSTM model has a strong ability in processing time series data and is suitable for the application scenario of the present invention.
[0130] like Figure 7, which shows a schematic diagram of the global and local attention mechanism of an embodiment of the present invention. The figure details how to weight input information through the attention mechanism to improve the model's ability to capture important features, thereby enhancing the performance of the model.
[0131] like Figure 8 FIG. 1 shows an architecture diagram of an accelerator according to an embodiment of the present invention. The figure shows the overall architecture of the accelerator, including a data input and output unit, a computing unit, and a control unit, etc., indicating that the design of the accelerator can effectively improve the computing speed and processing capability.
[0132] like Fig. 9 FIG. 1 shows a state diagram of a control unit according to an embodiment of the present invention. The diagram describes various states of the control unit and their conversion relationships, ensuring effective management of data flow and computing state during the entire computing process.
[0133] like Fig.10 , which shows an RTL circuit diagram of a storage unit according to an embodiment of the present invention. The figure shows the hardware implementation details of the storage unit, indicating that it can efficiently store and manage a large amount of data and provide support for model operations.
[0134] like Fig.11 FIG. 1 is a flowchart showing the operation flow of the grating moiré fringe intelligent subdivision model acceleration unit according to an embodiment of the present invention. The diagram describes the operation steps and data flow of the acceleration unit, indicating that its design can effectively accelerate the calculation process of the model.
[0135] like Fig.12 , which shows an RTL circuit diagram of a matrix-vector multiplication module of an embodiment of the present invention. The figure gives the hardware implementation details of the module, indicating that it can efficiently complete the matrix and vector multiplication operations and improve the overall computing efficiency.
[0136] The dual-channel moiré fringe intelligent segmentation model includes a control unit, a storage unit, and a segmentation model acceleration unit. The control unit is responsible for processing the signals of the RAM, coordinating the distribution of input data, weight data, and intermediate calculation results during the entire calculation process, and controlling the overall accelerator calculation logic. The storage unit includes an on-chip global cache and a local cache inside the processing unit. The global cache is used to efficiently store commonly used data, while the local cache is used to store temporary data and intermediate calculation results. The segmentation model acceleration unit consists of a matrix-vector multiplication module and an Element-wise module, which are used to perform the calculation tasks of the segmentation model. These components together constitute the hardware accelerator of the dual-channel moiré fringe intelligent segmentation model, which is deployed inside the FPGA processing unit to efficiently perform calculation tasks and improve calculation speed and efficiency.
[0137] In the matrix-vector multiplication calculation, the input vector is multiplied by the weight matrix and accumulated to produce the output vector. In the matrix-vector multiplication module, the input data is represented in matrix form, and the weight coefficients are also stored in matrix form. In simple terms, the multiplication and addition operations performed are Fig.12 shown.
[0138] like Fig.13 , which shows a structural diagram of an Element-wise module of an embodiment of the present invention. The figure shows the specific structure and function of the module, indicating that it can efficiently perform element-level operations, thereby improving calculation accuracy and speed.
[0139] like Fig.14 FIG. 1 is a schematic diagram showing a fixed-point number according to an embodiment of the present invention. The diagram illustrates a method for representing fixed-point numbers and their application in calculations, showing their important role in improving calculation accuracy and stability.
[0140] like Fig.15 FIG. 1 is a schematic diagram showing a truncation operation principle of an embodiment of the present invention. The diagram shows the specific steps and effects of the truncation operation, indicating that it can effectively reduce the amount of calculation and improve the processing speed when processing data.
[0141] Beneficial effects of the present invention:
[0142] 1. Improved the accuracy and stability of the displacement measurement system: By adopting the grating moiré fringe intelligent subdivision method, the present invention effectively solves the problem of poor linearity of the grating sensor output signal, thereby improving the accuracy and stability of the displacement measurement system.
[0143] 2. Improved data processing speed and execution efficiency: In the segmentation model deployment phase, FPGA is used to deploy the segmentation model, including the control unit, storage unit, and segmentation model acceleration unit, which greatly improves the model's computing speed and execution efficiency, enabling the displacement measurement system to respond and process data more quickly.
[0144] 3. Improved practicability and reliability of the displacement measurement system: The constructor and subdivision model proposed in the present invention can more accurately simulate the dynamic characteristics of the displacement measurement system, thereby improving the accuracy and reliability of displacement measurement and meeting the requirements for high precision and high stability of the displacement measurement system in practical applications.
[0145] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0146] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, similar words such as "one", "one" or "the" do not indicate quantity restrictions, but indicate that there is at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Similar words such as "connect" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
Claims
1. A grating moiré fringe intelligent subdivision method, characterized in that: The steps include: Use piecewise functions to construct data sets; A dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM was established, and the TAM model was used after the LSTM model to obtain the LSTM-TAM model; the LSTM-TAM model was introduced in the two channels respectively to obtain a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM; the TAM model contains local and global attention modules to improve the prediction ability of time series data; the LSTM model extracts features from the data, the local attention module focuses on dynamic changes within a short time range, and the global attention module focuses on the long-term dependency of the entire time series; the extracted features are aggregated and the final result is generated through the prediction layer; the target loss evaluates the difference between the prediction and the true label, and guides the model optimization , enhance the prediction performance; the dual-channel moiré fringe intelligent segmentation model is constructed on the basis of eight segmentation modules, and the piecewise function and the corresponding displacement value are respectively used as input and output. The method of constructing a data set using a piecewise function specifically includes: (1) interval division: using a piecewise function to equally divide the data in a cycle into eight intervals, and obtaining corresponding constructor values according to different inputs to improve linearity; (2) data induction: according to the piecewise function values and displacement values displayed in the eight intervals, data with the same characteristics are summarized together to construct a corresponding data set; using the data set to train the dual-channel moiré fringe intelligent segmentation model to obtain a trained dual-channel moiré fringe intelligent segmentation model; The dual-channel moiré fringe intelligent subdivision model is deployed in FPGA.
2. The grating moiré fringe intelligent subdivision method according to claim 1, characterized in that: The method uses [P, S] as the input and output of the training sample, where P is a piecewise function, and the formula is as follows: Wherein, θ is the angle between the fixed-scale grating and the moving-scale grating, and its value range is [0,90°), A is the intensity or contrast of the grating fringes, and A≥0; S represents the corresponding displacement value, and the formula is as follows: Where ω is the grating pitch of the grating sensor, θ is the angle between the fixed-scale grating and the moving-scale grating, and the value range is [0,90°).
3. The grating moiré fringe intelligent subdivision method according to claim 1, characterized in that: The method of establishing a dual-channel moiré fringe intelligent segmentation model based on LSTM-TAM, training the dual-channel moiré fringe intelligent segmentation model using the data set, and obtaining a trained dual-channel moiré fringe intelligent segmentation model specifically includes: (1) Capturing special relationships: In the algorithm modeling stage, the special relationships between input and output data in different intervals are captured through the dual-channel moiré fringe intelligent segmentation model; (2) Parameter adjustment: After training and parameter adjustment on the host computer, the parameters with the best training effect are obtained and verified on the host computer; (3) Parameter preservation: Train the intelligent segmentation model in the host computer and save its weights and thresholds.
4. The grating moiré fringe intelligent subdivision method according to claim 1, characterized in that: Deploy the dual-channel moiré fringe intelligent subdivision model in the FPGA through the Verilog hardware description language; The content structure of the FPGA accelerator includes a control unit, a storage unit and a subdivision model acceleration unit; the control unit is responsible for coordinating and managing internal operations, the storage unit is used for data and instruction storage, and the subdivision model acceleration unit is used to accelerate specific computing tasks; The control unit is used to manage the operation process of the entire hardware acceleration system, manage the input and output data flow, control the reading and writing of weight data, and control the calculation process; The storage unit includes multiple ram_unit modules and multiple altera_ram modules; the altera_ram module is used for storing and reading data, and each module is configured with 16 width and 1024 depth; the ram_unit module combines multiple altera_ram modules, and the multiple ram_unit modules and the multiple altera_ram modules work in a parallel connection manner; The subdivision model acceleration unit includes a matrix-vector multiplication module and an Element-wise module; The matrix-vector multiplication module operates on the input data and weights through parallel computing, and the output results are used for subsequent processing; the element-wise module performs multiplication and addition operations on vector elements and applies activation functions; each module is connected through input and output data streams and control signals to jointly complete the calculation tasks of the intelligent segmentation model.
5. The grating moiré fringe intelligent subdivision method according to claim 1, characterized in that: The FPGA uses a fixed-point quantization method to represent floating-point data with a low bit width; The FPGA uses a truncation operation to limit the data bit width.
6. The grating moiré fringe intelligent subdivision method according to claim 4, characterized in that: The grating moiré fringe intelligent subdivision method uses a matrix-vector multiplication module and an Element-wise module in a subdivision model acceleration unit in an FPGA to perform parallel calculations and activation function operations; The control unit manages data flow and computing status to ensure efficient completion of computing tasks; The method finally obtains the predicted displacement value after calculation, and realizes the intelligent subdivision of the one-dimensional data of the grating moiré fringes.
Citation Information
Patent Citations
Extraction method, system and device for moire fringe wrapped phase distribution based on unsupervised learning and storage medium
CN115310543A
Display quality detection system and method for display
CN116499712A