Screen-shooting-resistant image watermark network method and system with layered foreground attention and more real moire noise layer
By constructing a hierarchical foreground attention and realistic moiré noise layer anti-screen capture image watermarking network, the problems of watermark information dispersion and unrealistic noise layer simulation in existing technologies are solved, thereby improving the robustness of watermarks and decoding accuracy in screen capture scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING UNIV OF INFORMATION SCI & TECH
- Filing Date
- 2026-01-27
- Publication Date
- 2026-05-01
AI Technical Summary
Existing screen capture image watermarking technologies perform poorly under the influence of some piracy and strong moiré patterns. In particular, when the embedded watermark information is scattered at the edges of less important objects, the decoding accuracy is reduced. Furthermore, the existing screen capture noise layer simulation is not realistic enough and cannot fully cover the diversity of screen capture noise.
We construct an anti-screen capture image watermarking network with hierarchical foreground attention and a more realistic moiré noise layer. By expanding the watermark information at multiple scales, we introduce a hierarchical edge processor and a foreground edge attention module. We combine moiré, perspective distortion, brightness distortion and Gaussian noise to simulate the screen capture noise layer and optimize the watermark information embedding and decoding process.
It improves the robustness and decoding accuracy of watermarks during screen capture, especially in scenarios where only the main components of the image are captured, enhancing the imperceptibility and robustness of watermark information.
Smart Images

Figure CN121961822A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information security, specifically relating to a method and system for anti-screen capture image watermarking networks with layered foreground attention and more realistic moiré noise layers. Background Technology
[0002] With remote work becoming the norm, video conferencing systems are increasingly involved in new office workflows. As a software platform for document presentation and information transmission, it faces security issues such as content leakage due to screen capture. Robust watermarking technology, with its strong information traceability capabilities, has become a core technological support for addressing these risks. This technology embeds imperceptible encrypted identification information. When a leaker captures and disseminates confidential content from the screen, security personnel can extract the identification marker from the leaked image, thus enabling leak tracking. In the above scenario, the watermark in the leaked image must withstand complex cross-media processing, which can cause irreversible damage to the hidden watermark. Previous digital watermarking methods have mostly focused on how to combat digital editing distortion in electronic channels, lacking prior knowledge of screen capture distortion, which poses a challenge to existing robust watermarking methods.
[0003] Significant progress has been made in research on anti-screen-capture watermarking methods. Early methods largely focused on improving traditional approaches to adapt to anti-screen-capture scenarios. For example, to address perspective distortion in screen-captured images, an improved Scale Invariant Feature Transform (SIFT) algorithm was used to identify key points and surrounding pixels as watermark embedding regions. Then, Discrete Cosine Transform (DCT) was performed within these regions, and appropriately positioned transform coefficients were modified to embed the watermark information, thus balancing robustness and imperceptibility. This method can resist screen-capture attacks to a certain extent, but its robustness decreases when dealing with simple image carriers due to the inability to accurately locate key points. Furthermore, for example, for simple text images, highly imperceptible shading algorithms are designed in the spatial domain to enhance robustness against screen-capture cropping attacks. However, the improved traditional algorithms have limited understanding of the various complex attacks during screen-capture, often resulting in significant limitations when facing such attacks.
[0004] With the development of deep learning, the multi-layer convolutional-pooling structure of Convolutional Neural Networks (CNNs) has completely restructured the feature processing logic of watermarking technology. Through local connectivity and weight sharing mechanisms, it can automatically extract features such as edges and textures from images at multiple scales, finding a high-dimensional embedding space for watermark information. Mainstream deep watermarking networks typically include an encoder, a noise layer, a decoder, and a discriminator, forming a network framework that supports end-to-end training.
[0005] Currently, Unet-based encoder structures perform multi-scale feature extraction, fusing the carrier image and watermark information fed in together at multiple scales. They also optimize the embedding position of the watermark information based on the Just Noticeable Difference (JND), for example, embedding it more frequently at the edges of image targets to improve the visual quality of the embedded image. However, considering the reality of voyeurism, perpetrators often cannot capture the entire image due to environmental limitations, only photographing the main elements of interest. In this case, existing methods suffer from reduced decoding accuracy because the embedded watermark information is scattered at the edges of less important objects.
[0006] In addition, there are two main forms of constructing existing screen capture noise layers: one is supervised training using real-shot image sets. However, this method is difficult to fully cover the diversity of screen capture noise due to the limited available data and is easily affected by label bias. The other is to simulate several types of distortions that have the greatest impact on the screen capture process through mathematical modeling, such as perspective distortion, brightness distortion, and moiré distortion. However, this method often ignores the dependencies between various distortions and depends on the mathematical function used for simulation. As a result, the final screen capture effect still differs from the real screen capture noise. Summary of the Invention
[0007] Purpose of the invention: The technical problem to be solved by the present invention is that the existing screen capture image watermarking technology performs poorly under the influence of some piracy and strong moiré noise, so it provides an anti-screen capture image watermarking network method and system with layered foreground attention and more realistic moiré noise layer.
[0008] The method includes:
[0009] Step 1: Perform multi-scale expansion on the binary watermark information to be embedded. After passing through the DiffusionBlock, the one-dimensional watermark information sequence is output as two or more two-dimensional watermark information feature maps of different scales.
[0010] Step 2: Construct an image watermarking framework with hierarchical edge discrimination and foreground edge attention guidance. Integrate multiple modules into the UNet-based watermarking encoder: First, introduce a hierarchical edge processor to accurately distinguish foreground edges through multi-scale feature parsing and semantic hierarchical division, establishing a spatial hierarchical structure of edges; Second, embed a foreground edge attention module during the upsampling stage. Guided by the edge hierarchy information output by the hierarchical edge processor, the foreground edge attention module selectively strengthens the feature weights of the foreground edge region while suppressing the attention ratio of mid-ground, background, and non-edge regions; Finally, receive the multi-scale watermark information features output by the cascaded message processor and fuse them with the multi-level features extracted by the encoder and the upsampled features of the decoder. During the fusion process, the weight allocation is dynamically adjusted through the foreground edge attention mechanism to prioritize embedding the watermark information into the foreground edge region.
[0011] Step 3: Design a screen capture noise layer. Starting from the generation process of screen capture moiré pattern, the non-differentiable screen capture noise is made differentiable to form a noise layer containing moiré pattern distortion and perspective distortion as the main components, brightness distortion, and Gaussian noise as the auxiliary components. This layer participates in the training process of the image watermarking network model and simulates attacks on the model.
[0012] Step 4: Construct a watermark decoder with a foreground edge attention module that matches the encoder;
[0013] Step 5: Design a loss function and train the watermarking network composed of steps 1, 2, 3, and 4.
[0014] Step 1 includes:
[0015] Step 1-1: Randomly generate watermark information of size 64 bits. ;
[0016] Steps 1-2 involve transforming the one-dimensional watermark information M of length L using a linear layer, mapping the one-dimensional watermark information M from a space of dimension L to a real number space R of dimension 256, thus obtaining the feature vector. ;
[0017] Steps 1-3: Reshape the feature vector V into a two-dimensional feature map by flattening it into a two-dimensional feature map with 1 channel, height h=16, and width w=16. ;
[0018] Steps 1-4 involve feeding the two-dimensional feature maps F at different scales into the DoubleConv module for feature extraction, outputting a watermark information feature map with 64 channels. ;
[0019] Steps 1-5 involve dynamically adjusting the watermark information feature map through interpolation operations. The size of the watermark information feature map Matching the image feature sizes at different stages of the encoder yields the first... Watermark information feature map of the stage ,in , For scale quantity, This represents the number of channels in the watermark information feature map. and These correspond to the height and width of the original image, respectively. , Corresponding to the encoder's number The height and width of the stage feature map.
[0020] Step 2 includes:
[0021] Step 2-1, Input the original image Initial feature extraction is performed using a dual convolution module to obtain the low-level feature map. ;
[0022] Step 2-2 introduces a hierarchical edge processor during the encoder downsampling stage. The hierarchical edge processor is based on a multi-scale feature parsing architecture, and it works by... Semantic hierarchical modeling is performed on the feature maps generated during downsampling, and the foreground edge map is output by combining the edge prior knowledge of the pre-trained edge detection network EdgeNet. ,in The outline of the main target in the corresponding image;
[0023] Steps 2-3 involve feature adaptation processing of the edge map output by the hierarchical edge map: A 1×1 convolution is used to map the single-channel edge map to a dimension matching the number of channels in the corresponding feature layer, and bilinear interpolation is used to adjust it to the same spatial size as the feature map, resulting in the adapted foreground edge features. ;
[0024] Steps 2-4: Embed a foreground edge attention module (FGEA) after each double convolutional module in the downsampling stage: First, construct a foreground edge-guided spatial attention mask. Through lightweight convolutional layers After feature transformation, it is generated by the Sigmoid activation function. ,in Indicates the first The number of channels during each downsampling stage, followed by attention masking. With the current feature layer Hadamard product operations are performed to enhance the features of the foreground edge region, resulting in attention-modulated features. The formula is:
[0025] ,
[0026] Where ⊙ represents the Hadamard product, which includes the feature maps generated during the downsampling process at various levels. , Repeat steps 2-2 to 2-4;
[0027] Steps 2-5: In the upsampling stage, after each upsampled convolutional block outputs features, the foreground edge attention module (FGEA) is introduced again. Using the foreground edge features corresponding to the upsampled feature map as input, the attention mask generation and feature modulation process of steps 2-4 is repeated to obtain the decoded features after refined attention control. ;
[0028] Steps 2-6: Receive the multi-scale watermark information feature map output by the cascaded message processor. ,Will The features are fused with multi-level features generated during encoder downsampling and features upsampled by decoder: during fusion, foreground edge attention masks are used. As a weight guide, make the watermark features The fused features are obtained by performing high-intensity fusion with the carrier features in the foreground edge region. ;
[0029] Steps 2-7: Fusing features The residual feature map for watermark embedding is obtained by mapping to 3 channels through 1×1 convolution. ;
[0030] Steps 2-8: Extract the residual feature map. Compared with the original carrier image Perform pixel-level overlay, through The activation function constrains the output value to Within the specified range, an image with embedded watermark information is ultimately generated. The formula is:
[0031] .
[0032] Step 3 includes:
[0033] Step 3-1: Receive the image after embedding the watermark information. As the initial input, a random value is generated by a random number generator. If the random value is greater than a preset probability threshold... If the result is positive, return the input watermarked image directly; otherwise, proceed to step 3-2.
[0034] Step 3-2, generating the perspective transformation matrix for simulating changes in shooting angle, specifically includes:
[0035] Define the set of coordinates of the four vertices of the image. , is represented as:
[0036] ,
[0037] in, and The width and height of the image are given, and then the coordinates of the four target vertices of the image after random perturbation are generated. , , , :
[0038] ,
[0039] ,
[0040] ,
[0041] ,
[0042] in, For perspective transformation intensity parameters, , , , , , , and For interval Random numbers within, based on the original vertex coordinates Calculate the perspective transformation matrix using the target vertex coordinates. The calculation method is as follows:
[0043] for any point in the middle, x and y coordinates The x and y coordinates of the corresponding point in the target vertex coordinate system In homogeneous coordinates, the following conditions are met:
[0044] ,
[0045] in, To express proportion, expand according to the proportional relationship as follows:
[0046] ,
[0047] ,
[0048] By establishing a system of 8 linear equations with 4 pairs of corresponding vertices, the intermediate parameters can be obtained by solving the system. , , , , , , , That is, determine the matrix ;
[0049] Step 3-3: Use the perspective transformation matrix generated in step 3-2. For the input watermarked image Perform perspective transformation to obtain the transformed image. , is represented as:
[0050] ,
[0051] in, Indicates perspective transformation operation;
[0052] Steps 3-4 involve performing LCD color array mosaic processing on the input watermarked image. First, the size of the mosaic blocks in the mosaic process is set to... Next, the image edges are filled so that both the width and height of the image can be filled. Integer division, fill method is edge pixel copying, the filled image Represented as:
[0053] ,
[0054] in, This indicates a fill operation. , Indicates the height of the image after filling. This represents the width of the padded image; next, an image of the same size as the padded image is initialized, with all pixel values set to a value equal to 1.5. RGB image, then iterate through For all blocks in the mosaic, calculate the center coordinates of each mosaic block, where the... Line number The center coordinates of the mosaic blocks are:
[0055] ,
[0056] Where s is the size of the mosaic block. Next, obtain the RGB value of each pixel at the center position in the original image. To simulate the resampling process in real shooting, the interior of the mosaic blocks is filled with values. Each sub-region is filled with the RGB values of the pixel at the center of the corresponding block, represented as:
[0057] ,
[0058] in, The horizontal coordinates within the block, with a value range of [value range missing]. , G represents the red area, B represents the green area, and C represents the blue area; the pixel value of the red area becomes... The pixel value of the green area becomes The pixel value in the blue area becomes Finally, cropping the mosaic image back to its original size yields a mosaic image simulating an LCD color array. ;
[0059] Steps 3-5: Use the perspective transformation matrix For mosaic images A perspective transformation is performed to obtain the transformed LCD moiré image. :
[0060] ;
[0061] Steps 3-6: First, set the size of the mosaic blocks in the mosaic process. The process involves filling, initializing, traversing, and determining the center coordinates within each block. For each block, the values of the RGB channels of the pixel at the center position are filled. Time is represented as:
[0062] ,
[0063] in, This indicates a modulo operation; the pixel value in the red area becomes... The pixel value of the green area becomes The pixel value in the blue area becomes , The initial pixel values are used to represent the mosaic image. Finally, cropping the mosaic image back to its original size yields a mosaic image that simulates a Bayer color array. ;
[0064] Steps 3-7: Process the mosaic image obtained in step 3-6. Perform perspective transformation to obtain the transformed Bayer moiré image. :
[0065] ,
[0066] right To perform white balance, the formula is:
[0067] ,
[0068] in, This indicates the white balance operation; the image after white balance is... ;
[0069] Steps 3-8: Multiply the transformed watermark image by the weighting parameter. Then it is added to the transformed mosaic image, using the following formula:
[0070] ,
[0071] in, This is the image after adding moiré noise. For the original image weights, For LCD array moiré weights, As the weighting factor for the Bayer array moiré pattern, the moiré phenomenon under shooting conditions is simulated by dynamically adjusting the ratio of the three factors, while controlling... Simulated brightness distortion in shooting scenarios;
[0072] Steps 3-9: Add Gaussian noise to the fused image using the following formula:
[0073] ,
[0074] in, This is the image after adding Gaussian noise. Represents random variables Follows a mean of 0 and a variance of Normally distributed Gaussian noise;
[0075] Steps 3-10 restrict the processed image pixel values to [specific range]. Within the range, the final noise layer output image is obtained. .
[0076] Step 4 includes:
[0077] Step 4-1: Input the image with embedded watermark and after being subjected to a noise layer attack. Initial feature extraction is performed using a double convolutional module (DoubleConv) to obtain the initial feature map for the decoder. ;
[0078] Step 4-2: Before downsampling in the first stage of the decoder, a hierarchical edge detector is introduced based on the initial feature map. Semantic hierarchical modeling is performed, combining the foreground edge map output by the pre-trained EdgeNet. This provides a basis for foreground edge localization for the attention mechanism, and then maps it to a dimension that matches the number of channels in the current feature layer through a 1×1 convolution. Foreground edge map Feature adaptation processing is performed to obtain the adapted foreground edge features. ;
[0079] Step 4-3, introduce the Foreground Edge Attention (FGEA) module to... As input, a channel-spatial joint attention mask is generated using a lightweight convolutional layer and a sigmoid activation function. ,Will With the initial feature map Perform the Hadamard product operation to obtain the modulated features. The formula is:
[0080] ;
[0081] Step 4-4 employs a downsampling process, setting up n downsampling levels consistent with the encoder's downsampling levels. After downsampling through convolution and pooling operations at each level, the foreground edge attention module (FGEA) is introduced: This module processes the foreground edge image... Downsampled to the corresponding size via bilinear interpolation , And mapped to the current number of channels through a 1×1 convolution. To obtain the adapted edge features Generate attention mask , with the current downsampling features Modulation: Repeat step 4-4 until the nth level of downsampling to obtain the final downsampled feature map. ;
[0082] Steps 4-5, for Perform global average pooling to compress the spatial dimension to 1×1, resulting in a one-dimensional feature vector. Through linear layers Mapped to 256 dimensions, and compared with the watermark feature vector output from steps 1-2 Dimension matching, i.e. ,Will The sample is fed into a linear layer for dimensionality transformation, mapping it from a 256-dimensional real space to a 64-dimensional binary space. After processing with a sigmoid activation function, a threshold is applied to obtain the extracted watermark information. The watermark extraction process is now complete.
[0083] In step 5, the following loss function L is used during training:
[0084] ,
[0085] in , , These are weighting coefficients; It is the encoding loss. It is encoder message loss. It is discriminator loss;
[0086] The calculation formula is:
[0087] ,
[0088] in Represents the original image Image with embedded watermark The mean square error, Represents encoder The weight parameters involved in training;
[0089] It is the encoder message loss, calculated using the following formula:
[0090] ,
[0091] in This indicates the watermark information decoded by the decoder. and original watermark information The mean square error, Representative decoder Trainable weight parameters This represents an image after being subjected to noise attack.
[0092] In step 5, the discriminator loss The calculation formula is:
[0093] ,
[0094] in For the discriminator, These are the parameters of discriminator A.
[0095] The present invention also provides an anti-screen capture image watermarking system based on the method, which has a layered foreground attention layer and a more realistic moiré noise layer, comprising:
[0096] Watermark extension unit: It has a built-in watermark diffusion module, receives binary watermark information, and converts the one-dimensional watermark sequence into multiple two-dimensional watermark feature maps of different scales through multi-scale extension processing, and outputs them to the encoding unit.
[0097] Foreground edge coding unit: Based on the UNet architecture, it integrates a hierarchical edge processor and a foreground edge attention module. After receiving the carrier image and multi-scale watermark feature map, it distinguishes the foreground, midground and background edges through the hierarchical edge processor, and then strengthens the weight of the foreground edge region through the FGEA module. It then fuses the watermark features with the carrier image features and outputs the encoded image with embedded watermark.
[0098] Screen capture noise simulation unit: It has a built-in differentiable screen capture noise layer, which includes a noise simulation module that mainly includes moiré distortion and perspective distortion, and secondarily includes brightness distortion and Gaussian noise; after receiving the encoded image, it applies a simulated screen capture attack and outputs a noisy encoded image for model robustness training.
[0099] Edge attention decoding unit: Matches the structure of the encoding unit, integrates the foreground edge attention module, receives the noisy encoded image or the original encoded image, extracts and outputs one-dimensional watermark information by focusing on the features of the foreground edge region;
[0100] Network training unit: It has a built-in loss function calculation module that receives the original carrier image, the encoded image, the original watermark information and the extracted watermark information. By calculating the encoding loss, the decoding message loss and the adversarial loss, it jointly trains the encoding unit and the decoding unit to optimize the network parameters to balance the imperceptibility and robustness of the watermark.
[0101] The present invention also provides an electronic device, including a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method.
[0102] The present invention also provides a storage medium storing a computer program or instructions that, when the computer program or instructions are run on a computer, execute the steps of the method described.
[0103] To improve the accuracy of watermarking after screen capture, especially in scenarios where only the main components of the image are captured (which currently receive less attention), this invention first constructs a hierarchical foreground attention module. Based on the U-Net encoder structure, it integrates a foreground attention mechanism into the feature extraction process, focusing on the main component regions of the image layer by layer. Simultaneously, it combines an edge detection network to ultimately restrict the watermark information to the foreground edges, balancing watermark robustness and imperceptibility during the embedding stage. Furthermore, addressing the moiré pattern phenomenon, which is most destructive to the watermark image during screen capture, this invention uses re-mosaicing to simulate the imaging principle of moiré patterns after two samplings. It also redesigns a more realistic screen capture noise layer by incorporating existing perspective transformation, brightness transformation, and Gaussian noise to enhance the model's robustness against attacks such as strong moiré patterns in screen capture scenarios.
[0104] This invention offers the following advantages: It utilizes LENet to process watermark information and carrier images, achieving layered foreground edge embedding and enhancing the ability to preserve watermark information even in extreme shooting scenarios. Based on the main distortions in screen capture scenarios, such as moiré distortion, brightness distortion, perspective distortion, and blur distortion, this invention designs and trains a differentiable screen capture noise layer that can simulate more realistic moiré patterns, starting from the image transformation method between display and capture. Experiments demonstrate that the method of this invention exhibits better robustness of the watermark under real-world shooting tests. Attached Figure Description
[0105] Figure 1 This is a diagram illustrating the overall framework of the method of this invention.
[0106] Figure 2 It is an encoder structure diagram that includes foreground edge attention.
[0107] Figure 3 This is a schematic diagram simulating the moiré pattern of the noise layer captured on a screen. Detailed Implementation
[0108] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.
[0109] This invention provides a method for anti-screen capture image watermarking network with layered foreground attention and a more realistic moiré noise layer. The overall framework is as follows: Figure 1 As shown, it includes:
[0110] Step 1: Perform multi-scale expansion on the binary watermark information to be embedded. After passing through the DiffusionBlock, the one-dimensional watermark information sequence is output as multiple two-dimensional watermark information feature maps of different scales.
[0111] Step 2: Construct an image watermarking framework with hierarchical edge discrimination and foreground edge attention guidance. Integrate multi-level modules into the UNet-based watermarking encoder, including an encoder structure diagram with foreground edge attention, as shown below. Figure 2As shown: First, a hierarchical edge processor is introduced. Through multi-scale feature parsing and semantic hierarchical division, the image edges are accurately distinguished from the foreground edges, establishing a spatial hierarchical structure of the edges. Second, a foreground edge attention module is embedded in the upsampling stage. This module is guided by the edge hierarchy information output by the hierarchical edge processor, which specifically strengthens the feature weights of the foreground edge region while suppressing the attention ratio of the mid-ground, background, and non-edge regions. Finally, the multi-scale watermark information features output by the cascaded message processor are received and fused with the multi-level features extracted by the encoder and the upsampled features of the decoder. During the fusion process, the weight allocation is dynamically adjusted through the foreground edge attention mechanism, so that the watermark information is preferentially embedded into the foreground edge region, reducing the scattered embedding to irrelevant edges, and achieving a precise balance between robustness and imperceptibility.
[0112] Step 3: Design the screen capture noise layer. Starting from the generation process of screen capture moiré patterns, the non-differentiable screen capture noise is made differentiable to form a noise layer containing moiré distortion and perspective distortion as the main components, brightness distortion, and Gaussian noise as secondary components. This layer participates in the training process of the image watermarking network model, simulating attacks on the model. The principle diagram of the screen capture noise layer moiré simulation is shown below. Figure 3 As shown;
[0113] Step 4: Construct a watermark decoder with a foreground edge attention module that matches the encoder;
[0114] Step 5: Design a loss function and train the watermarking network composed of steps 1, 2, 3, and 4.
[0115] Step 1 includes:
[0116] Step 1-1: Randomly generate watermark information of size 64 bits. ;
[0117] Steps 1-2 involve transforming the one-dimensional watermark information M of length L using a linear layer, mapping it from a space of dimension L to a real number space R of dimension 256, thus obtaining the feature vector. ;
[0118] Steps 1-3: Reshape the feature vector V into a two-dimensional feature map by flattening it into a two-dimensional feature map with 1 channel, height h=16, and width w=16. ;
[0119] Steps 1-4 involve feeding the two-dimensional feature maps F at different scales into the DoubleConv module for feature extraction, outputting a watermark information feature map with 64 channels. ;
[0120] Steps 1-5 involve dynamically adjusting the watermark information feature map through interpolation operations. The size of the watermark information feature map Matching the image feature sizes at different stages of the encoder yields the first... Watermark information feature map of the stage ,in , For scale quantity, This represents the number of channels in the watermark information feature map. and These correspond to the height and width of the original image, respectively. , Corresponding to the encoder's number The height and width of the stage feature map.
[0121] Step 2 includes:
[0122] Step 2-1, Input the original image Initial feature extraction is performed using a dual convolution module to obtain the low-level feature map. ;
[0123] Step 2-2 introduces a hierarchical edge processor during the encoder downsampling stage. This edge processor is based on a multi-scale feature parsing architecture and utilizes... and the feature maps generated at each level during the downsampling process (such as...) , Semantic hierarchical modeling is performed, and the edge prior knowledge of the pre-trained edge detection network EdgeNet is combined to output a foreground edge map. ,in The outline edge of the main target in the image;
[0124] Steps 2-3 involve feature adaptation processing of the edge map output by the hierarchical edge map: A 1×1 convolution is used to map the single-channel edge map to a dimension matching the number of channels in the corresponding feature layer (e.g., ...). Mapped to ,in (This is the number of channels in the current feature layer), and is adjusted to the same spatial size as the feature map using bilinear interpolation to obtain the adapted foreground edge features. ;
[0125] Steps 2-4: Embed the Foreground Edge Attention Module (FGEA) after each feature extraction block in the downsampling stage: First, construct a foreground edge-guided channel-spatial joint attention mask. Through lightweight convolutional layers After feature transformation, it is generated by the Sigmoid activation function. ,in The weight values in the foreground edge region approach 1, and in other regions approach 0; then the attention mask is applied. With the current feature layer Hadamard product operations are performed to enhance the features of the foreground edge region, resulting in attention-modulated features. The formula is:
[0126] ,
[0127] Where ⊙ represents the Hadamard area;
[0128] Steps 2-5: In the upsampling stage, after each upsampling convolutional block outputs features, the foreground edge attention module (FGEA) is introduced again: This module focuses on the foreground edge features corresponding to the upsampling feature map (through the analysis of...). Using the upsampling adaptation as input, repeat steps 2-4 for attention mask generation and feature modulation to obtain the decoded features after refined attention control. This enables precise focusing of the foreground edge region during the upsampling stage;
[0129] Steps 2-6: Receive the multi-scale watermark information feature map output by the cascaded message processor. This is then fused with the multi-level features generated during encoder downsampling (after foreground edge attention modulation) and the features upsampled by decoder (after FGEA modulation): During the fusion process, the foreground edge attention mask is used. As a weight guide, make the watermark features High-intensity fusion is performed with the carrier features in the foreground edge region, and low-intensity fusion is performed with the carrier features in the midground and background edge regions to obtain the fused features. ;
[0130] Steps 2-7: Fusing features By mapping the image to 3 channels using a 1×1 convolution (consistent with the original image channels), the residual feature map for watermark embedding is obtained. ;
[0131] Steps 2-8: Extract the residual feature map. Compared with the original carrier image Perform pixel-level overlay, through The activation function constrains the output value to Within the specified range, an image with embedded watermark information is ultimately generated. The formula is:
[0132] .
[0133] Step 3 includes:
[0134] Step 3-1: Receive the image after embedding the watermark information. As the initial input, a random value is generated by a random number generator. If this random value is greater than a preset probability threshold... If the default value is 0.5, the input watermarked image is returned directly; otherwise, subsequent noise processing steps are performed.
[0135] Step 3-2, generating the perspective transformation matrix for simulating changes in shooting angle, specifically includes:
[0136] Define the set of coordinates of the four vertices of the image. , is represented as:
[0137] ,
[0138] in, and The width and height of the image are given, and then the coordinates of the four target vertices of the image after random perturbation are generated. :
[0139] ,
[0140] ,
[0141] ,
[0142] ,
[0143] in, This is the perspective transformation intensity parameter (default value is 0.2). For interval Random numbers within, based on the original vertex coordinates and target vertex coordinates Calculate the perspective transformation matrix The calculation method is as follows:
[0144] for any point in the middle and Corresponding point In homogeneous coordinates, the following conditions are met:
[0145] ,
[0146] in, To express proportion, the proportional relationship can be expanded as follows:
[0147] ,
[0148] ,
[0149] By establishing a system of 8 linear equations with 4 pairs of corresponding vertices, we can obtain the following solution: That is, determine the matrix .
[0150] Step 3-3: Use the perspective transformation matrix generated in step 3-2. For the input watermarked image Perform perspective transformation to obtain the transformed image. , is represented as:
[0151] ,
[0152] in, This indicates a perspective transformation operation.
[0153] Steps 3-4 involve performing LCD color array mosaic processing on the input watermarked image. First, the size of the mosaic blocks in the mosaic process is set to... The initial default minimum value is 3, which can be adjusted to a multiple of 3 according to the size of the input image. Then, the image edges are filled so that the width and height of the image can be filled. Integer division, with the fill method being edge pixel duplication, is represented as:
[0154] ,
[0155] in, This indicates a fill operation. Next, initialize an image of the same size as the padded image, with all pixel values set to... RGB image ( Used to control the brightness of the generated mosaic image. The value of determines the simulated moiré brightness, and then iterates through... For all blocks in the mosaic, calculate the center coordinates of each mosaic block, where the... Line number The center coordinates of the mosaic blocks are:
[0156] ,
[0157] Where s is the size of the mosaic block. First, ensure that the coordinates do not exceed the boundaries of the original image. Second, obtain the RGB value of the pixel at the center position in the original image. To simulate the resampling process in real-world photography, values are filled into the mosaic blocks. Referring to the RGB vertical color array commonly used in LCD screens, each sub-region is filled with the RGB values of the pixel at the center of the block, which can be represented as:
[0158] ,
[0159] in, The horizontal coordinates within the block, with a value range of [value range missing]. , G represents the red area, B represents the green area, and C represents the blue area; the pixel value of the red area becomes... The pixel value of the green area becomes The pixel value in the blue area becomes Finally, cropping the mosaic image back to its original size yields a mosaic image simulating an LCD color array. .
[0160] Step 3-5: Use the perspective transformation matrix generated in step 3-2. The mosaic image obtained in steps 3-4 Perspective transformation is performed. Steps 3-4 simulate the first sampling of the image by the monitor, while this step simulates the second sampling of the image by the imaging device, ultimately yielding the transformed moiré image. The formula is:
[0161] ,
[0162] in, This indicates a perspective transformation operation.
[0163] Step 3-6: Referring to Step 3-4, perform Bayer array mosaic processing on the input image after embedding the watermark. First, set the size of the mosaic blocks in the mosaic process. The initial default minimum value is 2, which can be adjusted to a multiple of 2 according to the size of the input image. Similarly, filling, initialization, traversal, and block center coordinates are performed. Referring to the Bayer color array commonly used in CFA, each block is filled with the RGB values of the corresponding pixel at the block center position. The formula is:
[0164] ,
[0165] in, and These are the horizontal and vertical coordinates within the block. This indicates a modulo operation; the pixel value in the red area becomes... The pixel value of the green area becomes The pixel value in the blue area becomes Finally, cropping the mosaic image back to its original size yields a mosaic image simulating a Bayer color array. .
[0166] Step 3-7: Refer to Step 3-5 and use the perspective transformation matrix generated in Step 3-2. The mosaic image obtained in steps 3-6 Perform perspective transformation to obtain the transformed moiré pattern image. The formula is:
[0167] ,
[0168] in, This indicates a perspective transformation operation, but since the G region of the Bayer color array is often twice the size of the R or B regions, further adjustments are needed. To perform white balance, the formula is:
[0169] ,
[0170] in, This indicates the white balance operation; the image after white balance is... .
[0171] Steps 3-8: Multiply the transformed watermark image by the weighting parameter. Adjusting this value can correspondingly adjust the moiré intensity and brightness distortion during screen capture. It is then added to the transformed mosaic image using the following formula:
[0172] ,
[0173] Among them, For the original image weights, For LCD array moiré weights, As the weighting factor for the Bayer array moiré pattern, the moiré phenomenon under shooting conditions is simulated by dynamically adjusting the ratio of the three factors, while controlling... Brightness distortion in simulated shooting scenarios.
[0174] Steps 3-9: Add Gaussian noise to the fused image using the following formula:
[0175] ,
[0176] in, This is the image after adding Gaussian noise. Represents random variables Follows a mean of 0 and a variance of Gaussian noise with a normal distribution.
[0177] Steps 3-10 restrict the processed image pixel values to [specific range]. Within the range, the final noise layer output image is obtained. .
[0178] Step 4 includes:
[0179] Step 4-1: Input the image with embedded watermark and after being subjected to a noise layer attack. Initial feature extraction is performed using a dual convolution module to obtain the initial feature map for the decoder. ;
[0180] Step 4-2: Before downsampling in the first stage of the decoder, introduce the same hierarchical edge processor as in step 2-2 of the encoder, based on the initial feature map. Semantic hierarchical modeling is performed, combining the foreground edge map output by the pre-trained EdgeNet. This provides the basis for foreground edge localization for the attention mechanism (the decoder focuses on the foreground edge without needing to distinguish between midground / background edges), and then maps it to a dimension matching the number of channels in the current feature layer through a 1×1 convolution. Foreground edge map Feature adaptation processing is performed to obtain the adapted foreground edge features. ;
[0181] Step 4-3, introduce the Foreground Edge Attention (FGEA) module to... As input, a channel-spatial joint attention mask is generated using a lightweight convolutional layer and a sigmoid activation function. ,Will With the initial feature map Perform the Hadamard product operation to obtain the modulated features. The formula is:
[0182] ,
[0183] Where ⊙ represents the Hadamard product, which enhances the watermark feature response in the foreground edge region;
[0184] Step 4-4 employs a downsampling process, setting up n downsampling levels consistent with the encoder's downsampling levels. After downsampling through convolution and pooling operations at each level, the foreground edge attention module (FGEA) is introduced: This module processes the foreground edge image... Downsampled to the corresponding size via bilinear interpolation , And mapped to the current number of channels through a 1×1 convolution. To obtain the adapted edge features Generate attention mask , with the current downsampling features Modulation: Repeat the above process until the nth downsampling level to obtain the final downsampled feature map. ;
[0185] Steps 4-5, for Perform global average pooling to compress the spatial dimension to 1×1, resulting in a one-dimensional feature vector. The feature vector is mapped to 256 dimensions through a linear layer and compared with the watermark feature vector output from steps 1-2. Dimension matching, i.e. ,Will The sample is fed into a linear layer for dimensionality transformation, mapping from a 256-dimensional real space to a 64-dimensional binary space. After processing with a Sigmoid activation function, a threshold (e.g., 0.5) is applied to obtain the extracted watermark information. The watermark extraction process is now complete.
[0186] In step 5, the following loss function L is used during training:
[0187] ,
[0188] in , , These are weighting coefficients (hyperparameters), which in this invention take values of 1, 10, and 0.0001, respectively.
[0189] in, It is the coding loss, calculated using the following formula:
[0190] ,
[0191] in Represents the original image Image with embedded watermark The mean square error, Represents encoder The weight parameters involved in training, Representing the original watermark information, the encoded image is updated by updating parameters. and the original image To enhance the imperceptibility of the watermark, it should be as visually similar as possible.
[0192] It is the encoder message loss, calculated using the following formula:
[0193] ,
[0194] in This indicates the watermark information decoded by the decoder. and original watermark information The mean square error, Representative decoder Trainable weight parameters This indicates that after an image has been subjected to noise attack, the watermark becomes robust to screen capture noise by updating parameters and backpropagation.
[0195] It is the discriminator loss, calculated using the following formula:
[0196] ,
[0197] in For the discriminator, The parameters for discriminator A are the original image received. and the image after embedding watermark As input, in adversarial training, the core objective of the discriminator is to accurately distinguish the input image as an "unaltered original image". "or "tampered images with embedded watermarks" The encoder, under the inverse constraint of the discriminator, generates as close as possible to the discriminator. Visually similar By engaging in a game of adversarial interaction between the two, a balance between imperceptibility and robustness is achieved while ensuring effective watermark embedding, and the risk of model overfitting is reduced.
[0198] The method of this invention exhibits significant advantages in both robustness and imperceptibility. In experimental evaluation, the watermarking method was tested for both screen capture robustness and imperceptibility. The results show that the invention achieves a high peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) after embedding, and maintains a low bit error rate under real screen capture conditions, demonstrating excellent screen capture resistance. Particularly in environments with strong moiré patterns, this method demonstrates more stable watermark information extraction, proving its effectiveness in practical applications.
[0199] Table 1
[0200]
[0201] Table 1 compares the performance of different watermarking methods on carrier image quality evaluation metrics (PSNR, SSIM). PSNR (Peak Signal-to-Noise Ratio) and SSIM (Structural Similarity) are core metrics for measuring image distortion; higher values indicate a smaller impact of watermark embedding on the visual quality of the carrier image. By comparing the two metrics of the HiDDeN, RIHOOP, and PIMog watermarking methods with the proposed method (Ours), we can intuitively evaluate the ability of each method to protect the carrier image while ensuring watermark performance, providing a quantitative basis for the visual concealment of the methods. The experimental results show that the proposed method (Ours) significantly outperforms other comparative methods in both PSNR and SSIM, indicating that it has less impact on the visual quality of the carrier image and better visual concealment.
[0202] Table 2
[0203]
[0204] Table 2 explores the impact of shooting distance on the detection performance of each watermarking method. Experiments were conducted with shooting distances ranging from 20cm to 40cm to simulate watermark recognition effects at different observation distances in real-world scenarios. The experimental results show that the other three anti-screen capture watermarking schemes are significantly superior to the HiDDeN method without anti-screen capture processing. Furthermore, the accuracy of this method is higher at 20cm and the accuracy difference is smaller at 25cm. This is because at close range, the captured image is highly susceptible to strong moiré patterns, and the proposed method has a significant advantage under these conditions.
[0205] Table 3
[0206]
[0207] Table 3 analyzes the impact of shooting angle shift on watermark detection performance. Experiments covered multiple shooting angles from 30° left to 30° right, simulating watermark recognition scenarios when shooting from a non-direct angle. The performance of each method at different angles directly reflects its robustness against viewing angle changes. The results show that even with an angle shift of ±30°, its accuracy is still significantly higher than other comparative methods, demonstrating superior robustness against viewing angle interference. Furthermore, since the simulated moiré pattern in the noise layer is based on different textures generated by the perspective matrix, it also exhibits stronger robustness against different forms of moiré patterns encountered in real-world shooting at different angles.
[0208] This invention provides a method and system for anti-screen capture image watermarking networks with layered foreground attention and more realistic moiré noise layers. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.
Claims
1. A method for anti-screen capture image watermarking network with layered foreground attention and more realistic moiré noise layers, characterized in that, Includes the following steps: Step 1: Perform multi-scale expansion on the binary watermark information to be embedded. After passing through the Diffusion Block, output the one-dimensional watermark information sequence as two or more two-dimensional watermark information feature maps of different scales. Step 2: Construct an image watermarking framework with hierarchical edge discrimination and foreground edge attention guidance. Integrate multiple modules into the UNet-based watermarking encoder: First, introduce a hierarchical edge processor to accurately distinguish foreground edges through multi-scale feature parsing and semantic hierarchical division, establishing a spatial hierarchical structure of edges; Second, embed a foreground edge attention module during the upsampling stage. Guided by the edge hierarchy information output by the hierarchical edge processor, the foreground edge attention module selectively strengthens the feature weights of the foreground edge region while suppressing the attention ratio of mid-ground, background, and non-edge regions; Finally, receive the multi-scale watermark information features output by the cascaded message processor and fuse them with the multi-level features extracted by the encoder and the upsampled features of the decoder. During the fusion process, the weight allocation is dynamically adjusted through the foreground edge attention mechanism to prioritize embedding the watermark information into the foreground edge region. Step 3: Design a screen capture noise layer. Starting from the generation process of screen capture moiré pattern, the non-differentiable screen capture noise is made differentiable to form a noise layer containing moiré pattern distortion and perspective distortion as the main components, brightness distortion, and Gaussian noise as the auxiliary components. This layer participates in the training process of the image watermarking network model and simulates attacks on the model. Step 4: Construct a watermark decoder with a foreground edge attention module that matches the encoder; Step 5: Design a loss function and train the watermarking network composed of steps 1, 2, 3, and 4.
2. The method according to claim 1, characterized in that, Step 1 includes: Step 1-1: Randomly generate watermark information of size 64 bits. ; Steps 1-2 involve transforming the one-dimensional watermark information M of length L using a linear layer, mapping the one-dimensional watermark information M from a space of dimension L to a real number space R of dimension 256, thus obtaining the feature vector. ; Steps 1-3: Reshape the feature vector V into a two-dimensional feature map by flattening it into a two-dimensional feature map with 1 channel, height h=16, and width w=16. ; Steps 1-4 involve feeding the two-dimensional feature maps F at different scales into the DoubleConv module for feature extraction, outputting a watermark information feature map with 64 channels. ; Steps 1-5 involve dynamically adjusting the watermark information feature map through interpolation operations. The size of the watermark information feature map Matching the image feature sizes at different stages of the encoder yields the first... Watermark information feature map of the stage ,in , For scale quantity, This represents the number of channels in the watermark information feature map. and These correspond to the height and width of the original image, respectively. , Corresponding to the encoder's number The height and width of the stage feature map.
3. The method according to claim 2, characterized in that, Step 2 includes: Step 2-1, Input the original image Initial feature extraction is performed using a dual convolution module to obtain the low-level feature map. ; Step 2-2 introduces a hierarchical edge processor during the encoder downsampling stage. The hierarchical edge processor is based on a multi-scale feature parsing architecture, and it works by... Semantic hierarchical modeling is performed on the feature maps generated during downsampling, and the foreground edge map is output by combining the edge prior knowledge of the pre-trained edge detection network EdgeNet. ,in The outline of the main target in the corresponding image; Steps 2-3 involve feature adaptation processing of the edge map output by the hierarchical edge map: A 1×1 convolution is used to map the single-channel edge map to a dimension matching the number of channels in the corresponding feature layer, and bilinear interpolation is used to adjust it to the same spatial size as the feature map, resulting in the adapted foreground edge features. ; Steps 2-4: Embed a foreground edge attention module (FGEA) after each double convolutional module in the downsampling stage: First, construct a foreground edge-guided spatial attention mask. Through lightweight convolutional layers After feature transformation, it is generated by the Sigmoid activation function. ,in Indicates the first The number of channels during each downsampling stage, followed by attention masking. With the current feature layer Hadamard product operations are performed to enhance the features of the foreground edge region, resulting in attention-modulated features. The formula is: , Where ⊙ represents the Hadamard product, which includes the feature maps generated during the downsampling process at various levels. , Repeat steps 2-2 to 2-4; Steps 2-5: In the upsampling stage, after each upsampled convolutional block outputs features, the foreground edge attention module (FGEA) is introduced again. Using the foreground edge features corresponding to the upsampled feature map as input, the attention mask generation and feature modulation process of steps 2-4 is repeated to obtain the decoded features after refined attention control. ; Steps 2-6: Receive the multi-scale watermark information feature map output by the cascaded message processor. ,Will The features are fused with multi-level features generated during encoder downsampling and features upsampled by decoder: during fusion, foreground edge attention masks are used. As a weight guide, make the watermark features The fused features are obtained by performing high-intensity fusion with the carrier features in the foreground edge region. ; Steps 2-7: Fusing features The residual feature map for watermark embedding is obtained by mapping to 3 channels through 1×1 convolution. ; Steps 2-8: Extract the residual feature map. Compared with the original carrier image Perform pixel-level overlay, through The activation function constrains the output value to Within the specified range, an image with embedded watermark information is ultimately generated. The formula is: 。 4. The method according to claim 3, characterized in that, Step 3 includes: Step 3-1: Receive the image after embedding the watermark information. As the initial input, a random value is generated by a random number generator. If the random value is greater than a preset probability threshold... If the result is positive, return the input watermarked image directly; otherwise, proceed to step 3-2. Step 3-2, generating the perspective transformation matrix for simulating changes in shooting angle, specifically includes: Define the set of coordinates of the four vertices of the image. , is represented as: , in, and The width and height of the image are given, and then the coordinates of the four target vertices of the image after random perturbation are generated. , , , : , , , , in, For perspective transformation intensity parameters, , , , , , , and For interval Random numbers within, based on the original vertex coordinates Calculate the perspective transformation matrix using the target vertex coordinates. The calculation method is as follows: for any point in the middle, x and y coordinates The x and y coordinates of the corresponding point in the target vertex coordinate system In homogeneous coordinates, the following conditions are met: , in, To express proportion, expand according to the proportional relationship as follows: , , By establishing a system of 8 linear equations with 4 pairs of corresponding vertices, the intermediate parameters can be obtained by solving the system. , , , , , , , That is, determine the matrix ; Step 3-3: Use the perspective transformation matrix generated in step 3-2. For the input watermarked image Perform perspective transformation to obtain the transformed image. , is represented as: , in, Indicates perspective transformation operation; Steps 3-4 involve performing LCD color array mosaic processing on the input watermarked image. First, the size of the mosaic blocks in the mosaic process is set to... Next, the image edges are filled so that both the width and height of the image can be filled. Integer division, fill method is edge pixel copying, the filled image Represented as: , in, This indicates a fill operation. , Indicates the height of the image after filling. This represents the width of the padded image; next, an image of the same size as the padded image is initialized, with all pixel values set to a value equal to 1.
5. RGB image, then iterate through For all blocks in the mosaic, calculate the center coordinates of each mosaic block, where the... Line number The center coordinates of the mosaic blocks are: , Where s is the size of the mosaic block. Next, obtain the RGB value of each pixel at the center position in the original image. To simulate the resampling process in real shooting, the interior of the mosaic blocks is filled with values. Each sub-region is filled with the RGB values of the pixel at the center of the corresponding block, represented as: , in, The horizontal coordinates within the block, with a value range of [value range missing]. , G represents the red area, B represents the green area, and C represents the blue area; the pixel value of the red area becomes... The pixel value of the green area becomes The pixel value in the blue area becomes Finally, cropping the mosaic image back to its original size yields a mosaic image simulating an LCD color array. ; Steps 3-5: Use the perspective transformation matrix For mosaic images A perspective transformation is performed to obtain the transformed LCD moiré image. : ; Steps 3-6: First, set the size of the mosaic blocks in the mosaic process. The process involves filling, initializing, traversing, and determining the center coordinates within each block. For each block, the values of the RGB channels of the pixel at the center position are filled. Time is represented as: , in, This indicates a modulo operation; the pixel value in the red area becomes... The pixel value of the green area becomes The pixel value in the blue area becomes Finally, cropping the mosaic image back to its original size yields a mosaic image simulating a Bayer color array. ; Steps 3-7: Process the mosaic image obtained in step 3-6. Perform perspective transformation to obtain the transformed Bayer moiré image. : , right To perform white balance, the formula is: , in, This indicates the white balance operation; the image after white balance is... ; Steps 3-8: Multiply the transformed watermark image by the weighting parameter. Then it is added to the transformed mosaic image, using the following formula: , in, This is the image after adding moiré noise. For the original image weights, For LCD array moiré weights, Assigning moiré weights to the Bayer array, and simulating the moiré phenomenon during shooting by dynamically adjusting the scale, while controlling... Simulated brightness distortion in shooting scenarios; Steps 3-9: Add Gaussian noise to the fused image using the following formula: , in, This is the image after adding Gaussian noise. Represents random variables Follows a mean of 0 and a variance of Normally distributed Gaussian noise; Steps 3-10 restrict the processed image pixel values to [specific range]. Within the range, the final noise layer output image is obtained. .
5. The method according to claim 4, characterized in that, Step 4 includes: Step 4-1: Input the image with embedded watermark and after being subjected to a noise layer attack. Initial feature extraction is performed using a double convolutional module (DoubleConv) to obtain the initial feature map for the decoder. ; Step 4-2: Before downsampling in the first stage of the decoder, a hierarchical edge detector is introduced based on the initial feature map. Semantic hierarchical modeling is performed, combining the foreground edge map output by the pre-trained EdgeNet. This provides a basis for foreground edge localization for the attention mechanism, and then maps it to a dimension that matches the number of channels in the current feature layer through a 1×1 convolution. Foreground edge map Feature adaptation processing is performed to obtain the adapted foreground edge features. ; Step 4-3, introduce the Foreground Edge Attention (FGEA) module to... As input, a channel-spatial joint attention mask is generated using a lightweight convolutional layer and a sigmoid activation function. ,Will With the initial feature map Perform the Hadamard product operation to obtain the modulated features. The formula is: ; Step 4-4 employs a downsampling process, setting up n downsampling levels consistent with the encoder's downsampling levels. After downsampling through convolution and pooling operations at each level, the foreground edge attention module (FGEA) is introduced: This module processes the foreground edge image... Downsampled to the corresponding size via bilinear interpolation , And mapped to the current number of channels through a 1×1 convolution. To obtain the adapted edge features Generate attention mask , with the current downsampling features Modulation: Repeat step 4-4 until the nth level of downsampling to obtain the final downsampled feature map. ; Steps 4-5, for Perform global average pooling to compress the spatial dimension to 1×1, resulting in a one-dimensional feature vector. Through linear layers Mapped to 256 dimensions, and compared with the watermark feature vector output from steps 1-2 Dimension matching, i.e. ,Will The sample is fed into a linear layer for dimensionality transformation, mapping it from a 256-dimensional real space to a 64-dimensional binary space. After processing with a sigmoid activation function, a threshold is applied to obtain the extracted watermark information. The watermark extraction process is now complete.
6. The method according to claim 5, characterized in that, In step 5, the following loss function L is used during training: , in , , These are weighting coefficients; It is the encoding loss. It is encoder message loss. It is discriminator loss; The calculation formula is: , in Represents the original image Image with embedded watermark The mean square error, Represents encoder The weight parameters involved in training; It is the encoder message loss, calculated using the following formula: , in This indicates the watermark information decoded by the decoder. and original watermark information The mean square error, Representative decoder Trainable weight parameters This represents an image after being subjected to noise attack.
7. The method according to claim 6, characterized in that, In step 5, the discriminator loss The calculation formula is: , in For the discriminator, These are the parameters of discriminator A.
8. A screen capture image watermarking system based on the method described in any one of claims 1 to 7, featuring layered foreground attention and a more realistic moiré noise layer, characterized in that, include: Watermark extension unit: It has a built-in watermark diffusion module, receives binary watermark information, and converts the one-dimensional watermark sequence into multiple two-dimensional watermark feature maps of different scales through multi-scale extension processing, and outputs them to the encoding unit. Foreground edge coding unit: Based on the UNet architecture, it integrates a hierarchical edge processor and a foreground edge attention module. After receiving the carrier image and multi-scale watermark feature map, it distinguishes the foreground, midground and background edges through the hierarchical edge processor, and then strengthens the weight of the foreground edge region through the FGEA module. It then fuses the watermark features with the carrier image features and outputs the encoded image with embedded watermark. Screen capture noise simulation unit: It has a built-in differentiable screen capture noise layer, which includes a noise simulation module that mainly includes moiré distortion and perspective distortion, and secondarily includes brightness distortion and Gaussian noise; after receiving the encoded image, it applies a simulated screen capture attack and outputs a noisy encoded image for model robustness training. Edge attention decoding unit: Matches the structure of the encoding unit, integrates the foreground edge attention module, receives the noisy encoded image or the original encoded image, extracts and outputs one-dimensional watermark information by focusing on the features of the foreground edge region; Network training unit: It has a built-in loss function calculation module that receives the original carrier image, the encoded image, the original watermark information and the extracted watermark information. By calculating the encoding loss, the decoding message loss and the adversarial loss, it jointly trains the encoding unit and the decoding unit to optimize the network parameters to balance the imperceptibility and robustness of the watermark.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, It stores a computer program or instructions that, when run on a computer, perform the steps of the method as described in any one of claims 1 to 7.