Optimization method of optical diffraction neural network
By designing a multi-objective loss function and optimizing the phase parameter distribution of the optical diffraction neural network, the problem that optical diffraction neural network is difficult to achieve high classification accuracy and high diffraction efficiency at the same time in image classification tasks is solved, and more efficient optical calculations are achieved.
Patent Information
- Application Number
- CN202411570776.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-06
Smart Images

Figure CN119540720A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an optimization method of an optical diffraction neural network, and belongs to the technical field of optical diffraction neural networks. Background Art
[0002] Optical diffraction neural networks make full use of the advantages of optical computing such as high speed, low power consumption and parallel processing, and have unique advantages in computer vision tasks, such as image classification, significant target detection, diffuse medium imaging, etc. By designing a loss function to optimize the modulation information of the phase of the diffraction layer, specific computational reasoning tasks can be achieved.
[0003] At present, there are two main types of loss functions for optical diffraction neural networks used for image classification tasks: mean square error loss function and cross entropy loss function. The mean square error loss function is based on the regression loss design principle, which can well realize the output light field of the optical diffraction neural network to be distributed in a directional area and maintain a high diffraction efficiency, but the image classification accuracy is not high. The cross entropy loss function is based on the classification loss design principle and can achieve a high classification accuracy, but it will cause the overall diffraction efficiency of the optical diffraction neural network system to decrease, affecting subsequent detection and analysis.
[0004] Therefore, those skilled in the art need to overcome the problem that the optical diffraction neural network model in image classification tasks has low diffraction efficiency while achieving high classification accuracy. Summary of the invention
[0005] Objective: In order to overcome the shortcomings of the prior art, the present invention provides an optimization method for an optical diffraction neural network, combines classification reasoning and diffraction efficiency performance to design a multi-objective loss function, jointly optimizes the phase parameter distribution of the optical diffraction neural network, and realizes an optical diffraction neural network model with high classification accuracy and high diffraction efficiency.
[0006] Technical solution: To solve the above technical problems, the technical solution adopted by the present invention is:
[0007] An optimization method for an optical diffraction neural network, specifically comprising:
[0008] Step 1: Obtain an optical diffraction neural network constructed based on phase modulation, wherein the optical diffraction neural network includes an input plane, an output plane, and multiple phase modulation diffraction layers.
[0009] Step 2: Define M detection areas in the output plane according to the total categories M of the image training data set. Each detection area corresponds to a category. Calculate the energy of each detection area and the total energy of the output plane. Determine the category of the input image according to the maximum value of the energy of the M detection areas. Normalize the ratio of the energy of the detection area corresponding to each category to the total energy of the output plane, and calculate the performance loss of classification reasoning.
[0010] Step 3, based on the diffraction efficiency of the optical diffraction neural network, construct a diffraction efficiency loss function of the relative relationship between the energy of the detection area corresponding to the correct category and the total energy of the input plane.
[0011] Step 4, correcting the loss function of the diffraction efficiency performance, setting a reference value of the ideal diffraction efficiency of the system, and obtaining the performance loss of the corrected diffraction efficiency.
[0012] Step 5, combining the performance loss of classification reasoning and the performance loss of corrected diffraction efficiency, constructing a multi-objective loss function, and using the multi-objective loss function to jointly optimize the phase parameters of the optical diffraction neural network to obtain the optimized phase parameters.
[0013] Step 6: Update the optical diffraction neural network according to the optimized phase parameters to obtain the optimized optical diffraction neural network.
[0014] As a preferred solution, the optical diffraction neural network includes a forward propagation model and a back propagation model. The forward propagation model is established according to the Rayleigh-Sommerfeld diffraction theory, and the forward propagation model realizes the transmission of the light field from the input light field to the output plane for image classification tasks; the back propagation model is realized according to the back propagation algorithm to optimize the phase parameter distribution of the optical diffraction layer.
[0015] As a preferred solution, the expression of the forward propagation model is as follows:
[0016]
[0017] in, represents the forward propagation model, It is the superposition of the incident light field of all k diffraction neural units in the l-1th layer incident on the i-th diffraction neural unit in the l-th diffraction layer. λ represents the working wavelength of the incident light, represents the coordinates of the i-th diffractive neural unit, Indicates that the coordinates of the lth layer are The output light field at the diffraction neural unit is transmitted to the l-1th layer with coordinates The light wave transmission coefficient at the diffraction neural unit, Represents the transmission coefficient corresponding to the i-th diffractive neural unit in the l-th layer.
[0018] As a preferred option,
[0019] in, Representing coordinates and coordinates The Euclidean distance between diffraction neural units, λ represents the incident light working wavelength, , represents pi, represents the natural exponential function.
[0020] t i l ( x i , y i , z i , λ ) = a i l ( x i , y i , z i , λ ) exp [ j ϕ i l ( x i , y i , z i , λ ) ]
[0021] in, represents the amplitude coefficient, Represents the phase coefficient, the amplitude coefficient is set to a constant 1, and the phase coefficient is a learnable parameter with a value range of [ 0 , 2 π ] .
[0022] As a preferred solution, the back propagation model adopts a random gradient descent algorithm to modulate the phase coefficient of the diffraction layer. as a learnable parameter to be optimized.
[0023] As a preferred solution, the cross entropy loss function is used to calculate the performance loss of classification reasoning.
[0024] As a preferred solution, the performance loss of the classification reasoning is The calculation formula is as follows:
[0025]
[0026] in, One-hot encoded vector representing the true label of the image sample, It represents the normalized value of the energy of the mth detection area, and M represents the total number of detection areas.
[0027] As a preferred option,
[0028] in, represents the energy of the mth detection area, represents the natural exponential function, and M represents the total number of detection regions.
[0029] As a preferred solution, the loss function expression of the diffraction efficiency is as follows:
[0030]
[0031] in, represents the energy of the detection area, represents the total energy of the input plane.
[0032] As a preferred solution, the performance loss of the corrected diffraction efficiency is , the calculation formula is as follows:
[0033]
[0034] in, A reference value representing the ideal diffraction efficiency of a system.
[0035] As a preferred solution, the multi-objective loss function expression is:
[0036]
[0037] in, Represents a configurable hyperparameter, with a value range of [ 0 , 1 ] .
[0038] Beneficial effect: The present invention provides an optimization method for an optical diffraction neural network, which designs a multi-objective loss function by combining classification reasoning performance and diffraction efficiency performance, and jointly optimizes the diffraction layer phase parameter distribution of the optical neural network, thereby greatly improving the diffraction efficiency of the trained optical diffraction neural network.
[0039] Compared with the prior art, the advantages of the present invention are:
[0040] 1) Compared with the traditional cross entropy loss function training method, the method of the present invention greatly improves the diffraction efficiency of the optical diffraction neural network by adding a diffraction efficiency performance loss function on the basis of the original cross entropy loss function of classification performance.
[0041] 2) The trained optical diffraction neural network alleviates the problem of output plane field distribution spuriousness, has higher signal contrast, enhances the robustness of the system, and further promotes the application of optical diffraction neural networks in actual image classification scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a schematic flow chart of the method for optimizing the phase of the optical diffraction neural network of the present invention.
[0043] Figure 2 This is a result diagram of the phase optimization training process of the multi-objective loss function provided in an embodiment of the present invention on a handwritten digital data set. Figure 2 (A) shows the overall loss value change during training. Figure 2 Middle (B) shows the classification inference accuracy and diffraction efficiency change results of the optical diffraction neural network model tested on the validation set.
[0044] Figure 3 This is a distribution diagram of the phase modulation diffraction layer parameters of the optical diffraction neural network provided in an embodiment of the present invention.
[0045] Figure 4 This is a confusion matrix diagram of the optical diffraction neural network provided in an embodiment of the present invention on a handwritten digital data test set.
[0046] Figure 5 The figure compares the optimization result (using the multi-objective loss function) obtained on the handwritten digit dataset in an embodiment of the present invention with the result before optimization (using the traditional cross entropy loss function). Figure 5 (A) is the result before optimization. Figure 5 The middle (B) is the result after optimization. Figure 5 Middle (C) is the performance comparison of the optical diffraction neural network before and after optimization. DETAILED DESCRIPTION
[0047] The following is a clear and complete description of the technical solutions in the examples of the present invention in conjunction with the accompanying drawings in the examples of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the protection scope of the present invention.
[0048] The present invention will be further described below in conjunction with specific embodiments.
[0049] Embodiment 1:
[0050] This embodiment introduces an optimization method for an optical diffraction neural network. Figure 1 As shown, the method is specifically described as follows:
[0051] Step 1: construct an optical diffraction neural network based on phase modulation, wherein the optical diffraction neural network includes an input plane, an output plane, and multiple phase modulation diffraction layers.
[0052] Step 2: Define M detection areas in the output plane according to the total categories M of the image training data set. Each detection area corresponds to a category. Calculate the energy of each detection area and the total energy of the output plane. Determine the category of the input image according to the maximum value of the energy of the M detection areas. Normalize the ratio of the energy of the detection area corresponding to each category to the total energy of the output plane. Use the cross entropy loss function to calculate the performance loss of classification reasoning.
[0053] Step 3, based on the diffraction efficiency of the optical diffraction neural network, construct a diffraction efficiency loss function of the relative relationship between the energy of the detection area corresponding to the correct category and the total energy of the input plane.
[0054] Step 4, in order to balance the problem of too small performance loss of diffraction efficiency in step 3 during the training process, the loss function of the diffraction efficiency performance is corrected, and a reference value of the ideal diffraction efficiency of the system is set to obtain the corrected performance loss of diffraction efficiency.
[0055] Step 5, combining the performance loss of classification reasoning and the performance loss of corrected diffraction efficiency, constructing a multi-objective loss function, and using the multi-objective loss function to jointly optimize the phase parameters of the optical diffraction neural network to obtain the optimized phase parameters.
[0056] Step 6: Update the optical diffraction neural network according to the optimized phase parameters to obtain the optimized optical diffraction neural network.
[0057] Preferably, the optical diffraction neural network includes a forward propagation model and a back-propagation model; the forward propagation model is established according to the Rayleigh-Sommerfeld diffraction theory, and the forward propagation model is used to realize the light field transmission from the input light field to the output plane for image classification tasks; the back-propagation model is realized according to the back-propagation algorithm to optimize the phase parameter distribution of the optical diffraction layer.
[0058] Preferably, the expression of the forward propagation model established according to the Rayleigh-Sommerfeld diffraction theory is as follows:
[0059]
[0060] in, represents the forward propagation model, It is the superposition of the incident light field of all k diffraction neural units in the l-1th layer incident on the i-th diffraction neural unit in the l-th diffraction layer. λ represents the working wavelength of the incident light, represents the coordinates of the i-th diffractive neural unit, Indicates that the coordinates of the lth layer are The output light field at the diffraction neural unit is transmitted to the l-1th layer with coordinates The light wave transmission coefficient at the diffraction neural unit, Represents the transmission coefficient corresponding to the i-th diffractive neural unit in the l-th layer.
[0061] in,
[0062] in, , Representing coordinates and coordinates The Euclidean distance between diffraction neural units, λ represents the incident light working wavelength, , represents pi, represents the natural exponential function.
[0063] in, t i l ( x i , y i , z i , λ ) = a i l ( x i , y i , z i , λ ) exp [ j ϕ i l ( x i , y i , z i , λ ) ]
[0064] in, represents the amplitude coefficient, The present invention adopts a phase modulation optical diffraction neural network, the amplitude coefficient is set to a constant 1, and the phase coefficient is used as a learnable parameter with a value range of [ 0 , 2 π ] .
[0065] The expression of the forward propagation model describes the light wave from the lth layer with coordinates The i-th diffraction neural unit propagates to the next layer with coordinates The light field transmission process of the diffractive neural unit.
[0066] The forward propagation model is a recursive model. The image information is loaded on the input plane, i.e., the 0th layer of the optical diffraction neural network. The optical diffraction neural network model has N layers. Then, after the forward propagation model, the real light intensity energy distribution on the output plane, i.e., the N+1th layer of the optical diffraction neural network, is expressed as , The coordinates of the N+1th layer of the optical diffraction neural network are The real light intensity energy distribution of the diffraction neural unit.
[0067] Preferably, the back propagation model adopts a stochastic gradient descent algorithm to transform the phase coefficient of the diffraction layer as a learnable parameter to be optimized.
[0068] Preferably, the performance loss of the classification reasoning The calculation formula is as follows:
[0069]
[0070] in, One-hot encoding vector representing the true label of the image sample. For example, the true label of 2 can be encoded as (0, 0, 1, 0, 0, 0, 0, 0, 0). It represents the normalized value of the energy of the mth detection area. M represents the total number of detection areas.
[0071] Performance loss for classification inference It is used to calculate the classification loss in the phase parameter training process of the optical diffraction neural network. According to the forward propagation model of the optical diffraction neural network, the real light intensity energy of the i-th diffraction neural unit in the output plane is calculated as , the energy distribution of the detection area corresponding to the M categories defined on the statistical output plane are . , represents the energy of the mth detection area The value after Softmax normalization corresponds to the probability value of predicting the mth class.
[0072] Preferably, the loss function expression of the diffraction efficiency is as follows:
[0073]
[0074] in, represents the energy of the detection area, represents the total energy of the input plane.
[0075] Preferably, the performance loss of the corrected diffraction efficiency is , the calculation formula is as follows:
[0076]
[0077] in, It represents the reference value of the ideal diffraction efficiency of the system, which is obtained through multiple experimental tests. The loss convergence value of the optical diffraction neural network under single action is obtained to ensure that the performance loss of classification reasoning during back propagation is on the same order of magnitude as the performance loss of diffraction efficiency.
[0078] Preferably, the multi-objective loss function expression is:
[0079]
[0080] in, Represents a configurable hyperparameter, with a value range of [ 0 , 1 ] .
[0081] The multi-objective loss function uses a weighted approach to balance the classification reasoning accuracy and diffraction efficiency of the optical diffraction neural network system.
[0082] Embodiment 2:
[0083] This embodiment introduces an optimization method calculation process of an optical diffraction neural network. The method combines classification reasoning performance and diffraction efficiency performance to design a multi-objective loss function, and jointly optimizes the diffraction layer phase parameter distribution of the optical neural network. The method is specifically described as follows:
[0084] 1) Construct an optical diffraction neural network based on phase modulation.
[0085] Based on the Rayleigh-Sommerfeld diffraction formula and the angular spectrum method to further simplify the calculation process, a Python program was written to simulate the propagation of the input light field in free space, a 5-layer diffraction layer phase modulation was designed, and the initial phase value of the diffraction layer was set. The Adam random gradient descent algorithm was used for back propagation to update the phase value; the structural parameters of the optical diffraction neural network met the full connection condition, and the physical parameters of the optical diffraction neural network were designed according to the wavelength λ of the illumination light source used. The parameters involved included: the number of diffraction neural units N in each layer of the optical diffraction neural network was 200×200, the characteristic size a of the diffraction unit was 0.53λ, and the spacing d between the diffraction layers was 40λ.
[0086] 2) On a standard handwritten digit training set, a multi-objective loss function combining the designed classification reasoning performance loss and diffraction efficiency performance loss is used to calculate the overall loss after the output of the optical diffraction neural network.
[0087] On the handwritten digital data set, after multiple experimental tests and training, the ideal reference values of diffraction efficiency are 0.18, 0.2, and 0.22. In this embodiment, 0.18 is selected as the reference value of diffraction efficiency, and the diffraction efficiency loss function is improved to ensure that the performance loss of classification reasoning in the back propagation process is at the same order of magnitude as the performance loss of diffraction efficiency.
[0088] In order to balance the classification reasoning performance and diffraction efficiency performance on the handwritten digit training set, the weight factor ratio of the two is 0.8:0.2, and the multi-objective loss function for training and optimizing the phase of the optical diffraction neural network is specifically expressed as:
[0089]
[0090] The classification reasoning performance loss Using the cross entropy loss function to calculate the diffraction efficiency performance loss Specifically expressed as:
[0091]
[0092] The loss changes on the handwritten digit training set are as follows Figure 2 As shown in (A), Figure 2 (B) shows the changes in classification reasoning accuracy and diffraction efficiency of the optical diffraction neural network model on the validation set, and the network model parameters with the best performance during the training process are selected and saved.
[0093] 3) After the optical diffraction neural network model is trained on the handwritten digit training set, the phase modulation parameter distribution of each diffraction layer of the model is obtained, such as Figure 3 As shown, the confusion matrix of the model on the handwritten digit test set is obtained, as Figure 4 shown.
[0094] 4) Figure 5 The optimization of the phase parameters of the optical diffraction neural network (optimized results) using a multi-objective loss function that combines classification reasoning performance and diffraction efficiency performance is demonstrated. Figure 5 As shown in (B), compared with the traditional cross entropy loss function (result before optimization) Figure 5 As shown in (A). The performance comparison on the handwritten digit set is shown in Figure 5 As shown in (C), it can be seen that the energy distribution of the output field of the optical diffraction neural network after training with the multi-objective loss function proposed in the present invention is more concentrated in the target area, alleviating the problem of stray distribution of the output energy field of the model trained by the traditional cross entropy loss function. At the same time, according to the signal contrast performance on the handwritten digit test set, it can be seen that the signal contrast of the output field of the model trained with the multi-objective loss function proposed in the present invention is higher and the model performance is better.
[0095] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An optimization method for an optical diffraction neural network is characterized by: Specifically include: Step 1, obtaining an optical diffraction neural network constructed based on phase modulation, wherein the optical diffraction neural network includes an input plane, an output plane, and a plurality of phase modulation diffraction layers; Step 2: Define M detection areas in the output plane according to the total categories M of the image training data set. Each detection area corresponds to a category. Calculate the energy of each detection area and the total energy of the output plane. Determine the category of the input image according to the maximum value of the energy of the M detection areas. Normalize the ratio of the energy of the detection area corresponding to each category to the total energy of the output plane, and calculate the performance loss of classification reasoning. Step 3, based on the diffraction efficiency of the optical diffraction neural network, construct a diffraction efficiency loss function of the relative relationship between the energy of the detection area corresponding to the correct category and the total energy of the input plane; Step 4, correcting the loss function of the diffraction efficiency performance, setting a reference value of the ideal diffraction efficiency of the system, and obtaining the performance loss of the corrected diffraction efficiency; Step 5, combining the performance loss of classification reasoning and the performance loss of corrected diffraction efficiency, constructing a multi-objective loss function, and using the multi-objective loss function to jointly optimize the phase parameters of the optical diffraction neural network to obtain the optimized phase parameters; Step 6: Update the optical diffraction neural network according to the optimized phase parameters to obtain the optimized optical diffraction neural network.
2. The method for optimizing an optical diffraction neural network according to claim 1, characterized in that: The optical diffraction neural network includes a forward propagation model and a back-propagation model. The forward propagation model is established according to the Rayleigh-Sommerfeld diffraction theory, and the forward propagation model is used to realize the light field transmission from the input light field to the output plane for image classification tasks. The back-propagation model is realized according to the back-propagation algorithm to optimize the phase parameter distribution of the optical diffraction layer.
3. The method for optimizing an optical diffraction neural network according to claim 2, characterized in that: The expression of the forward propagation model is as follows: ; in, represents the forward propagation model, is the superposition of the incident light fields of all k diffraction neural units in the l-1th layer incident on the i-th diffraction neural unit in the lth diffraction layer; λ represents the working wavelength of the incident light, represents the coordinates of the i-th diffractive neural unit, Indicates that the coordinates of the lth layer are The output light field at the diffraction neural unit is transmitted to the l-1th layer with coordinates The light wave transmission coefficient at the diffraction neural unit, Represents the transmission coefficient corresponding to the i-th diffractive neural unit in the l-th layer.
4. The method for optimizing an optical diffraction neural network according to claim 3, characterized in that: ; in, Representing coordinates and coordinates The Euclidean distance between diffraction neural units, λ represents the incident light working wavelength, , represents pi, represents the natural exponential function; ; in, represents the amplitude coefficient, Represents the phase coefficient, the amplitude coefficient is set to a constant 1, and the phase coefficient is a learnable parameter with a value range of .
5. The method for optimizing an optical diffraction neural network according to claim 2, characterized in that: The back propagation model uses a stochastic gradient descent algorithm to phase modulate the phase coefficient of the diffraction layer as a learnable parameter to be optimized.
6. The method for optimizing an optical diffraction neural network according to claim 1, characterized in that: The performance loss of classification inference The calculation formula is as follows: ; in, represents the hot encoded vector of the true label of the image sample, It represents the normalized value of the energy of the mth detection area, and M represents the total number of detection areas.
7. The method for optimizing an optical diffraction neural network according to claim 6, characterized in that: ; in, represents the energy of the mth detection area, represents the natural exponential function, and M represents the total number of detection regions.
8. The method for optimizing an optical diffraction neural network according to claim 1, characterized in that: The loss function expression of the diffraction efficiency is as follows: ; in, represents the energy of the detection area, represents the total energy of the input plane.
9. The method for optimizing an optical diffraction neural network according to claim 8, characterized in that: The performance loss of the corrected diffraction efficiency is , the calculation formula is as follows: ; in, A reference value representing the ideal diffraction efficiency of a system.
10. The method for optimizing an optical diffraction neural network according to claim 1, characterized in that: The multi-objective loss function expression is: ; in, Represents a configurable hyperparameter, with a value range of , is the performance loss for classification reasoning, is the performance loss of the corrected diffraction efficiency.
Citation Information
Patent Citations
All-optical diffraction neural network system based on metasurface
CN113822424A
Single-layer phase regulation diffraction deep neural network optimization method
CN115034378A
Deep learning large-field-of-view multi-super-structure surface lens design method based on model driving
CN116187162A
Quantitative optical diffraction neural network system and training method thereof
CN117521746A
Large model training method and system, terminal and storage medium
CN117637101A
Cited By
All-optical image generation method based on diffraction neural network and storage medium
CN120529201A
Optical neural network system and training method and device thereof
CN122334376A
Optical neural network system and method and apparatus for training the same
CN122334376B