Method and apparatus for designing metasurface spectral encoder based on conditional diffusion model, device and medium

CN123013649APending Publication Date: 2026-10-30TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611132228.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

变分自编码器类方法通常通过潜空间压缩和重构学习结构分布,容易引入信息损失,导致结构边界模糊及局部特征不清晰

Benefits of technology

[0021]根据本公开的各方面,根据本公开实施例的方法,通过训练好的条件扩散模型直接从随机高斯噪声出发生成候选超表面结构图,避免了传统参数扫描和全波仿真反复优化所带来的高计算成本,可显著缩短光谱编码器设计周期,同时条件扩散模型本身具有训练更稳定、生成质量更高等特点,可以避免现有利用生成对抗网络进行超表面结构生成所产的各类问题,尤其是,利用条件扩散模型还能够在不同随机高斯噪声和不同结构尺寸参数的联合控制下,针对同一目标光谱响应生成多个候选超表面结构图,从而更符合超表面逆向设计“一谱多构”的物理特征,相比单一结构回归方法具有更好的表达能力,有利于筛选出与目标光谱响应更匹配的超表面结构,进而再利用训练好的光谱预测模型确定各个候选超表面结构图对应的预测光谱响应以及分别确定预测光谱响应与目标光谱响应之间的误差,再根据误差最小的候选超表面结构图确定超表面结构设计结果,可以提高最终生成的超表面结构与目标光谱响应的匹配精度,得到更满足目标光谱响应且高质量超表面结构。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013649A_ABST
    Figure CN123013649A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a metasurface spectral encoder design method and device based on a conditional diffusion model, equipment and medium. The method comprises: obtaining a target spectral response, a structure size parameter and a plurality of random Gaussian noises; using a trained conditional diffusion model to iteratively denoise each random Gaussian noise according to the target spectral response and each structure size parameter respectively, to obtain a plurality of candidate metasurface structure graphs generated under various structure size parameters and various random Gaussian noises; using a trained spectral prediction model to determine the predicted spectral response corresponding to each candidate metasurface structure graph and to determine the error between the predicted spectral response corresponding to each candidate metasurface structure graph and the target spectral response respectively; and determining the metasurface structure design result of the metasurface spectral encoder according to the error between the predicted spectral response corresponding to each candidate metasurface structure graph and the target spectral response. Thus, the spectral matching precision and generation quality of the metasurface structure can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial optical metasurface technology, and in particular to a design method, apparatus, device and medium for a metasurface spectral encoder based on a conditional diffusion model. Background Technology

[0002] Metasurfaces are optical devices composed of subwavelength-scale artificial microstructures that can flexibly control the amplitude, phase, and polarization of electromagnetic waves, offering broad application prospects in fields such as spectral detection, computational imaging, sensing, display, and communication. For computational spectroscopy systems, the core function of a spectral encoder is to apply differential modulation to incident light of different wavelengths, enabling the output response to carry characteristic information of the measured spectrum, thus providing a foundation for subsequent spectral reconstruction, target identification, or material composition analysis. Metasurface spectral encoders are a type of spectral encoder that utilizes metasurface structures.

[0003] Traditional metasurface structure design typically relies on human experience, parameter scanning, and iterative electromagnetic simulations to search for geometric structures that satisfy the target spectral response. However, with increased design freedom, especially when design variables expand from a few regular geometric parameters to two-dimensional free-form pixel structures, the design space dimension increases dramatically. This makes traditional trial-and-error design and full-wave simulation iteration methods computationally intensive, time-consuming, and inefficient, making them unsuitable for the design requirements of high-degree-of-freedom, broadband, and multi-objective metasurface spectral encoders.

[0004] In recent years, deep learning methods have been introduced into the field of metasurface reverse design. These methods learn the mapping relationship between metasurface structure and spectral response, directly outputting structural parameters or two-dimensional patterns based on a given target spectral response. This significantly reduces the reliance on electromagnetic simulation in single-design iterations and improves reverse design efficiency. In particular, the development of generative models has provided a new technical approach for solving the design problem of complex free-form metasurface structures.

[0005] However, existing deep learning-based metasurface inverse design methods typically employ network architectures such as tandem neural networks, variational autoencoder networks (VAEs), and generative adversarial networks (GANs). These methods input the transmission spectrum to be designed as conditional information into the network and output corresponding structural parameters or two-dimensional patterns. While these methods significantly improve design efficiency compared to traditional parameter scanning or exhaustive simulation, several problems remain to be solved when designing practical spectral encoders.

[0006] First, direct neural network inverse mapping suffers from a one-to-many non-uniqueness problem. Metasurface structures typically exhibit a clear one-to-many mapping characteristic to spectral responses; that is, the same target spectral response often corresponds to multiple feasible structures with different geometries but similar responses. If a network is directly trained to regress a single structure from the target spectrum, it is easily affected by this non-uniqueness, leading to model training instability or outputting a fuzzy average structure. This problem is even more pronounced for two-dimensional pixelated free-form metasurface structures.

[0007] Secondly, existing reverse engineering methods have limited expressive power, resulting in low spectral matching accuracy. For example, cascaded neural networks are suitable for low-dimensional parametric structures, such as those with regular parameters like radius, length, period, and thickness, but not for high-degree-of-freedom binary patterns. Variational autoencoder methods typically learn structural distributions through latent space compression and reconstruction, which easily introduces information loss, leading to blurred structural boundaries and unclear local features. For binary metasurface encoder structures requiring well-defined boundaries and direct fabrication, the output of variational autoencoder networks often requires additional complex post-processing.

[0008] Furthermore, the training of generative adversarial networks (GANs) is unstable and prone to pattern collapse, resulting in low-quality metasurface structure generation. While GANs can be used for structure generation, their reliance on adversarial training mechanisms often leads to problems such as training oscillations, pattern collapse, and sensitivity to network structure and hyperparameters. When the input is a high-dimensional target spectral response and the output is a high-degree-of-freedom binary metasurface structure map, the difficulty of ensuring stable training and spectral consistency of the GAN further increases. Summary of the Invention

[0009] In view of this, this disclosure proposes a metasurface spectral encoder design method, device, and medium based on a conditional diffusion model, which can effectively alleviate the one-to-many non-uniqueness problem in metasurface design, improve spectral matching accuracy, and have high stability and generation quality.

[0010] According to one aspect of this disclosure, a method for designing a metasurface spectral encoder is provided, comprising: acquiring a target spectral response, at least one structural size parameter, and multiple random Gaussian noises; wherein the structural size parameter characterizes the size of the desired metasurface structure; using a trained conditional diffusion model to iteratively denoise each random Gaussian noise based on the target spectral response and each structural size parameter, to obtain multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noises; using a trained spectral prediction model to determine the predicted spectral response corresponding to each candidate metasurface structure map, and determining the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response; and determining the metasurface structure design result of the metasurface spectral encoder based on the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response.

[0011] In some embodiments, the step of using a trained conditional diffusion model to iteratively denoise each type of random Gaussian noise based on the target spectral response and each type of structural size parameter to obtain multiple candidate metasurface structure maps generated under various structural size parameters and various types of random Gaussian noise includes: for the s-th structural size parameter among at least one structural size parameter and the i-th type of random Gaussian noise among multiple types of random Gaussian noise, using a trained conditional diffusion model to perform T-step backsampling starting from the i-th type of random Gaussian noise based on the target spectral response and the s-th structural size parameter to obtain candidate metasurface structure maps generated under the s-th structural size parameter and the i-th type of random Gaussian noise, where T is a positive integer; wherein, the T-step backsampling... Backsampling includes the process from backsampling step T to backsampling step 1. The backsampling process from backsampling step T to backsampling step 1 includes: using a trained conditional diffusion model to predict the noise in the structure diagram at step t based on the target spectral response, the s-th type of structural size parameter, the time step corresponding to backsampling step t, and the structure diagram at step t, where the structure diagram at step T is the ith type of random Gaussian noise; denoising the structure diagram at step t based on the noise in the structure diagram at step t to obtain the structure diagram at step t-1; wherein, the candidate metasurface structure diagram generated under the s-th type of structural size parameter and the ith type of random Gaussian noise includes: the structure diagram at step 0 generated by the backsampling process at step 1.

[0012] In some embodiments, for the R-th backsampling specified in the T-step backsampling, where T > R > 1, the process from the R-th backsampling to the t-th backsampling in the 1st backsampling further includes: after obtaining the (t-1)-th step structure map, using a trained spectral prediction model to generate a predicted spectral response corresponding to the (t-1)-th step structure map; determining a spectral guidance loss based on the error between the predicted spectral response and the target spectral response, and calculating the gradient of the spectral guidance loss relative to the (t-1)-th step structure map; correcting the (t-1)-th step structure map using the gradient of the spectral guidance loss relative to the (t-1)-th step structure map to obtain a corrected (t-1)-th step structure map, and performing the (t-1)-th step backsampling process using the corrected (t-1)-th step structure map; wherein, the candidate metasurface structure map generated under the s-th structural size parameter and the i-th random Gaussian noise includes: the corrected 0-th step structure map generated in the 1st backsampling process.

[0013] In some embodiments, generating the predicted spectral response corresponding to the (t-1)th step structure diagram using a trained spectral prediction model includes: performing soft binarization on the (t-1)th step structure diagram to obtain an intermediate (t-1)th step structure diagram; generating a target (t-1)th step structure diagram based on the intermediate (t-1)th step structure diagram and an effective region mask corresponding to the s-th structural size parameter, wherein the effective region mask is used to indicate the effective metasurface structure regions in the intermediate (t-1)th step structure diagram that satisfy the structural size parameter; and generating the predicted spectral response corresponding to the (t-1)th step structure diagram using a trained spectral prediction model based on the target (t-1)th step structure diagram and the effective region mask.

[0014] In some embodiments, determining the metasurface structure design result of the metasurface spectral encoder based on the error between the predicted spectral response corresponding to each candidate metasurface structure image and the target spectral response includes: performing hard binarization on at least one candidate metasurface structure image with an error less than a specified error threshold to obtain at least one binarized metasurface structure image; and using the effective region mask corresponding to the at least one candidate metasurface structure image with an error less than the specified error threshold, determining the metasurface structure within the effective metasurface structure region from the at least one binarized metasurface structure image as the metasurface structure design result of the metasurface spectral encoder.

[0015] In some embodiments, the training process of the conditional diffusion model includes: acquiring a training dataset, the training dataset including: multiple sample metasurface structure maps and sample structure size parameters and sample target spectral responses corresponding to each sample metasurface structure map; for any sample metasurface structure map, adding Gaussian noise to the sample metasurface structure map step by step over time to obtain a T-step noisy structure map; for the t-th step noisy structure map in the T-step noisy structure map, inputting the t-th step noisy structure map, the corresponding time step, and the corresponding sample target spectral responses and sample structure size parameters into an initial conditional diffusion model to obtain the predicted noise in the t-th step noisy structure map; and optimizing the model parameters of the initial conditional diffusion model based on the error between the predicted noise in the t-th step noisy structure map and the Gaussian noise added in the t-th step noisy structure map to obtain a trained conditional diffusion model.

[0016] In some embodiments, the conditional diffusion model includes: a temporal embedding branch network, a conditional embedding branch network, and a denoising backbone network; the temporal embedding branch network is used to encode the input time steps to obtain a temporal conditional vector; the conditional embedding branch network is used to encode and concatenate the input structural size parameters and the target spectral response to obtain a joint conditional vector; the denoising backbone network is used to perform multi-scale feature extraction and reconstruction on the input noisy structure map based on the temporal conditional vector and the joint conditional vector to obtain a metasurface structure map that satisfies the target spectral response; wherein, the denoising backbone network includes multiple residual blocks, and the temporal conditional vector and the joint conditional vector are linearly mapped to the output channel dimension corresponding to each residual block and then injected into each residual block.

[0017] According to another aspect of this disclosure, a metasurface spectral encoder design apparatus is provided, comprising: an acquisition module for acquiring a target spectral response, at least one structural size parameter, and multiple random Gaussian noises; wherein the structural size parameter characterizes the size of the desired metasurface structure; a generation module for iteratively denoising each random Gaussian noise using a trained conditional diffusion model based on the target spectral response and each structural size parameter, to obtain multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noises; a determination module for determining the predicted spectral response corresponding to each candidate metasurface structure map using a trained spectral prediction model, and determining the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response; and a selection module for selecting the candidate metasurface structure map with the smallest error from the multiple candidate metasurface structure maps as the metasurface structure design result of the metasurface spectral encoder.

[0018] According to another aspect of this disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described method.

[0019] According to another aspect of this disclosure, a non-volatile computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the above-described method.

[0020] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the above-described method.

[0021] According to various aspects of this disclosure, the method according to embodiments of this disclosure generates candidate metasurface structure maps directly from random Gaussian noise using a trained conditional diffusion model. This avoids the high computational cost associated with repeated optimizations through traditional parameter scanning and full-wave simulation, significantly shortening the design cycle of the spectral encoder. Furthermore, the conditional diffusion model itself is characterized by more stable training and higher generation quality, avoiding various problems associated with existing methods using generative adversarial networks for metasurface structure generation. In particular, the conditional diffusion model can generate multiple candidate metasurface structure maps for the same target spectral response under the joint control of different random Gaussian noises and different structure size parameters. This better aligns with the "one spectrum, multiple structures" physical characteristic of metasurface reverse design, offering better expressive power compared to single structure regression methods. This facilitates the selection of metasurface structures that better match the target spectral response. A trained spectral prediction model is then used to determine the predicted spectral response corresponding to each candidate metasurface structure map and the error between the predicted spectral response and the target spectral response. Finally, the metasurface structure design result is determined based on the candidate metasurface structure map with the smallest error. This improves the matching accuracy between the final generated metasurface structure and the target spectral response, resulting in a higher-quality metasurface structure that better meets the target spectral response.

[0022] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0023] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.

[0024] Figure 1 A flowchart illustrating a metasurface spectral encoder design method according to an embodiment of the present disclosure is shown.

[0025] Figure 2 This diagram illustrates a training process for a conditional diffusion model according to an embodiment of the present disclosure.

[0026] Figure 3 A schematic diagram of a network structure of a conditional diffusion model according to an embodiment of the present disclosure is shown.

[0027] Figure 4 A schematic diagram of a spectral-guided reverse sampling process according to an embodiment of the present disclosure is shown.

[0028] Figure 5 A schematic diagram showing the design results of three sets of metasurface structures according to an embodiment of the present disclosure is provided.

[0029] Figure 6 A schematic diagram of a metasurface spectral encoder design framework according to an embodiment of the present disclosure is shown.

[0030] Figure 7 A block diagram of a metasurface spectral encoder design device according to an embodiment of the present disclosure is shown.

[0031] Figure 8 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0032] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0033] As used herein, the terms “comprising,” “including,” “having,” or variations thereof are open-ended and include one or more of the stated features, integrals, elements, steps, components, or functions, but do not exclude the presence or addition of one or more other features, integrals, elements, steps, components, functions, or groups thereof.

[0034] When an element is referred to as “connected,” “coupled,” “responding,” or a variation thereof relative to another element, it may be directly connected, coupled, or responding to another element, or there may be an intermediate element present.

[0035] Although the terms first, second, third, etc., may be used herein to describe various elements / operations, these elements / operations should not be limited by these terms. These terms are only used to distinguish one element / operation from another. Therefore, without departing from the teachings of the inventive concept, a first element / operation in some embodiments may be referred to as a second element / operation in other embodiments.

[0036] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0037] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

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

[0039] As mentioned above, while existing deep learning-based metasurface reverse design methods can improve the efficiency of metasurface reverse design, they still have various problems. To overcome these problems, this disclosure proposes a metasurface spectral encoder design method based on a conditional diffusion model. This method uses the target spectral response and structural size parameters as joint conditional inputs, and gradually generates a two-dimensional metasurface structure from random Gaussian noise through a conditional diffusion model. In addition, a spectral prediction model is introduced during the sampling process to correct the structure diagram, thereby achieving a metasurface spectral encoder structure design that meets the target spectral response and has manufacturability, high spectral matching accuracy, high quality, and high stability.

[0040] As is known, diffusion models are a rapidly developing type of generative model in recent years. Their basic idea is to progressively add Gaussian noise to real samples during the training phase and train the neural network to learn the reverse denoising process; during the generation phase, they start from random noise and gradually recover the target sample satisfying the conditional distribution through multiple steps of backsampling. Compared with models that directly generate structures in one go, diffusion models have advantages such as more stable training, higher generation quality, stronger ability to represent complex distributions, and natural suitability for generating multiple solutions. Therefore, this disclosure's embodiment introduces the conditional diffusion model into the reverse design of a metasurface spectral encoder, which has significant engineering application prospects.

[0041] In practical applications, the metasurface spectral encoder design method of this disclosure can be deployed on various terminal devices through software or hardware modifications. The terminal devices involved in this disclosure can refer to devices with wireless and / or wired connection functions. Wireless connection means that they can connect to other devices via Wi-Fi, Bluetooth, or other wireless connection methods. The terminal devices involved in this disclosure can also communicate with other devices via wired connection functions. The terminal devices involved in this disclosure can be touchscreen, non-touchscreen, or screenless. Touchscreen devices can be controlled by clicking or swiping on the display screen using fingers, styluses, etc. Non-touchscreen devices can connect to input devices such as mice, keyboards, and touch panels to control the terminal device. Screenless devices can be, for example, screenless Bluetooth speakers. For example, the terminal devices in this application can include, but are not limited to, user equipment (UE), mobile devices, user terminals, terminals, handheld devices, tablet computers, laptops, PDAs, computing devices, etc.

[0042] The metasurface spectral encoder design method of this disclosure can also be deployed on a server, which can be located in the cloud or locally, and can be a physical device or a virtual device, such as a virtual machine or container, with wireless communication capabilities. These wireless communication capabilities can be configured in the server's chip (system) or other components. The server can be a device with wireless connectivity, meaning it can connect to other servers or terminal devices via wireless connections such as Wi-Fi or Bluetooth. The server involved in this disclosure can also have wired communication capabilities. For example, the server can receive the target spectral response, at least one structural dimension parameter, and various random Gaussian noises sent by the terminal device. The server executes the design method of this disclosure to obtain the metasurface structure design result of the metasurface spectral encoder and returns the metasurface structure design result to the terminal device for display to the user.

[0043] Figure 1 A flowchart illustrating a metasurface spectral encoder design method according to an embodiment of this disclosure is shown. Figure 1 As shown, the method includes steps S11 to S14.

[0044] In step S11, the target spectral response, at least one structural size parameter, and multiple random Gaussian noises are obtained; wherein the structural size parameter characterizes the size of the desired metasurface structure.

[0045] As is known, the spectral response of a metasurface refers to its dependence on the wavelength (frequency) of incident light, manifested as specific curves or resonance peak-valley characteristics of optical parameters such as reflectivity, transmittance, absorptivity, or phase as they change with wavelength. Therefore, the target spectral response can be understood as the spectral response that the user expects the metasurface spectral encoder to possess. The structural size parameters can be understood as the dimensions of the metasurface structure that the user expects the metasurface spectral encoder to have. It should be understood that the user can provide one or more desired structural dimensions according to actual needs, and metasurface structures with the same target spectral response but different structural dimensions can be generated based on different structural size parameters.

[0046] The random Gaussian noise can be, for example, noise randomly sampled from a standard Gaussian distribution. It should be understood that multiple types of random Gaussian noise can be randomly sampled from a standard Gaussian distribution, so that a conditional diffusion model can be used to generate multiple candidate metasurface structure maps from different random Gaussian noises for the same target spectral response and structural size parameters. This disclosure does not limit the process of obtaining the random Gaussian noise.

[0047] In step S12, the trained conditional diffusion model is used to iteratively denoise each type of random Gaussian noise based on the target spectral response and each type of structural size parameter, resulting in multiple candidate metasurface structure maps generated under various structural size parameters and various types of random Gaussian noise.

[0048] In practical applications, those skilled in the art can use training methods known in the art to train conditional diffusion models, as long as the trained conditional diffusion model has the ability to gradually generate metasurface structures that satisfy the target spectral response and structural size parameters from random Gaussian noise under the joint control of the target spectral response and structural size parameters. This disclosure does not limit this. This disclosure proposes a training process for a conditional diffusion model. Specifically, the training process for a conditional diffusion model may include:

[0049] Obtain the training dataset, which includes: multiple sample metasurface structure maps and the sample structure size parameters and sample target spectral response corresponding to each sample metasurface structure map;

[0050] For any sample metasurface structure map, Gaussian noise is added to the sample metasurface structure map step by step over time to obtain a T-step noisy structure map;

[0051] For the t-th noisy structure diagram in the T-step noisy structure diagram, the t-th noisy structure diagram, the corresponding time step, and the corresponding sample target spectral response and sample structure size parameters are input into the initial conditional diffusion model to obtain the predicted noise in the t-th noisy structure diagram.

[0052] Based on the error between the predicted noise in the noisy structure graph at step t and the Gaussian noise added in the noisy structure graph at step t, the model parameters of the initial conditional diffusion model are optimized to obtain the trained conditional diffusion model.

[0053] In practical applications, the multiple sample metasurface structure maps in the training dataset can be two-dimensional metasurface structure maps randomly generated based on various sample structure size parameters (for example, patterns generated by randomly generating pixels 0 and 1 under various sample structure size parameters). Then, the sample target spectral response corresponding to each sample metasurface structure map can be obtained through electromagnetic simulation or other forward calculation methods in the art. This disclosure does not limit the construction process of the aforementioned training dataset.

[0054] like Figure 2 As shown, for each sample metasurface structure map (i.e., the original sample), Gaussian noise can be added to the sample metasurface structure map step by step through a forward noise addition process to obtain a T-step noisy structure map (i.e., a noisy sample). This results in the following: the first step noisy structure map (first step noisy sample), ..., the (t-1)th step noisy structure map (t-1)th step noisy sample, the tth step noisy structure map (t-1)th step noisy sample, ..., the Tth step noisy structure map (Tth step noisy sample). It should be understood that T can be customized, and this embodiment does not limit this. Specifically, Gaussian noise ε is added to the sample metasurface structure map X0 at the random diffusion time step t to obtain the noisy structure map. The forward noise addition process can be expressed as formula (1):

[0055] (1)

[0056] in, Let βt be the cumulative noise scheduling coefficient for the diffusion process, and ε be the Gaussian noise sampled from the standard Gaussian distribution. The cumulative noise scheduling coefficient can be understood as the value obtained through multiple calculations of a pre-set parameter βt. The specific calculation process of this cumulative noise scheduling coefficient can be found in existing denoising diffusion probability models, and will not be described in detail in this embodiment.

[0057] As can be seen, in the denoising diffusion probability model, the time step is a discrete index marking the progress of the diffusion process. It represents the step number from "pure data" to "pure noise" (forward) or from "pure noise" back to "clear data" (backward), and can determine the noise intensity and denoising strategy of the current sample. Specifically, the time step corresponding to the t-th noisy structure diagram represents the t-th step of the forward denoising process. The sample target spectral response and sample structure size parameters corresponding to the t-th noisy structure diagram are the sample target spectral response and sample structure size parameters possessed by the sample metasurface structure diagram corresponding to the t-th noisy structure diagram.

[0058] like Figure 2 As shown, during the training process, the initial conditional diffusion model can be represented by the noisy structure diagram at step t (the noisy sample at step t). The following parameters are taken as input: diffusion time step (i.e., time step condition) t, sample target spectral response (i.e., spectral condition) y, and normalized structural size parameters (i.e., size condition) s. The output is the noisy structure diagram at step t. Predicted value of medium noise ε (That is, predicting t-step noise), the prediction process can be expressed as formula (2):

[0059] (2)

[0060] in, This represents the initial conditional diffusion model, or it can represent the trained conditional diffusion model. Its training objective can be to minimize the prediction noise. The error between the actual noise ε (i.e., the actual t-step noise, or the actual added Gaussian noise) and the true noise ε is... For example, the model parameters can be updated based on the error by calculating the mean squared error loss (MSE), or the loss can be calculated using the loss function shown in Equation (3). The model parameters are updated based on this loss, but this disclosure does not limit the embodiments thereof.

[0061] (3)

[0062] Here, E(·) represents the expectation operation.

[0063] It should be understood that the training of the initial conditional diffusion model described above can be performed iteratively multiple times until the loss converges or is zeroed, or until a specified number of iterations is reached to obtain a trained conditional diffusion model. The initial conditional diffusion model and the trained conditional diffusion model have the same model structure. By iteratively updating the model parameters of the initial conditional diffusion model, the trained conditional diffusion model is obtained.

[0064] In some embodiments, the conditional diffusion model may employ a conditional U-Net structure, for example... Figure 3 The diagram shows a network structure of a conditional diffusion model, as follows: Figure 3 As shown, the conditional diffusion model can include: a temporal embedding branch network, a conditional embedding branch network, and a denoising backbone network; as mentioned above, the model input is a noisy structure map (i.e., a noisy sample Xt), a diffusion time step t, a target spectral response y, and a normalized structure size parameter s, and the output is a prediction noise ε of the same size as the input image. θFor example, the size of the noisy structure map Xt can be 25×25, the dimension of the target spectral response y can be 501, the dimension of the normalized structure size parameter s can be 1, and the output prediction noise ε θ The dimensions are 25×25.

[0065] The temporal embedding branch network is used to encode the input time steps to obtain a temporal condition vector, which is used to extract diffusion time step information; for example, such as Figure 3 The network structure of the time embedding branch shown in (c) is as follows: at time step t, the sinusoidal time embedding module is first input to obtain a 128-dimensional time embedding vector, and then it passes through a linear layer from 128-dimensional to 128-dimensional, the SiLU activation function and a linear layer from 128-dimensional to 128-dimensional to form a 128-dimensional time conditional vector.

[0066] The conditional embedding branch network encodes and concatenates the input structural size parameters and the target spectral response to obtain a joint conditional vector, which is used to extract the joint conditional information of the target spectrum and size parameters (i.e., target size); for example, such as Figure 3 The network structure of the conditional embedding branch shown in (d) is as follows: the target spectral response y passes through a linear layer from 501 dimensions to 256, a SiLU activation function, a linear layer from 256 to 128, and another SiLU activation function to obtain a 128-dimensional spectral feature vector. The normalized structural size parameter s passes through a linear layer from 1 dimension to 32 dimensions, a SiLU activation function, a linear layer from 32 dimensions to 128, and another SiLU activation function to obtain a 128-dimensional size feature vector. The two are then concatenated to form a 256-dimensional joint feature vector, which is then passed through a linear layer from 256 dimensions to 128, a SiLU activation function, and a linear layer from 128 to 128 to obtain a 128-dimensional joint conditional vector.

[0067] The denoising backbone network is used to perform multi-scale feature extraction and reconstruction on the input noisy structure map based on the time conditional vector and joint conditional vector, so as to obtain the metasurface structure map that satisfies the target spectral response; for example, such as Figure 3As shown in (a), the denoising backbone network can refer to the U-Net structure, including an encoding module and a decoding module. The encoding module is used to extract multi-scale features, and the decoding module is used to decode (i.e., reconstruct) the reconstructed metasurface structure map based on the extracted multi-scale features. The encoding module and the decoding module transmit features through skip connections. Specifically, in the encoding stage (i.e., the encoding module), the input noisy structure map first passes through a 3×3 convolutional layer (Conv3×3), increasing the number of channels from 1 to 32, resulting in a feature map with a size of 32×25×25. Then it passes through the first encoding residual block (EncoderResBlock1), with the size remaining unchanged; then it passes through the downsampling module (DownSample), changing the feature map size from 25×25 to 13×13, while maintaining the number of channels at 32. The feature map then enters the second encoding residual block (Encoder ResBlock2), where the number of channels is increased to 64, resulting in a feature map of size 64×13×13. It then passes through a downsampling module (DownSample), reducing the feature map size from 13×13 to 7×7 while maintaining the number of channels at 64. At the bottleneck, the feature map passes through two intermediate residual blocks (BottleneckResBlock), first increasing the number of channels from 64 to 128, then decreasing them back to 64, resulting in an output size of 64×7×7. In the decoding stage (i.e., the decoding module), the 64×7×7 feature map output from the bottleneck is first upsampled (UpSample), restoring the feature map size to 13×13. This upsampled feature map is then concatenated with the feature map output from the second encoding residual block via a skip connection, forming a 128×13×13 feature map. This 128×13×13 feature map is then input into the second decoding residual block (Decoder ResBlock2), outputting a 64×13×13 feature map. Next, upsampling is performed again to restore the feature map size to 25×25. This feature map is then concatenated with the feature map output from the first encoding residual block via a skip connection, forming a 96×25×25 feature map. This 96×25×25 feature map is then input into the first decoding residual block (Decoder ResBlock1), outputting a 32×25×25 feature map. Finally, the 32×25×25 feature map is sequentially passed through a group normalization layer (GroupNorm), a SiLU activation function, and a 3×3 convolutional layer (Conv3×3), compressing the number of channels from 32 to 1, resulting in the predicted noise ε. θ .

[0068] Among them, such as Figure 3As shown in (a), the denoising backbone network includes multiple residual blocks (the aforementioned first coding residual block, second coding residual block, two intermediate residual blocks, first decoding residual block, and second decoding residual block). The temporal condition vector and joint condition vector are linearly mapped to the corresponding output channel dimension of each residual block (e.g., they can be mapped to the corresponding dimension through a linear layer) and then injected into each residual block. For example, as shown in (a), Figure 3 Figure (b) illustrates a network structure for residual blocks. Each residual block's main branch sequentially includes a GroupNorm, a SiLU activation function, a 3×3 convolutional layer (Conv3×3), conditional injection (the "+" in the figure), another GroupNorm, a SiLU activation function, a Dropout regularization layer, and a 3×3 convolutional layer (Conv3×3). The temporal embedding vector and joint conditional vector are linearly projected onto the output channel dimension corresponding to the current residual block, and then broadcast onto the convolutional feature map (i.e., the feature map output by the first 3×3 convolutional layer), thus achieving joint modulation of the denoising process by temporal step information and joint conditional information. The residual shortcut branch uses identity mapping when the number of input and output channels is the same, and uses 1×1 convolution (Conv1×1) for matching when the number of channels is different. Finally, it is added to the main branch output to obtain the residual block output, i.e., the input feature F is processed by a 1×1 convolutional layer (conv1×1). in The output features are concatenated with the output features of the last 3×3 convolutional layer to obtain the final output feature F. out .

[0069] It should be understood that the above Figure 3 The network structure and model parameters of the conditional diffusion model shown are one possible implementation proposed in the embodiments of this disclosure. In fact, under the guidance of the disclosed embodiments, those skilled in the art can customize the network structure and model parameters of the conditional diffusion model, as long as they can achieve the ability to gradually generate a metasurface structure that satisfies the target spectral response and structural size parameters from random Gaussian noise under the joint control of the target spectral response and structural size parameters. The embodiments of this disclosure do not limit this.

[0070] Based on the trained conditional diffusion model, in step S12, the trained conditional diffusion model is used to iteratively denoise each type of random Gaussian noise according to the target spectral response and each structural size parameter, resulting in multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noises. These can include:

[0071] For at least one structural size parameter of type s and multiple random Gaussian noises of type i, a trained conditional diffusion model is used to perform T-step backsampling based on the target spectral response and the type s structural size parameter, starting from the type i random Gaussian noise. This yields candidate metasurface structure maps generated under the type s structural size parameter and the type i random Gaussian noise, where T is a positive integer. The T-step backsampling includes the process from the start of the T-step backsampling to the 1st step backsampling. The t-th backsampling step within the process from the start of the T-step backsampling to the 1st step backsampling includes:

[0072] Step S1211: Using the trained conditional diffusion model, based on the target spectral response, the s-th type of structure size parameter, the time step corresponding to the t-th step back sampling, and the t-th step structure diagram, predict the noise in the t-th step structure diagram, where the t-th step structure diagram is the ith type of random Gaussian noise.

[0073] Step S1212: Based on the noise in the structure diagram of step t, denoise the structure diagram of step t to obtain the structure diagram of step t-1.

[0074] Among them, the candidate metasurface structure diagrams generated under the s-th structural size parameter and the i-th random Gaussian noise include: the 0-th step structure diagram generated by the 1st step back sampling process.

[0075] It should be understood that performing T-step backsampling starting from the i-th type of random Gaussian noise is equivalent to performing T-step forward noise addition in reverse from the metasurface structure diagram. Therefore, in this backsampling stage, the target spectral response y, the structure size parameter s, the time step corresponding to the t-th backsampling step, and the t-th structure diagram are input. Starting from the t-th structure diagram (i.e., the i-th type of random Gaussian noise), the trained conditional diffusion model is used to perform backsampling, gradually generating candidate metasurface structure diagrams. At each backsampling time step t, the trained conditional diffusion model predicts the noise ε in the t-th structure diagram based on the t-th structure diagram Xt, time step t, target spectral response y, and structure size parameter s. θ Then, the noise in the structure diagram at step t can be removed using formula (4), which means the corresponding structure diagram at step t-1 can be calculated. :

[0076] (4)

[0077] It should be understood that steps S1211 to S1212 above can be executed cyclically until the structure diagram of step 0 generated by the reverse sampling process in step 1 is obtained. This means predicting the candidate metasurface structure map generated under the s-th structural size parameter and the i-th random Gaussian noise. A structural size parameter and a random Gaussian noise can generate a candidate metasurface structure. Furthermore, for each permutation and combination of structural size parameter and each random Gaussian noise, by using the conditional diffusion model to perform T-step back sampling as shown in steps S1211 to S1212, multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noises can be obtained.

[0078] Considering that the above-mentioned method of generating candidate metasurface structures solely based on the conditional diffusion model itself may not be accurate enough, or that the matching accuracy with the target spectral response may not be high, in some embodiments, in order to further improve the matching accuracy between the generated candidate metasurface structures and the target spectral response, a forward spectral prediction model can be introduced during the back-diffusion sampling process for spectral consistency guidance. That is, the metasurface structure generated by the conditional diffusion model is gradient corrected based on the error between the predicted spectral vector and the target spectral response, thereby significantly improving the consistency between the generated metasurface structure and the target spectral response, improving the matching accuracy between the candidate metasurface structure and the target spectral response, and thus facilitating the subsequent screening of high-quality metasurface structure design results that meet the target spectral response.

[0079] Furthermore, considering that introducing a strong constraint of spectral consistency guidance using a forward spectral prediction model in the high-noise stage (i.e., the first few dozen backsampling steps starting from random Gaussian noise) might lead to instability in backsampling and affect the denoising process of the conditional diffusion model, this embodiment of the present disclosure enables spectral consistency guidance using a forward spectral prediction model within a specified time step interval of backsampling (i.e., back diffusion). This avoids introducing strong constraints too early in the high-noise stage, which could lead to sampling instability, and allows for fine correction using spectral errors after the structural contour is gradually formed. Specifically, for the Rth backsampling step specified in T-step backsampling, where T > R > 1, the process from the Rth backsampling step to the tth backsampling step in the 1st backsampling step may also include:

[0080] Step S1213: After obtaining the structure diagram of step t-1, the trained spectral prediction model is used to generate the predicted spectral response corresponding to the structure diagram of step t-1 based on the structure diagram of step t-1.

[0081] Step S1214: Based on the error between the predicted spectral response and the target spectral response, determine the spectral guidance loss and calculate the gradient of the spectral guidance loss relative to the structure map at step t-1.

[0082] Step S1215: The structure diagram of step t-1 is corrected by using the gradient of the spectral guided loss relative to the structure diagram of step t-1 to obtain the corrected structure diagram of step t-1, so as to perform the backsampling process of step t-1 using the corrected structure diagram of step t-1.

[0083] Among them, the candidate metasurface structure diagrams generated under the s-th structural size parameter and the i-th random Gaussian noise include: the corrected 0-th step structure diagram generated by the 1st step back sampling process.

[0084] In practical applications, the specific value of R can be customized based on historical experience. This embodiment does not impose any restrictions on this. For example, if T is 100, R can be 50. In this way, only the reverse sampling process of steps S1211 to S1212 is executed during the reverse sampling process from step 100 to step 49. During the reverse sampling process from step 50 to step 1, the denoising process of steps S1211 to S1212 and the correction process of steps S1213 to S1215 can be executed.

[0085] For example, such as Figure 4 The spectral-guided backsampling process shown uses the t-th step structure diagram, target spectral response, and structural size parameters as inputs to the conditional diffusion model. The output is the noise in the t-th step structure diagram (i.e., the predicted t-th step noise). The t-th step structure diagram is denoised using the above formula (4) to obtain the t-1 step structure diagram. Then, the spectral prediction model is used to generate the predicted spectral response corresponding to the t-1 step structure diagram based on the t-1 step structure diagram. Then, the mean square error loss function shown in formula (5) can be used to predict the spectral response. With the target spectral response Error between Calculate spectral guidance loss (e.g., MSE loss):

[0086] (5)

[0087] Then, based on the above-mentioned spectral guidance loss, the following can be calculated: Regarding the structure diagram at step t-1 gradient And referring to formula (6), use this gradient to... The correction (i.e., updating the structure diagram) is performed to obtain the corrected structure diagram at step t-1. :

[0088] (6)

[0089] Where η is the guiding intensity coefficient, which can be an empirical value. It should be understood that the corrected structure diagram of step t-1 will participate in the posterior update of the current backsampling step, that is, the backsampling process of step t-1 will be executed until the backsampling process of step 1 is completed, and the corrected structure diagram of step 0 generated by the backsampling process of step 1 can be used as a candidate metasurface structure diagram, thereby realizing closed-loop control of directly correcting the structure based on spectral error during the generation process.

[0090] In some embodiments, to ensure the transitivity of the loss gradient and the manufacturability of the resulting metasurface structure, a differentiable soft binarization can be used in the spectral guidance stage, and hard binarization can be used in the final output stage to obtain a binary candidate metasurface structure, thereby balancing gradient transitivity and structure manufacturability. Therefore, in step S1213 above, generating the predicted spectral response corresponding to the structure diagram at step t-1 based on the trained spectral prediction model can include:

[0091] Step S12131: Perform soft binarization on the structure diagram of step t-1 to obtain the intermediate structure diagram of step t-1;

[0092] Step S12132: Based on the intermediate structure diagram of step t-1 and the effective region mask corresponding to the s-th type of structure size parameter, generate the target structure diagram of step t-1, wherein the effective region mask is used to indicate the effective metasurface structure region in the intermediate structure diagram of step t-1 that satisfies the structure size parameter.

[0093] Step S12133: Using the trained spectral prediction model, generate the predicted spectral response corresponding to the structure map at step t-1 based on the target structure map at step t-1 and the effective region mask.

[0094] In step S12131, soft binarization can be understood as setting a pixel value to 0 when it is less than a certain threshold λ, and shrinking the pixel value towards zero when it is greater than λ, thereby achieving continuous smoothness at the threshold. Thus, for example, the soft binarization function shown in formula (7) can be used to perform soft binarization on the structure image at step t-1. Perform soft binarization to obtain the intermediate structure diagram at step t-1. :

[0095] (7)

[0096] Where σ(·) represents the Sigmoid function, and k is the soft binarization steepness coefficient (which can be an empirical value). This represents the threshold λ.

[0097] Considering that different structural size parameters indicate different structural sizes, in order to adapt to unified network modeling, the structural diagrams input and output by the conditional diffusion model and the structural diagrams input by the spectral prediction model can have a unified size, and this unified size is larger than the size of various metasurface structures. Therefore, in step S12132, given the s-th structural size parameter, an effective region mask corresponding to the s-th structural size parameter can be obtained. This effective region mask can be used to indicate the effective metasurface structure region that satisfies the structural size parameter in the intermediate structural diagram of step t-1. For example, if the size of the structural diagram output by the conditional diffusion model is 25×25 and the structural size indicated by the s-th structural size parameter is 18×18, then the effective region mask can indicate the 18×18 effective metasurface structure region in the 25×25 structural diagram. It should be understood that since the size of the structure diagram output by the model is fixed, while the structure size of a metasurface, although varied, is finite, a unified structure diagram size can be designed during the training phase of the conditional diffusion model and the spectral prediction model (e.g., both input and output structure diagrams are 25×25). Corresponding effective region masks can be generated for different structure size parameters to indicate the effective metasurface structure regions in the structure diagram, and a correspondence between different structure size parameters and effective region masks can be established. This correspondence can then be used during the backsampling phase to obtain the effective region mask corresponding to any structure size parameter. Alternatively, a pre-defined rule for determining the effective metasurface structure region can be used to obtain the effective region mask corresponding to different structure size parameters. For example, if the structure size indicated by the structure size parameter is 18×18, the effective metasurface structure region can be defined by default from the first row and first column to the 18th row and 18th column in the 25×25 structure diagram. Alternatively, it could be from the first row and 25th column to the 18th row and 7th column; this embodiment does not limit this.

[0098] In practical applications, the size of the effective region mask is the same as the size of the structure diagram output by the model. A mask value of "1" can be used to indicate the effective metasurface structure region, and a mask value of "0" can be used to indicate the invalid region (i.e., the region other than the effective metasurface structure region). Therefore, in step S12132, based on the intermediate structure diagram of step t-1 and the effective region mask corresponding to the size parameter of the s-th structure, the target structure diagram of step t-1 is generated. This can be understood as retaining the structure within the effective metasurface structure region in the intermediate structure diagram of step t-1. Specifically, formula (8) can be used to retain the structure within the effective metasurface structure region in the intermediate structure diagram of step t-1:

[0099] (8)

[0100] in, Represents the effective area mask; ⊙ indicates pixel-by-pixel multiplication. This represents the target structure map at step t-1 after retaining only the effective metasurface region. In other words, in the target structure map at step t-1, the pixel values ​​of the remaining regions can be zero, except for the effective metasurface region.

[0101] Then, in step S12133, [ [M] is used as a dual-channel input to feed into the spectral prediction model to obtain the predicted spectral response corresponding to the structure diagram at step t-1. This allows the effective region mask to identify the actual region involved in encoding, facilitating subsequent spectral encoding models to calculate only the effective region and improving computational efficiency. Furthermore, steps S1214 to S1215 can be executed to correct the (t-1)th step structure diagram based on the spectral error. The corrected (t-1)th step structure diagram continues to undergo the (t-1)th step backsampling process until the first step backsampling process is completed, resulting in the corrected (0)th step structure diagram as a candidate metasurface structure diagram.

[0102] In practical applications, those skilled in the art can use training methods known in the art to train the spectral prediction model, and the spectral prediction model can use network structures known in the art, such as the aforementioned cascaded neural network, variational autoencoder network, etc., and this disclosure does not limit this. The spectral prediction model is trained to learn the mapping relationship between metasurface structure diagrams and spectral responses, so as to use the trained spectral prediction model to predict the spectral response corresponding to any structure diagram.

[0103] For example, as described above, a training dataset can be constructed to train the conditional diffusion model. The structure maps input to or output by the conditional diffusion model and the spectral prediction model have the same size. Therefore, to adapt to unified network modeling, randomly generated metasurface structures with different sample structure size parameters can be embedded in a fixed-size canvas to form sample metasurface structure maps of the same size. Simultaneously, an effective region mask is used to identify the effective metasurface structure regions actually involved in encoding in the sample metasurface structure maps, facilitating subsequent training and sampling stages by constraining and calculating only the effective regions. Thus, the training dataset, in addition to containing multiple sample metasurface structure maps and the corresponding sample structure size parameters and target spectral responses for each sample metasurface structure map, can also include the effective region mask for each sample metasurface structure map. During training, the spectral prediction model can use the dual-channel features composed of the sample metasurface structure map and the effective region mask, along with the sample structure size parameters, as input conditions to output the predicted spectral response. Then, the loss (such as mean squared error loss) can be calculated using the error between the predicted spectral response and the target spectral response. This loss is then used to optimize the model parameters of the spectral prediction model to obtain the trained spectral prediction model. For example, if the structure diagram is represented as X, then the spectral prediction model can be expressed as formula (9):

[0104] (9)

[0105] in, This represents a spectral prediction model. Let [X, M] represent the predicted spectral vector, where [X, M] represents the concatenated input of the structure map and the effective region mask in the channel dimension, and s represents the normalized structure size parameters. It should be understood that after the spectral prediction model is trained, its model parameters remain fixed in subsequent design stages, and can be used for spectral consistency guidance and rapid evaluation of generated results.

[0106] Back Figure 1 In step S13, the trained spectral prediction model is used to determine the predicted spectral response corresponding to each candidate metasurface structure diagram, and the error between the predicted spectral response and the target spectral response corresponding to each candidate metasurface structure diagram is determined.

[0107] The method of determining the predicted spectral response corresponding to each candidate metasurface structure image using a trained spectral prediction model can be achieved by inputting the dual-channel features composed of each candidate metasurface structure image and its corresponding effective region mask, along with the structural size parameters, into the spectral prediction model to obtain the predicted spectral response corresponding to each candidate metasurface structure image output by the spectral prediction model. It should be understood that the effective region mask corresponding to each candidate metasurface structure image can be determined based on the structural size parameters corresponding to each candidate metasurface structure image, and this disclosure does not limit this aspect.

[0108] Those skilled in the art can use any known error calculation method in the art, such as mean square error, absolute error, relative error, etc., to determine the error between the predicted spectral response and the target spectral response corresponding to each candidate metasurface structure diagram, and the embodiments of this disclosure do not limit this.

[0109] Back Figure 1 In step S14, the metasurface structure design result of the metasurface spectral encoder is determined based on the error between the predicted spectral response and the target spectral response corresponding to each candidate metasurface structure diagram.

[0110] In some embodiments, candidate metasurface structure images can be sorted and filtered according to an error index to select at least one candidate metasurface structure image with an error less than a specified error threshold. The metasurface structure in the candidate metasurface structure image with an error less than the specified error threshold is then used as the metasurface structure design result of the metasurface spectral encoder. The specified error threshold can be customized to meet the user's requirements for the matching accuracy between the designed metasurface structure and the target spectral response. Alternatively, if the user does not have specific spectral matching accuracy requirements, the metasurface structure in the at least one candidate metasurface structure image with the smallest error (i.e., the Top-K candidate metasurface structure images) can be directly used as the metasurface structure design result of the metasurface spectral encoder; this embodiment does not impose any limitations on this approach.

[0111] As described above, during the backsampling stage, soft binarization is used to make the gradient transferable to correct the structure map, and the structure map output by the model has a uniform size. Therefore, to ensure the manufacturability of the final generated metasurface structure, hard binarization can be applied to the generated candidate metasurface structure map to obtain a binary metasurface structure. Then, an effective region mask is used to clear the invalid regions (i.e., regions in the structure map other than the effective metasurface structure regions), thereby outputting a manufacturable metasurface structure. Thus, in some embodiments, the above-mentioned determination of the metasurface structure design result of the metasurface spectral encoder based on the error between the predicted spectral response and the target spectral response corresponding to each candidate metasurface structure map may include:

[0112] Hard binarization is performed on at least one candidate metasurface structure image with an error less than a specified error threshold from multiple candidate metasurface structure images to obtain at least one binarized metasurface structure image.

[0113] Using the effective region mask corresponding to at least one candidate metasurface structure image with an error less than a specified error threshold, the metasurface structure within the effective metasurface structure region is determined from at least one binary metasurface structure image as the metasurface structure design result of the metasurface spectral encoder.

[0114] In this process, multiple candidate metasurface structure images can be sorted according to their errors to select at least one candidate metasurface structure image whose error is less than a specified error threshold. Then, each selected candidate metasurface structure image can be subjected to hard binarization to obtain at least one binarized metasurface structure image. It should be understood that hard binarization means that when the pixel value in the structure image is less than a certain threshold λ (such as 0.5), it is directly set to 0, and when it is greater than the threshold λ, it is set to 1. Then, referring to the implementation method of the above formula (8), the invalid regions in the binarized metasurface structure image can be cleared to zero using the effective region mask (that is, the metasurface structure in the effective metasurface structure region is determined from the binarized metasurface structure image), so as to determine the metasurface structure in the effective metasurface structure region from each binarized metasurface structure image, as the metasurface structure design result of the metasurface spectral encoder.

[0115] In some embodiments, when the user does not have specific spectral matching accuracy requirements, the above-mentioned determination of the metasurface structure design result of the metasurface spectral encoder based on the error between the predicted spectral response and the target spectral response corresponding to each candidate metasurface structure image may further include: performing hard binarization processing on at least one candidate metasurface structure image with the smallest error among multiple candidate metasurface structure images to obtain at least one binarized metasurface structure image; using the effective region mask corresponding to the at least one candidate metasurface structure image with the smallest error, determining the metasurface structure within the effective metasurface structure region from each binarized metasurface structure image as the metasurface structure design result of the metasurface spectral encoder.

[0116] It should be understood that if the user specifies the spectral matching accuracy requirement (i.e., the specified error threshold), and there is no candidate metasurface structure diagram that meets the specified error threshold among the multiple candidate metasurface structure diagrams generated, multiple random Gaussian noises can be regenerated to re-execute the above steps S11 to S13 until a candidate metasurface structure that meets the requirement that the error between the predicted spectral response and the target spectral response is less than the specified error threshold is obtained, thereby obtaining the metasurface structure design result that meets the spectral matching accuracy requirement.

[0117] According to the method of this disclosure, candidate metasurface structure maps are generated directly from random Gaussian noise using a trained conditional diffusion model. This avoids the high computational cost of repeated optimizations through traditional parameter scanning and full-wave simulation, significantly shortening the design cycle of the spectral encoder. Furthermore, the conditional diffusion model itself is characterized by more stable training and higher generation quality, avoiding various problems associated with existing methods using generative adversarial networks for metasurface structure generation. In particular, the conditional diffusion model can generate multiple candidate metasurface structure maps for the same target spectral response under the joint control of different random Gaussian noises and different structure size parameters. This better aligns with the "one spectrum, multiple structures" physical characteristic of metasurface reverse design, offering better expressive power compared to single structure regression methods. This facilitates the selection of metasurface structures that better match the target spectral response. The trained spectral prediction model is then used to determine the predicted spectral response corresponding to each candidate metasurface structure map and the error between the predicted and target spectral responses. Finally, the metasurface structure design result is determined based on the candidate metasurface structure map with the smallest error. This improves the matching accuracy between the final generated metasurface structure and the target spectral response, resulting in a higher-quality metasurface structure that better meets the target spectral response.

[0118] For example, Figure 5 The diagram illustrates three sets of metasurface structure design results according to an embodiment of the present disclosure. Each set of results includes a comparison region of the target spectrum and the designed spectrum, as well as the final generated binary metasurface structure diagram (S=18 represents a metasurface structure size of 18×18). Figure 5 As shown in (a), (b), and (c), the design method proposed in this embodiment can generate metasurface structures that have a good match with the target spectral response under different target spectral responses. That is, the similarity between the designed spectral response curve (i.e., the actual spectral response curve of the designed metasurface structure) and the target spectral response curve is high, or the matching accuracy is high. At the same time, the generated metasurface structure has good regularity, clear binary boundaries, and good manufacturability, indicating that the design method proposed in this embodiment can effectively take into account both the target spectral matching capability and the engineering implementation requirements, and generate high-quality metasurface structures that meet the target spectral response.

[0119] Based on the design method proposed in the embodiments of this disclosure above, Figure 6 A schematic diagram of a metasurface spectral encoder design framework according to an embodiment of the present disclosure is shown, as follows: Figure 6As shown, the design framework includes a training phase and a sampling phase. The training phase is used to establish a training dataset (i.e., construct a metasurface pattern-spectral response dataset), train the spectral prediction model, and train the conditional diffusion model. The sampling phase is used to generate and screen the metasurface structure of the metasurface spectral encoder under the conditions of the target spectral response y and the structural size parameters, using the trained conditional diffusion model and the spectral prediction model. Specifically, the user inputs the target spectral response, randomly generates the structural size parameters and random Gaussian noise (i.e., random noise pattern), and uses the trained conditional diffusion model and the trained spectral prediction model to perform spectral guided conditional diffusion inverse denoising (i.e., steps S1211 to S1215 above) to obtain multiple candidate metasurface structure maps. Then, the trained spectral prediction model is used to perform spectral prediction evaluation on each candidate metasurface structure map (i.e., determine the predicted spectral response of each candidate metasurface structure). Finally, by determining whether each candidate metasurface structure map meets the design requirements (i.e., whether it is less than the specified error threshold), the optimal metasurface structure design result is obtained.

[0120] The design method and design framework of this disclosure have the following beneficial effects:

[0121] (1) Improve reverse design efficiency. The conditional diffusion model, which has been trained, directly generates candidate metasurface structure maps from random noise, avoiding the high computational cost caused by repeated optimization of traditional parameter scanning and full-wave simulation, and can significantly shorten the design cycle of spectral encoder.

[0122] (2) Alleviating the one-to-many non-uniqueness problem. The conditional diffusion model can generate multiple candidate metasurface structure maps from different random Gaussian noises under the same target spectral response and structural size parameters. This is more in line with the physical characteristics of "one spectrum, multiple structures" in metasurface reverse design and has better expressive power than the single structure regression method.

[0123] (3) Improve spectral matching accuracy. The method proposed in this embodiment does not only passively screen the results after generating candidate metasurface structure maps, but directly introduces a forward spectral prediction model during the back diffusion sampling process. The structure is then gradient-corrected based on the error between the predicted spectrum and the target spectrum, thereby significantly improving the consistency between the generated structure and the target spectrum.

[0124] (4) Forming a design closed loop facilitates rapid screening of candidate metasurface structures. By providing the predicted spectrum and its error index of the spectral prediction model output at the same time as the output of the generated results, it is convenient to quickly screen the optimal result among multiple candidate metasurface structures, which helps to reduce the number of subsequent high-precision electromagnetic simulation verifications and improve the quality of the finally selected metasurface structure.

[0125] In the design method provided in the embodiments of this disclosure, the target spectral response and structural size parameters are encoded and fused into a joint conditional vector, which is then embedded with a common input conditional denoising network at the diffusion time step to perform noise prediction training on the noisy structure. In the sampling stage, a metasurface structure that satisfies the target spectral response is gradually generated from random noise.

[0126] Furthermore, a conditional diffusion model for high-degree-of-freedom binary metasurface structures is provided. The model uses a conditional U-Net as the backbone network and modulates the denoising process in a multi-scale residual module through temporal embedding, target spectral embedding, and size conditional embedding, thereby achieving the generation of two-dimensional structures under the joint control of target spectrum and structural size.

[0127] Furthermore, a proxy model-guided backdiffusion sampling method was implemented. Within a preset time step interval of backdiffusion, the predicted structure was soft-binarized and processed with an effective region mask before being input into the forward spectral prediction model. The structural gradient was calculated based on the error between the predicted spectrum and the target spectrum, and the predicted structure was normalized to improve the consistency between the generated metasurface structure and the target spectrum.

[0128] Furthermore, a metasurface structure generation method that combines soft binarization and hard binarization is provided. In the sampling guidance stage, a differentiable soft binarization form is used to participate in the model spectrum guidance, and in the final output stage, hard binarization is used to obtain the binary metasurface structure, thereby taking into account both gradient transferability and structure manufacturability.

[0129] Furthermore, a closed-loop process of structure generation, model prediction, and error evaluation was constructed. For each generated result (i.e., each candidate metasurface structure image), a continuous structure image (i.e., the structure image after soft binarization), a binary structure image (i.e., the structure image after hard binarization), the target spectral response, the predicted spectral response, and the error index can be output simultaneously to achieve rapid evaluation and selection of multiple candidate structures. Moreover, for the same target spectral response, multiple candidate metasurface structure images can be generated by changing the random initial noise or structure size parameters. Then, the candidate metasurface structure images are sorted and filtered according to the error index to select the optimal design result.

[0130] Figure 7 A block diagram of a metasurface spectral encoder design apparatus according to an embodiment of the present disclosure is shown, as follows: Figure 7 As shown, the device includes:

[0131] The acquisition module 701 is used to acquire the target spectral response, at least one structural size parameter, and multiple random Gaussian noises; wherein the structural size parameter characterizes the size of the required metasurface structure.

[0132] The generation module 702 is used to use the trained conditional diffusion model to iteratively denoise each type of random Gaussian noise according to the target spectral response and each type of structural size parameter, so as to obtain multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noise.

[0133] The determination module 703 is used to determine the predicted spectral response corresponding to each candidate metasurface structure map, and to determine the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response respectively;

[0134] The selection module 704 is used to select the candidate metasurface structure diagram with the smallest error from the multiple candidate metasurface structure diagrams as the metasurface structure design result of the metasurface spectral encoder.

[0135] In some embodiments, the step of using a trained conditional diffusion model to iteratively denoise each type of random Gaussian noise based on the target spectral response and each type of structural size parameter to obtain multiple candidate metasurface structure maps generated under various structural size parameters and various types of random Gaussian noise includes: for the s-th structural size parameter among at least one structural size parameter and the i-th type of random Gaussian noise among multiple types of random Gaussian noise, using a trained conditional diffusion model to perform T-step backsampling starting from the i-th type of random Gaussian noise based on the target spectral response and the s-th structural size parameter to obtain candidate metasurface structure maps generated under the s-th structural size parameter and the i-th type of random Gaussian noise, where T is a positive integer; wherein, the T-step backsampling... Backsampling includes the process from backsampling step T to backsampling step 1. The backsampling process from backsampling step T to backsampling step 1 includes: using a trained conditional diffusion model to predict the noise in the structure diagram at step t based on the target spectral response, the s-th type of structural size parameter, the time step corresponding to backsampling step t, and the structure diagram at step t, where the structure diagram at step T is the ith type of random Gaussian noise; denoising the structure diagram at step t based on the noise in the structure diagram at step t to obtain the structure diagram at step t-1; wherein, the candidate metasurface structure diagram generated under the s-th type of structural size parameter and the ith type of random Gaussian noise includes: the structure diagram at step 0 generated by the backsampling process at step 1.

[0136] In some embodiments, for the R-th backsampling specified in the T-step backsampling, where T > R > 1, the process from the R-th backsampling to the t-th backsampling in the 1st backsampling further includes: after obtaining the (t-1)-th step structure map, using a trained spectral prediction model to generate a predicted spectral response corresponding to the (t-1)-th step structure map; determining a spectral guidance loss based on the error between the predicted spectral response and the target spectral response, and calculating the gradient of the spectral guidance loss relative to the (t-1)-th step structure map; correcting the (t-1)-th step structure map using the gradient of the spectral guidance loss relative to the (t-1)-th step structure map to obtain a corrected (t-1)-th step structure map, and performing the (t-1)-th step backsampling process using the corrected (t-1)-th step structure map; wherein, the candidate metasurface structure map generated under the s-th structural size parameter and the i-th random Gaussian noise includes: the corrected 0-th step structure map generated in the 1st backsampling process.

[0137] In some embodiments, generating the predicted spectral response corresponding to the (t-1)th step structure diagram using a trained spectral prediction model includes: performing soft binarization on the (t-1)th step structure diagram to obtain an intermediate (t-1)th step structure diagram; generating a target (t-1)th step structure diagram based on the intermediate (t-1)th step structure diagram and an effective region mask corresponding to the s-th structural size parameter, wherein the effective region mask is used to indicate the effective metasurface structure regions in the intermediate (t-1)th step structure diagram that satisfy the structural size parameter; and generating the predicted spectral response corresponding to the (t-1)th step structure diagram using a trained spectral prediction model based on the target (t-1)th step structure diagram and the effective region mask.

[0138] In some embodiments, determining the metasurface structure design result of the metasurface spectral encoder based on the error between the predicted spectral response corresponding to each candidate metasurface structure image and the target spectral response includes: performing hard binarization on at least one candidate metasurface structure image with an error less than a specified error threshold to obtain at least one binarized metasurface structure image; and using the effective region mask corresponding to the at least one candidate metasurface structure image with an error less than the specified error threshold, determining the metasurface structure within the effective metasurface structure region from the at least one binarized metasurface structure image as the metasurface structure design result of the metasurface spectral encoder.

[0139] In some embodiments, the training process of the conditional diffusion model includes: acquiring a training dataset, the training dataset including: multiple sample metasurface structure maps and sample structure size parameters and sample target spectral responses corresponding to each sample metasurface structure map; for any sample metasurface structure map, adding Gaussian noise to the sample metasurface structure map step by step over time to obtain a T-step noisy structure map; for the t-th step noisy structure map in the T-step noisy structure map, inputting the t-th step noisy structure map, the corresponding time step, and the corresponding sample target spectral responses and sample structure size parameters into an initial conditional diffusion model to obtain the predicted noise in the t-th step noisy structure map; and optimizing the model parameters of the initial conditional diffusion model based on the error between the predicted noise in the t-th step noisy structure map and the Gaussian noise added in the t-th step noisy structure map to obtain a trained conditional diffusion model.

[0140] In some embodiments, the conditional diffusion model includes: a temporal embedding branch network, a conditional embedding branch network, and a denoising backbone network; the temporal embedding branch network is used to encode the input time steps to obtain a temporal conditional vector; the conditional embedding branch network is used to encode and concatenate the input structural size parameters and the target spectral response to obtain a joint conditional vector; the denoising backbone network is used to perform multi-scale feature extraction and reconstruction on the input noisy structure map based on the temporal conditional vector and the joint conditional vector to obtain a metasurface structure map that satisfies the target spectral response; wherein, the denoising backbone network includes multiple residual blocks, and the temporal conditional vector and the joint conditional vector are linearly mapped to the output channel dimension corresponding to each residual block and then injected into each residual block.

[0141] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0142] This disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.

[0143] This disclosure also provides a non-volatile computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0144] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.

[0145] Figure 8A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. For example, the electronic device 1900 may be provided as a server or a terminal device. (Refer to...) Figure 8 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.

[0146] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). Electronic device 1900 can operate on an operating system, such as Windows Server, stored in memory 1932. TM Mac OS X TM Unix TM Linux TM FreeBSD TM Or similar.

[0147] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of an electronic device 1900 to perform the above-described method.

[0148] Computer-readable storage media can be tangible devices capable of holding and storing programs / instructions used by instruction execution devices. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0149] The computer program (or computer-readable program instructions) described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage medium in the respective computing / processing device.

[0150] The computer program (or computer program instructions) used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions to implement various aspects of this disclosure.

[0151] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0152] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0153] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0154] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0155] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for designing a metasurface spectral encoder, characterized in that, include: The target spectral response, at least one structural size parameter, and multiple random Gaussian noises are obtained; wherein the structural size parameter characterizes the size of the desired metasurface structure. Using a trained conditional diffusion model, each type of random Gaussian noise is iteratively denoised based on the target spectral response and each structural size parameter, resulting in multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noises. The predicted spectral response corresponding to each candidate metasurface structure map is determined using a trained spectral prediction model, and the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response is determined respectively. The metasurface structure design result of the metasurface spectral encoder is determined based on the error between the predicted spectral response corresponding to each candidate metasurface structure diagram and the target spectral response.

2. The method according to claim 1, characterized in that, The trained conditional diffusion model iteratively denoises each type of random Gaussian noise based on the target spectral response and each structural size parameter, resulting in multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noise conditions, including: For at least one structural size parameter of type s and multiple random Gaussian noises of type i, a trained conditional diffusion model is used to perform T-step back sampling starting from the type i random Gaussian noise based on the target spectral response and the type s structural size parameter, to obtain a candidate metasurface structure map generated under the type s structural size parameter and the type i random Gaussian noise, where T is a positive integer; The T-step reverse sampling includes the process from the start of the T-th reverse sampling to the 1st reverse sampling. The t-th reverse sampling process from the start of the T-th reverse sampling to the 1st reverse sampling includes: Using a trained conditional diffusion model, based on the target spectral response, the s-th type of structural size parameter, the time step corresponding to the t-th step back sampling, and the t-th step structural diagram, the noise in the t-th step structural diagram is predicted, where the t-th step structural diagram is the i-th type of random Gaussian noise; Based on the noise in the structure diagram at step t, the structure diagram at step t is denoised to obtain the structure diagram at step t-1. Among them, the candidate metasurface structure diagrams generated under the s-th structural size parameter and the i-th random Gaussian noise include: the 0-th step structure diagram generated by the 1st step back sampling process.

3. The method according to claim 2, characterized in that, For the R-th reverse sampling specified in the T-step reverse sampling, where T > R > 1, the process from the R-th reverse sampling to the t-th reverse sampling in the 1st reverse sampling also includes: After obtaining the structure diagram at step t-1, the trained spectral prediction model is used to generate the predicted spectral response corresponding to the structure diagram at step t-1 based on the structure diagram at step t-1. Based on the error between the predicted spectral response and the target spectral response, the spectral guidance loss is determined, and the gradient of the spectral guidance loss relative to the structure diagram at step t-1 is calculated. The gradient of the spectral guided loss relative to the structure diagram of step t-1 is used to correct the structure diagram of step t-1, so as to obtain the corrected structure diagram of step t-1, and then the backsampling process of step t-1 is performed using the corrected structure diagram of step t-1. Among them, the candidate metasurface structure diagrams generated under the s-th structural size parameter and the i-th random Gaussian noise include: the corrected 0-th step structure diagram generated by the 1st step back sampling process.

4. The method according to claim 3, characterized in that, The step of generating the predicted spectral response corresponding to the (t-1)th step structure diagram using the trained spectral prediction model based on the (t-1)th step structure diagram includes: The structure diagram at step t-1 is subjected to soft binarization to obtain the intermediate structure diagram at step t-1. Based on the intermediate structure diagram of step t-1 and the effective region mask corresponding to the s-th type of structure size parameter, the target structure diagram of step t-1 is generated, wherein the effective region mask is used to indicate the effective metasurface structure region in the intermediate structure diagram of step t-1 that satisfies the structure size parameter; Using the trained spectral prediction model, the predicted spectral response corresponding to the structure diagram at step t-1 is generated based on the target structure diagram at step t-1 and the effective region mask.

5. The method according to claim 4, characterized in that, The step of determining the metasurface structure design result of the metasurface spectral encoder based on the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response includes: Hard binarization is performed on at least one candidate metasurface structure image whose error is less than a specified error threshold from the plurality of candidate metasurface structure images to obtain at least one binarized metasurface structure image. Using the effective region mask corresponding to at least one candidate metasurface structure image with an error less than a specified error threshold, the metasurface structure within the effective metasurface structure region is determined from the at least one binarized metasurface structure image as the metasurface structure design result of the metasurface spectral encoder.

6. The method according to claim 1, characterized in that, The training process of the conditional diffusion model includes: Obtain a training dataset, which includes: multiple sample metasurface structure maps and sample structure size parameters and sample target spectral response corresponding to each sample metasurface structure map; For any sample metasurface structure map, Gaussian noise is added to the sample metasurface structure map step by step over time to obtain a T-step noisy structure map; For the t-th step noisy structure diagram in the T-step noisy structure diagram, the t-th step noisy structure diagram, the corresponding time step, and the corresponding sample target spectral response and sample structure size parameters are input into the initial conditional diffusion model to obtain the predicted noise in the t-th step noisy structure diagram; Based on the error between the predicted noise in the noisy structure diagram at step t and the Gaussian noise added in the noisy structure diagram at step t, the model parameters of the initial conditional diffusion model are optimized to obtain a trained conditional diffusion model.

7. The method according to any one of claims 1 to 6, characterized in that, The conditional diffusion model includes: a temporal embedding branch network, a conditional embedding branch network, and a denoising backbone network; The temporal embedding branch network is used to encode the input time steps to obtain a temporal condition vector; The conditional embedding branch network is used to encode and concatenate the input structural size parameters and the target spectral response to obtain a joint conditional vector; The denoising backbone network is used to perform multi-scale feature extraction and reconstruction on the input noisy structure map based on the time condition vector and the joint condition vector, so as to obtain a metasurface structure map that satisfies the target spectral response. The denoising backbone network includes multiple residual blocks. The time condition vector and the joint condition vector are linearly mapped to the output channel dimension corresponding to each residual block and then injected into each residual block.

8. A design device for a metasurface spectral encoder, characterized in that, include: An acquisition module is used to acquire the target spectral response, at least one structural size parameter, and multiple random Gaussian noises; wherein the structural size parameter characterizes the size of the desired metasurface structure. The generation module is used to use a trained conditional diffusion model to iteratively denoise each type of random Gaussian noise based on the target spectral response and each type of structural size parameter, so as to obtain multiple candidate metasurface structure maps generated under various structural size parameters and various random Gaussian noise. The determination module is used to determine the predicted spectral response corresponding to each candidate metasurface structure map using a trained spectral prediction model, and to determine the error between the predicted spectral response corresponding to each candidate metasurface structure map and the target spectral response. The selection module is used to select the candidate metasurface structure diagram with the smallest error from the multiple candidate metasurface structure diagrams as the metasurface structure design result of the metasurface spectral encoder.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.

10. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.