The method of protection for DCGAN comprises two major steps: watermark embedding and watermark retrieval. The part of watermark embedding is integrated into DCGAN (the object to be protected), which enables the content generated from the DCGAN carrying concealed watermark information. On the contrary, the part of watermark retrieval is constructed as an individual network to extract watermark information from the content generated.
3.2.1. Watermark Embedding in DCGAN
To enable effective copyright identification in the generated images, a feature extraction module and a watermark embedding module (denoted by a red solid border) are integrated into the original DCGAN [
15] architecture (as illustrated in
Figure 4), forming an end-to-end watermark integration mechanism. The feature extraction module captures semantic features of the generated content to enhance the semantic relevance of the embedded watermark. The watermark embedding module imperceptibly integrates copyright information into the generated images, enabling reliable ownership identification and traceability while preserving image quality. A more detailed illustration of the network architecture is presented in
Figure 5.
- (1)
Feature Extraction Module Design
The feature extraction module is designed to perform preliminary semantic representation extraction on images generated by the DCGAN generator. It serves a dual purpose in the watermark embedding process, functioning both as a semantic encoder of the image content and as a carrier for embedding information. By extracting high-level semantic features—such as edges, textures, and local structures—the module enhances the integration and imperceptibility of the embedded watermark, significantly mitigating artifacts and information loss typically associated with pixel-level embedding. Compared with conventional direct embedding methods, this module maintains the original image resolution while providing a more stable embedding pathway, thereby reducing training complexity. Furthermore, its architecture is carefully designed to balance feature expressiveness and computational efficiency, offering essential support features for the downstream embedding module. The detailed architecture and parameter settings are provided in
Table 1.
In
Table 1,
denotes the output image generated by the DCGAN generator. “Conv” refers to a convolutional layer, and “ReLU” indicates the activation function applied after the convolution. “Kernel 3 × 3” specifies that the convolutional kernel size is 3 × 3, while “Stride” represents the step size of the convolution operation.
- (2)
Watermark Embedding Module Design
The watermark embedding module adopts a feature fusion strategy to embed the watermark into the deep semantic features of the generated image in an implicit manner, ensuring that the embedding process does not introduce noticeable visual artifacts. Specifically, feature fusion integrates the multi-channel image features with the watermark information within the feature space, enabling the watermark to be distributed across high-level semantic components such as edges, textures, and local structures. This approach not only enhances the robustness and imperceptibility of the watermark but also avoids the artifacts and information loss typically caused by pixel-level overlay methods. Moreover, the feature fusion mechanism supports multi-scale feature interaction and optimization, which improves the stability of the embedding pathway, reduces training complexity, and facilitates reliable watermark extraction. In this module, multi-channel image features are progressively and hierarchically fused with the single-channel grayscale watermark, ultimately producing the watermarked output image. The module consists of five layers, with detailed structural parameters presented in
Table 2.
In this context, denotes the combination of feature maps extracted from the feature extraction module and the watermark information, which together serve as the input to the watermark embedding network. The structure “Conv + BN + ReLU” refers to a sequence consisting of a convolutional layer (Conv), followed by batch normalization (BN), and a ReLU activation function, enabling nonlinear transformation and accelerating convergence. The final output stage adopts a “Conv + Tanh” configuration to produce the image with the imperceptible watermark, where the Tanh activation function compresses the output values into the range , aligning with the distribution characteristics of image data.
- (3)
Training Strategy for DCGAN with Embedded Watermark
The training process adopts an alternating optimization strategy. First, a batch of real images is sampled and fed into the discriminator with a positive label: 1. The discriminator is updated via backpropagation by minimizing the prediction error, enhancing its ability to recognize real samples. Next, the generator synthesizes fake images containing watermarks from random noise Z, which are inputted into the discriminator with a negative label: 0. Backpropagation is performed again to strengthen the discriminator’s capability to detect these watermarked fake images. Finally, another batch of watermarked images are generated and fed into the discriminator with a positive label. Using the adversarial loss
defined in Equation (5), only the generator parameters are updated, enabling it to learn to fool the discriminator and thereby improving both the visual realism and adversarial robustness of the watermarked images. The detailed flowchart of training strategy for DCGAN with the embedded watermark is illustrated as
Figure 6.
The model of DCGAN with the embedded watermark is trained on a server equipped with 32 GB RAM and an RTX 3090 24 GB GPU, using a batch size of 16. Adam optimizer was employed, with learning rates set to 0.0002 for the generator and 0.0001 for the discriminator. Throughout the training process, the generator, feature extraction module, and watermark embedding module are jointly optimized as a unified network. This iterative training continues until the discriminator’s loss approaches a value of 0.5, indicating that it can no longer reliably distinguish between real and watermarked fake images, thus reaching adversarial equilibrium. The generator loss stabilized around 0.7. At this point, a favorable balance is achieved between the visual quality of the generated images and the robustness and imperceptibility of the embedded watermarks.
In the process of training, there are two critical loss functions
and
, which represent discriminator loss and generator loss, respectively. During adversarial training, the discriminator and the generator are optimized alternately with respect to their own objectives related to
and
respectively. The discriminator loss
is composed of the losses from real image (
) and generated image (
), which is written as Formula (2).
Specifically, the
and
are expressed as Formulas (3) and (4):
where
and
are the outputs of discriminator and generator, respectively, and the variables
and
represent the real image and random noise, respectively.
The generator loss
represents the whole loss of the sub-network composed of the generator, feature extraction, and watermark embedding modules. Generator loss consists of three components illustrated by Formula (5):
Specifically, the three terms
,
, and
are expressed as Formulas (6)–(8):
where
is the adversarial loss, which measures the discrepancy between watermarked generated images and real images;
is the perceptual loss, used to evaluate the difference between the generator’s outputs and the watermarked images in a high-level feature space; and
represents the pixel-wise L1 loss, quantifying the pixel-level difference between the generator’s outputs and the watermarked generated images. The hyperparameters
and
are used to balance the perceptual and pixel-level reconstruction terms, ensuring that the generator not only fools the discriminator but also produces structurally coherent and visually natural images.
In Formulas (6)–(8), represents a final generated image, is the generator module, is the feature extraction module, and is the watermark embedding module.
3.2.2. Watermark Retrieval from DCGAN
- (1)
Design of the Watermark Retrieval Network
The WRN (watermark retrieval network) is tasked with recovering the embedded watermark from watermarked images. Once the surrogate attack occurs (training a new GAN using generated images), the copyright ownership of new GAN can be confirmed by extracting the watermark from its re-generated images, thereby providing an effective and verifiable mechanism for intellectual property protection. The whole architecture of watermark retrieval network is shown in
Figure 7, and the detailed configuration of watermark retrieval module is illustrated in
Table 3.
In the architecture of WRN, an attack simulation module is set at the front end of the network to enhance the robustness of watermark retrieval and mitigate the risk of attacker’s employing data augmentation techniques during surrogate model training. The module introduces perturbations in watermarked images simulating potential tampering scenarios, so as to train the robustness of watermark retrieval. In the attack simulation, we have introduced seven different common attacks that include five types of pixel-level distortions and two types of image-level composite attacks, as detailed in
Table 4.
- (2)
Training Strategy for Watermark Retrieval Network
The total loss of WRN is denoted by
, which comprises two terms
and
representing the retrieval loss of watermarked and watermark-free information, respectively, illustrated as Formula (9):
where
and
are hyperparameters that balance the two extraction losses
and
. The retrieval losses of watermarked information and watermark-free information
and
are illustrated as Formulas (10) and (11), respectively.
In Formulas (10) and (11),
and
denote the watermark retrieval and attack simulation modules, respectively,
represents a watermarked image,
is the desired watermark,
is a blank image, and the
norm (
) is used to compute the pixel-level difference between the extracted and desired watermarks.
The training procedure of WRN is illustrated in
Figure 8. During training of the WRN, both watermarked and watermark-free images are inputted alternately. Each training iteration uses a batch size of 16 and the Adam optimizer with a learning rate set to 0.0001. To ensure high extraction accuracy while effectively suppressing false detections on clean images, the loss function’s weighting parameters
and
are set to 1.0 and 15.0, respectively.
Backpropagation is conducted to update WRN parameters according to the total loss . Although at beginning the training epoch is initialized as 1000 for a full computation, however, the training procedure is terminated when the difference between two adjacent training is less than 0.001.