Generative model for multiple-purpose inverse design and forward prediction of disordered waveguides in linear and nonlinear regimes
if you like our work, please reference us. This generation contains large uncertainty and diversity, if you want to more precise model, please see the Conditions_Mimicking_WGAN_Disordered_Waveguide_inverse_design project.
The Work has been presented in Machine Learning in Photonics, SPIE PHOTONICS EUROPE 8 April 2024, Strasbourg, France. https://spie.org/photonics-europe/presentation/Generative-model-for-multiple-purpose-inverse-design-and-forward-prediction/13017-2
Platform:
CPU: AMD R9 5900x 4.6Ghz
GPU: ASUS ROG strix 3090oc
RAM: Crucial 48GB 4200Mhz oc
Pytorch Version: 2.0.1 + cuda 11.7
Conda Version: v23.7.2
In this project, we demonstrated the random waveguide design in image size 64 x 64 x 1 channel, and physical size 6.4 x 6.4 um. The waveguide was stimulated via the FDTD method using custom Fortran code. Ref: Optical parametric oscillations in isotropic photonic crystals, Claudio Conti, Andrea Di Falco, and Gaetano Assanto. https://opg.optica.org/oe/fulltext.cfm?uri=oe-12-5-823&id=79198
Traditional inverse design waveguides use all kinds of optimization techniques, such as PSO, GA. However, these methods are all very time-consuming. Therefore, Data-driven Machine learning is introduced. A Wasserstein generative adversarial network (WGAN-gp) is used for inverse design random waveguide, and CNN is used for forward prediction.
Our work considered more randomness in order to extend the overall degree of freedom of waveguide design space. Therefore, it is possible to improve model generalization to avoid mode collapse during the training, as our physical data is sparse type. 200 etched holes in total 4096 design space.
Examples to support our findings
The model prediction is measured with MSE, and the acceptable error is within 10%. Due to CNN kernel scanning ability for random, sparse type doesn't perform well.
This code was written and run in Windows 10. Therefore, number_workers = 0 If you want to run it in Linux, please remember to change the number_workers to your desired number.
Steps:
-
if your data is split in *. txt, you can use convertarray2image.py in Utilities folder Notice: Remember to change color, size, row and col size to fit your data.
-
Check Dataloder.py Notice: Check your data path, image path, data index to avoid error
-
Check Model.py in Model folder Notice: Model.py contains some hyperparameters (where some are also can be controlled in main.py)
-
Check main.py and run Notice: main.py contains hyperparameters and need to be changed to suit your data. Dont forgot the save location.
-
Check Pre_Known.py and Unknown.py Notice: path location and Z_dim size to avoid errors.
-
Load generated geometry, go through Norm_image.py to remove noise Notice: check >, <, = value to estimate noise from images
-
Do regression in Nonlinear folder Notice: remember to change hyperparameters to fit your data, repeat 10 times for different power input
-
Prediction using Nonlinear_pred1e0.py, etc Notice: Where to predict the output, etc