# Generative Adversarial Network for Overcoming Occlusion in Images: A Survey
## 6 Loss Functions
\(\mathcal{L}_{1}\) loss enforces correctness in low-frequency features; hence, it results in less blurred images compared to \(\mathcal{L}_{2}\)[8]. Both losses are defined in Equations (6) and (7). \[\mathcal{L}_{1}=\mathbb{E}_{x,y,z}[\|y-G(x,z)\|_{1}] \tag{6}\]  
\[\mathcal{L}_{2}=\mathbb{E}_{x,y,z}[\|y-G(x,z)\|_{2}^{2}] \tag{7}\]  
where \(x\), \(y\), and \(z\) are the ground-truth image, the generated image, and the random noise, respectively. 6. **Perceptual Loss**: The perceptual loss measures the high-level perceptual and semantic differences between the real and the fake images. Several works [141; 142] introduce perceptual loss as a combination of the content loss (or feature reconstruction loss) and the style loss. However, [PERSON] et al. [62] simply compute the \(L_{1}\) distance between the real and the completed images. Others incorporate more similarity metrics into it [140]. 7. **BCE Loss**: BCE loss measures how close the probability of the predicted data is to the real data. Its value increases as the predicted probability deviates from the real label. The BCE is defined as \[\mathcal{L}_{BCE}=-\frac{1}{N}\sum_{i=1}^{N}(y_{i}log(D(i)+(1-y_{i})log(1-D(i)))\] (8) where \(y_{i}\) is the label of \(i\). \(y_{i}\)=0 and \(y_{i}\)=1 represents fake and real samples. BCE is used in training the discriminator in amodal segmentation task [76], and in training the generator [110]. 8. **Hinge Loss**: In GAN, Hinge loss is used to help the convergence to a Nash equilibrium. Proposed by [PERSON] and [PERSON] [143], the objective function for \(G\) is \[\mathcal{L}_{G}=-\mathbb{E}_{z\sim p_{z}(z)}[D(G(z))]\] (9) and for \(D\) is \[\mathcal{L}_{D}=\mathbb{E}_{x\sim p_{data}(x)}[max(0,1-D(x)]+\mathbb{E}_{z \sim p_{z}(z)}[max(0,1+D(G(z))]\] (10) where \(x\) and \(z\) are the ground-truth and the generated images, respectively. As it can be seen from Tables 3 and 4, many of the previously mentioned loss functions are combined with others to train a GAN model. Adversarial loss is the base objective function for training the two networks of the GAN. However, with the original GAN's adversarial loss function, the model may not converge. Therefore, the Hinge loss is often implemented as an alternative objective function. In some works, global and local adversarial losses are used to train local and global discriminators to ensure that the generated data is semantically and locally coherent. In addition to this, \(\mathcal{L}_{1}\) or \(\mathcal{L}_{2}\) losses are frequently utilized to capture low-frequency features, and hence improve the quality of the generated images. Furthermore, the reconstruction loss is employed to encourage the generator to maintain the contents of the original input image. On the other hand, perceptual loss encourages the model to capture patch-level information when completing a missing patch in an object/image. Furthermore, to emphasize on the style match between the generated image and the input image, style loss is implemented. The choice of the objective functions is an essential decision of designing a model. In amodal completion and inpainting, designing a loss function is still an active area of research. The ablation studies performed by the reviewed works show that there is no optimal objective function. For different tasks and data, a different set of loss terms produces the best results. In addition, using a complex loss function may lead to problems of instability, vanishing gradient, and mode collapse.