# Image Completion with Large or Edge-Missing Areas
## 3 Method  
Based on [PERSON]'s method [21], we randomly generate blank areas with arbitrary shape on the original image _orig_ to get the input image \(x\) and the corresponding binary mask (Figure 2). In the training process, the MSE loss between the complementary region \(c\) and the corresponding region in the original image _orig_ is used to train the completion network (Equation (1)). Next, an image block \(d\) centered on the complemented region is cropped, the entire generated image and \(d\) are input into the global discriminator and the local discriminator respectively and the two networks are trained with generate adversarial loss (GAN loss) (Equation (2)). The preliminary completion result preserved the structural information of the image. The global network discriminator is used to ensure the global consistency of the image, and the local network discriminator is used to maintain the local consistency of the complementary region with other regions. \[L(orig,M_{c})=\big{\|}M_{c}\odot(C(orig,M_{c})-orig)\big{\|}_{2}, \tag{1}\]  
\[L_{advd}=\min_{C}\max_{D}\mathrm{E}[\log D(orig,M_{d})+\log(1-D(C(orig,M_{c}),M _{c}))], \tag{2}\]  
where \(C\) denotes the completion network, \(D\) denotes the discriminator networks, \(M_{c}\) denotes the input binary mask, and \(M_{d}\) denotes the area corresponding to the local area \(d\) centered on the missing area in the binary image. However, when the missing areas are large or located at the edge of the image, due to the lack of context information and the instability of the training, the result of the completion of the above three networks may be blurred and the color distorted. Therefore, as shown in Figure 2, we also generate an image block which located at the center of the missing region. By inputting \(d^{\prime}\) into the local discriminator network 2 and calculating the GAN loss (Equation (3)) between \(d^{\prime}\) and the original image, the completion result of the central position \(d^{\prime}\) of the large missing area has global and local consistency with the surrounding information. Finally, the entire network structure is trained synchronously with the joint loss of three networks (Equation (4)), where \(\alpha\) denotes coefficient of the proportion of the adversarial loss. \[L_{advd^{\prime}}=\min_{C}\max_{D}\mathrm{E}[\log D(orig,M_{d^{\prime}})+\log (1-D(C(orig,M_{c}),M_{c}))], \tag{3}\]  
\[L^{\prime}=\min_{C}\max_{D}\mathrm{E}[L(orig,M_{c})+\alpha\log(1-D(C(orig,M_{ c}),M_{c}))]+\alpha\log D(orig,M_{d})+\alpha\log D(orig,M_{d^{\prime}}) \tag{4}\]  
The network structure adopted by our method is shown in Figure 3. The network includes a completion network, a global discriminator, a local discriminator, and a local discriminator 2. The completion network is used to generate content of the missing area, the global discriminator views global consistency of the generated image, and the local discriminator only looks at small areas centered on the complemented region to ensure local consistency of the generated image blocks. Our added local discriminator network (local discriminator 2) is used to ensure the content accuracy of the image generated in the central region of the missing region and the local consistency between the central area and the outer area. The inputs of the completion network are the entire image with the missing areas and the corresponding binary channel mask. The output is the combined image of the intact area and the completed areas of the input image. Then, the entire generated image is input into the global network discriminator to judge the accuracy of the generated content and to maintain the global consistency of  
Figure 2: (**a**) [PERSON]’s method; (**b**) Our method. \(x\) denotes the input image, \(d\) denotes the image block centered on the missing area in the image, \(c\) denotes the missing area, and \(d^{\prime}\) denotes the image block located at the center of the missing area and having a size of 1/4 of the missing area. the image.