## 4 FIAE-GAN Digital Watermarking Model
### The Structure of Encoder  
The encoder \(E_{\alpha}\) is designed to embed the watermark into the original image \(F_{cover}\) while preserving the image quality and ensuring robustness against various attacks. Additionally, a residual structure enhances training efficiency by incorporating a global residual skip connection. The formula for generating \(F_{en}\) is as follows:  
\[F_{en}=E(F_{cover},W_{in}) \tag{1}\]  
where \(E()\) denotes the process of encoding, as demonstrated in Figure 7. The encoder consists of two key modules: the Feature Integration Module (FIM) and the Attention-Enhanced Module (AEM). The FIM addresses the limitation of extracting only limited image features by capturing shallow and deep image features across multiple layers. Integrating  
Figure 6: Overall architecture of the proposed FIAE-GAN. The FIAE-GAN is an end-to-end watermarking network designed to automatically generate watermarks with both invisibility and robustness. The key components of the model, indicated in blue boxes, include the encoder, decoder, noise subnetwork, and discriminator. these features enhances the encoder's ability to embed the watermark robustly. The feature \(X_{W}\) is obtained in the following manner:  
\[X_{W}=E_{FIM}(F_{cover},W_{in}) \tag{2}\]  
where \(E_{FIM}\) denotes the process of the FIM. The structure of the FIM includes several dense blocks, each containing a sequence of Batch Normalization (BN), Rectified Linear Unit (ReLU) activation, and convolutional layers. The dense connections within the FIM allow for the reuse of these features, significantly boosting the encoder's representational capacity. Watermarks embedded into various parts of an image impact distortion and robustness differently. Embedding the watermark in inconspicuous regions enhances visual image quality while placing it in textured regions boosts robustness. We developed a specialized module called attention-enhanced module (AEM) to minimize the distortion from watermark embedding. This module enhances or suppresses specific regions within the spatial domain of the feature map based on their relevance while simultaneously capturing global image features to generate an attention mask, which dictates varying watermarking strengths across different image regions, ensuring a balance between invisibility and robustness. In addition, the attention mask ensures that flat and sensitive areas are suppressed. Meanwhile, inconspicuous and textured regions are intensified, achieving higher embedding strength and maintaining the invisibility of the watermark. To be specific, based on the global features of \(F_{cover}\), the AEM creates an attention mask \(M_{A}\) to aid in generating \(F_{en}\), allowing it to adjust the features of \(F_{en}\) effectively, thereby minimizing image distortion caused by watermark embedding and reducing visibility perturbations. \(M_{A}\) is computed by  
\[M_{A}=E_{AEM}(F_{cover}) \tag{3}\]  
where \(E_{AEM}()\) denotes the process of the AEM, which consists of a spatial attention mechanism. Then, we utilize the \(M_{A}\) to adjust the distribution of \(X_{W}\). Finally, we adopt the global residual skip connection to generate \(F_{en}\) by  
\[F_{en}=F_{cover}+X_{W}\times M_{A} \tag{4}\]  
The encoding loss function \(L_{E}\) is designed to minimize the distance between \(F_{cover}\) and \(F_{en}\) by updating the parameter \(\alpha\). \(L_{E}\) is composed of the image reconstruction loss and the visual loss  
\[L_{E}=\epsilon_{1}MSE(F_{cover},F_{en})+\epsilon_{2}SSIM(F_{cover},F_{en}) \tag{5}\]  
Figure 7: Architecture of encoder. The encoder includes (1) a Feature-Integrated Module (FIM) that utilizes dense connections to extract both shallow and deep features, which are then fused with the watermark to improve its robustness; (2) an Attention-Enhanced Module (AEM) that applies spatial attention to embed the watermark in less noticeable regions of the original image. where \(MSE()\) denotes the mean square error function, and \(SSIM()\) refers to the structural similarity index metric.