# Progress of the Computer-Generated Holography Based on Deep Learning
## 3 Network Structures
### Gan  
With the gradual development of deep learning, different network structures have been proposed. In order to reduce the needed datasets for training, the GAN structure was proposed. In 2014, [PERSON] et al. proposed the GAN network, which can be seen as a zero-sum game. After that, the research group reviewed the applications of GANs and identified the core research problems to make GANs a reliable technology in 2020 [47]. The GAN methods make the samples generated by the generated network obey the real data distribution through confrontation training. The GAN structures include two sub-networks for adversarial training. One is called the generator and the other is called the discriminator. The structure is shown in Figure 4. The discriminator is used to accurately determine whether a sample is from real data or generated by the generator, while the generator is used to generate samples from sources that cannot be distinguished by the discriminator. In the following, how GAN conducts generative confrontation is demonstrated. The function of the discriminator network \(D(x;\varphi)\) is to distinguish whether the sample \(x\) is from true distribution \(p_{r}(x)\) or the generated model \(p_{g}(x)\). Therefore, \(D\) is a binary classifier. \(y=1\) indicates that the sample comes from the true distribution, and \(y=0\) indicates that the sample comes from the generator. The value of \(D(x;\varphi)\) represents the probability that the sample \(x\) is the distribution of real data. The model can be formulated as  
\[p(y=1|x)=D(x;\varphi) \tag{3}\]  
Given the sample \((x,y)\), \(y=\{0,1\}\) indicates whether it comes from \(p_{r}(x)\) or \(p_{g}(x)\), and the objective function is to minimize the cross entropy, formulated as  
Figure 4: Structure of GAN. Figure 3: The residual element block structure. \[\underset{\varphi}{min}\{E_{x}[y\ log\ p(y=1|x)+(1-y)log\ p(y=0|x)]\} \tag{4}\]  
If \(p(x)\) is mixed with \(p_{r}(x)\) and \(p_{g}(x)\) in equal proportions, then \(p(x)=\frac{1}{2}\big{(}p_{r}(x)+p_{g}(x)\big{)}\). Equation (4) can be equivalent to the following equation:  
\[\underset{\varphi}{max}\Big{\{}E_{x\sim p_{r}(x)}[log\ D(x;\varphi )]+E_{x^{\prime}\sim p_{g}(x^{\prime})}[log(1-D(x^{\prime};\varphi))]\Big{\}}= \tag{5}\] \[\underset{\varphi}{max}\Big{\{}E_{x\sim p_{r}(x)}[log\ D(x; \varphi)]+E_{z\sim p(z)}[log(1-D(G(z;g);\varphi))]\Big{\}}.\]  
In Equation (5), \(g\) and \(\varphi\) are the parameters of the generator and discriminator, respectively. The goal of the generator is opposite that of the discriminator. It aims to make the discriminator distinguish the samples generated by the generator from real samples. The model can be defined as  
\[\underset{g}{max}\Big{\{}E_{z\sim p(z)}[log\ D(G(z;g);\varphi)]\Big{\}}= \underset{g}{min}\Big{\{}E_{z\sim p(z)}[log(1-D(G(z;g);\varphi))]\Big{\}} \tag{6}\]  
We combine the two networks as a whole and regard them as the minimax game, which can be defined as  
\[\underset{g}{min}\underset{\varphi}{max}\Big{\{}E_{x\sim p_{r}(x)}[log\ D(x ;\varphi)]+E_{x\sim p_{g}(x)}[log(1-D(x;\varphi))]\Big{\}}= \tag{7}\] \[\underset{g}{min}\underset{\varphi}{max}\Big{\{}E_{x\sim p_{r}(x )}[log\ D(x;\varphi)]+E_{z\sim p(z)}[log(1-D(G(z;g);\varphi))]\Big{\}}.\]  
If \(p_{r}(x)\) and \(p_{g}(x)\) are known, the optimal discriminator can be defined as  
\[p(y=1|x)=D(x;\varphi) \tag{3}\]0  
The GAN method is a kind of semi-supervised method to train classifiers [48]. The parameter update of the generator is not obtained directly from the data sample but by using the backpropagation from the discriminator. Thus, it can reduce the number of samples and generate samples faster. However, compared with the single objective optimization, the training of GANs is difficult and unstable because it is necessary to balance the capabilities of the two networks. Thus, for the CGH calculation, we need to keep the generator value constant when training the discriminator, and vice versa.