# Efficient Computer-Generated Holography Based on Mixed Linear Convolutional Neural Networks
## 4 Model Training  
Considering the constraints of computer performance and computing time, the Mixed National Institute of Standards and Technology database (MNIST), with an image size of \(48\times 48\), was used to train the model. In this work, 6000 MNIST images were used and split into a training set and a test set according to the ratio of 5:1. The MNIST dataset consists of handwritten digits 0-9 collected from census employees and high school students, each with a different style. Figure 6 shows a partial representation of the MNIST data. Figure 5: Sampling method: (**a**) DownSample structure; (**b**) UpSample structure. Figure 6: Some handwritten digits. The initial assignment of network parameters is random. In order to obtain parameters that match the computational holography problem, the network parameters need to be optimized. We use the Adam optimizer and the mean square loss function to promote the optimization process:  
\[\text{Loss}(x,y)=\sum_{i=0}^{m}\sum_{j=0}^{n}(a_{ij}-b_{ij})^{2}/(mn) \tag{3}\]  
where \(x\) and \(y\) are the computer generated image and label image, respectively; \(a_{ij}\) and \(b_{ij}\) are the corresponding pixels of the image; and \(m\) and \(n\) are the number of pixels in the length/width of the image. The parameter settings of the Adam optimizer are given in Table 1, where \(\beta_{1}\) and \(\beta_{2}\) are hyper parameters, and \(\epsilon\) is a stabilization factor. The network was trained for 600 epochs on the platform of the Pytorch framework. The comparison of the U-net model parameters with ours is given in Table 2. Although our method requires more hidden layers, it no longer requires a large number of convolution kernels to complete information mining, and therefore, the total number of parameters is fewer. Compared with the conventional U-net network using 31,042,369 parameters, the MLCNN network contains 9,720,580 parameters, which account for only 31% of the U-net network parameters. Simultaneously, the mean square deviation decreases from 0.03181 to 0.00731. To investigate the performance of this MLCNN design further, the training results are given in Figure 7. In Figure 7, the results of the loss function for the training set and the test set by the MLCNN network and the U-net network are shown simultaneously for comparison. To investigate the computing efficiency of MLCNN network, a common computer with a CPU processor (Intel i5) and a GPU (Nvidia GTX 1060) is employed to complete the training. The results show that 38 ms and 9.8 ms are needed to finish the MLCNN network training and the phase-only holographic image generation for one frame, respectively. For comparison, similar work is additionally conducted by both the U-net network and the GS iterative method. The corresponding computing times used for the phase-only holographic image generation are 13.5 ms and 0.62 s for one frame. The results show that the MLCNN network has faster optimization speed and higher accuracy than either the U-net network or the GS algorithm. We use the network parameters with an epoch of 600 to generate the holographic images and have analyzed the test set. Part of the results is shown in Figure 8. Figure 8a shows phase-type holographic images of the numbers \"1-9\" obtained using this method, and Figure 8b shows the computer-simulated results of these holographic images. \begin{table}
\begin{tabular}{c c c c} \hline
**Optimizer** & **Learning Rate** & **(\(\beta_{1}\), \(\beta_{2}\))** & \(\epsilon\) \\ \hline Adam & 0.01 & (0.9, 0.999) & \(10^{-8}\) \\ \hline \end{tabular}
\end{table} 
Table 1: Optimizer parameter table. \begin{table}
\begin{tabular}{c c c c c} \hline
**Model** & **Input/Output Size** & **Layers** & **Total Params** & **Mean Square Loss** \\ \hline U-net & 48 \(\times\) 48 & 62 & 31,042,369 & 0.03181 \\ \hline Ours & 48 \(\times\) 48 & 82 & 9,720,580 & 0.00731 \\ \hline \end{tabular}
\end{table} 
Table 2: Model parameter comparison. Figure 8: Generated holograms and reproduced images.