Screen shooting resistant robust text image watermarking method fusing edge attention gating and multi-scale cavity convolution
By integrating edge attention gating with multi-scale dilated convolution and combining it with an adaptive loss weight adjustment mechanism, the robustness and readability issues of text image watermarks during screen capture are solved, achieving efficient information protection.
Patent Information
- Application Number
- CN202511216271.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-08-28
AI Technical Summary
Existing text image watermarking methods have difficulty maintaining the readability and robustness of text during the embedding process, and are especially susceptible to being affected during screen capture, leading to information leakage.
By integrating edge attention gating with multi-scale dilated convolution, a message processor, an edge-guided gating mechanism, a hybrid pooling layer, and a regularized inactivation layer are designed, combined with an adaptive loss weight adjustment mechanism to optimize the encoder and decoder training process and enhance the robustness and imperceptibility of the watermark.
The robustness and imperceptibility of the watermark are significantly improved, and it can effectively protect the integrity and information security of the text image during the screen capture process, reduce the bit error rate and maintain a high peak signal-to-noise ratio and structural similarity.
Smart Images

Figure CN120707366A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information security, and in particular relates to a screen capture-resistant robust text image watermarking method that integrates edge attention gating and multi-scale dilated convolution. Background Art
[0002] With the rapid development of internet information technology, the transmission of text content is becoming increasingly convenient, and text information has become an essential component of online communication. As a key carrier of text information, the need for copyright protection for text images is becoming increasingly prominent. With the advancement of multimedia technology, file leaks during video conferencing have become a frequent occurrence. Especially with the prevalence of smartphones, taking photos has become the simplest and most effective way to transmit information. Anyone with access to files (such as authorized employees) can steal and leak information by taking photos without leaving any record. Furthermore, the filming process is difficult to monitor or intercept. In this context, digital watermarking technology, with its powerful tracking and tracing capabilities, has become a key technical tool for combating screen capture leaks and protecting copyright. By embedding encrypted identification information, digital watermarks ensure that even if important information such as contracts and documents is secretly photographed or disseminated, the integrity and confidentiality of the watermark information remains, enabling traceability.
[0003] Research on digital watermarking for text leaks has made significant progress. Text watermarking methods can be broadly categorized into three types: semantic-based, structural-based, and image-based. Structural-based watermarking methods embed secret information by modifying the text's format, layout, or content structure. They focus on adjusting the text's external presentation while maintaining its semantic integrity. These watermarking schemes lack robustness and have limited capacity. Semantic-based watermarking relies on natural language processing (NLP) technology, providing a more discreet watermark embedding scheme by fine-tuning the text's semantics or modifying its grammar. However, these methods have limited application scenarios and limited watermark capacity. Image-based watermarking methods directly treat the text as an image. However, to minimize the visual quality of the text, these methods employ relatively small modifications, resulting in poor robustness.
[0004] In recent years, a growing number of watermarking algorithms based on convolutional neural networks (CNNs) have been proposed. The basic framework of this type of watermarking is an end-to-end autoencoder-like architecture, consisting of an encoder, a decoder, and a noise layer. A well-defined noise layer ensures the robustness of the watermarking algorithm, and robustness can be guaranteed by training with a target noise layer. However, most CNN-based watermarking frameworks are designed for natural images, while text images cannot be directly treated as natural images. Text images typically carry a higher information density, with the arrangement of characters and symbols constituting the primary carrier of information. This dense arrangement makes text images more susceptible to watermarking during embedding. Any slight change can directly affect the readability and accuracy of the text, in stark contrast to the visual tolerance of natural images. Therefore, during watermark embedding, text images must ensure that the watermarking process does not compromise readability. In particular, text images have unique structural characteristics. Local and edge features (such as sharp character boundaries and fine textures) significantly impact the clarity and visual integrity of the image content. Unlike the smooth transitions and complex textures in natural images, text images are extremely sensitive to distortion during watermark embedding, especially in high-contrast areas such as character edges. Therefore, designing a robust text watermarking scheme that is resistant to screen capture is crucial to solving this problem. Summary of the Invention
[0005] Purpose of the invention: In business meetings, video conferences, and other scenarios, secret information in text form accounts for the majority of cases. In order to solve the problem of text image leakage in such scenarios, the present invention provides a robust text image watermarking method that integrates edge attention gating and multi-scale dilated convolution to resist screen capture, including the following steps: Step 1: Design a message processor MessageProProcess to pre-process the secret message. Add the expansion network ExpandNet and channel attention SENet to the message processor MessageProProcess, input a binary secret message and output a message feature map. Step 2: Build a text watermarking framework based on the fusion of edge attention gating and multi-scale dilated convolution. Functional modules are added to the encoder of the end-to-end watermarking framework, including: a multi-branch dilated convolution module (MBDC-block), an edge-guided gating mechanism (Edge-Gated Mechanism), a hybrid pooling layer, and a regularized dropout layer (DropBlock). First, convolution activation (ConvBNReLU) is performed on the input carrier image to obtain the underlying feature map. Input the underlying feature map into the multi-branch dilated convolution module MBDC-block to obtain the image feature map, and input the underlying feature map into the lightweight edge detection network LedgeNet to obtain the edge feature map; Perform residual connection on the image feature map and the edge feature map to obtain fused features; input the fused features into the hybrid pooling layer for compression, and the output of the hybrid pooling layer enters the regularization deactivation layer DropBlock for regularization. Finally, it enters the fully connected layer to output the image features and fuse them with the message feature map; Step 3: Design a noise layer and simulate attacks on the model during watermark model training. Step 4: Design an optimization method for the loss function.
[0006] Step 1 includes: Step 1-1, add a message processor MessageProProcess to process the message, then provide the feature map to the encoder, convert the one-dimensional secret message M of length L into two-dimensional data, and then reshape the two-dimensional data into a two-dimensional secret message , h and w are the height and width of the two-dimensional message respectively; R represents the real number space; Step 1-2, reshaped two-dimensional secret message After entering a convolution activation layer ConvBNReLU with a convolution kernel size of 3 for preliminary feature extraction, it enters the expansion network ExpandNet and performs n times of 2 upsampling operations to expand to the same size as the carrier image. Message feature maps of the same size , where C is the number of channels of the carrier image, H and W are the height and width of the carrier image respectively; Steps 1-3, the expanded message feature graph enters the channel attention network SENet to obtain the message feature graph .
[0007] Step 2 includes: Step 2-1, first take the carrier image tensor is the initial input, which is encoded into the underlying semantic feature map after the primary convolution operation , underlying semantic feature map It is fed into three dilation-rate-differential convolution branches in parallel as input, and the feature maps are constructed using convolution kernels with dilation rates d of 1, 2, and 3, respectively. To enhance the modeling capabilities of local details, mesoscale structures, and global context, the formula is: , in and They represent the convolution kernel weight and bias of the dilation rate d of the dilated convolution branch respectively; is the nonlinear ReLU activation function; It is a two-dimensional convolution operation; Step 2-2, design a structural variant of the overall nested edge detection HED based on the residual network ResNet-18 in the encoder; the structural variant is a lightweight edge detection network LedgeNet, which is used to generate an explicit edge guide graph , guiding network feature extraction and fusion; k=1,2,3, respectively represent the output of low, medium and high scales, and the three scales are selected from the first three feature layers of the residual network ResNet-18; Step 2-3, edge guide map As an explicit attention mask, it participates in the gating and fusion process of the encoder feature channel to obtain an enhanced feature map after edge modulation. ; Step 2-4: To achieve joint modeling of edge response and original semantic features, the enhanced feature map is connected using residual connections. With feature map Fusion, get fusion features : ; A mixed pooling layer is established in the encoder, which includes a maximum pooling layer and an average pooling layer; the fusion feature map of the three scale outputs Enter the mixed pooling layer for feature compression to form an edge-enhanced perception feature map ; Step 2-5: Enhance the edge perception feature map The regularized inactivation layer DropBlock in the input encoder is randomly inactivated. Finally, the processed feature vector enters the fully connected layer to obtain the final image features. ; The final image features And the message feature map after upsampling Splice, convolution map and carrier image tensor 𝐼 C Perform a jump connection and finally generate a coded image containing a watermark through a 1×1 convolution .
[0008] Step 2-3 includes: first, the edge guide map After 1×1 convolution dimensionality reduction and several bilinear interpolation upsampling operations, the feature map with the expansion rate d is obtained. The corresponding edge feature map ; Then, in order to achieve the display enhancement of the edge area response, an edge-guided channel space soft gating mask is constructed, and the gating weight map is generated by lightweight convolution and Sigmoid activation function : , in represents a 1×1 convolution operation, Sigmoid activation function, gate weight map Represents the importance response of the edge area in each branch channel space, represents the number of channels of a branch with a dilation rate of d; Combine the gate weight map with the feature map Perform fusion operation to obtain enhanced feature map after edge modulation : , where ⊙ represents the Hadamard product.
[0009] In steps 2-4, the maximum pooling layer is used to enhance the texture, and the average pooling layer is used to retain the overall structure, which are respectively expressed as: , , in, Represents the compressed feature map of the output of the c-th channel processed by the maximum pooling layer at the pooling coordinate position (i, j); Represents the compressed feature map of the output of the c-th channel at the pooling coordinate position (i, j) after the average pooling layer processing; Represents the eigenvalue of the cth channel at position (x, y); x, y represent the horizontal and vertical coordinates in the input feature map respectively. Indicates the input box area corresponding to the horizontal coordinate position i, Indicates the input box area corresponding to the vertical coordinate position j, expressed as: , , in and They represent the height and width of the target output after pooling, and the two compressed feature maps are fused element-wise to obtain the pooled feature fusion map. : , in is the hyperparameter set; Represents the pooled feature fusion map of the output of the c-th channel processed by the hybrid pooling layer and the pooling coordinate position (i, j); Calculate the full-image response mean for the pooled feature fusion image: , in Represents the pooled feature fusion map with an expansion rate of d The mean of the full-graph response; Represents the value of the cth channel at the spatial position (x, y) in the pooled feature fusion graph of the branch with an expansion rate of d; Perform softmax normalization on the mean of the full-image response to obtain the structurally adaptive fusion weight : , d = 1,2,3, Where e represents a natural number, Express Perform exponential operations;
[0010] Finally, the feature maps of the three dilated convolution branches are weighted and fused to form an edge-enhanced perception feature map. : .
[0011] In step 4, the model's loss function is divided into the following three parts: encoder loss , decoder loss and the discriminator loss , Encoder loss , decoder loss and the discriminator loss The corresponding loss weights are 、 、 ; An adaptive loss weight adjustment mechanism is introduced to balance the training of encoder and decoder. The formula is: , , in, and are the loss weights of the encoder and decoder at the nth epoch, is a constant, and are the average loss of the encoder and the average loss of the decoder, respectively.
[0012] In step 4, the adaptive loss weight adjustment mechanism also adds a moving average smoothing mechanism. For the encoder, the smoothing factor is used. The weight at each update is: , in Represents the encoder loss weight of the n+1th epoch after adjustment using the smoothing factor.
[0013] In step 4, finally, the total loss function L is expressed as: , in Respectively represent the encoder loss weight and decoder loss weight adjusted by the smoothing factor, is the coding loss, which is calculated as: , in Represents the carrier image With encoded image The mean square error, represents the parameters of the encoder E, Represents a message feature graph; Represents the encoder's response to the input image and message feature graph The encoding process outputs an image with a watermark embedded in it ; is the decoding loss, which is calculated as: , in Represents the secret message M and the decoded message The binary cross entropy of represents the parameters of the decoder D, Denotes the decoder D in parameter Next, for the noisy image Process and output the decoded secret message ; is the discriminator loss, which is calculated as: , Where A is the discriminator, are the parameters of the discriminator A; Indicates that the parameter Next, the discriminator’s discrimination result on the encoded image output by the encoder is: Represents the discriminator's response to the carrier image The judgment result of .
[0014] The present invention also provides an electronic device, comprising a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of the method.
[0015] The present invention also provides a storage medium storing a computer program or instruction, which executes the steps of the method when the computer program or instruction is run on a computer.
[0016] The present invention has the following beneficial effects: It utilizes a combination of multi-scale dilated convolution and edge gating to achieve multi-scale, fine-grained watermark embedding. It also designs an adaptive loss weight adjustment mechanism. This mechanism dynamically adjusts the loss weights of the encoder and decoder based on the change in loss during each training cycle. To avoid drastic weight fluctuations, the mechanism also incorporates a smoothing strategy that gradually updates the weights using a moving average method, thereby ensuring the stability of the training process. Experiments have demonstrated that the method significantly improves the robustness and imperceptibility of the watermark. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is the overall framework diagram of the method of the present invention.
[0018] Figure 2 This is the architectural diagram of the message processor and encoder.
[0019] Figure 3 It is the lightweight edge detection network LedgeNet of the present invention. DETAILED DESCRIPTION
[0020] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more apparent.
[0021] The embodiment of the present invention provides a method for robust text image watermarking that integrates edge attention gating and multi-scale dilated convolution. The overall framework is as follows: Figure 1 Shown, including: Step 1: Design a message processor MessageProProcess to pre-process the secret message. Add the expansion network ExpandNet and channel attention SENet to the message processor MessageProProcess, input a binary secret message and output a message feature map. Step 2: Build a text watermarking framework based on the fusion of edge attention gating and multi-scale dilated convolution. Functional modules are added to the encoder of the end-to-end watermarking framework, including: a multi-branch dilated convolution module (MBDC-block), an edge-guided gating mechanism (Edge-Gated Mechanism), a hybrid pooling layer, and a regularized dropout layer (DropBlock). First, convolution activation (ConvBNReLU) is performed on the input carrier image to obtain the underlying feature map. Input the underlying feature map into the multi-branch dilated convolution module MBDC-block to obtain the image feature map, and input the underlying feature map into the lightweight edge detection network LedgeNet to obtain the edge feature map; Perform residual connection on the image feature map and the edge feature map to obtain fused features; input the fused features into the hybrid pooling layer for compression, and the output of the hybrid pooling layer enters the regularization deactivation layer DropBlock for regularization. Finally, it enters the fully connected layer to output the image features and fuse them with the message feature map; Step 3: Design a noise layer and simulate attacks on the model during watermark model training. Step 4: Design an optimization method for the loss function.
[0022] Step 1 includes: Step 1-1: To better support the encoding process, add a message processor MessageProProcess to process the message, then provide the feature map to the encoder, convert the one-dimensional secret message M of length L into two-dimensional data to facilitate input into the convolution layer for processing, and then reshape it into a two-dimensional secret message (h and w are the height and width of the two-dimensional message respectively); Step 1-2, reshaped two-dimensional secret message After entering a convolution activation layer ConvBNReLU with a convolution kernel size of 3 for preliminary feature extraction, it enters the expansion network ExpandNet and performs n times of 2 upsampling operations to expand its size to the same size as the carrier image. Message feature maps of the same size (C is the number of channels, H and W are the height and width of the carrier image respectively). In this way, the spatial resolution of the message is enhanced to be closer to the resolution of the image, so that the message can be spread to the entire feature map as much as possible.
[0023] Steps 1-3: The expanded message feature graph enters the channel attention network SENet to obtain a more detailed message feature graph. .
[0024] Step 2 includes: Step 2-1 First take the carrier image tensor (𝐶 is the number of channels, H and W are the height and width of the carrier image respectively) is the initial input, which is encoded into the underlying semantic feature map after the primary convolution operation , where R represents the real number space; the underlying semantic feature map It is fed into three dilation-rate-differential convolution branches in parallel as input, and the feature maps are constructed using convolution kernels with dilation rates d of 1, 2, and 3, respectively. To enhance the modeling capabilities of local details, mesoscale structures, and global context, the formula is: , in and They represent the convolution kernel weight and bias of the dilation rate d of the dilated convolution branch respectively; is the nonlinear ReLU activation function; It is a special two-dimensional convolution operation that converts the convolution kernel Slide in steps of d. This makes the receptive field expand to about d times that of ordinary convolution, but does not introduce additional parameters.
[0025] Among them, the dilated convolution branch with a dilation rate d of 1 mainly focuses on capturing local microscopic details, and can respond more sensitively to fine-grained texture structures such as character edges and stroke ups and downs; the dilated convolution branch with d of 2 has a medium receptive field, which is suitable for identifying texture or structural regularities at the word block level, and is conducive to perceiving medium-scale semantic structures; the dilated convolution branch with d of 3 tends to model a broader contextual layout and global geometric relationships, which is conducive to the modeling and representation of macro text organizational structures and enhances the perception of global arrangements.
[0026] Step 2-2, in order to realize the focus guidance of the edge area of the character in the feature extraction process, the present invention designs a structural variant of the overall nested edge detection HED based on the residual network ResNet-18, a lightweight edge detection network LedgeNet, which is used to generate an explicit edge guidance map , guiding network feature extraction and fusion, k=1,2,3, respectively represents the output of low, medium and high scales.
[0027] Different from the computationally complex VGG-16 backbone used in the original Holistic Nested Edge Detection (HED), this paper retains three scale outputs (low, medium, and high), which are selected from the first three feature layers of the residual network ResNet-18, significantly reducing the number of model parameters and computational FLOPs. Figure 3 shown.
[0028] Step 2-3, first guide the edge map After 1×1 convolution dimensionality reduction and several bilinear interpolation upsampling operations, the feature map with the expansion rate d is obtained. The corresponding edge feature map ; Then, in order to achieve the display enhancement of the edge area response, an edge-guided channel space soft gating mask is constructed, and the gating weight map is generated by lightweight convolution and Sigmoid activation function : , in represents a 1×1 convolution operation, Sigmoid activation function, gate weight map Represents the importance response of the edge area in each branch channel space, where the position with a value close to 1 represents a significant amplification of the feature, and the position with a value close to 0 suppresses the irrelevant area. Indicates the number of channels of the branch with expansion rate d. Perform fusion operation to obtain enhanced feature map after edge modulation : , Where ⊙ represents the Hadamard product, i.e., element-wise multiplication, which significantly enhances the features of edge regions. In this invention, the residual modulation structure ensures that the features of non-edge regions are transmitted intact, while the edge regions are explicitly enhanced, thus achieving response enhancement without introducing additional depth paths.
[0029] Step 2-4: To achieve joint modeling of edge response and original semantic features, the enhanced feature map is connected using residual connections. With feature map Fusion, get fusion features : , A mixed pooling layer is established in the encoder, which includes a maximum pooling layer and an average pooling layer; the fusion feature map of the three scale outputs Enter the mixed pooling layer for feature compression; The maximum pooling layer is used to enhance the texture, and the average pooling layer is used to retain the overall structure, which are respectively expressed as: , , in, Represents the compressed feature map of the output of the c-th channel processed by the maximum pooling layer at the pooling coordinate position (i, j); Represents the compressed feature map of the output of the c-th channel at the pooling coordinate position (i, j) after the average pooling layer processing; Represents the eigenvalue of the cth channel at position (x, y), which is the input data of the pooling operation; x, y represent the horizontal and vertical coordinates in the input feature map respectively. Indicates the input box area corresponding to the horizontal coordinate position i, Indicates the input box area corresponding to the vertical coordinate position j, expressed as: , , in and They represent the height and width of the target output after pooling, and the two compressed feature maps are fused element-wise to obtain the pooled feature fusion map. : , in is a manually set hyperparameter, representing the weight parameter; Represents the pooled feature fusion map of the output of the c-th channel processed by the hybrid pooling layer and the pooling coordinate position (i, j); Calculate the full-image response mean for the pooled feature fusion image: , in Represents the pooled feature fusion map with an expansion rate of d The mean of the full-graph response; Represents the value of the cth channel at the spatial position (x, y) in the pooled feature fusion graph of the branch with an expansion rate of d; Perform softmax normalization on the mean of the full-image response to obtain the structurally adaptive fusion weight : , d = 1,2,3, Where e represents a natural constant, Express Perform exponential operations to amplify the differences, making the branches with larger responses more prominent and the branches with smaller responses further suppressed; Finally, the feature maps of the three dilated convolution branches are weighted and fused to form an edge-enhanced perception feature map. : , Step 2-5: Enhance the edge perception feature map The regularized inactivation layer DropBlock in the input encoder performs random inactivation, which enhances the robustness of the watermark model to redundant features and forces it to make correct judgments even when some areas fail. It can effectively prevent overfitting and redundancy in the multi-scale path fusion process.
[0030] Finally, the processed feature vector enters the fully connected layer to obtain the final image features .
[0031] The final image features and the upsampled message feature map 𝐼 mSplice, convolution map and carrier image tensor 𝐼 C Perform a jump connection and finally generate a coded image containing a watermark through a 1×1 convolution .
[0032] In step 3, the noise layer is susceptible to various noise attacks during the encoding process, causing distortion. Without training, the watermarking scheme of the present invention will be unable to withstand the effects of these noises. Therefore, the present invention incorporates a noise layer into the model to simulate noise attacks. The noise layer includes several common noise types: cropping, dropout, JPEG compression, Gaussian noise, and median blur filter.
[0033] For these five noise attacks, the present invention controls the cropping attack strength by controlling the value of the cropping ratio r (0.3-0.7); the percentage p of the replaced image pixels to the original image pixels (0.3-0.7) to control the pixel loss attack strength; the quality factor Q (30-70) to control the strength of JPEG compression; the Gaussian kernel width σ controls the Gaussian noise strength; and the filter kernel k (3-7) controls the strength of the median blur.
[0034] In order to further improve the robustness of the model against non-differentiable noise attacks, the present invention adopts a small batch training strategy. When training the model's robustness to JPEG compression, it randomly selects from the real JPEG layer, the simulated JPEG-Mask layer, and the noise-free attack layer Identity each time.
[0035] In step 4, the model's loss function is mainly divided into the following three parts: encoder loss , decoder loss and the discriminator loss , the corresponding loss weight 、 、 Initial settings are 1, 10, and 0.0001.
[0036] In the watermarking scheme of this invention, the encoder aims to seamlessly embed the secret information within the image while preserving the original image quality as much as possible. The decoder's goal, on the other hand, is to accurately extract the hidden information from the image. These two goals often conflict in optimization: improving watermark extraction accuracy may sacrifice image quality, and vice versa. The discriminator, however, has a relatively small impact on watermark quality.
[0037] It can be seen from this that using a fixed loss weight obviously cannot achieve the above-mentioned dynamic balance requirements, because the loss changes of the encoder and decoder are different at different stages of training. Fixed loss weights may cause instability in the training process and thus lead to unsatisfactory final results. Therefore, the present invention introduces an adaptive loss weight adjustment mechanism to balance the training of the encoder and decoder. The core of this method's adaptive loss weight adjustment is to dynamically adjust the loss weights of the encoder and decoder through inverse proportional adjustment and moving average smoothing mechanism. The details are as follows: , , in, and are the loss weights of the encoder and decoder at the nth epoch, is a small constant that prevents the denominator from being zero. and are the average loss of the encoder and the average loss of the decoder, respectively.
[0038] Taking into account the fluctuation of loss during training, adaptive weight adjustment also adds a moving average smoothing mechanism to prevent weight fluctuations from affecting training stability. Taking the encoder as an example, the smoothing factor The weight at each update is: , represents the encoder loss weight of the n+1th epoch after adjustment using the smoothing factor; Finally, the total loss function L is expressed as: , in Respectively represent the encoder and decoder loss weights adjusted by the smoothing factor, is the coding loss, which is calculated as: , in Represents the carrier image With encoded image The mean square error, represents the parameters of the encoder E, Represents a message feature graph; Represents the encoder's response to the input image and message feature graph The encoding process outputs an image embedded with a watermark, i.e. ; is the decoding loss, which is calculated as: , in Represents the secret message M and the decoded message The binary cross entropy of represents the parameters of the decoder D, Denotes the decoder D in parameter Next, for the noisy image Process and output the decoded secret message, that is, ; is the discriminator loss, which is calculated as: , Where A is the discriminator, are the parameters of the discriminator A; Indicates that the parameter Under this condition, the discriminator’s judgment result on the encoded image output by the encoder is the probability that the image is a “real image”. Similarly, Represents the discriminator's response to the carrier image The discriminant loss is It represents the training goal of the discriminator when identifying the original image and the watermarked image, which is used to improve its ability to distinguish true and false images, and also reversely push the encoder to generate more "deceptive" images.
[0039] The method of the present invention demonstrates significant advantages in both robustness and stealth. Experimental evaluations tested the watermarking method using a variety of common noise attack methods (including cropping, pixel dropout, JPEG compression, Gaussian noise, and median blur filters). The results show that the method can maintain a low bit error rate and a high peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) under various distortion conditions, demonstrating excellent resistance to screen capture.
[0040] The evaluation metrics used in this example are bit error rate (BER), peak signal-to-noise ratio (PSNR), and structural similarity (SSIM). Lower BER and higher PSNR and SSIM indicate a superior model. The present invention uses the models from the HiDDeN, MBRS, and Adaptor papers as control experimental groups to highlight the superiority of the present invention.
[0041] Table 1 Crop attack experimental data table
[0042]
[0043] Cropping involves randomly cutting the image from the top / bottom and left / right, then filling the missing areas with black pixels. The cropped image renders the watermark detection algorithm ineffective, distorting the extracted watermark. In this embodiment, cropping ratios r of 0.3, 0.5, and 0.7 were selected as the noise layer for training and testing. A cropping ratio of 0.5 represents the percentage of the remaining encoded image size to the original image size, meaning the cropped image size is 50% of the original image. The experimental results show that the watermarking method of the present invention can effectively recover watermark information even when part of the watermark information is missing.
[0044] Table 2 Experimental data of pixel loss attack Dropout
[0045]
[0046] In the scenario of screen capture, during the transmission of the channel, due to signal interference and other problems, some pixels may be lost, resulting in the damage of the integrity of the watermark information. To simulate this situation, the pixel loss attack Dropout is used for experiments, that is, some pixels are randomly removed and replaced with pixels of the cover image to test the robustness of the model in the scenario of screen capture signal loss. In the experiment of the present invention, noise parameters of 0.3, 0.5 and 0.7 are used for testing in the training phase. A Dropout rate of 0.5 indicates that the percentage of the remaining encoded image to the original image size is 50%. This method has good robustness and imperceptibility. The method of the present invention is significantly better than other methods under pixel loss attack, while SSIM and PSNR still maintain a high level.
[0047] Table 3 Experimental data of JPEG compression
[0048]
[0049] JPEG compression is the most common lossy digital image compression method. JPEG compression is based on the discrete cosine transform, a process that includes steps such as quantization and encoding, most of which are non-differentiable. Therefore, it is impossible to adjust the model parameters through backpropagation. If JPEG compression is used directly, gradient updates cannot be performed during training, resulting in the model being unable to learn an effective watermark embedding strategy. In the experiment of the present invention, a small batch noise addition method is adopted, randomly selecting one of the simulated JPEG-Mask, real JPEG compression, and no noise as the new noise for each training small batch. In the experiment, JPEG compression with quality factors of 30, 50, and 70 was selected for training and testing. The experimental results show that as Q increases, the compression rate decreases, the image quality improves, and the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) also increase accordingly. The results show that the method of the present invention performs well in terms of compressed image quality, bit error rate control, and structural preservation.
[0050] Table 4 Experimental data of Gaussian Noise attack
[0051]
[0052] Gaussian noise attack is a random signal or interference that conforms to the Gaussian (normal) distribution. The main sources of this noise are sensor noise caused by low lighting or high temperature during the screen capture process, and Gaussian noise contamination of the image due to poor channel characteristics during image transmission. In this embodiment, σ values of 0.001, 0.002, and 0.005 are used. 2 The model can improve the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) while maintaining the bit error rate at 0.
[0053] Table 5 Experimental data of median fuzzy filter
[0054]
[0055] Median blurring means that for each pixel, the median pixel value of adjacent image elements is used, rather than the pixel value at that location within a window centered on the pixel. This method is called median smoothing, also known as median filtering. In this example, different filter kernel k sizes of 3, 5, and 7 were selected for median blurring. Experimental results show that while the bit error rate of this method is significantly lower than that of other methods, the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) are still maintained at high levels, demonstrating superior information integrity and image quality.
[0056] The present invention provides a method for robust text image watermarking that is resistant to screen capture and integrates edge attention gating with multi-scale dilated convolution. There are many methods and approaches to implement this technical solution. The above is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and such improvements and modifications should also be considered within the scope of protection of the present invention. Any components not specified in this embodiment may be implemented using existing technologies.
Claims
1. A method for robust text image watermarking against screen capture that integrates edge attention gating and multi-scale dilated convolution, characterized by: The following steps are involved: Step 1: Design a message processor MessageProProcess to pre-process the secret message. Add the expansion network ExpandNet and channel attention SENet to the message processor MessageProProcess, input a binary secret message and output a message feature map. Step 2: Build a text watermarking framework based on the fusion of edge attention gating and multi-scale dilated convolution. Functional modules are added to the encoder of the end-to-end watermarking framework, including: a multi-branch dilated convolution module (MBDC-block), an edge-guided gating mechanism (Edge-Gated Mechanism), a hybrid pooling layer, and a regularized dropout layer (DropBlock). First, convolution activation (ConvBNReLU) is performed on the input carrier image to obtain the underlying feature map. Input the underlying feature map into the multi-branch dilated convolution module MBDC-block to obtain the image feature map, and input the underlying feature map into the lightweight edge detection network LedgeNet to obtain the edge feature map; Perform residual connection on the image feature map and the edge feature map to obtain fused features; input the fused features into the hybrid pooling layer for compression, and the output of the hybrid pooling layer enters the regularization deactivation layer DropBlock for regularization. Finally, it enters the fully connected layer to output the image features and fuse them with the message feature map; Step 3: Design a noise layer and simulate attacks on the model during watermark model training. Step 4: Design an optimization method for the loss function.
2. The method according to claim 1, characterized in that Step 1 includes: Step 1-1, add a message processor MessageProProcess to process the message, then provide the feature map to the encoder, convert the one-dimensional secret message M of length L into two-dimensional data, and then reshape the two-dimensional data into a two-dimensional secret message , h and w are the height and width of the two-dimensional message respectively; R represents the real number space; Step 1-2, reshaped two-dimensional secret message After entering a convolution activation layer ConvBNReLU with a convolution kernel size of 3 for preliminary feature extraction, it enters the expansion network ExpandNet and performs n times of 2 upsampling operations to expand to the same size as the carrier image. Message feature maps of the same size , where C is the number of channels of the carrier image, H and W are the height and width of the carrier image respectively; Steps 1-3, the expanded message feature graph enters the channel attention network SENet to obtain the message feature graph .
3. The method according to claim 2, characterized in that Step 2 includes: Step 2-1, first take the carrier image tensor is the initial input, which is encoded into the underlying semantic feature map after the primary convolution operation , underlying semantic feature map It is fed into three dilation-rate-differential convolution branches in parallel as input, and the feature maps are constructed using convolution kernels with dilation rates d of 1, 2, and 3, respectively. To enhance the modeling capabilities of local details, mesoscale structures, and global context, the formula is: , in and They represent the convolution kernel weight and bias of the dilation rate d of the dilated convolution branch respectively; is the nonlinear ReLU activation function; It is a two-dimensional convolution operation; Step 2-2, design a structural variant of the overall nested edge detection HED based on the residual network ResNet-18 in the encoder; the structural variant is a lightweight edge detection network LedgeNet, which is used to generate an explicit edge guide graph , guiding network feature extraction and fusion; k=1,2,3, respectively represent the output of low, medium and high scales, and the three scales are selected from the first three feature layers of the residual network ResNet-18; Step 2-3, edge guide map As an explicit attention mask, it participates in the gating and fusion process of the encoder feature channel to obtain an enhanced feature map after edge modulation. ; Step 2-4: To achieve joint modeling of edge response and original semantic features, the enhanced feature map is connected using residual connections. With feature map Fusion, get fusion features : ; A mixed pooling layer is established in the encoder, which includes a maximum pooling layer and an average pooling layer; the fusion feature map of the three scale outputs Enter the mixed pooling layer for feature compression to form an edge-enhanced perception feature map ; Step 2-5: Enhance the edge perception feature map The regularized inactivation layer DropBlock in the input encoder is randomly inactivated. Finally, the processed feature vector enters the fully connected layer to obtain the final image features. ; The final image features And the message feature map after upsampling Splice, convolution map and carrier image tensor 𝐼 C Perform a jump connection and finally generate a coded image containing a watermark through a 1×1 convolution .
4. The method according to claim 3, characterized in that Step 2-3 includes: first, the edge guide map After 1×1 convolution dimensionality reduction and bilinear interpolation upsampling, the feature map with the expansion rate d is obtained. The corresponding edge feature map ; Then, in order to achieve the display enhancement of the edge area response, an edge-guided channel space soft gating mask is constructed, and the gating weight map is generated by lightweight convolution and Sigmoid activation function : , in represents a 1×1 convolution operation, Sigmoid activation function, gate weight map Represents the importance response of the edge area in each branch channel space, represents the number of channels of a branch with a dilation rate of d; Combine the gate weight map with the feature map Perform fusion operation to obtain enhanced feature map after edge modulation : , where ⊙ represents the Hadamard product.
5. The method according to claim 4, characterized in that In steps 2-4, the maximum pooling layer is used to enhance the texture, and the average pooling layer is used to retain the overall structure, which are respectively expressed as: , , in, Represents the compressed feature map of the output of the c-th channel processed by the maximum pooling layer at the pooling coordinate position (i, j); Represents the compressed feature map of the output of the c-th channel at the pooling coordinate position (i, j) after the average pooling layer processing; Represents the eigenvalue of the cth channel at position (x, y); x, y represent the horizontal and vertical coordinates in the input feature map respectively. Indicates the input box area corresponding to the horizontal coordinate position i, Indicates the input box area corresponding to the vertical coordinate position j, expressed as: , , in and They represent the height and width of the target output after pooling, and the two compressed feature maps are fused element-wise to obtain the pooled feature fusion map. : , in is the hyperparameter set; Represents the pooled feature fusion map of the output of the c-th channel processed by the hybrid pooling layer and the pooling coordinate position (i, j); Calculate the full-image response mean for the pooled feature fusion image: , in Represents the pooled feature fusion map with an expansion rate of d The mean of the full-graph response; Represents the value of the cth channel at the spatial position (x, y) in the pooled feature fusion graph of the branch with an expansion rate of d; Perform softmax normalization on the mean of the full-image response to obtain the structurally adaptive fusion weight : ,d = 1,2,3, Where e represents a natural number, Express Perform exponential operations; Finally, the feature maps of the three dilated convolution branches are weighted and fused to form an edge-enhanced perception feature map. : 。 6. The method according to claim 5, characterized in that In step 4, the model's loss function is divided into the following three parts: encoder loss , decoder loss and the discriminator loss , Encoder loss , decoder loss and the discriminator loss The corresponding loss weights are 、 、 ; An adaptive loss weight adjustment mechanism is introduced to balance the training of encoder and decoder. The formula is: , , in, and are the loss weights of the encoder and decoder at the nth epoch, is a constant, and are the average loss of the encoder and the average loss of the decoder, respectively.
7. The method according to claim 6, characterized in that In step 4, the adaptive loss weight adjustment mechanism also adds a moving average smoothing mechanism. For the encoder, the smoothing factor is used. The weight at each update is: , in Represents the encoder loss weight of the n+1th epoch after adjustment using the smoothing factor.
8. The method according to claim 7, characterized in that In step 4, finally, the total loss function L is expressed as: , in Respectively represent the encoder loss weight and decoder loss weight adjusted by the smoothing factor, is the coding loss, which is calculated as: , in Represents the carrier image With encoded image The mean square error, represents the parameters of the encoder E, Represents a message feature graph; Represents the encoder's response to the input image and message feature graph The encoding process outputs an image with a watermark embedded in it ; is the decoding loss, which is calculated as: , in Represents the secret message M and the decoded message The binary cross entropy of represents the parameters of the decoder D, Denotes the decoder D in parameter Next, for the noisy image Process and output the decoded secret message ; is the discriminator loss, which is calculated as: , Where A is the discriminator, are the parameters of the discriminator A; Indicates that the parameter Next, the discriminator’s discrimination result on the encoded image output by the encoder is: Represents the discriminator's response to the carrier image The judgment result of .
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.
10. A storage medium, characterized in that: A computer program or instruction is stored, and when the computer program or instruction is run on a computer, the steps of the method according to any one of claims 1 to 8 are executed.
Citation Information
Patent Citations
DTI image copyright protection method and system based on deep watermark algorithm
CN116894752A
Adaptive robust watermark embedding method and system based on attention and edge information
CN117274025A
Animal matting method and device, computer equipment and storage medium
CN118229725A
Screen-shooting-resistant robust image watermark soft fusion network method and system based on UNet architecture
CN120147099A
Watermark detection method, device, terminal and storage medium
WO2021129466A1
Cited By
Self-adaptive multi-mode generation hiding method and system
CN122223168A
An adaptive multi-modal generative hidden method and system
CN122223168B