Cgh fringe encoding method, device and medium based on generative neural network

CN122965542APending Publication Date: 2026-10-23LEADING OPTICS (JIANGSU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611461090.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-20
Publication Date
2026-10-23

AI Technical Summary

Benefits of technology

[0014]本发明的基于生成式神经网络的CGH条纹编码方法,通过构建包含位置编码与自适应尺度变换的生成式神经网络,将编码问题重构为端到端的正向函数逼近问题,无需传统的密集采样与压缩取舍过程,且基于GPU批量并行推理机制,将编码时间从传统方法的数小时缩短至数分钟;通过引入相位一致性损失等多任务损失函数,网络能够在训练阶段直接对预测坐标施加物理相位约束,并在推理阶段快速定位局部相位误差,针对超差区域可实现局部迭代或损失惩罚的自适应补偿,解决了传统方法验证滞后且难以精准补偿的痛点;通过极坐标中心回拉与MaskIndex掩码机制的有效配合,本发明能够自动处理偏心等复杂相位函数的有效映射区域,大幅提升通用性;同时,网络参数存储方式使得编码文件体积压缩率较高,显著降低了刻蚀设备的算力需求和存储压力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122965542A_ABST
    Figure CN122965542A_ABST
Patent Text Reader

Abstract

The application provides a CGH fringe encoding method and device based on a generative neural network and a medium, relates to the technical field of CGH fringe encoding, and comprises the following steps: obtaining a phase function of a computer-generated hologram (CGH) plane; constructing a training sample set from phase values and spatial coordinates to physical coordinates; constructing a generative neural network comprising a position encoding module, a fully connected hidden layer and an adaptive scaling transformation layer; in a training stage, a multi-task loss function is formed by using a coordinate regression loss, a phase consistency loss and a monotonicity regularization loss; all sampling points of to-be-encoded contour lines are organized into a batch tensor, input into the trained network, and all contour line coordinate sequences are inferred; the inferred coordinates are substituted back into the original phase function to calculate a phase error, if the error exceeds a tolerance, adaptive compensation is performed through local iteration or loss penalty, and coordinate data in the format of an etching device is output; and the application significantly reduces the computing power requirement and storage pressure of the etching device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of CGH stripe coding technology, and in particular to a CGH stripe coding method, device and medium based on generative neural networks. Background Technology

[0002] In the field of high-precision interferometric testing of aspherical optical components, fringe coding of computational holograms (CGH) is a crucial step in component fabrication and testing. Existing CGH fringe coding techniques generally employ a reverse modeling approach, involving dense sampling followed by compression and selection, and extracting contour lines using methods such as nonmaximum suppression, circular arc fitting, or variable step-size search. However, these traditional methods suffer from lengthy computational processes, high computational load, and difficulty in parallelization (often requiring several hours to over ten hours), resulting in massive encoded file sizes (often several GB) and a heavy burden on etching equipment memory. Furthermore, it is difficult to balance accuracy and compression ratio; after encoding, error evaluation relies on inverse fitting, making the verification process cumbersome and lacking an active error compensation mechanism. The methods also perform poorly in handling complex phase functions such as eccentricity, limiting their versatility. Summary of the Invention

[0003] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:

[0004] According to a first aspect of this application, a CGH stripe coding method based on a generative neural network is provided, comprising the following steps:

[0005] S100, obtain the phase function for calculating the CGH plane of the hologram;

[0006] S200: Select coordinate representation based on the symmetry of the phase function. If it is an eccentric phase function, pull the polar coordinate center back to the origin and set the MaskIndex mask matrix to mark the effective mapping area. Within the effective area, construct a training sample set from phase value and spatial coordinates to physical coordinates through linear inverse interpolation.

[0007] S300 constructs a generative neural network that includes a position encoding module, a fully connected hidden layer, and an adaptive scaling layer. The position encoding module maps low-dimensional spatial coordinates to high-frequency features, and the adaptive scaling layer maps the fixed-range output of the network to the actual physical coordinate range and performs supervised training on the network.

[0008] S400, during the training phase, uses coordinate regression loss, phase consistency loss and monotonic regularization loss to form a multi-task loss function; the phase consistency loss substitutes the predicted coordinates back into the original phase function to calculate the phase constraint deviation, and the monotonic regularization loss constrains the continuity of the geometric shape of adjacent predicted points.

[0009] S500 organizes the sampling points of all contour lines to be encoded into batch tensors, inputs them into the trained network, and infers the coordinate sequence of all contour lines.

[0010] S600 substitutes the inference coordinates back into the original phase function to calculate the phase error. If the error exceeds the tolerance, adaptive compensation is performed through local iteration or loss penalty, and coordinate data in the format of the etching device is output.

[0011] According to another aspect of this application, a non-transitory computer-readable storage medium is also provided, wherein at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or at least one program is loaded and executed by a processor to implement the above-described CGH stripe coding method based on a generative neural network.

[0012] According to another aspect of this application, an electronic device is also provided, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0013] The present invention has at least the following beneficial effects:

[0014] The CGH stripe coding method based on generative neural networks of this invention reconstructs the coding problem into an end-to-end forward function approximation problem by constructing a generative neural network that includes positional encoding and adaptive scaling transformation. This eliminates the need for traditional dense sampling and compression trade-offs, and, based on GPU batch parallel inference mechanisms, reduces the coding time from hours to minutes compared to traditional methods. By introducing multi-task loss functions such as phase consistency loss, the network can directly apply physical phase constraints to the predicted coordinates during the training phase and quickly locate local phase errors during the inference phase. For out-of-tolerance regions, it can achieve adaptive compensation through local iteration or loss penalty, solving the pain points of traditional methods such as lag in verification and difficulty in accurate compensation. Through the effective combination of polar coordinate center pullback and MaskIndex masking mechanism, this invention can automatically handle the effective mapping region of complex phase functions such as eccentricity, greatly improving versatility. At the same time, the network parameter storage method results in a high compression ratio of the encoded file size, significantly reducing the computing power requirements and storage pressure of etching equipment. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 A flowchart of the CGH stripe coding method based on a generative neural network provided in an embodiment of the present invention;

[0017] Figure 2 A schematic diagram of phase function coordinate mapping provided in an embodiment of the present invention;

[0018] Figure 3 This is a schematic diagram of a generative neural network architecture provided in an embodiment of the present invention;

[0019] Figure 4 A comparison diagram of the conventional method and the forward modeling process of the present invention provided in the embodiments of the present invention;

[0020] Figure 5 The overall distribution map of CGH stripes predicted by the generative network is provided in the embodiment of the present invention. Detailed Implementation

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] It should be noted that, based on this disclosure, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the device and / or practice the method. Furthermore, this device and / or practice the method can be implemented using other structures and / or functionalities besides one or more of the aspects set forth herein.

[0023] The following will refer to Figure 1 The flowchart shown is a CGH stripe coding method based on a generative neural network, which introduces a CGH stripe coding method based on a generative neural network.

[0024] The CGH stripe coding method based on generative neural networks may include the following steps:

[0025] S100, obtain the phase function of the CGH plane of the hologram.

[0026] This step is the preliminary physical input for the coding process. In practice, a detection model can be built in optical design software such as Zemax based on the surface parameters of the aspherical optical element under test and the detection optical path structure, and the working wavelength can be set (e.g., the typical He-Ne laser wavelength λ=632.8nm). Through ray tracing calculations, the ideal phase distribution data on the CGH design plane is derived. In actual engineering, this data is typically output as a two-dimensional grid phase matrix, such as an 8192×8192 pixel matrix, where each pixel position corresponds to spatial coordinates on the design plane, and the value at that point represents the required phase modulation amount. .

[0027] This step directly obtains the phase function using optical software, ensuring the accuracy of the physical input data and providing a reliable theoretical basis for the subsequent mapping and training of the neural network. Furthermore, the processing flow is standardized, facilitating fully automated design.

[0028] S200: Select coordinate representation based on the symmetry of the phase function. If it is an eccentric phase function, pull the polar coordinate center back to the origin and set the MaskIndex mask matrix to mark the effective mapping region. Within the effective region, construct a training sample set from phase value and spatial coordinates to physical coordinates through linear inverse interpolation.

[0029] Furthermore, step S200 includes the following steps:

[0030] S210, determine the symmetry of the phase function. If it has rotational symmetry, use polar coordinate transformation; if it is a non-rotationally symmetric eccentric phase function, pull the polar coordinate center back to the origin.

[0031] The core of this step is to determine the coordinate system describing the phase function and eliminate the ambiguity in the mapping caused by the eccentric structure. Specifically, the system parses the phase matrix obtained by S100. The system determines the geometric characteristics of the phase function. By calculating the coordinates of the global minimum of the phase function, it judges whether the minimum deviates from the geometric center. If the minimum is located at the geometric center or exhibits rotational symmetry, it is determined to be rotationally symmetric, requiring no additional processing; a polar coordinate transformation with the geometric center as the origin is directly applied. If the coordinates of the phase minimum are significantly offset, the system determines that the phase function is a non-rotationally symmetric eccentric phase function. In this case, coordinate system remapping is required: the global minimum point of the eccentric phase is directly used as the new polar coordinate origin, and the polar coordinate center of the entire phase function is pulled back to this origin, thereby transforming the eccentric distribution into a polar coordinate distribution relative to this new origin, eliminating the potential ambiguity of "one polar angle corresponding to multiple radial positions" for subsequent mapping calculations.

[0032] This step introduces an adaptive pull-back mechanism for the polar coordinate origin by judging the geometric characteristics of the phase function distribution. This enables the method to establish a clear and unambiguous one-to-one correspondence when dealing with eccentric aspherical surfaces that contain installation errors or special design requirements, avoiding the encoding failure caused by coordinate mapping confusion in traditional algorithms under eccentric structures.

[0033] S220: By analyzing the value range and monotonicity of the phase function at different spatial locations, a MaskIndex matrix is ​​generated. MaskIndex is a two-dimensional Boolean mask, with rows corresponding to different contour line phase values ​​and columns corresponding to different spatial coordinates. If the effective range of the phase function at the current spatial coordinate contains the current phase value, it is marked as the first label True; otherwise, it is marked as the second label False.

[0034] This step aims to define the effective computational space at the physical level, i.e., to generate the MaskIndex matrix. Specifically, during the data preprocessing stage, the system first identifies all contour phase values ​​that need to be encoded. The set, and the set of sampling space coordinates (e.g., polar angle). (360 points are uniformly sampled within the range [0, 2π]. Subsequently, the system initializes a two-dimensional Boolean matrix, where each row corresponds to the phase value of a specific contour line. Each column corresponds to a specific spatial coordinate (such as angle). ).

[0035] The system iterates through all row and column combinations of the matrix. For each (phase value, spatial coordinate) pair, it automatically scans the corresponding physical ray direction based on the current phase's value range and monotonicity. If the effective range of the phase function along the ray direction covers the current phase value... If the corresponding mask value is higher or lower than the first mark "True", then the mask is marked as "True". If the phase value is not included, the corresponding mask is marked as the second label "False," and subsequent calculations will completely skip this False region. (See attached reference.) Figure 2 The revealed nonlinear phase distribution allows the mask matrix to accurately mark effective sampling points in regions where the phase gradient changes drastically.

[0036] The introduction of the MaskIndex matrix allows the neural network to infer only from physically existing stripes. It filters out invalid data caused by phase edge truncation or eccentricity, preventing the neural network's gradient from diverging in invalid regions and significantly reducing redundant computation, thereby improving the stability of network training and the efficiency of inference from the source.

[0037] S230 uses linear inverse interpolation only for valid regions marked as True to extract phase values ​​and corresponding spatial coordinates, generating a training sample set for supervised learning of neural networks.

[0038] This step transforms the defined effective region into high-precision neural network training labels. In implementation, the system only assigns phase values ​​for each contour line within the effective mapping region where MaskIndex is marked "True". and specific spatial coordinates (such as angles) ), traversing the discrete phase grid data along the corresponding ray direction.

[0039] To improve label accuracy, this step abandons the coarse approach of directly selecting the nearest neighbor grid point and instead employs linear inverse interpolation. Specifically, it searches for two adjacent discrete grid nodes along the ray direction, whose corresponding spatial coordinates are... and The corresponding phase values ​​are respectively and And satisfy and Subsequently, the linear proportion formula was used. Accurately solve the target phase Corresponding actual physical radial distance Ultimately, the system will obtain a high-precision radial distance. As the network output label, the corresponding phase value and spatial coordinates (angles) These features are used as network input features to construct a batch of training sample sets for supervised learning of neural networks.

[0040] The linear inverse interpolation method used in this step overcomes the precision limitations of discrete grids, enabling the label data trained on the neural network to achieve extremely high precision at the sub-pixel level. This high-fidelity label construction process ensures that the subsequent neural network can fit nonlinear phase curves (as shown in the attached figure). Figure 2 The system possesses a precise supervisory signal during bending (as shown), thus ensuring that the encoding result strictly meets the requirements. Optical contour line constraints.

[0041] Furthermore, in step S200, a training sample set is constructed within the effective region using linear inverse interpolation, transforming phase values ​​and spatial coordinates into physical coordinates. This includes:

[0042] Traverse the discrete grid of the phase function along a fixed ray direction, finding two adjacent discrete nodes such that the phase values ​​of these two adjacent discrete nodes are less than and greater than the target phase value, respectively. Let the spatial coordinates of the two grid nodes be respectively and The phase values ​​are respectively and Precise spatial coordinates of the target phase point Solve using the following formula:

[0043] ;

[0044] in, The integer represents the order of the contour lines; the solution obtained is... This refers to the actual physical coordinate label value corresponding to the current direction on the contour line.

[0045] In this embodiment, when generating the training sample set for supervised learning of the neural network, the phase function derived by optical software such as Zemax is used... It is a discrete two-dimensional grid matrix, while the training labels required for high-precision encoding must be continuous, sub-pixel-level physical coordinates. Therefore, this step uses linear inverse interpolation for precise localization; the specific implementation is as follows:

[0046] First, within the valid area marked "True" in the MaskIndex matrix, a fixed ray direction is defined (corresponding to a fixed x-coordinate in Cartesian coordinates). In polar coordinates, the corresponding fixed polar angle The system traverses the phase matrix pixel by pixel along this ray, reading the spatial coordinates and phase values ​​corresponding to the discrete grid points through which the ray passes.

[0047] Phase value of the target contour line ( (where is an integer representing the stripe number). In the traversal path described above, search for two adjacent discrete grid nodes, requiring that the phase values ​​of these two nodes fall on either side of the target phase value; that is, the phase value of one node is less than 1. The phase value of the adjacent node is greater than Because the phase function exhibits the following characteristics: Figure 2 The nonlinear bending characteristics shown often occur in edge regions where phase gradient changes drastically in practical engineering.

[0048] Once adjacent discrete grid nodes that meet the conditions are found, let the spatial coordinates of the two nodes be respectively... and The corresponding phase values ​​are respectively and This step uses a linear proportional conversion, employing the formula:

[0049] ;

[0050] Accurately solve for the actual physical coordinates corresponding to the target phase point The physical meaning of this formula is: distance from the target point. The distance, and the overall grid spacing The proportion is exactly equal to the target phase difference. Throughout the entire phase difference range The proportion of.

[0051] Finally, the system will obtain the precise physical coordinates. As the output label of the network, the corresponding phase value and current spatial coordinates (such as x-coordinate) or angle These features are used as input features to the network, combined into standardized training sample pairs, and stored in the training dataset.

[0052] For example, consider a contour line along the edge of an actual 63mm diameter CGH. Assume the target phase is along a certain ray direction. for At two adjacent discrete grid points, the measured phase value is... (corresponding radial distance) )and (corresponding radial distance) Using the linear interpolation formula described above, the system can accurately calculate the target point's position. Instead of making a crude choice, [we should] choose [the appropriate location]. or This effectively avoids the fixed errors inherent in discrete grids.

[0053] like Figure 2 The curve in the lower middle section shows that the true phase varies with spatial coordinates. The changes are not a uniform linear relationship, but exhibit significant curvature and non-uniform gradients. This non-linear characteristic means that simply using coarse sampling or taking the nearest grid point will result in significant encoding errors. The linear inverse interpolation method described in this embodiment provides a more accurate and consistent encoding result for subsequent neural networks. Figure 2 High-precision monitoring signals for curved curve fitting.

[0054] The linear inverse interpolation mechanism used in this step successfully transforms the originally discrete phase matrix, limited by grid resolution, into a continuous mapping label with sub-pixel precision. This effectively solves the systematic bias introduced by traditional encoding methods due to grid discretization sampling, ensuring that the supervision signals received by the neural network during the training phase strictly represent the real physical boundary conditions. This high-fidelity label data, combined with the subsequent phase consistency loss function, fundamentally guarantees that the encoding result can perfectly satisfy… The optical contour line constraints provide a solid data foundation for generating CGH etching files with extremely high phase accuracy.

[0055] S300 constructs a generative neural network that includes a position encoding module, a fully connected hidden layer, and an adaptive scaling layer. The position encoding module maps low-dimensional spatial coordinates to high-frequency features, and the adaptive scaling layer maps the fixed interval output of the network to the actual physical coordinate range and performs supervised training on the network.

[0056] Furthermore, the position encoding module in step S300 adopts a sixth-order sine-cosine position encoding, with the mapping formula as follows:

[0057] ;

[0058] in, Low-dimensional spatial coordinates are input to the network; This is the high-dimensional feature vector output after position encoding; to For different orders of frequencies, it is used to map single-dimensional spatial coordinates to a 12-dimensional high-frequency feature space, and together with the phase value, it forms the data vector at the network input.

[0059] Furthermore, the transformation formula for the adaptive scaling layer in step S300 is as follows:

[0060] ;

[0061] in, These are the normalized coordinate values ​​generated after the fully connected output layer of the network is processed by the activation function. These are the actual physical coordinate values ​​obtained after adaptive scaling transformation; Scaling factor This is for translation and offset.

[0062] In this embodiment, this step aims to build a generative neural network that combines high-frequency feature extraction capability with physical scale adaptation capability, and train it to convergence.

[0063] like Figure 3 The network architecture shown receives a two-dimensional feature vector at its input: one is the phase value of the target to be encoded, and the other is the spatial coordinates (polar angle in polar coordinates). Since the phase distribution of aspherical surfaces often contains a large number of high-frequency oscillation details, directly inputting low-dimensional spatial coordinates will cause the network to have a "spectral bias" and be unable to fit the high-frequency texture at steep edges. Therefore, it is necessary to first pass through a position encoding module.

[0064] This module employs a sixth-order sine-cosine encoding technique to encode single-dimensional spatial coordinates. (or polar angle) Through the mapping formula:

[0065] ;

[0066] It is expanded into a 12-dimensional high-frequency feature vector, which is then concatenated with the phase value to form the final network input.

[0067] The input signal then enters a fully connected hidden layer. According to a preferred configuration in this embodiment, there are a total of 8 hidden layers, each containing 256 neurons, with ReLU activation functions used for non-linear transformations between layers. This type of layer with residual connections (such as...) Figure 3 The deep structure of the network (shown by the upper cross line) and wide hidden layers ensures that the network has a strong ability to approximate nonlinear functions.

[0068] The input signal then enters a fully connected hidden layer. According to a preferred configuration in this embodiment, there are a total of 8 hidden layers, each containing 256 neurons, with ReLU activation functions used for non-linear transformations between layers. This type of layer with residual connections (such as...) Figure 3 The deep structure of the network (shown by the upper cross line) and wide hidden layers ensures that the network has a strong ability to approximate nonlinear functions.

[0069] At the end of the network, since conventional activation functions limit the output values ​​to a fixed range (e.g., [-1, 1]), an adaptive scaling layer is needed to restore the normalized values ​​calculated by the network to the actual physical coordinate system. The scaling formula is as follows: ,in This is the normalized network output. and The scaling factor and translation offset are both automatically updated and optimized by the network during training, without the need for manual setting of the upper and lower limits of the physical coordinates.

[0070] Furthermore, the specific hyperparameters for network training in step S300 are set as follows:

[0071] The generative neural network has 4 to 8 hidden layers, each containing 256 neurons, and uses ReLU or Sigmoid as the activation function; the Adam optimization algorithm is used during the training phase, with the initial learning rate set to [value missing]. The batch size during training was set to 4096, and the total number of training rounds was 500. During training, the training set and the validation set were divided in an 8:2 ratio, and the model parameters with the lowest loss in the validation set were saved.

[0072] After the network is built, the high-precision training sample set constructed in step S200 is randomly divided into a training set and a validation set in an 8:2 ratio. The Adam optimization algorithm is used for error backpropagation, with the initial learning rate set to... The batch size was set to 4096 to fully utilize the parallel computing power of the graphics processing unit (GPU), and the total number of training epochs was set to 500. After each training epoch, the loss value on the validation set was calculated, and the network weight model file with the lowest validation set loss was saved.

[0073] like Figure 3 The diagram illustrating the generative neural network architecture visually demonstrates the complete forward propagation path from the input (phase, polar coordinate angle), through 8 layers of 256-dimensional hidden layers, to the final output normalized value, which is then converted into a polar coordinate radius. The diagram clearly defines the core structure of the network and indicates the location encoding module and the adaptive scaling processing position.

[0074] The position encoding module introduced in this step fundamentally solves the underfitting problem that traditional neural networks are prone to when processing high-frequency complex phases of CGH, enabling the network to accurately capture the steep details of optical edges. The use of the adaptive scale transformation layer means that the neural network does not need to repeatedly modify the design of the output layer for CGHs with different apertures and processing sizes, and has good cross-size generalization ability, thus improving R&D efficiency.

[0075] S400, during the training phase, uses coordinate regression loss, phase consistency loss and monotonic regularization loss to form a multi-task loss function; the phase consistency loss substitutes the predicted coordinates back into the original phase function to calculate the phase constraint deviation, and the monotonic regularization loss constrains the continuity of the geometric shape of adjacent predicted points.

[0076] Furthermore, the total loss of the multi-task joint loss function in step S400 The calculation formula is:

[0077] ;

[0078] in, , , These are the weighting coefficients for each sub-loss term; The coordinate regression loss is calculated using a smoothed L1 loss function to measure the absolute deviation between the network-predicted coordinates and the training label coordinates. The phase consistency loss is used to constrain the predicted coordinates to strictly satisfy the contour line phase condition after substituting them back into the original phase function. The monotonicity regularization loss is used to calculate the vector angle and Euclidean distance between adjacent prediction points to prevent contour lines from exhibiting self-intersections or discontinuous non-physical shapes.

[0079] Step S400 guides the neural network from pure numerical fitting to physical constraints. Its implementation mainly consists of three levels: the construction of the multi-task loss function, the physical meaning and specific calculation method of each loss term, and the setting of the weight ratio of the sub-loss terms.

[0080] After each forward propagation of the network, the system needs to calculate the total loss based on the network's prediction results and then backpropagate to update the network weights. To simultaneously consider numerical accuracy, physical laws, and geometric shape, the following multi-task joint loss function is constructed. .

[0081] In this embodiment, the three weighting coefficients can be set as follows: , , In practical engineering, the CGH phase function can be fine-tuned according to its complexity. For example, for phases with high-frequency, drastic fluctuations, the adjustment can be appropriately increased. To ensure the strength of physical constraints.

[0082] This is a data-driven loss function that ensures the network has basic predictive capabilities. In practice, a smooth L1 loss function is used instead of the traditional mean squared error (MSE) function. The characteristics of the smooth L1 loss are: when the absolute deviation between the predicted value and the label value is small (e.g., less than 1), the penalty term takes the form of a quadratic function, which helps to accelerate convergence and ensure gradient smoothness; when the deviation is large, it takes the form of a linear function, reducing the drastic fluctuations in the gradient caused by large errors. This loss term directly measures the physical coordinates of the network output. With the high-precision real coordinate labels constructed in step S230 The absolute deviation between them ensures that the macroscopic position of the network output is within the correct range.

[0083] This embodiment uses a physically supervised loss that differs from traditional regression training methods. The system substitutes the coordinates generated by the network prediction in step S300 back into the original CGH phase function to calculate the actual phase value at the predicted coordinate point. Then, it subtracts this actual phase value from the target theoretical phase value and takes the absolute value to obtain the phase deviation.

[0084] This loss term requires the neural network not only to fit the absolute value of the coordinates, but also to ensure that the coordinate point is physically in phase. The contour points. Engineering experiments revealed that using only... At this time, the network is prone to exhibiting situations in regions with steep phase, where "the numerical coordinates are correct, but the phase at that point is not equal to the actual phase." The phenomenon of "pseudo-compliance" and joining This can effectively eliminate such spurious solutions.

[0085] This refers to the geometric continuity loss that ensures the smoothness of CGH stripes and improves processing yield. When generating discrete coordinate point sequences through fully connected network inference, without geometric constraints, non-physical noise patterns such as curve reversals, self-intersections, or jagged jumps are easily generated. In practical engineering, the system calculates the vector angle and Euclidean distance between adjacent predicted coordinate points on the same contour line in the output of each batch of samples. If the spatial distance between adjacent points changes abruptly, or the angle is less than a set threshold (indicating a sharp reversal), the network is forced to learn smooth physical contour line geometric features by increasing the penalty for that local area.

[0086] The loss function architecture of this step and Figure 4 The "forward modeling of neural networks" process shown in the article is consistent. Figure 4 The flow chart on the right indicates that after calculating the fringe coordinates, the system needs to "fit a phase function" and determine if the "difference between the fitted phase and the target phase is less than a threshold." This step... It is precisely through backpropagation during the training phase that this logical loop is achieved in advance, enabling the network to directly generate functions that satisfy the requirements during inference. Figure 5 The CGH fringe point cloud shown is clear, smooth, and physically accurate.

[0087] This step addresses the problem of traditional neural networks easily deviating from optical physical laws and generating processing defects in CGH encoding by constructing a three-dimensional joint constraint system of coordinate regression loss, phase consistency loss, and monotonicity regularization loss. Specifically, coordinate regression loss ensures macroscopic accuracy of the prediction; phase consistency loss strictly pulls the prediction results back to optical contour line constraints, eliminating physically spurious solutions; and monotonicity regularization loss preemptively eliminates geometric distortions intolerable during the etching process. The mutual constraints and cooperation of these three losses enable the generative network in this embodiment to complete the closed loop of data fitting and physical verification during the training phase, enhancing the robustness of the encoding algorithm in unknown or extreme phase regions and its adaptability to actual processing.

[0088] S500 organizes the sampling points of all contour lines to be encoded into batch tensors, inputs them into the trained network, and infers the coordinate sequences of all contour lines.

[0089] Step S500 involves putting the converged neural network model into actual production inference. Unlike the traditional serial line-by-line computation method, the inference process in this embodiment has been specially designed in terms of data processing mode and computing power scheduling, as follows:

[0090] In practice, the target CGH often contains hundreds to thousands of contour lines to be encoded. Prior to this step, the system has pre-determined the set of all contour lines to be encoded in the current CGH and specified the sampling density of each contour line in its spatial coordinates (e.g., in polar coordinates). from arrive (360 points are uniformly sampled within the range). To fully leverage the parallel computing advantages of the graphics processing unit (GPU), this step abandons the inefficient approach of sequential input line by line. Instead, the input features (i.e., the "target phase value" and the corresponding "spatial coordinates") of all sampled points on all contour lines are stacked sequentially and combined into a huge two-dimensional batch tensor.

[0091] For example: if the CGH contains 101 contour lines, with 360 sampling points per line, then the system's batch tensor contains a total of Each sample contains two input features (phase value and angle), and the shape of the batch tensor is [36360,2].

[0092] The organized batch tensors are loaded into the generative neural network in the inference state all at once. Since all the network parameters (including weights, biases, positional encoding parameters, and adaptive scaling parameters) have been fixed into model files and loaded into GPU memory after training in step S400, when this huge batch tensor completes forward propagation all at once, the thousands of computing cores of the GPU can concurrently perform massive matrix multiplications and activation operations, while simultaneously calculating the normalized output values ​​of all sampling points.

[0093] The network's forward output is merely a normalized coordinate sequence vector of length 36360. The system then calls the parameters of the adaptive scaling layer constructed and trained in step S300, using the formula... , and normalize each output Converted into actual, concrete physical coordinate values After the conversion is complete, the system will reverse index and reshape this one-dimensional plane coordinate sequence according to the original organization rules (i.e., according to the continuous length of "360 points fixed for each contour line"), restoring it to several independent coordinate streams belonging to different contour lines, thereby realizing the spatial mapping from phase input to the actual CGH physical coordinate point cloud.

[0094] The final data result generated after this step is performed is as follows: Figure 5 As shown. Figure 5This study demonstrates that after the network completes batch parallel inference and undergoes physical coordinate mapping, it presents a dense concentric ring-shaped CGH fringe prediction point cloud in Cartesian coordinates. The fringe distribution is uniform and continuous, verifying the efficiency and accuracy of the batch tensor organization and parallel inference strategy in this step. Meanwhile, Figure 4 The flowchart on the right also clearly defines the reasoning and output logic from "calculating fringe coordinates" to "fitting the phase function" and finally "outputting the fringe".

[0095] The batch tensor organization and GPU parallel inference strategy in this step replaces the serial working mode of iteratively calculating contour lines one by one in the traditional method, thus improving efficiency.

[0096] S600 substitutes the inference coordinates back into the original phase function to calculate the phase error. If the error exceeds the tolerance, adaptive compensation is performed through local iteration or loss penalty, and coordinate data in the format of the etching device is output.

[0097] Furthermore, the error assessment and compensation in step S600 includes:

[0098] S610, substitute the coordinate values ​​of all sampling points on each contour line obtained by reasoning back into the original phase function to obtain the phase deviation value of each sampling point.

[0099] After S500 completes batch inference and obtains the physical coordinate sequence of all contour lines, the system enters the positive error evaluation stage. Specifically, the system substitutes each coordinate point output by the network back into the original discrete phase matrix from step S100. Since the phase matrix is ​​a discrete grid, sub-pixel-level positioning of the coordinate point is required. This is achieved using bilinear interpolation (or a linear interpolation method similar to S230) to accurately extract the actual phase value corresponding to that coordinate point. Then, the actual phase value and the theoretical target phase value are calculated. The absolute deviation, i.e. To comprehensively evaluate encoding quality, the system will calculate the root mean square error (RMS) and peak-to-valley (PV) values ​​of all sampled error data.

[0100] S620: If the root mean square error or peak-to-valley value of the phase deviation exceeds the preset tolerance, the local area where the phase error exceeds the tolerance is marked.

[0101] In this step, the system has a built-in error tolerance threshold determined empirically (e.g., the maximum permissible phase error). (i.e., one-thousandth of a wavelength). The system compares the global RMS and PV calculated by S610 with this threshold. If the RMS or PV exceeds the threshold, the system triggers the area localization algorithm. Specifically, it iterates through the phase deviation values ​​of all sampling points. All The coordinates of sampling points exceeding the threshold are extracted and numbered according to the contour stripe to which they belong ( Value) and spatial location (such as angle) (range), aggregate these discrete out-of-range points into continuous "local regions", and establish an index mapping table between the local regions and the original inference coordinates.

[0102] S630, for the local region, adaptive compensation is achieved by either of the following methods: by adding a local iterative optimization step; or by fine-tuning the training by re-incorporating the error penalty information of the local region into the loss function in step S400.

[0103] After identifying the localized areas where the error exceeds the tolerance, the system employs closed-loop feedback for repair. This embodiment provides two independent compensation methods:

[0104] Method 1: Local Iterative Optimization. Without modifying the network parameters, this method isolates the coordinates of the local out-of-tolerance regions marked by S620. Gradient descent or coordinate fine-tuning algorithms are then applied within a small local area (e.g., a micrometer-scale area around the coordinate point) to force the local coordinate point to again satisfy the condition of near-zero phase difference.

[0105] Method 2: Fine-tuning the loss penalty. The error penalty term generated in the local region marked in S620 is added as a new additional term to the total loss function in S400. The network is then subjected to weighted calculations (e.g., multiplying the error weights for the local region by a large penalty coefficient), and then the optimal weights trained by S300 are loaded. The network is then fine-tuned for a very small number of epochs (e.g., 10-20 epochs) to force the network to refocus on resolving the local anomalous bias.

[0106] S640 generates an etching file from the compensated contour coordinates in GDSII or CIF format.

[0107] Once the overall phase error (RMS and PV) is confirmed to fall within the preset tolerance range after compensation, the system organizes the final corrected continuous coordinate point sequence into polygonal polyline data. To match the graphics input interface of the laser direct-write etching equipment, the system converts the physical coordinate data into a graphics data exchange format that conforms to standard industry specifications, such as GDSII or CIF format. After conversion, the data file with the .gds or .cif extension can be directly delivered to the etching equipment for subsequent micro-nano processing.

[0108] This step performs a forward evaluation by substituting the inference coordinates back into the original phase function, abandoning the cumbersome verification process of encoding followed by inverse fitting in traditional methods, and can instantly locate the source of error. Based on this, two compensation strategies, local iteration or loss penalty fine-tuning, are applied to the marked out-of-tolerance local regions, achieving precise repair of encoding errors and fundamentally solving the technical shortcomings of traditional methods that cannot trace errors and are difficult to perform local corrections.

[0109] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0110] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.

[0111] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0112] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0113] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0114] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0115] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0116] The electronic device is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments in this application.

[0117] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and a bus connecting different system components (including memory and processor).

[0118] The memory stores program code that can be executed by the processor, causing the processor to perform the steps in the various embodiments described in this specification.

[0119] The memory may include readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read-only memory (ROM).

[0120] The memory may also include programs / utilities having a set (at least one) of program modules, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0121] A bus can represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus that uses any of the various bus structures.

[0122] Electronic devices can also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable user interaction with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication can be achieved through input / output (I / O) interfaces. Furthermore, electronic devices can communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via network adapters. The network adapter communicates with other modules of the electronic device via a bus. It should be understood that other hardware and / or software modules can be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0123] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0124] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.

[0125] While specific embodiments of the invention have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and are not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention.

Claims

1. A CGH stripe coding method based on a generative neural network, characterized in that, Includes the following steps: S100, obtain the phase function for calculating the CGH plane of the hologram; S200: Select coordinate representation based on the symmetry of the phase function. If it is an eccentric phase function, pull the polar coordinate center back to the origin and set the MaskIndex mask matrix to mark the effective mapping area. Within the effective area, construct a training sample set from phase value and spatial coordinates to physical coordinates through linear inverse interpolation. S300 constructs a generative neural network that includes a position encoding module, a fully connected hidden layer, and an adaptive scaling layer. The location encoding module maps low-dimensional spatial coordinates to high-frequency features, and the adaptive scaling transformation layer maps the fixed interval output of the network to the actual physical coordinate range and performs supervised training on the network. S400, during the training phase, uses coordinate regression loss, phase consistency loss and monotonic regularization loss to form a multi-task loss function; the phase consistency loss substitutes the predicted coordinates back into the original phase function to calculate the phase constraint deviation, and the monotonic regularization loss constrains the continuity of the geometric shape of adjacent predicted points. S500 organizes the sampling points of all contour lines to be encoded into batch tensors, inputs them into the trained network, and infers the coordinate sequence of all contour lines. S600 substitutes the inference coordinates back into the original phase function to calculate the phase error. If the error exceeds the tolerance, adaptive compensation is performed through local iteration or loss penalty, and coordinate data in the format of the etching device is output.

2. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, Step S200 includes the following steps: S210, determine the symmetry of the phase function. If it has rotational symmetry, use polar coordinate transformation; if it is a non-rotationally symmetric eccentric phase function, pull the polar coordinate center back to the origin. S220: By analyzing the value range and monotonicity of the phase function at different spatial locations, a MaskIndex matrix is ​​generated. The MaskIndex is a two-dimensional Boolean mask, with rows corresponding to different contour line phase values ​​and columns corresponding to different spatial coordinates. If the effective range of the phase function at the current spatial coordinate contains the current phase value, it is marked as the first label True; otherwise, it is marked as the second label False. S230 uses linear inverse interpolation only for valid regions marked as True to extract phase values ​​and corresponding spatial coordinates, generating a training sample set for supervised learning of neural networks.

3. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, The position encoding module in step S300 uses sixth-order sine-cosine position encoding, and the mapping formula is: ; in, Low-dimensional spatial coordinates are input to the network; This is the high-dimensional feature vector output after position encoding; to For different orders of frequencies, it is used to map single-dimensional spatial coordinates to a 12-dimensional high-frequency feature space, and together with the phase value, it forms the data vector at the network input.

4. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, The transformation formula for the adaptive scaling layer in step S300 is: ; in, These are the normalized coordinate values ​​generated after the fully connected output layer of the network is processed by the activation function. These are the actual physical coordinate values ​​obtained after adaptive scaling transformation; Scaling factor This is for translation and offset.

5. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, The total loss of the multi-task joint loss function in step S400 The calculation formula is: ; in, , , These are the weighting coefficients for each sub-loss term; The coordinate regression loss is calculated using a smoothed L1 loss function to measure the absolute deviation between the network-predicted coordinates and the training label coordinates. The phase consistency loss is used to constrain the predicted coordinates to strictly satisfy the contour line phase condition after substituting them back into the original phase function. The monotonicity regularization loss is used to calculate the vector angle and Euclidean distance between adjacent prediction points to prevent contour lines from exhibiting self-intersections or discontinuous non-physical shapes.

6. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, Step S200 involves constructing a training sample set within the effective region using linear inverse interpolation, derived from phase values ​​and spatial coordinates to physical coordinates. This includes: Traverse the discrete grid of the phase function along a fixed ray direction, finding two adjacent discrete nodes such that the phase values ​​of these two adjacent discrete nodes are less than and greater than the target phase value, respectively. Let the spatial coordinates of the two grid nodes be respectively and The phase values ​​are respectively and Precise spatial coordinates of the target phase point Solve using the following formula: ; in, The integer represents the order of the contour lines; the solution obtained is... This refers to the actual physical coordinate label value corresponding to the current direction on the contour line.

7. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, The specific hyperparameters for network training in step S300 are set as follows: The generative neural network has 4 to 8 hidden layers, each containing 256 neurons, and uses ReLU or Sigmoid as the activation function; the Adam optimization algorithm is used during the training phase, with the initial learning rate set to [value missing]. The batch size during training was set to 4096, and the total number of training rounds was 500. During training, the training set and the validation set were divided in an 8:2 ratio, and the model parameters with the lowest loss in the validation set were saved.

8. The CGH stripe coding method based on a generative neural network according to claim 1, characterized in that, Error assessment and compensation in step S600 includes: S610, substitute the coordinate values ​​of all sampling points on each contour line obtained by reasoning back into the original phase function to obtain the phase deviation value of each sampling point; S620, if the root mean square error or peak-to-valley value of the phase deviation exceeds the preset tolerance, the local area where the phase error exceeds the tolerance is marked. S630, for the local region, adaptive compensation is achieved in any of the following ways: by adding a local iterative optimization step; or by fine-tuning the training by re-incorporating the error penalty information of the local region into the loss function in step S400; S640 generates an etching file from the compensated contour coordinates in GDSII or CIF format.

9. A non-transitory computer-readable storage medium, wherein the storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the CGH stripe coding method based on a generative neural network as described in any one of claims 1-8.

10. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 9.