## 2 Methods
### Generator and Discriminator Networks  
The generator network architecture used in this paper is shown in Figure 7, which is different from the random noise used in the original DCGANs. The input image is a decoded binary image with a size of \(H\times W\times 1\). After three layers of Conv after the block, an \(8\times 8\times 128\) feature vector is generated, and then through three layers of ConvT Block, an image of \(128\times 128\times 3\) is output. Conv Block contains a Batch Normalization (BN) layer, a convolutional layer with a kernel size of \(4\times 4\), and a LeakyReLU activation function; ConvT Block includes a BN layer, a transposed convolutional layer with a kernel size of \(4\times 4\), and a LeakyReLU activation function. Finally, the feature vector passes through a layer of the tanh activation function and outputs the generated image.  
The discriminator architecture of this study is similar to the original DCGAN discriminator. The discriminator architecture is shown in Figure 8. The input image size is H \(\times\) W \(\times\) 1, including three Conv Block 1 and one Conv Block 2. Conv Block 1 contains one Batch Normalization (BN) layer, a convolutional layer with a kernel size of \(4\times 4\), and  
Figure 6: Example of decoder.  
Figure 7: Generator architecture diagram.  
the LeakyReLU activation function. Conv Block 2 contains a convolutional layer with a kernel size of 4 \(\times\) 4 and the sigmoid activation function. The final output is the probability of whether the generated image is true.  
In the training phase, the loss function used in this study is shown in Equations (8)-(10). Equation (8) represents the loss function \(L_{D}\) of the discriminator \(D\), and its purpose is to maximize the value of the function. The closer the value of the real sample is to 1, the better, and the closer the value of the generated sample is to 0, the better, where \(x\) represents the real sample, \(D(x)\) represents the value that the discriminator judges for the real sample, \(y\) represents the input sample, \(G(y)\) represents the image generated by the generator with the input sample, and \(D(G(y))\) represents the value that the discriminator judges for the generated image.  
\[L_{D}=E_{x\sim P_{data}(x)}[-\log\!D(x)]+E_{y\sim P_{data}(y)}[-\log(1-D(G(y)))] \tag{8}\]  
Equation (9) represents the loss function \(L_{G}\) of generator \(G\). Its purpose is to maximize the value of the function. We hope that generator \(G\) will eventually produce an image that can fool discriminator \(D\). Therefore, the closer the value of the generated sample is to 1, the better; where y represents the input sample, \(G(y)\) represents the image generated by the generator with the input sample, and \(D(G(y))\) represents the value that the discriminator judges for the generated image.  
\[L_{G}=E_{y\sim P_{data}(y)}[-\log\!D(G(y))] \tag{9}\]  
In the method proposed in this paper, it is hoped that the generated image will be as similar to the original watermark as possible, so an additional loss function \(L_{w}\) is added, as shown in Equation (10). We hope that the generated image will be similar to the real sample at the pixelwise, so the loss function uses L1 Loss, where \(n\) is the number of pixels in the image, \(G(y)_{i}\) represents the i-th pixel of the generated image, and \(x_{i}\) represents the i-th pixel of real sample.  
\[L_{w}=\frac{1}{n}\underset{i=1}{\overset{n}{\underset{i=1}{\sum}}}|G(y)_{i}-x _{i}| \tag{10}\]  
The overall loss function \(L_{total}\) is shown in Equation (11), which includes the loss function of the discriminator, the loss function of generator \(G\), and the newly added loss function.  
\[L_{total}=L_{D}+L_{G}+L_{w} \tag{11}\]  
Figure 8: Discriminator architecture diagram.