Inverse design method of nanophotonic metamaterial structure based on CVAE and PSO
By combining conditional variational autoencoders and particle swarm optimization algorithms, a nanophotonic metamaterial design method is developed, which solves the problems of high computational resource consumption and insufficient accuracy in existing technologies. This method enables efficient and accurate reverse design, generating nanophotonic metamaterial structures that conform to the target spectrum.
Patent Information
- Application Number
- CN202411570143.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-06
AI Technical Summary
Existing design methods for nanophotonic metamaterials suffer from high computational resource consumption, poor generalization performance, and insufficient accuracy in reverse design. In particular, traditional deep learning models such as GAN and VAE struggle to meet high-precision requirements in generating structures.
We employ a method based on Conditional Variational Autoencoder (CVAE) and Particle Swarm Optimization (PSO). By constructing a forward prediction network and designing a reverse dataset, we search for the optimal structure in the latent space using the PSO algorithm. The forward prediction network is then used for accurate verification, thus optimizing the generated results.
Finding material structures that match the target spectrum within seconds significantly improves the accuracy and efficiency of reverse engineering, avoiding time-consuming blind multiple sampling processes.
Smart Images

Figure CN119494270B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of metamaterial design, specifically involving a reverse design method for nanophotonic metamaterial structures based on CVAE and PSO. Background Technology
[0002] Metamaterials are a class of carefully designed artificial structural materials possessing unique physical properties not found in natural materials. These materials control physical phenomena such as electromagnetic waves and sound waves by altering the geometry and arrangement of their structures, rather than relying on their chemical composition. Nanophotonic metamaterials are an important branch of metamaterials, focusing on manipulating photon behavior at the nanoscale. By controlling the geometry, shape, and composition of nanostructures, these metamaterials can achieve precise control over light waves, such as negative refractive index, optical cloaking, and extreme optical imaging. Nanophotonic metamaterials have broad application prospects in cutting-edge technologies such as photonic integrated circuits, super-resolution imaging, optical sensors, and optical communications, driving the development of nanophotonics.
[0003] Forward prediction of the electromagnetic response of nanophotonic metamaterials refers to obtaining the corresponding electromagnetic response based on the provided topological information of the metamaterial structure. Currently, the mainstream method for forward prediction in the design of nanophotonic metamaterials is still numerical iterative calculation. This involves solving Maxwell's equations numerically to obtain the corresponding electromagnetic response. Commonly used numerical methods include the method of moments (MOM), the finite element method (FEM), the finite integral method (FIT), and the finite-difference time-domain method (FDTD). This method requires a large amount of numerical computation and iteration; simulation of a single example typically takes minutes, resulting in high resource consumption. Therefore, forward prediction in metamaterial design is significantly limited by numerical computation capabilities.
[0004] The reverse design of electromagnetic responses in nanophotonic metamaterials aims to generate metamaterial structures that meet specific electromagnetic response requirements. Currently, reverse design methods for electromagnetic metasurfaces are mainly divided into heuristic algorithms and deep learning algorithms. Heuristic algorithms, such as genetic algorithms, simulated annealing algorithms, and ant colony algorithms, typically obtain the final result through iterative search within the solution space. However, these algorithms have poor generalization performance and require iterative search again for each new requirement, resulting in high computational costs. In recent years, with the rise of deep learning generative models, many emerging generative models, such as generative adversarial networks (GANs), variational autoencoders (VAEs), and diffusion models, have been gradually applied to the field of metamaterial design. Generative adversarial networks, through adversarial training between the generator and discriminator, allow the generator to continuously optimize, thereby generating metamaterial structures that match the target electromagnetic response. However, GAN models lack effective information from prior noise and face difficulties in convergence during training. Variational autoencoders (VAEs) efficiently generate samples and optimize designs by mapping complex structure-performance relationships into a latent space. However, VAEs rely on purely random sampling in inverse design, which may lead to insufficient accuracy of the generated structures and make it difficult to meet higher accuracy design requirements.
[0005] Therefore, developing a new reverse design method for nanophotonic metamaterial structures is of great significance. Summary of the Invention
[0006] The technical problem this invention aims to solve is to address the shortcomings of existing technologies by providing a reverse design method for nanophotonic metamaterial structures based on conditional variational autoencoders (CVAEs) and particle swarm optimization (PSO) for intelligent optimization. This method optimizes and improves upon the random sampling problem in traditional variational autoencoder design. By introducing a particle swarm optimization algorithm, a deep search of the latent space is performed, and the generated results are accurately verified using a fully trained forward prediction network. Compared to traditional random sampling methods, this method can significantly improve the accuracy of candidate structures while maintaining diversity.
[0007] To address the aforementioned technical problems, this invention discloses a reverse design method for nanophotonic metamaterial structures based on CVAE and PSO, the specific steps of which are as follows:
[0008] S1. Construct a dataset, which includes a binary encoding matrix converted from a basic grayscale image and an electromagnetic reflection spectrum vector;
[0009] S2. Divide the forward prediction dataset and reverse design dataset constructed in S1 into 80% training set, 10% validation set and 10% test set, respectively.
[0010] S3. Construct a positive prediction network model, feed the training set into the positive prediction network model for iterative training, and fix the parameters of the positive prediction network model after training is completed.
[0011] S4. Construct a conditional variational autoencoder network model, including an encoder network and a decoder network, and initialize the network parameters;
[0012] S5. The encoding matrix and reflectance spectral vector in the training set are used as data pairs and fed into the conditional variational autoencoder network model for iterative training.
[0013] S6. Find the optimal latent vector through particle swarm optimization algorithm, concatenate the latent vector with the reflection spectrum vector and input it into the conditional variational autoencoder network model to obtain candidate design structures, and use the forward prediction network model for screening to obtain the reverse design material pattern.
[0014] In S1, the specific steps for constructing the dataset are as follows:
[0015] S11. Eight grayscale pattern samples of shapes—cross, H, open ring, ellipse, bow tie, L, rectangle, and arc—are collected using nanophotonic metamaterial units. The grayscale patterns are then converted into 64×64 binary encoding matrices to construct corresponding electromagnetic metasurface units. These units are then fed into electromagnetic simulation software to obtain the corresponding electromagnetic response reflection spectrum curves, with the frequency range set to 60–160 Thz. The electromagnetic reflection spectrum includes three types of linear polarization reflection: the reflection coefficients Rxx and Ryy for incident waves with co-polarization in the x and y directions, and the reflection coefficient Rxy for cross-polarized incident waves.
[0016] S12. The 64×64 binary coding matrix is used as the input to the forward prediction network, and it is also one of the inputs to the conditional variational autoencoder;
[0017] S13. The three types of electromagnetic reflection spectrum curves Rxx, Ryy, and Rxy are sampled at a uniform frequency with a sampling interval of 2Thz, and represented as 51-dimensional vectors respectively. The three 51-dimensional vectors are then concatenated to obtain a reflection spectrum vector with a length of 153 dimensions. The reflection spectrum vector serves as both a label for the forward prediction network dataset and one of the inputs to the conditional variational autoencoder model.
[0018] Preferably, the nanophotonic metamaterial unit comprises an upper layer, a middle layer, and a lower layer; the lower layer is fully covered with gold, has an electrical conductivity of 4.561e+007 S / m, and a thickness of t = 50 nm; the middle layer dielectric substrate material has a specified dielectric constant of 2.0(1+0.003i), a magnetic permeability of 1.0, a width of l1 = 2000 nm, and a thickness of h = 100 nm; the upper layer is divided into a coding pattern region, the width of which is less than l1, and the coding pattern region is divided into a 64×64 matrix. The gold patch of the coding pattern has an electrical conductivity of 4.561e+007 S / m, a width of 31.25 nm, and a thickness of t = 50 nm. The coding pattern pattern uses eight common metamaterial antenna shapes.
[0019] The specific steps in S3 are as follows:
[0020] The constructed forward prediction network model consists of a feature extraction network and three parallel spectral prediction modules. The feature extraction network extracts features from the encoding matrix and outputs a 512-dimensional feature vector. The parallel spectral prediction modules accept the 512-dimensional vector and output 51-dimensional Rxx, Ryy, and Rxy vectors respectively. Finally, the vectors are merged and concatenated to form the network output. The feature extraction network adopts the ResNet34 structure. The network optimizer is set to Adam with a learning rate of 1e-4.
[0021] use Let represent the network loss function, where y is the true value. Let N be the predicted value, and N be the dimension. The training set is fed into the forward prediction network model for training. The total loss value of the forward prediction network is defined as... Where Rf is the reflectance spectral vector of the positive prediction dataset, This is the reflectance spectrum vector predicted by the forward prediction network. After training, the parameters of the forward prediction network model are fixed.
[0022] Specifically, in step S4, the steps are as follows:
[0023] The encoder of the conditional variational autoencoder includes a feature extraction network that uses a ResNet34 backbone convolutional network module. It accepts a 153-dimensional reflectance spectrum vector and a 64×64×1 encoding matrix vector as input, generating a 20-dimensional mean vector and variance vector of the posterior probability distribution parameters. The decoder consists of transposed convolutional layers. The reparameterized 20-dimensional latent space vector is concatenated with the reflectance spectrum and used as input. After being transposed and convolved by the decoder, it generates a 64×64×1 structure matrix tensor.
[0024] Specifically, in S5, the iterative training steps are as follows:
[0025] S51. The encoding matrix-reflectance spectrum vector of the training set is fed into the feature extraction network of the encoder in pairs to obtain a 512-dimensional compact feature vector. This vector is then passed through two dense layers and outputs a 20-dimensional statistical parameter mean vector and a log-variance vector that approximate the posterior distribution.
[0026] S52. Obtain the latent space vector z through resampling;
[0027] S53. The latent space vector obtained in S52 is concatenated with the 153-dimensional reflection spectrum vector and then fed into the reconstruction network of the decoder to generate the reconstructed metamaterial design coding matrix.
[0028] S54. Calculate the reconstruction error by reconstructing the coding matrix pattern output by the network and the KL divergence error by calculating the statistical parameters output by the encoder, and update the network parameters of the conditional variational autoencoder by performing the backpropagation algorithm.
[0029] Specifically, in step S6, the steps for finding the optimal potential vector using the particle swarm optimization algorithm are as follows:
[0030] S61. Given the expected reflectance spectrum, randomly sample a 20-dimensional potential vector z from the standard normal distribution N(0,I) and concatenate the two, then feed them into the reconstruction network to obtain the candidate design;
[0031] S62. Using a forward prediction model, predict the reflectance spectrum of the candidate design, maintaining a mean square error of less than 10% compared to the true reflectance spectrum. -3 The samples were used as the final design result of random sampling;
[0032] S63. The particle swarm optimization algorithm treats the 20-dimensional potential vector as particles. First, it initializes the position and velocity of the particles and sets the initial values for individual optima and global optima.
[0033] S64. Iterative update: Based on the particle's current position, the decoder is used to obtain image predictions, and the predicted reflectance spectrum is calculated through a forward prediction network. The evaluation update process includes updating the particle fitness using the error between the predicted spectrum and the expected spectrum, including individual optimality and global optimality, and retaining samples that meet the threshold conditions.
[0034] S65. Terminate after reaching the maximum number of iterations or finding a sufficient number of valid samples.
[0035] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the reverse design method for nanophotonic metamaterial structures based on CVAE and PSO of the present invention.
[0036] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the reverse design method for nanophotonic metamaterial structures based on CVAE and PSO of the present invention.
[0037] Beneficial effects: By introducing latent space optimization search and using a positive prediction network model as an alternative electromagnetic simulation simulator, compared with the traditional random sampling method, the time-consuming and blind multiple sampling process is avoided. The material structure that best matches the target spectrum can be found within seconds, improving the accuracy of the final on-demand design of candidate structures. Attached Figure Description
[0038] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.
[0039] Figure 1 This is a schematic diagram of the nanophotonic metamaterial unit structure in an embodiment of the present invention;
[0040] Figure 2 This is a flowchart illustrating the structure and training process of the forward network model in an embodiment of the present invention.
[0041] Figure 3 This is a flowchart illustrating the structure and training process of the conditional variational autoencoder network model in this embodiment of the invention.
[0042] Figure 4 This is a graph showing the decreasing trend of the loss function during the forward network training process in an embodiment of the present invention.
[0043] Figure 5 This is a graph showing the decreasing trend of the loss function during the training process of the conditional variational autoencoder in this embodiment of the invention.
[0044] Figure 6 This refers to the difference between the predicted and simulated values of the forward network in this embodiment of the invention.
[0045] Figure 7 This describes the reconstruction of a specific sample during the training process in this embodiment of the invention.
[0046] Figure 8 This is a flowchart of the particle swarm latent space optimization search algorithm in an embodiment of the present invention;
[0047] Figure 9 This is a comparison between the results of the particle swarm latent space optimization search algorithm reverse-engineering for a specific spectrum and the results of random sampling in an embodiment of the present invention. Detailed Implementation
[0048] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings and specific implementation examples.
[0049] This invention proposes a reverse design method for nanophotonic metamaterial structures based on CVAE and PSO intelligent optimization. To improve the accuracy of the reverse design, a latent space search strategy based on the Particle Swarm Optimization (PSO) algorithm is adopted. By searching and optimizing the smooth and continuous standard normal distribution latent space generated after training, and using a pre-trained forward prediction network model as the evaluation criterion, the fitness of the particle swarm during the iteration process is evaluated and the position is updated, thereby achieving the optimization of the design objective.
[0050] The technical solution of the present invention is as follows:
[0051] Step 1: Input the design of the nanophotonic metamaterial unit structure and the periodic arrangement of related parameters into electromagnetic simulation software to obtain the corresponding reflection spectrum and construct the dataset required for model training; the dataset includes two-dimensional images characterizing the material structure and electromagnetic reflection spectra, wherein the electromagnetic reflection spectra include three types of linearly polarized reflection spectra.
[0052] The design of nanophotonic metamaterial units, such as Figure 1 As shown, Figure 1 (a) is a front view, and (b) is a side view. The dielectric constant of the middle layer substrate material is specified as 2.0(1+0.003i), the width l1 = 2000nm, and the thickness h = 100nm. The lower layer is covered with all-metal gold, with a conductivity of 4.561e+007S / m and a thickness t = 50nm. The upper layer is divided into a coding pattern area, the width of which is less than l1. The coding pattern area can be divided into a 64×64 matrix. The conductivity of the coding pattern metal gold patch is 4.561e+007S / m, the width is 31.25nm, and the thickness is t = 50nm. The coding pattern pattern uses eight common metamaterial antenna shapes.
[0053] In step one, the steps for constructing the dataset required for model training are as follows:
[0054] 1) 3000 basic grayscale pattern samples were collected for eight shapes: cross, H, open ring, ellipse, bow tie, L, rectangle and arc. The grayscale patterns were further converted into 64×64 binary coding matrices to construct the corresponding electromagnetic metasurface units. The corresponding electromagnetic responses were obtained by sending them into electromagnetic simulation software. The frequency range was set to 60~160Thz.
[0055] 2) The 64×64 binary coding matrix is used as the input to the forward prediction network, and it is also one of the inputs to the conditional variational autoencoder;
[0056] 3) The three types of electromagnetic reflection spectrum curves Rxx, Ryy, and Rxy are sampled at a uniform frequency with a sampling interval of 2Thz, and represented as 51-dimensional vectors respectively. The three 51-dimensional vectors are then concatenated to obtain a reflection spectrum vector with a length of 153 dimensions. This vector serves as both the label for the forward prediction network dataset and one of the inputs to the conditional variational autoencoder model.
[0057] Step 2: Divide the model training dataset constructed in Step 1 into 80% training set, 10% validation set, and 10% test set.
[0058] The input to the forward prediction dataset is a 64×64 encoding matrix, with corresponding labels being a concatenation of 153-dimensional Rxx, Ryy, and Rxy vectors. The input to the conditional autoencoder model dataset is a 64×64 encoding matrix vector, with the corresponding spectral data also serving as input, which is also a concatenation of 153-dimensional Rxx, Ryy, and Rxy vectors.
[0059] Step 3: Construct as follows Figure 2 The positive prediction network model shown is constructed with a main architecture consisting of a feature extraction network. This network uses the ResNet34 backbone and includes three parallel fully connected layers to fit three different spectral line shape vectors. The network optimizer is set to Adam with a learning rate of 1e-4.
[0060] use Let represent the network loss function, where y is the true value. Let N be the predicted value, and N be the dimension. The training set is fed into the forward prediction network model for training. The total loss value of the forward prediction network is defined as... Where Rf is the reflectance spectral vector of the positive prediction dataset, This is the reflectance spectrum vector predicted by the forward prediction network. After training, the parameters of the forward prediction network model are fixed.
[0061] Step 4: Construct a conditional variational autoencoder network model, including an encoder network and a decoder network, and initialize the network parameters;
[0062] The encoder of the conditional variational autoencoder includes a feature extraction network that uses a ResNet34 backbone convolutional network module. It accepts a 153-dimensional reflectance spectrum vector and a 64×64×1 encoding matrix vector as input, generating a 20-dimensional mean vector and variance vector of the posterior probability distribution parameters. The decoder consists of transposed convolutional layers. The reparameterized 20-dimensional latent space vector is concatenated with the reflectance spectrum and used as input. After being transposed and convolved by the decoder, it generates a 64×64×1 structure matrix tensor.
[0063] Step 5: Input the encoded pattern matrix and 153-dimensional reflectance spectral vector from the model training dataset into the encoder as data pairs. At the same time, the decoder needs to provide the 153-dimensional reflectance spectral vector as input to the generator network. Then, perform iterative training.
[0064] The training loss function of a conditional variational autoencoder consists of two main parts: the reconstruction loss of the metasurface structure pattern and the KL divergence loss between the encoder output approximate posterior distribution and the standard normal prior distribution.
[0065]
[0066] Where x, y, and z represent the encoded pattern matrix, the 153-dimensional spectral response vector, and the latent vector, respectively, and φ and θ represent the parameters of the encoding network and the generating network, respectively. The first term represents the approximate posterior distribution q formed by the latent vector z jointly encoded by the metamaterial and the spectral response. φ (z|x,y) and the standard normal prior distribution p θ The KL divergence loss between (z) and β is the weighting coefficient; the second term represents the reconstructed log-likelihood error between the metamaterial reconstructed pattern obtained by combining the spectral response with the output of the generator network and the real pattern.
[0067] In step five, the iterative calculation process for each round is as follows:
[0068] Step 5.1: The encoding matrix (64×64×1) and reflectance spectrum (153×1) of the training set are fed into the feature extraction network of the encoder in pairs to obtain a compact feature vector of 512 dimensions. After passing through two dense layers, the vector outputs a 20-dimensional statistical parameter mean vector mean and a log-variance vector logvar with an approximate posterior distribution, with a size of 20×1.
[0069] Step 5.2: Obtain the latent space vector z using the traditional resampling method. The specific resampling process is z = mean + var * ε, where ε is a 20-dimensional random vector that follows a standard normal distribution, i.e., ε ~ N(0, I).
[0070] Step 5.3: The latent space vector obtained in Step 5.2 is concatenated with the 153-dimensional reflectance spectrum vector in the last dimension to form a 173×1 vector, which is then fed into the reconstruction network of the generator to perform transpose convolution upsampling operation to obtain the reconstructed metamaterial design coding matrix.
[0071] Step 5.4: Calculate the pixel-by-pixel reconstruction error using the encoding matrix pattern output by the reconstructed network, and calculate the KL divergence error using the statistical parameters output by the encoder. Accumulate and summarize the errors, and use the backpropagation algorithm to update the encoder network and generator network parameters of the conditional variational autoencoder. The KL divergence loss term needs to be multiplied by a small weighting coefficient β to avoid posterior collapse. In this embodiment, the weighting coefficient is 10. -4 ;
[0072] Step Six: During the training process, this invention deliberately makes the approximate posterior distribution q φ (z|x,y) approximates the prior distribution p. θ (z), and this invention assumes a prior distribution p θ (z) follows a standard normal Gaussian distribution, so after the model is fully trained, its latent space must be continuous and smooth. The reverse design process is to generate conditional control over the fully trained conditional variational autoencoder model. Here, the particle swarm optimization algorithm is introduced to search for the optimal latent vector in the latent space.
[0073] In step six, the latent space search calculation process of the particle swarm optimization algorithm is as follows:
[0074] Step 6.1: The particle swarm optimization algorithm treats the 20-dimensional latent vector as particles. First, it initializes the position and velocity of the particles and sets the initial values of the individual optimum (the best position in the history of each particle) and the global optimum (the best position in the history of all particles). Specifically, m latent vectors are randomly sampled as initial particles. The position and velocity of the particles are random vectors of the same size as the latent vectors and are all sampled from the standard normal distribution.
[0075] Step 6.2: Iterative update. Based on the particle's current position, input the particle (potential vector) and the given spectrum into the decoder to obtain the material image matrix, i.e. Then input the prediction matrix into the forward prediction network to calculate the predicted reflectance spectrum. We use a fitness function to calculate scores, further obtaining the fitness of each particle, determining whether to update the individual optimum and the global optimum, and then calculate the particle velocity. The fitness function can be a non-differentiable function; here we will predict the reflectance spectrum. The mean square error between the true reflectance spectrum R and the actual reflectance spectrum R is used as the fitness function, i.e. The arbitrariness of the fitness function enhances the algorithm's applicability in designing photonic structures with complex design goals. The particle's velocity and position are updated according to the following formula:
[0076] v i (t+1)=w·v i (t)+c1*r1*(pBesti -x i (t))+c2*r2*(gBest-x i (t))
[0077] x i (t+1)=x i (t)+v i (t+1)
[0078] Where: v i (t) is the velocity of particle i at time t, w is the inertia weight, controlling the degree to which the particle maintains its original velocity, and c1 and c2 are learning factors, controlling the degree to which the particle approaches its individual optimal position and global optimal position, respectively. r1 and r2 are random numbers, usually between [0,1]. pBest i gBest is the individual best position of particle i, gBest is the global best position, and x is the individual best position of particle i. i (t) is the position of particle i at time t.
[0079] Step 6.3: If the maximum number of iterations is reached or a sufficient number of valid samples (set by the user) are collected, terminate the iteration and return the valid samples. Valid samples are those whose mean square error between the predicted reflectance spectrum and the true reflectance spectrum is less than a preset threshold.
[0080] The proposed method for designing nanophotonic metamaterials based on conditional variational autoencoders (CVAEs) and optimization algorithms constructs a smooth and continuous latent space containing rich metamaterial structure-response information by jointly encoding metamaterial structural information and reflection spectral information. Then, the particle swarm optimization algorithm is combined to efficiently optimize the latent space, effectively improving the design accuracy and efficiency of reverse design post-processing.
[0081] The following examples illustrate the invention:
[0082] Example 1:
[0083] Using Python programming, 3000 pattern samples were generated for each of eight patterns: cross, H, open loop, ellipse, bow tie, L, rectangle, and arc. These generated pattern samples were then fed into electromagnetic simulation software for numerical simulation. Following step one of the specific implementation steps, a dataset containing 24,000 pairs of data (encoding matrices and three types of linear polarization reflectance spectra) was constructed. Based on the specific implementation steps, the dataset was divided into a training set of size 19200, a validation set of size 2400, and a test set of size 2400.
[0084] Following step three, a forward prediction network model was built, and the forward prediction dataset was fed into the model for iterative training. The optimizer for model training was set to Adam, with an initial learning rate of 1e-4. The training epochs were set to 10000, and an early stopping mechanism was defined, which automatically stopped training if the validation set loss did not decrease for 200 consecutive epochs.
[0085] Figure 4 The table shows the decrease in the total loss value over several training epochs before early training stoppage. The loss function of the forward prediction network gradually decreases, and the losses on the training and test sets are similar, eventually converging synchronously to a lower value. The forward prediction network exhibits high accuracy and generalization ability. After 2500 training epochs, the training set loss forward = 2.07e-4; the test set loss forward = 2.16e-4. Specifically, the specific values of each loss value on the test set are shown in Table 1. After 2500 training epochs, the test set approaches convergence and has achieved high accuracy. Randomly selected examples from the test set show the difference between the predicted and simulated values as follows: Figure 6 As shown, the predicted values and simulated values of the forward prediction network fit each other very well on the three types of reflection curves. The forward prediction network has achieved high accuracy and can quickly and accurately predict the reflection spectrum of nanophotonic metamaterials.
[0086] Table 1. Specific values of the loss function during the forward network training process.
[0087]
[0088] The trained positive prediction network is then fixed in parameters. Following step four, the encoder and decoder of the conditional variational autoencoder are constructed. Further, the dataset is fed into the encoder and decoder networks for iterative training, as per step four. The optimizer is set to Adam, with an initial learning rate of 1e-4, a training epoch of 10000, and early stopping enabled. The weight coefficient β of the KL divergence loss term is 10. -4 During training, observe the reconstruction of the material structure and record the trends of reconstruction loss and KL divergence loss.
[0089] Figure 5 The diagram shows the changes in total loss, reconstruction loss, and KL divergence loss during training epochs. The total loss and reconstruction loss show a decreasing trend, indicating that the model effectively achieves the encoding and decoding reconstruction process. Simultaneously, the KL divergence loss shows a trend of first decreasing and then increasing, indicating that the model effectively pushes the approximate posterior distribution towards a predefined standard normal Gaussian distribution. This fully demonstrates that the conditional variational autoencoder model has high accuracy and generalization ability. After more than one thousand training epochs, the training set loss total = 2.12e-2, MSE...recon =1.44e-2, KL_Loss=67.49; Test set Losstotal=2.42e-2, MSE recon =1.74e-2, KL_Loss=67.39; Specifically, the specific values of each loss on the test set are shown in Table 2. After thousands of training cycles, the test set also tends to converge, achieving high accuracy in reconstruction loss. Figure 7 The reconstruction effect of the model for a certain sample as it changes with rounds is shown in the figure.
[0090] Table 2. Specific numerical values of the loss function during the training of the Conditional Variational Autoencoder network.
[0091]
[0092]
[0093] After the variational autoencoder network is trained, this embodiment uses an optimization algorithm to iteratively search for samples in the latent space. Figure 8 The algorithm flow for particle swarm optimization search is illustrated. In this embodiment, a sample is extracted from the test set, the number of particles is set to 30, and after initializing the particle population, iterative search begins. After 100 rounds of iterative search within seconds, target samples that meet the spectral threshold are obtained. Figure 9 As shown, the proposed latent space particle swarm optimization algorithm can achieve efficient and accurate reverse design, meeting the requirements for fast and accurate design.
[0094] The specific parameter settings are as follows:
[0095]
[0096] Example 2:
[0097] The computer-readable storage medium of this embodiment stores a computer program that, when executed by a processor, implements the steps in the reverse design method for nanophotonic metamaterial structures based on CVAE and PSO in Embodiment 1.
[0098] The computer-readable storage medium in this embodiment can be an internal storage unit of the terminal, such as the terminal's hard disk or memory; the computer-readable storage medium in this embodiment can also be an external storage device of the terminal, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc. equipped on the terminal; furthermore, the computer-readable storage medium can include both the terminal's internal storage unit and external storage devices.
[0099] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0100] Example 3:
[0101] The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the reverse design method of nanophotonic metamaterial structure based on CVAE and PSO in Embodiment 1.
[0102] In this embodiment, the processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. The memory can include read-only memory and random access memory, and provides instructions and data to the processor. A portion of the memory can also include non-volatile random access memory. For example, the memory can also store device type information.
[0103] Those skilled in the art will understand that the content disclosed in the embodiments can be provided as a method, system, or computer program product. Therefore, this solution can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this solution can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage) containing computer-usable program code.
[0104] This solution is described with reference to flowchart illustrations and / or block diagrams of methods and computer program products according to embodiments of this solution. 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 program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0105] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0107] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0108] This invention provides a reverse design method for nanophotonic metamaterial structures based on CVAE and PSO. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.
Claims
1. A reverse design method for nanophotonic metamaterial structures based on CVAE and PSO, characterized in that, The specific steps are as follows: S1. Construct a dataset, which includes a binary encoding matrix converted from a basic grayscale image and an electromagnetic reflection spectrum vector; S2. Divide the dataset constructed in S1 into 80% training set, 10% validation set, and 10% test set; S3. Construct a positive prediction network model, feed the training set into the positive prediction network model for iterative training, and fix the parameters of the positive prediction network model after training is completed. S4. Construct a conditional variational autoencoder network model, including an encoder network and a decoder network, and initialize the network parameters; S5. The binary encoding matrix and reflectance spectrum vector in the training set are used as data pairs and fed into the conditional variational autoencoder network model for iterative training. S6. Find the optimal latent vector through particle swarm optimization algorithm, concatenate the latent vector with the reflection spectrum vector and input it into the conditional variational autoencoder network model to obtain the candidate design structure, and use the forward prediction network model to filter it, thus obtaining the reverse design material pattern. In S1, the specific steps for constructing the dataset are as follows: S11. Eight grayscale pattern samples of shapes—cross, H, open ring, ellipse, bow tie, L, rectangle, and arc—are collected using nanophotonic metamaterial units. These grayscale patterns are then converted into 64 × 64 binary encoding matrices to construct corresponding electromagnetic metasurface units. The samples are then fed into electromagnetic simulation software to obtain the corresponding electromagnetic response reflection spectrum curves, with a frequency range of 60–160 Thz. The electromagnetic reflection spectrum includes three types of linear polarization reflection: the reflection coefficients Rxx and Ryy for incident waves with co-polarization in the x and y directions, and the reflection coefficient Rxy for cross-polarized incident waves. S12. The 64 × 64 binary coding matrix is used as the input to the forward prediction network, and it is also one of the inputs to the conditional variational autoencoder; S13. The three types of electromagnetic reflection spectrum curves Rxx, Ryy, and Rxy are sampled at a uniform frequency with a sampling interval of 2Thz, and represented as 51-dimensional vectors respectively. The three 51-dimensional vectors are then concatenated to obtain a reflection spectrum vector with a length of 153 dimensions. The reflection spectrum vector serves as both a label for the forward prediction network dataset and one of the inputs to the conditional variational autoencoder model. In step S3, the specific steps are as follows: A forward prediction network model is constructed, which consists of a feature extraction network and three parallel spectral prediction modules. The feature extraction network is used to extract the features of the encoding matrix and outputs a 512-dimensional feature vector. The parallel spectral prediction modules accept the 512-dimensional vector and output 51-dimensional Rxx, Ryy, and Rxy vectors respectively. Finally, they are merged and spliced to form the output of the network. In step S4, the specific steps are as follows: The encoder of the conditional variational autoencoder includes a feature extraction network that uses a ResNet34 backbone convolutional network module. It accepts a 153-dimensional reflectance spectrum vector and a 64×64×1 encoding matrix vector as input, and generates a 20-dimensional mean vector and variance vector of the posterior probability distribution parameters. The decoder consists of transposed convolutional layers. The reparameterized 20-dimensional latent space vector is concatenated with the reflectance spectrum and used as input. After being transposed and convolved by the decoder, it generates a 64×64×1 structure matrix tensor. In S5, the specific steps of iterative training are as follows: S51. The encoding matrix-reflectance spectrum vector of the training set is fed into the feature extraction network of the encoder in pairs to obtain a 512-dimensional compact feature vector. This vector is then passed through two dense layers and outputs a 20-dimensional statistical parameter mean vector and a log-variance vector that approximate the posterior distribution. S52. Obtain the latent space vector z through resampling; S53. The latent space vector obtained in S52 is concatenated with the 153-dimensional reflection spectrum vector and then fed into the reconstruction network of the decoder to generate the reconstructed metamaterial design coding matrix. S54. Calculate the reconstruction error by reconstructing the coding matrix pattern output by the network and the KL divergence error by calculating the statistical parameters output by the encoder, and update the network parameters of the conditional variational autoencoder by performing the backpropagation algorithm. In step S6, the specific steps for finding the optimal potential vector using the particle swarm optimization algorithm are as follows: S61. Given a desired reflectance spectrum, from a standard normal distribution A 20-dimensional latent vector z is randomly sampled from the network, and the expected reflectance spectrum and the 20-dimensional latent vector z are concatenated and fed into the reconstruction network to obtain the candidate design. S62. Using a forward prediction model, predict the reflectance spectrum of the candidate design, maintaining a mean square error of less than the true reflectance spectrum. The samples were used as the final design result of random sampling; S63. The Particle Swarm Optimization algorithm treats the 20-dimensional potential vector as particles. First, it initializes the position and velocity of the particles and sets the initial values for individual optima and global optima. S64. Iterative update: Based on the particle's current position, the decoder obtains image predictions, and the predicted reflectance spectrum is calculated through a forward prediction network. The evaluation update process includes updating the particle fitness using the error between the predicted spectrum and the expected spectrum, including individual optimality and global optimality, and retaining samples that meet the threshold condition. S65. Terminate after reaching the maximum number of iterations or finding a sufficient number of valid samples.
2. The design method according to claim 1, characterized in that, The nanophotonic metamaterial unit comprises an upper layer, a middle layer, and a lower layer; the lower layer is fully covered with metallic gold, has an electrical conductivity of 4.561e + 007 S / m, and a thickness of... =50 ; The dielectric constant of the intermediate layer substrate material is specified as 2.0 (1 + 0.003i), the permeability is 1.0, and the width is... =2000 Thickness h=100 The upper layer is divided into a coding pattern area, the width of which is less than... The coded pattern area is divided into a 64 × 64 matrix. The conductivity of the gold metal patch in the coded pattern is 4.561e + 007 S / m, and the width is 31.
25. The thickness is = 50 The coding pattern uses eight common metamaterial antenna shapes.
3. The design method according to claim 1, characterized in that, In S3, the feature extraction network adopts a ResNet34 structure; the network optimizer is set to Adam with a learning rate of 1e-4; and... Let represent the network loss function, where For the true value, Let N be the predicted value, and N be the dimension. The training set is fed into the forward prediction network model for training. The total loss value of the forward prediction network is defined as... ,in, For the reflectance spectral vector of the positive prediction dataset, This is the reflectance spectrum vector predicted by the forward prediction network. After training, the parameters of the forward prediction network model are fixed.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processor, it implements the reverse design method for nanophotonic metamaterial structures based on CVAE and PSO as described in any one of claims 1 to 3.
5. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the reverse design method for nanophotonic metamaterial structures based on CVAE and PSO as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Superatom reverse design method based on LDM-PNN and particle swarm optimization
CN116913436A
Hyperspectral abnormal target detection method based on multi-scale analysis and variational auto-encoder
CN118279747A