CN114529441A - Image frequency domain digital watermarking method, system, device and medium - Google Patents

Image frequency domain digital watermarking method, system, device and medium Download PDF

Info

Publication number
CN114529441A
CN114529441A CN202210061192.1A CN202210061192A CN114529441A CN 114529441 A CN114529441 A CN 114529441A CN 202210061192 A CN202210061192 A CN 202210061192A CN 114529441 A CN114529441 A CN 114529441A
Authority
CN
China
Prior art keywords
watermark
picture
attention
image
encoder
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210061192.1A
Other languages
Chinese (zh)
Other versions
CN114529441B (en
Inventor
伍冠中
余翔宇
梅雨婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
South China University of Technology SCUT
Original Assignee
South China University of Technology SCUT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by South China University of Technology SCUT filed Critical South China University of Technology SCUT
Priority to CN202210061192.1A priority Critical patent/CN114529441B/en
Publication of CN114529441A publication Critical patent/CN114529441A/en
Application granted granted Critical
Publication of CN114529441B publication Critical patent/CN114529441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/002Image coding using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0065Extraction of an embedded watermark; Reliable detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The invention discloses a method, a system, a device and a medium for image frequency domain digital watermarking, wherein the method comprises the following steps: designing an embedding and extracting model of the image frequency domain digital watermark; inputting a carrier picture and a watermark into a watermark embedding and extracting self-encoder to obtain a first picture with the watermark, randomly adding the first picture into noise attack, and inputting the first picture into a decoder of the watermark embedding and extracting self-encoder to obtain a rough extracted watermark; randomly selecting the first picture to cut or not attack to obtain a second picture and a standard confidence map, inputting the second picture into an attention scorer, and outputting an attention confidence map; and (4) multiplying the roughly extracted watermark and the attention confidence map pixel by pixel on a two-dimensional plane for modification to obtain a final watermark. The invention analyzes the picture of the watermark to be extracted through the attention scoring device, reduces the influence of the watermark-free part on the real part with the watermark, obtains better extraction accuracy rate, and can be widely applied to the technical field of information security.

Description

一种图像频域数字水印方法、系统、装置及介质A kind of image frequency domain digital watermarking method, system, device and medium

技术领域technical field

本发明涉及信息安全技术领域,尤其涉及一种图像频域数字水印方法、系统、装置及介质。The present invention relates to the technical field of information security, and in particular, to a method, system, device and medium for digital watermarking in the frequency domain of images.

背景技术Background technique

在互联网时代,数字水印技术在生活以及商业活动中应用广泛,具有保护数字媒体的版权,防止篡改等功能,是信息安全领域重要的一环。在嵌入附加信息的众多可能载体中,较为常见的是数字图像。数字图像在各种领域中的广泛传播,从社交网络上的日常通信到医学,军队和太空,都促进了这一过程。In the Internet era, digital watermarking technology is widely used in daily life and commercial activities. It has functions such as protecting the copyright of digital media and preventing tampering. It is an important part of the field of information security. Among the many possible carriers for embedding additional information, digital images are the most common. The widespread dissemination of digital images in a variety of fields, from everyday communications on social networks to medicine, the military and space, has facilitated this process.

数字水印技术需要分为嵌入和提取的两个主要过程。嵌入是指将水印嵌入到数字媒体且不明显改变其内容原来的感知效果,而提取过程则是从嵌入过信息的数字媒体提取出原先嵌入的内容。数字水印技术的关键技术难点之一,就是如何在嵌入水印的数字媒体经过各种数字信号处理过程后,还能尽可能提取出原先的水印,即数字水印的鲁棒性。Digital watermarking technology needs to be divided into two main processes of embedding and extraction. Embedding refers to embedding the watermark into digital media without significantly changing the original perceptual effect of its content, while the extraction process is to extract the original embedded content from the embedded digital media. One of the key technical difficulties of digital watermarking technology is how to extract the original watermark as much as possible after the digital media embedded with the watermark has undergone various digital signal processing processes, that is, the robustness of the digital watermark.

通常,按水印嵌入的位置不同,大致可以分为频域嵌入和空域嵌入,具体来说,空间域水印算法修改的对象是图像上点的像素值,即在满足不可察觉性的前提下将水印进行嵌入到图像中,典型的有基于最低有效位算法。空间域水印算法的一大优点便是容易实现,但其具有较差的鲁棒性。频域数字水印技术的具体做法是先对图像进行数学变换,再在变换域上进行水印的嵌入,常用的数学变换包括离散傅里叶变换、离散小波变换、离散余弦变换,均在数字水印领域逐步得到了广泛的应用。Usually, according to the position of the watermark embedding, it can be roughly divided into frequency domain embedding and spatial domain embedding. Specifically, the object modified by the spatial domain watermarking algorithm is the pixel value of the point on the image, that is, the watermark is placed on the premise of imperceptibility. Embedding into the image, typically based on the least significant bit algorithm. One of the advantages of spatial domain watermarking algorithm is that it is easy to implement, but it has poor robustness. The specific method of frequency domain digital watermarking technology is to first perform mathematical transformation on the image, and then embed the watermark in the transformation domain. Common mathematical transformations include discrete Fourier transform, discrete wavelet transform, and discrete cosine transform, all of which are in the field of digital watermarking. Gradually it has been widely used.

随着计算机视觉的发展,神经网络在目标检测、人脸识别等多个领域大放异彩。考虑到图像的数字水印技术也是数字图像处理的一个特殊分支,也可以将神经网络引入到数字水印当中。目前研究者们在传统空间域算法和变换域算法的基础上,逐步将数字水印技术和神经网络等技术结合,极大的提高了算法的鲁棒性,且在某些方面具有其独特的优势,这对于数字水印技术的发展有着很大的促进作用。伊斯法罕科技大学的Ahmadi等人提出了一种使用卷积自编码器在频域进行水印嵌入的方法,得到了一众学者的关注。With the development of computer vision, neural networks shine in many fields such as object detection and face recognition. Considering that the digital watermarking technology of images is also a special branch of digital image processing, neural network can also be introduced into digital watermarking. At present, on the basis of traditional spatial domain algorithm and transform domain algorithm, researchers gradually combine digital watermarking technology with neural network and other technologies, which greatly improves the robustness of the algorithm and has its unique advantages in some aspects. , which greatly promotes the development of digital watermarking technology. Ahmadi et al. of Isfahan University of Science and Technology proposed a method for watermark embedding in the frequency domain using a convolutional autoencoder, which has attracted the attention of many scholars.

对于图像数字水印而言,各种数字信号处理手段中,裁剪是一种严重破坏水印的操作。对于图像的裁剪意味着信息的丢失,裁剪得越多,丢失的信息也越多,如何从剩余的小部分信息中提取出完整的水印成为了一个难题。如果要让图像在裁剪后仍然能准确地提取出水印,就需要设计一个精妙的算法,将水印尽可能嵌入到图像的每个局部单位,并很好地将水印提取出来。For image digital watermarking, among various digital signal processing methods, cropping is an operation that seriously destroys watermarking. The cropping of the image means the loss of information. The more cropping, the more information is lost. How to extract the complete watermark from the remaining small part of the information becomes a difficult problem. If the watermark can still be accurately extracted from the image after cropping, an exquisite algorithm needs to be designed to embed the watermark into each local unit of the image as much as possible, and extract the watermark well.

发明内容SUMMARY OF THE INVENTION

为至少一定程度上解决现有技术中存在的技术问题之一,本发明的目的在于提供一种图像频域数字水印方法、系统、装置及介质。In order to solve one of the technical problems existing in the prior art at least to a certain extent, the purpose of the present invention is to provide an image frequency domain digital watermarking method, system, device and medium.

本发明所采用的技术方案是:The technical scheme adopted in the present invention is:

一种图像频域数字水印方法,包括以下步骤:An image frequency domain digital watermarking method, comprising the following steps:

设计图像频域数字水印的嵌入与提取模型;其中,嵌入与提取模型包括水印嵌入提取自编码器和注意力得分器;Design the embedding and extraction model of image frequency domain digital watermark; the embedding and extraction model includes the watermark embedding extraction from the encoder and the attention scorer;

将载体图片和水印输入水印嵌入提取自编码器后,得到带水印的第一图片,将所述第一图片随机加入噪声攻击后,再输入到水印嵌入提取自编码器的解码器中,得到粗提取水印;After the carrier picture and the watermark are input into the watermark embedded and extracted from the encoder, the first picture with the watermark is obtained, and the first picture is randomly added to the noise attack, and then input into the decoder of the watermark embedded and extracted from the encoder, and the rough picture is obtained. extract watermark;

将所述第一图片随机选择裁剪攻击或不进行攻击,得到第二图片和标准置信度图,将所述第二图片输入到注意力得分器,输出注意力置信度图;The first picture is randomly selected to be cropped to attack or not to attack, to obtain a second picture and a standard confidence level map, input the second picture to an attention scorer, and output an attention confidence level map;

将通过水印嵌入提取自编码器获得的粗提取水印和通过注意力得分器获得的注意力置信度图,在二维平面上逐像素相乘进行修正,得到最终的水印。The coarse extraction watermark obtained by the self-encoder extracted by the watermark embedding and the attention confidence map obtained by the attention scorer are multiplied pixel by pixel on the two-dimensional plane for correction to obtain the final watermark.

进一步地,所述一种图像频域数字水印方法还包括训练所述水印嵌入提取自编码器的步骤:Further, the method for digital watermarking in the frequency domain of an image further comprises the step of training the watermark embedding and extracting from the encoder:

以最小化载体图片和带水印图片之间的误差,以及输入的水印和提取得到的水印之间的误差为方向,训练水印嵌入提取自编码器进行水印嵌入提取;In order to minimize the error between the carrier picture and the watermarked picture, as well as the error between the input watermark and the extracted watermark, the training watermark embedding is extracted from the encoder to extract the watermark embedding;

所述一种图像频域数字水印方法还包括训练所述注意力得分器的步骤:Described a kind of image frequency domain digital watermarking method also comprises the step of training described attention scorer:

以最小化注意力得分器的输出和标准置信度图的误差为训练方向,训练注意力得分器计算出输入图片在各个位置带有水印的置信度。Taking minimizing the error between the output of the attention scorer and the standard confidence map as the training direction, the training attention scorer calculates the confidence that the input image has a watermark at each position.

进一步地,所述水印嵌入提取自编码器和所述注意力得分器均由卷积神经网络组成;Further, the watermark embedding is extracted from the encoder and the attention scorer is composed of a convolutional neural network;

在将图片输入所述水印嵌入提取自编码器和所述注意力得分器之前,包括对图片进行预处理的步骤:Before inputting the picture into the watermark embedding and extracting from the encoder and the attention scorer, it includes the steps of preprocessing the picture:

如果图片为三通道的彩色图片,先将彩色图片进行色彩空间变换到YCbCr空间,保留CbCr通道不变,仅取Y通道作为灰度图进行嵌入;If the image is a three-channel color image, first transform the color image into the YCbCr space, keep the CbCr channel unchanged, and only take the Y channel as a grayscale image for embedding;

如果图片为单通道灰度图,则无需进行色彩空间变换;将灰度图分成互不重叠的8×8大小的图像块,每一图像块单独进行离散余弦变换后,所有图像块一起重塑为边长为载体图像边长的1/8,通道数为64的张量,每个通道代表一个离散余弦变换的系数;If the image is a single-channel grayscale image, there is no need to perform color space transformation; the grayscale image is divided into non-overlapping 8×8 image blocks, and after each image block is individually discrete cosine transform, all image blocks are reshaped together is a tensor whose side length is 1/8 of the side length of the carrier image, and the number of channels is 64, and each channel represents a coefficient of discrete cosine transform;

另外,将水印输入水印嵌入提取自编码器,对水印进行以下预处理:In addition, the watermark input watermark embedding is extracted from the encoder, and the following preprocessing is performed on the watermark:

将水印排列成边长相等的,共4个通道的张量,保留通道数不变,在二维平面上重复至边长与图像重构张量的边长相同。Arrange the watermarks into tensors with equal side lengths and a total of 4 channels, keep the number of channels unchanged, and repeat on the two-dimensional plane until the side length is the same as the side length of the image reconstruction tensor.

进一步地,在水印嵌入提取自编码器中,预处理后的图片张量和水印张量拼接后,输入到六层卷积核大小均为1×1,步长均为1×1,无填充的卷积层和非线性激活层串联形成的神经网络进行编码,对编码器的输出进行逆离散余弦变换,得到的残差图与载体图片相加,得到最终的带水印灰度图;Further, in the watermark embedding extraction from the encoder, after the preprocessed image tensor and the watermark tensor are spliced, they are input to the six-layer convolution kernel with a size of 1×1, a stride of 1×1, and no padding. The neural network formed by the convolution layer and the nonlinear activation layer in series is used for encoding, and the output of the encoder is inverse discrete cosine transform, and the obtained residual image is added to the carrier image to obtain the final watermarked gray image;

若预处理前的图片为三通道彩色图片,则将编码器输出的灰度图作为Y通道,与预处理时保留的CbCr通道再次变换回RGB色彩空间;随后选择预设的数字图像处理手段加入噪声攻击,再经过四层卷积核大小均为1×1,步长均为1×1,无填充的卷积层和非线性激活层串联形成的神经网络进行解码得到粗提取的水印张量,对重复的信息位求均值得到粗提取水印,以最小化粗提取水印和输入水印的误差以及编码器输出的带水印图片和输入图片之间的误差为训练方向,训练水印嵌入提取自编码器进行水印的嵌入和提取。If the image before preprocessing is a three-channel color image, use the grayscale image output by the encoder as the Y channel, and convert it back to the RGB color space with the CbCr channel retained during preprocessing; then select the preset digital image processing method to add Noise attack, and then after four layers of convolution kernel size are 1 × 1, step size is 1 × 1, the unfilled convolution layer and the nonlinear activation layer are connected in series to form a neural network to decode the watermark tensor. , the repeated information bits are averaged to obtain the rough extraction watermark, in order to minimize the error between the rough extraction watermark and the input watermark and the error between the watermarked picture output by the encoder and the input picture as the training direction, the training watermark embedding is extracted from the encoder Embedding and extracting the watermark.

进一步地,在注意力得分器中,裁剪攻击是随机生成一个小于图片大小的矩形,矩形内的图像内容不变,而矩形外的部分可以修改为任何其他的值;Further, in the attention scorer, the cropping attack is to randomly generate a rectangle smaller than the image size, the image content inside the rectangle remains unchanged, and the part outside the rectangle can be modified to any other value;

对应的置信度图在剪去位置的值为0,在保留位置的值为1,如果不进行攻击,则置信度图全图均为1;然后对置信度图进行核大小为8×8,步长为8×8的二维均值池化,得到标准置信度图;The corresponding confidence map has a value of 0 at the clipping position and 1 at the reserved position. If no attack is performed, the entire confidence map is 1; then the kernel size of the confidence map is 8 × 8, Two-dimensional mean pooling with a step size of 8 × 8 to obtain a standard confidence map;

处理后的图片进行离散余弦变换后输入到四层卷积核大小为3×3,步长为1×1和1个单位零填充的卷积层和非线性激活层串联形成的卷积神经网络,得到注意力置信度图,以最小化注意力置信度图和标准置信度图的误差为方向,训练注意力得分器能学习到输入图片在各个位置带有水印的置信度。The processed image is subjected to discrete cosine transform and then input to a four-layer convolution kernel with a size of 3 × 3, a stride of 1 × 1, and a convolutional neural network formed in series with a unit zero-padding convolutional layer and a non-linear activation layer. , get the attention confidence map, in the direction of minimizing the error between the attention confidence map and the standard confidence map, training the attention scorer can learn the confidence of the input image with watermark at each position.

进一步地,对所述水印嵌入提取自编码器进行训练中,输入水印和提取得到的水印的误差采用均方误差,图片之间的误差也采用均方误差,用于训练损失函数为图片误差和水印误差之和;Further, in the training of the watermark embedding extracted from the encoder, the error between the input watermark and the extracted watermark adopts the mean square error, and the error between the pictures also adopts the mean square error, and the loss function used for training is the picture error and sum of watermark errors;

对所述注意力得分器进行训练中,标准置信度图和注意力置信度图之间的误差采用均方误差,所述均方误差作为训练的损失函数。In the training of the attention scorer, the error between the standard confidence map and the attention confidence map adopts the mean square error, and the mean square error is used as the loss function of training.

进一步地,所述将通过水印嵌入提取自编码器获得的粗提取水印和通过注意力得分器获得的注意力置信度图,在二维平面上逐像素相乘进行修正,得到最终的水印,包括:Further, the rough extraction watermark obtained from the encoder extracted by the watermark embedding and the attention confidence map obtained by the attention scorer are multiplied pixel by pixel on the two-dimensional plane for correction to obtain the final watermark, including :

粗提取水印张量,所有值的值域为(0,1),将水印张量的值域进行线性转化到(-1,1);Roughly extract the watermark tensor, the value range of all values is (0, 1), and linearly transform the value range of the watermark tensor to (-1, 1);

采用注意力置信度图与水印张量在二维平面上进行逐元素相乘,得到最终的水印张量;The attention confidence map and the watermark tensor are multiplied element by element on the two-dimensional plane to obtain the final watermark tensor;

根据最终的水印张量,对重复的水印位求均值后取整得到最终的水印。According to the final watermark tensor, the repeated watermark bits are averaged and rounded to obtain the final watermark.

本发明所采用的另一技术方案是:Another technical scheme adopted by the present invention is:

一种图像频域数字水印系统,包括:An image frequency domain digital watermarking system, comprising:

模型设计模块,用于设计图像频域数字水印的嵌入与提取模型;其中,嵌入与提取模型包括水印嵌入提取自编码器和注意力得分器;The model design module is used to design the embedding and extraction model of the image frequency domain digital watermark; wherein, the embedding and extraction model includes the watermark embedding and extraction from the encoder and the attention scorer;

水印提取模块,用于将载体图片和水印输入水印嵌入提取自编码器后,得到带水印的第一图片,将所述第一图片随机加入噪声攻击后,再输入到水印嵌入提取自编码器的解码器中,得到粗提取水印;The watermark extraction module is used to extract the carrier picture and the watermark input watermark from the encoder to obtain the first picture with the watermark, add the first picture randomly to the noise attack, and then input it into the watermark embedded and extracted from the encoder. In the decoder, the rough extraction watermark is obtained;

置信度获取模块,用于将所述第一图片随机选择裁剪攻击或不进行攻击,得到第二图片和标准置信度图,将所述第二图片输入到注意力得分器,输出注意力置信度图;Confidence acquisition module, used to randomly select the first picture to crop or not to attack, obtain the second picture and the standard confidence map, input the second picture to the attention scorer, and output the attention confidence picture;

水印修正模块,用于将通过水印嵌入提取自编码器获得的粗提取水印和通过注意力得分器获得的注意力置信度图,在二维平面上逐像素相乘进行修正,得到最终的水印。The watermark correction module is used to multiply the coarse extraction watermark obtained by the watermark embedding from the encoder and the attention confidence map obtained by the attention scorer on a two-dimensional plane by pixel-by-pixel multiplication to obtain the final watermark.

本发明所采用的另一技术方案是:Another technical scheme adopted by the present invention is:

一种图像频域数字水印装置,包括:An image frequency domain digital watermarking device, comprising:

至少一个处理器;at least one processor;

至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;

当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现上所述方法。When the at least one program is executed by the at least one processor, the at least one processor implements the above method.

本发明所采用的另一技术方案是:Another technical scheme adopted by the present invention is:

一种计算机可读存储介质,其中存储有处理器可执行的程序,所述处理器可执行的程序在由处理器执行时用于执行如上所述方法。A computer-readable storage medium in which a processor-executable program is stored, the processor-executable program, when executed by the processor, is used to perform the method as described above.

本发明的有益效果是:本发明通过注意力得分器,对待提取水印的图片进行分析,对被篡改部分给予较低的得分,减少最后多数表决或取均值过程中,这些无水印部分对真正带水印部分的影响,得到更好的提取准确率。The beneficial effects of the present invention are: the present invention analyzes the pictures to be watermarked through the attention scorer, gives a lower score to the tampered part, reduces the final majority voting or takes the mean value, these non-watermarked parts have no effect on the real watermark. The influence of the watermark part can get better extraction accuracy.

附图说明Description of drawings

为了更清楚地说明本发明实施例或者现有技术中的技术方案,下面对本发明实施例或者现有技术中的相关技术方案附图作以下介绍,应当理解的是,下面介绍中的附图仅仅为了方便清晰表述本发明的技术方案中的部分实施例,对于本领域的技术人员而言,在无需付出创造性劳动的前提下,还可以根据这些附图获取到其他附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following descriptions are given to the accompanying drawings of the embodiments of the present invention or the related technical solutions in the prior art. It should be understood that the drawings in the following introduction are only In order to facilitate and clearly express some embodiments of the technical solutions of the present invention, for those skilled in the art, other drawings can also be obtained from these drawings without creative work.

图1是本发明实施例中水印嵌入提取自编码器的编码器的结构图;1 is a structural diagram of an encoder whose watermark embedding is extracted from an encoder in an embodiment of the present invention;

图2是本发明实施例中水印嵌入提取自编码器的解码器的结构图;2 is a structural diagram of a decoder whose watermark embedding is extracted from an encoder in an embodiment of the present invention;

图3是本发明实施例中注意力得分器的结构图;3 is a structural diagram of an attention scorer in an embodiment of the present invention;

图4是本发明实施例中对图片的预处理的流程图;Fig. 4 is the flow chart of the preprocessing of the picture in the embodiment of the present invention;

图5是本发明实施例中对水印信息的预处理的流程示意图;5 is a schematic flowchart of preprocessing of watermark information in an embodiment of the present invention;

图6是本发明实施例中一种基于注意力机制的图像频域数字水印方法的流程图;6 is a flow chart of an image frequency domain digital watermarking method based on an attention mechanism in an embodiment of the present invention;

图7是本发明实施例中注意力得分器训练的流程图。FIG. 7 is a flowchart of attention scorer training in an embodiment of the present invention.

具体实施方式Detailed ways

下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能理解为对本发明的限制。对于以下实施例中的步骤编号,其仅为了便于阐述说明而设置,对步骤之间的顺序不做任何限定,实施例中的各步骤的执行顺序均可根据本领域技术人员的理解来进行适应性调整。The following describes in detail the embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary, only used to explain the present invention, and should not be construed as a limitation of the present invention. The numbers of the steps in the following embodiments are only set for the convenience of description, and the sequence between the steps is not limited in any way, and the execution sequence of each step in the embodiments can be adapted according to the understanding of those skilled in the art Sexual adjustment.

在本发明的描述中,需要理解的是,涉及到方位描述,例如上、下、前、后、左、右等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。In the description of the present invention, it should be understood that the azimuth description, such as the azimuth or position relationship indicated by up, down, front, rear, left, right, etc., is based on the azimuth or position relationship shown in the drawings, only In order to facilitate the description of the present invention and simplify the description, it is not indicated or implied that the indicated device or element must have a particular orientation, be constructed and operated in a particular orientation, and therefore should not be construed as limiting the present invention.

在本发明的描述中,若干的含义是一个或者多个,多个的含义是两个以上,大于、小于、超过等理解为不包括本数,以上、以下、以内等理解为包括本数。如果有描述到第一、第二只是用于区分技术特征为目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量或者隐含指明所指示的技术特征的先后关系。In the description of the present invention, the meaning of several is one or more, the meaning of multiple is two or more, greater than, less than, exceeding, etc. are understood as not including this number, above, below, within, etc. are understood as including this number. If it is described that the first and the second are only for the purpose of distinguishing technical features, it cannot be understood as indicating or implying relative importance, or indicating the number of the indicated technical features or the order of the indicated technical features. relation.

本发明的描述中,除非另有明确的限定,设置、安装、连接等词语应做广义理解,所属技术领域技术人员可以结合技术方案的具体内容合理确定上述词语在本发明中的具体含义。In the description of the present invention, unless otherwise clearly defined, words such as setting, installation, connection should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above words in the present invention in combination with the specific content of the technical solution.

如图6所示,本实施例提供一种基于注意力机制的图像频域数字水印方法,包括下述步骤:As shown in FIG. 6 , this embodiment provides an image frequency domain digital watermarking method based on an attention mechanism, including the following steps:

S1、水印嵌入与提取的自编码器模型和注意力得分器设计,具体网络结构设置如下:如图1所示,本实施例的自编码器模型包括编码器和解码器,均为卷积神经网络,其中,编码器一共有六层,如图1所示,前五层均为64个64×1×1、步长为1×1、无填充的卷积核和ELU激活函数串联形成,最后一层为1个64×1×1、步长为1×1、无填充的卷积核和ELU激活函数串联形成;解码器一共有四层,如图2所示,前三层均为64个64×1×1、步长为1×1、无填充的卷积核和ELU激活函数串联形成,最后一层为4个64×1×1、步长为1×1、无填充的卷积核和sigmoid激活函数串联形成。S1. The design of the self-encoder model and attention scorer for watermark embedding and extraction. The specific network structure is set as follows: As shown in Figure 1, the self-encoder model of this embodiment includes an encoder and a decoder, both of which are convolutional neural networks. The network, in which the encoder has a total of six layers, as shown in Figure 1, the first five layers are 64 64 × 1 × 1, stride 1 × 1, unfilled convolution kernel and ELU activation function are formed in series, The last layer is a 64×1×1, stride 1×1, unfilled convolution kernel and ELU activation function in series; the decoder has a total of four layers, as shown in Figure 2, the first three layers are 64 convolution kernels of 64×1×1, stride 1×1, and no padding are formed in series with the ELU activation function, and the last layer is 4 64×1×1, stride 1×1, no padding. The convolution kernel and the sigmoid activation function are formed in series.

如图3所示,注意力得分器一共有四层,前三层均为64个64×3×3、步长为1×1、1个单位零填充的卷积核和ELU激活函数串联形成,最后一层为1个64×3×3、步长为1×1、1个单位零填充的卷积核和sigmoid激活函数串联形成。As shown in Figure 3, the attention scorer has a total of four layers. The first three layers are 64 convolution kernels of 64 × 3 × 3, stride of 1 × 1, 1 unit zero-padding and ELU activation function in series. , the last layer is a 64×3×3 convolution kernel with a stride of 1×1, a unit zero-padding and a sigmoid activation function in series.

ELU激活函数如下公式所示:The ELU activation function is shown in the following formula:

Figure BDA0003478259780000061
Figure BDA0003478259780000061

其中x为激活函数ELU的输入值,ELU(x)为激活函数的输出值,α为常数,本实施例中为1;Wherein x is the input value of the activation function ELU, ELU(x) is the output value of the activation function, and α is a constant, which is 1 in this embodiment;

sigmoid激活函数如下公式所示:The sigmoid activation function is shown in the following formula:

Figure BDA0003478259780000062
Figure BDA0003478259780000062

其中x为激活函数sigmoid的输入值,sigmoid(x)为激活函数的输出值。where x is the input value of the activation function sigmoid, and sigmoid(x) is the output value of the activation function.

S2、图片和水印信息在进入每个网络前后的预处理和后处理,具体操作如下:S2. The preprocessing and postprocessing of pictures and watermark information before and after entering each network. The specific operations are as follows:

如图4所示,对图片的预处理可以分为色彩空间转换、切块、空间与到频率域转换三个步骤,如果输入图片为黑白单通道图片则跳过色彩空间转换。本实施例中,采用3×128×128的彩色图片作为输入图片。对于彩色图片,先将其由RGB色彩空间变化为YCbCr色彩空间,由于CbCr通道的改变容易造成图片颜色的变化,因此保留CbCr通道不变,只对Y通道进行信息嵌入。然后对Y通道分割成互不重叠的大小为8×8的图像块,将每个图像块从空间域变换到频域,本实施例中采用8×8的DCT(离散余弦变换),得到大小为64×16×16的图片张量,其中64为通道数,每个通道代表一个DCT系数。对于自编码器中的编码器而言,还需对网络的输出进行后处理。本实施例中,编码器输出大小64×16×16的张量,先进行IDCT(逆离散余弦变换)再重塑得到1×128×128的Y通道残差图,然后将残差图与输入编码器时的Y通道图相加,再与CbCr通道反变换回RGB色彩空间。As shown in Figure 4, the preprocessing of the image can be divided into three steps: color space conversion, slicing, space and frequency domain conversion. If the input image is a black and white single-channel image, the color space conversion is skipped. In this embodiment, a color picture of 3×128×128 is used as the input picture. For color pictures, first change it from RGB color space to YCbCr color space. Since the change of CbCr channel is easy to cause the color of the picture to change, the CbCr channel is kept unchanged, and only the information of the Y channel is embedded. Then, the Y channel is divided into non-overlapping image blocks of size 8×8, and each image block is transformed from the spatial domain to the frequency domain. In this embodiment, 8×8 DCT (discrete cosine transform) is used to obtain the size is a 64×16×16 image tensor, where 64 is the number of channels, and each channel represents a DCT coefficient. For the encoder in the autoencoder, the output of the network also needs to be post-processed. In this embodiment, the encoder outputs a tensor with a size of 64×16×16, first performs IDCT (inverse discrete cosine transform) and then reshapes to obtain a 1×128×128 Y channel residual map, and then combines the residual map with the input The Y channel map at the encoder is added, and then inversely transformed with the CbCr channel back to the RGB color space.

如图5所示,对水印信息的预处理分为重塑和重复两个步骤。本实施例中,输入的水印信息大小为64位,每位分别用0和1表示,先重塑成4×4×4的张量,然后在二维平面上重复至与图片张量相同大小,本实施例中在二维平面上的宽高维度均重复4次,最后得到4×16×16的水印张量。As shown in Figure 5, the preprocessing of watermark information is divided into two steps: reshaping and repetition. In this embodiment, the size of the input watermark information is 64 bits, and each bit is represented by 0 and 1 respectively. It is first reshaped into a 4×4×4 tensor, and then repeated on the two-dimensional plane to the same size as the image tensor. , in this embodiment, the width and height dimensions on the two-dimensional plane are repeated 4 times, and finally a 4×16×16 watermark tensor is obtained.

S3、水印嵌入与提取的自编码器模型的训练,具体操作如下:S3, watermark embedding and training of the extracted autoencoder model, the specific operations are as follows:

如图6所示,将待嵌入水印的载体图片I和准备嵌入的水印信息W经过步骤S2的预处理后,放入步骤S1中的自编码器的编码器,得到带水印的图片I’,计算I与I’之间的重构误差,计算公式如下:As shown in Figure 6, the carrier picture I to be embedded in the watermark and the watermark information W to be embedded are put into the encoder of the self-encoder in step S1 after the preprocessing of step S2 to obtain the watermarked picture I', Calculate the reconstruction error between I and I', and the calculation formula is as follows:

Figure BDA0003478259780000071
Figure BDA0003478259780000071

其中c、h和w分别表示图片通道数、高和宽,I和I’分别表示载体图片和嵌入水印后的图片。Among them, c, h and w represent the number of image channels, height and width, respectively, and I and I' represent the carrier image and the image after embedding the watermark, respectively.

然后每次迭代过程中,对I’选择一个常用的数字图像处理方法加入噪声,本实施例中,在高斯噪声(均值为0,标准差为0.06),高斯模糊(半径为2,标准差为0.1),椒盐噪声(噪声强度为0.1),JPEG压缩(质量因子为50)中随机选择一个,得到加噪后的图片InThen in each iteration process, select a common digital image processing method to add noise to I'. In this embodiment, in Gaussian noise (mean value 0, standard deviation is 0.06), Gaussian blur (radius is 2, standard deviation is 0.1), salt and pepper noise (noise intensity is 0.1), and one of JPEG compression (quality factor is 50) is randomly selected to obtain the image I n after adding noise.

再将In输入到自编码器中的解码器,得到大小与步骤S2中水印张量大小相同的粗提取水印张量Wo,其中每个元素的值域为(0,1),本实施例中张量大小为4×16×16。得到粗提取水印张量后,按步骤S2进行重复的方式,对代表重复水印位的元素求均值后,得到大小为4×4×4粗提取水印张量,再进行步骤S2重塑的相反操作得到64位的粗提取水印W’,计算W与W’之间的重构误差,计算公式如下:Then input In to the decoder in the self-encoder, and obtain the roughly extracted watermark tensor W o with the same size as the watermark tensor in step S2, wherein the value range of each element is ( 0 , 1), this implementation The tensor size in the example is 4×16×16. After obtaining the rough extracted watermark tensor, repeat step S2, and average the elements representing the repeated watermark bits to obtain a 4×4×4 rough extracted watermark tensor, and then perform the reverse operation of step S2 reshaping The 64-bit rough extraction watermark W' is obtained, and the reconstruction error between W and W' is calculated. The calculation formula is as follows:

Figure BDA0003478259780000072
Figure BDA0003478259780000072

其中,W和W’分别为输入的水印和提取得到的水印,wi和w’i分别为W和W’的第i位,n为水印的位数;Wherein, W and W' are the input watermark and the extracted watermark, respectively, w i and w' i are the ith bit of W and W' respectively, and n is the number of bits of the watermark;

最后将图片的重构误差和水印重构误差相加得到自编码器的损失函数Loss:Finally, the reconstruction error of the picture and the reconstruction error of the watermark are added to obtain the loss function Loss of the auto-encoder:

Loss=MSE(I,I′)+aMSE(W,W′)Loss=MSE(I,I')+aMSE(W,W')

其中α为常数,本实施例中为1,用于平衡图像质量与鲁棒性。α is a constant, which is 1 in this embodiment, and is used to balance image quality and robustness.

S4、注意力得分器的训练,具体步骤如下:如图7所示,使用步骤S3训练好的编码器对图片嵌入水印后,本实施例中,在每一次迭代时,随机从三种方式中选择一种对带水印图片进行处理得到Ic,三种方式分别为不进行任何操作,裁剪后填充随机颜色,裁剪后填充载体图对应位置像素。其中裁剪操作为随机生成一个边长为原图边长0.2至0.8倍的矩形,在本实施例中边长范围为24到104,保留矩形内像素的值不变,矩形外的值替换为其他。同时生成与图片等大小的置信度图,矩形内的值为1,其余为0。如果不进行裁剪,则置信度图全为1。S4, the training of the attention scorer, the specific steps are as follows: as shown in Figure 7, after using the encoder trained in step S3 to embed the watermark on the picture, in this embodiment, in each iteration, randomly select from three methods Choose one to process the watermarked image to obtain I c , the three methods are respectively no operation, fill with random color after cropping, and fill the corresponding position pixel of the carrier image after cropping. The cropping operation is to randomly generate a rectangle whose side length is 0.2 to 0.8 times the side length of the original image. In this embodiment, the side length ranges from 24 to 104, and the values of the pixels in the rectangle remain unchanged, and the values outside the rectangle are replaced by other . At the same time, a confidence map of the same size as the picture is generated, the value in the rectangle is 1, and the rest are 0. Without cropping, the confidence map is all 1s.

然后对置信度图进行核大小8×8,步长为8的二维均值池化,得到平面大小与步骤S2中水印张量相同的标准置信度图C,本实施例中大小为16×16。然后将Ic输入到注意力得分器中,输出注意力置信度图C’,计算C与C’之间的重构误差即为损失函数,计算公式如下:Then, perform two-dimensional mean pooling with a kernel size of 8×8 and a step size of 8 on the confidence map to obtain a standard confidence map C with the same plane size as the watermark tensor in step S2, which is 16×16 in this embodiment. . Then input I c into the attention scorer, output the attention confidence map C', and calculate the reconstruction error between C and C' as the loss function. The calculation formula is as follows:

Figure BDA0003478259780000081
Figure BDA0003478259780000081

其中,h和w分别表示置信度图的高和宽。Among them, h and w represent the height and width of the confidence map, respectively.

S5、使用步骤S4训练好的模型对步骤S3的解码器进行修正,如图6所示。在步骤S3中,训练好的解码器输出粗提取水印Wo,如果解码器输入的带水印图片经过裁剪攻击,则Wo在二维平面上,对应被剪去的部分解码出来的信息应该是不具有参考价值的,只有保留下来的那部分像素对应的解码结果是正确的。为此先将Wo元素的值域进行线性转化到(-1,1),转换公式如下:S5. Use the model trained in step S4 to modify the decoder of step S3, as shown in FIG. 6 . In step S3, the trained decoder outputs a rough extraction watermark W o , if the watermarked picture input by the decoder is subjected to a cropping attack, then W o is on a two-dimensional plane, and the decoded information corresponding to the cropped part should be What has no reference value, only the decoding result corresponding to the remaining part of the pixels is correct. To this end, first linearly transform the value range of the W o element to (-1, 1), and the conversion formula is as follows:

然后使用步骤S4得到的注意力置信度图C’与Wo在二维平面上进行逐元素相乘,得到修正后的水印张量Wc。此时被裁剪部分对应的位置在C‘上的值接近0,因此修正后Wc中对应位置的值也接近0,减少对后续求均值过程的干扰。然后与步骤S3中类似,对Wc重复水印位的元素求均值后向上取整,大于0的元素对应水印位为1,小于0对应的水印位为0。Then use the attention confidence map C' obtained in step S4 and W o to perform element-by-element multiplication on the two-dimensional plane to obtain the corrected watermark tensor W c . At this time, the value of the position corresponding to the clipped part on C' is close to 0, so the value of the corresponding position in W c after the correction is also close to 0, reducing the interference to the subsequent averaging process. Then, similar to step S3, the elements of the repeated watermark bits of W c are averaged and then rounded up, the watermark bits corresponding to elements greater than 0 are 1, and the watermark bits corresponding to less than 0 are 0.

综上所述,本发明实施例相比与现有技术,具有如下有益效果:To sum up, compared with the prior art, the embodiments of the present invention have the following beneficial effects:

(1)本发明实施例通过将水印信息重塑成四个平面再与图片张量拼接,使载体图像像每个8×8图像块相较于之前嵌入了四倍的信息,更好地利用了图像的频域进行嵌入。(1) In the embodiment of the present invention, by reshaping the watermark information into four planes and then splicing it with the picture tensor, each 8×8 image block of the carrier image has four times the information embedded in it, which is better to use embedded in the frequency domain of the image.

(2)本发明通实施例过在输入水印自编码器前对水印信息的预处理,即水印信息在平面空间上更多次的重复,使带水印图像在更小的一块区域就能提取到完整的水印信息;同时由于在平面上的更多次的重复,在水印粗提取后的表决或取均值时可以有更好的纠错能力,提升水印方法的鲁棒性。(2) According to the embodiment of the present invention, the watermark information is preprocessed before the watermark self-encoder is input, that is, the watermark information is repeated more times in the plane space, so that the watermarked image can be extracted in a smaller area. Complete watermark information; at the same time, due to more repetitions on the plane, it can have better error correction ability in voting or averaging after rough watermark extraction, and improve the robustness of the watermarking method.

(3)本发明实施例加入了注意力得分器,对待提取水印的图片进行分析,得到该图片每个8×8块的得分,对被篡改部分给予较低的得分,减少最后多数表决或取均值过程中,这些无水印部分对真正带水印部分的影响,得到更好的提取准确率。(3) An attention scorer is added in the embodiment of the present invention to analyze the picture to be watermarked, obtain the score of each 8×8 block of the picture, give a lower score to the tampered part, reduce the final majority vote or take In the averaging process, the influence of these non-watermarked parts on the real watermarked parts can get better extraction accuracy.

本发明还提供一种图像频域数字水印系统,包括:The present invention also provides an image frequency domain digital watermarking system, comprising:

模型设计模块,用于设计图像频域数字水印的嵌入与提取模型;其中,嵌入与提取模型包括水印嵌入提取自编码器和注意力得分器;The model design module is used to design the embedding and extraction model of the image frequency domain digital watermark; wherein, the embedding and extraction model includes the watermark embedding and extraction from the encoder and the attention scorer;

水印提取模块,用于将载体图片和水印输入水印嵌入提取自编码器后,得到带水印的第一图片,将所述第一图片随机加入噪声攻击后,再输入到水印嵌入提取自编码器的解码器中,得到粗提取水印;The watermark extraction module is used to extract the carrier picture and the watermark input watermark from the encoder to obtain the first picture with the watermark, add the first picture randomly to the noise attack, and then input it into the watermark embedded and extracted from the encoder. In the decoder, the rough extraction watermark is obtained;

置信度获取模块,用于将所述第一图片随机选择裁剪攻击或不进行攻击,得到第二图片和标准置信度图,将所述第二图片输入到注意力得分器,输出注意力置信度图;Confidence acquisition module, used to randomly select the first picture to crop or not to attack, obtain the second picture and the standard confidence map, input the second picture to the attention scorer, and output the attention confidence picture;

水印修正模块,用于将通过水印嵌入提取自编码器获得的粗提取水印和通过注意力得分器获得的注意力置信度图,在二维平面上逐像素相乘进行修正,得到最终的水印。The watermark correction module is used to multiply the coarse extraction watermark obtained by the watermark embedding from the encoder and the attention confidence map obtained by the attention scorer on a two-dimensional plane by pixel-by-pixel multiplication to obtain the final watermark.

本实施例的一种图像频域数字水印系统,可执行本发明方法实施例所提供的一种图像频域数字水印方法,可执行方法实施例的任意组合实施步骤,具备该方法相应的功能和有益效果。An image frequency domain digital watermarking system in this embodiment can execute an image frequency domain digital watermarking method provided by the method embodiment of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effect.

本实施例还提供一种图像频域数字水印装置,包括:This embodiment also provides an image frequency domain digital watermarking device, including:

至少一个处理器;at least one processor;

至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;

当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如6所示方法。When the at least one program is executed by the at least one processor, the at least one processor implements the method shown in 6 .

本实施例的一种图像频域数字水印装置,可执行本发明方法实施例所提供的一种图像频域数字水印方法,可执行方法实施例的任意组合实施步骤,具备该方法相应的功能和有益效果。An image frequency domain digital watermarking apparatus in this embodiment can execute the image frequency domain digital watermarking method provided by the method embodiment of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effect.

本申请实施例还公开了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存介质中。计算机设备的处理器可以从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行图6所示的方法。Embodiments of the present application further disclose a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method shown in FIG. 6 .

本实施例还提供了一种存储介质,存储有可执行本发明方法实施例所提供的一种图像频域数字水印方法的指令或程序,当运行该指令或程序时,可执行方法实施例的任意组合实施步骤,具备该方法相应的功能和有益效果。This embodiment also provides a storage medium, which stores an instruction or program for executing an image frequency domain digital watermarking method provided by the method embodiment of the present invention. When the instruction or program is executed, the method embodiment can be executed. Any combination of implementation steps has corresponding functions and beneficial effects of the method.

在一些可选择的实施例中,在方框图中提到的功能/操作可以不按照操作示图提到的顺序发生。例如,取决于所涉及的功能/操作,连续示出的两个方框实际上可以被大体上同时地执行或所述方框有时能以相反顺序被执行。此外,在本发明的流程图中所呈现和描述的实施例以示例的方式被提供,目的在于提供对技术更全面的理解。所公开的方法不限于本文所呈现的操作和逻辑流程。可选择的实施例是可预期的,其中各种操作的顺序被改变以及其中被描述为较大操作的一部分的子操作被独立地执行。In some alternative implementations, the functions/operations noted in the block diagrams may occur out of the order noted in the operational diagrams. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/operations involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of the various operations are altered and in which sub-operations described as part of larger operations are performed independently.

此外,虽然在功能性模块的背景下描述了本发明,但应当理解的是,除非另有相反说明,所述的功能和/或特征中的一个或多个可以被集成在单个物理装置和/或软件模块中,或者一个或多个功能和/或特征可以在单独的物理装置或软件模块中被实现。还可以理解的是,有关每个模块的实际实现的详细讨论对于理解本发明是不必要的。更确切地说,考虑到在本文中公开的装置中各种功能模块的属性、功能和内部关系的情况下,在工程师的常规技术内将会了解该模块的实际实现。因此,本领域技术人员运用普通技术就能够在无需过度试验的情况下实现在权利要求书中所阐明的本发明。还可以理解的是,所公开的特定概念仅仅是说明性的,并不意在限制本发明的范围,本发明的范围由所附权利要求书及其等同方案的全部范围来决定。Furthermore, while the invention is described in the context of functional modules, it is to be understood that, unless stated to the contrary, one or more of the described functions and/or features may be integrated in a single physical device and/or or software modules, or one or more functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to understand the present invention. Rather, given the attributes, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the modules will be within the routine skill of the engineer. Accordingly, those skilled in the art, using ordinary skill, can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are illustrative only and are not intended to limit the scope of the invention, which is to be determined by the appended claims along with their full scope of equivalents.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,“计算机可读介质”可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。The logic and/or steps represented in flowcharts or otherwise described herein, for example, may be considered an ordered listing of executable instructions for implementing the logical functions, may be embodied in any computer-readable medium, For use with, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from and execute instructions from an instruction execution system, apparatus, or apparatus) or equipment. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport the program for use by or in connection with an instruction execution system, apparatus, or apparatus.

计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。More specific examples (non-exhaustive list) of computer readable media include the following: electrical connections with one or more wiring (electronic devices), portable computer disk cartridges (magnetic devices), random access memory (RAM), Read Only Memory (ROM), Erasable Editable Read Only Memory (EPROM or Flash Memory), Fiber Optic Devices, and Portable Compact Disc Read Only Memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program may be printed, as the paper or other medium may be optically scanned, for example, followed by editing, interpretation, or other suitable medium as necessary process to obtain the program electronically and then store it in computer memory.

应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that various parts of the present invention may be implemented in hardware, software, firmware or a combination thereof. In the above-described embodiments, various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or a combination of the following techniques known in the art: Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, Programmable Gate Arrays (PGA), Field Programmable Gate Arrays (FPGA), etc.

在本说明书的上述描述中,参考术语“一个实施方式/实施例”、“另一实施方式/实施例”或“某些实施方式/实施例”等的描述意指结合实施方式或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施方式或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施方式或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施方式或示例中以合适的方式结合。In the above description of the present specification, reference to the description of the terms "one embodiment/example", "another embodiment/example" or "certain embodiments/examples" etc. means the description in conjunction with the embodiment or example. Particular features, structures, materials, or characteristics are included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

尽管已经示出和描述了本发明的实施方式,本领域的普通技术人员可以理解:在不脱离本发明的原理和宗旨的情况下可以对这些实施方式进行多种变化、修改、替换和变型,本发明的范围由权利要求及其等同物限定。Although embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, The scope of the invention is defined by the claims and their equivalents.

以上是对本发明的较佳实施进行了具体说明,但本发明并不限于上述实施例,熟悉本领域的技术人员在不违背本发明精神的前提下还可做作出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned embodiments, and those skilled in the art can also make various equivalent deformations or replacements on the premise of not violating the spirit of the present invention. Equivalent modifications or substitutions are included within the scope defined by the claims of the present application.

Claims (10)

1. A method for digital watermarking in image frequency domain is characterized by comprising the following steps:
designing an embedding and extracting model of the image frequency domain digital watermark; wherein the embedding and extracting model comprises a watermark embedding extracting from an encoder and an attention scorer;
inputting a carrier picture and a watermark into a watermark embedding and extracting self-encoder to obtain a first picture with the watermark, randomly adding the first picture into a noise attack, and then inputting the first picture into a decoder of the watermark embedding and extracting self-encoder to obtain a rough extracted watermark;
randomly selecting the first picture to cut or not to attack to obtain a second picture and a standard confidence map, inputting the second picture into an attention scorer, and outputting an attention confidence map;
and (3) carrying out pixel-by-pixel multiplication on a two-dimensional plane for correcting the coarsely extracted watermark obtained by embedding the watermark into the self-encoder and the attention confidence map obtained by the attention scorer to obtain the final watermark.
2. The image frequency-domain digital watermarking method of claim 1, further comprising the step of training the watermark embedding extraction self-encoder to:
training watermark embedding and extracting from an encoder to perform watermark embedding and extracting in a direction of minimizing an error between a carrier picture and a picture with a watermark and an error between an input watermark and an extracted watermark;
the image frequency domain digital watermarking method further comprises the step of training the attention scorer:
and taking the error between the output of the minimized attention scorer and the standard confidence map as a training direction, and calculating the confidence degree of the input picture with the watermark at each position by the training attention scorer.
3. The image frequency domain digital watermarking method according to claim 1, wherein the watermark embedding extraction encoder and the attention scorer are both composed of a convolutional neural network;
before inputting the picture into said watermark embedding extraction from the encoder and said attention scorer, a step of pre-processing the picture is included:
if the picture is a three-channel color picture, firstly converting the color space of the color picture into a YCbCr space, keeping a CbCr channel unchanged, and only taking a Y channel as a gray scale image for embedding;
if the picture is a single-channel grey-scale image, color space transformation is not needed; dividing the gray-scale image into non-overlapping image blocks with the size of 8 multiplied by 8, after each image block is subjected to discrete cosine transform independently, all the image blocks are reshaped into 1/8 with the side length being the side length of the carrier image, the number of channels is 64, and each channel represents a coefficient of the discrete cosine transform;
in addition, the watermark input watermark is embedded and extracted from the encoder, and the watermark is preprocessed as follows:
arranging the watermarks into tensors with equal side lengths and 4 channels in total, keeping the number of the channels unchanged, and repeating the steps on a two-dimensional plane until the side lengths are the same as the side lengths of the image reconstruction tensors.
4. The image frequency domain digital watermarking method according to claim 3, wherein after the preprocessed image tensor and watermark tensor are spliced in the watermark embedding extraction encoder, the input six layers of convolution kernels are all 1 x 1 in size and all 1 x 1 in step length, a neural network formed by the unfilled convolution layer and the nonlinear active layer in series is encoded, the output of the encoder is subjected to inverse discrete cosine transform, and the obtained residual image is added to the carrier image to obtain a final watermarked gray image;
if the picture before preprocessing is a three-channel color picture, the gray-scale image output by the encoder is used as a Y channel, and the Y channel and the CbCr channel reserved during preprocessing are converted back to the RGB color space again; then selecting a preset digital image processing means to add noise attack, decoding through a neural network formed by connecting four layers of convolution kernels with the size of 1 multiplied by 1 and the step length of 1 multiplied by 1 in a series manner to obtain a roughly extracted watermark tensor, averaging repeated information bits to obtain a roughly extracted watermark, and embedding and extracting the watermark from an encoder by taking the error between the roughly extracted watermark and an input watermark and the error between a watermarked picture output by the encoder and the input picture as a training direction.
5. The method for digital watermarking in image frequency domain according to claim 3, wherein in the attention classifier, the cropping attack is to randomly generate a rectangle smaller than the picture size, the image content in the rectangle is not changed, and the part outside the rectangle can be modified into any other value;
the value of the corresponding confidence map at the cut-out position is 0, the value at the reserved position is 1, and if the attack is not carried out, the whole confidence map is 1; then, performing two-dimensional mean pooling on the confidence coefficient graph with the kernel size of 8 multiplied by 8 and the step length of 8 multiplied by 8 to obtain a standard confidence coefficient graph;
after discrete cosine transform is carried out on the processed picture, the processed picture is input into a convolutional neural network formed by connecting four layers of convolutional layers with convolutional kernel size of 3 multiplied by 3 and step length of 1 multiplied by 1 and unit zero filling and a nonlinear activation layer in series, an attention confidence coefficient graph is obtained, the error of the minimum attention confidence coefficient graph and the standard confidence coefficient graph is taken as the direction, and the attention scorer can be trained to learn the confidence coefficient of the input picture with watermarks at each position.
6. The image frequency domain digital watermarking method according to claim 2, wherein in training the watermark embedding extraction self-encoder, errors of the input watermark and the extracted watermark adopt mean square errors, errors between pictures also adopt mean square errors, and a loss function for training is the sum of the picture errors and the watermark errors;
in training the attention scorer, the error between the standard confidence map and the attention confidence map adopts the mean square error, and the mean square error is used as a loss function of training.
7. The method for digital watermarking the image in the frequency domain according to claim 1, wherein the step of modifying the coarsely extracted watermark obtained by embedding the watermark into the encoder and the attention confidence map obtained by the attention scorer by multiplying the coarsely extracted watermark and the attention confidence map pixel by pixel on a two-dimensional plane to obtain the final watermark comprises:
roughly extracting a watermark tensor, wherein the value range of all values is (0, 1), and linearly converting the value range of the watermark tensor to (-1, 1);
performing element-by-element multiplication on a two-dimensional plane by adopting the attention confidence coefficient diagram and the watermark tensor to obtain a final watermark tensor;
and according to the final watermark tensor, averaging the repeated watermark bits and then rounding to obtain the final watermark.
8. An image frequency domain digital watermarking system, comprising:
the model design module is used for designing an embedding and extracting model of the image frequency domain digital watermark; wherein the embedding and extracting model comprises a watermark embedding extracting from an encoder and an attention scorer;
the watermark extraction module is used for embedding and extracting the carrier picture and the watermark into the encoder to obtain a first picture with the watermark, randomly adding the first picture into noise attack, and then inputting the first picture into a decoder of the watermark embedding and extracting encoder to obtain a rough extracted watermark;
the confidence coefficient acquisition module is used for randomly selecting the first picture to cut or not attack to obtain a second picture and a standard confidence coefficient map, inputting the second picture into the attention scorer and outputting the attention confidence coefficient map;
and the watermark correction module is used for performing pixel-by-pixel multiplication on the roughly extracted watermark obtained by embedding and extracting the watermark into the encoder and the attention confidence coefficient image obtained by the attention scorer for correction to obtain the final watermark.
9. An image frequency domain digital watermarking apparatus, comprising:
at least one processor;
at least one memory for storing at least one program;
when executed by the at least one processor, cause the at least one processor to implement the method of any one of claims 1-7.
10. A computer-readable storage medium, in which a program executable by a processor is stored, wherein the program executable by the processor is adapted to perform the method according to any one of claims 1 to 7 when executed by the processor.
CN202210061192.1A 2022-01-19 2022-01-19 Image frequency domain digital watermarking method, system, device and medium Active CN114529441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210061192.1A CN114529441B (en) 2022-01-19 2022-01-19 Image frequency domain digital watermarking method, system, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210061192.1A CN114529441B (en) 2022-01-19 2022-01-19 Image frequency domain digital watermarking method, system, device and medium

Publications (2)

Publication Number Publication Date
CN114529441A true CN114529441A (en) 2022-05-24
CN114529441B CN114529441B (en) 2024-12-03

Family

ID=81620987

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210061192.1A Active CN114529441B (en) 2022-01-19 2022-01-19 Image frequency domain digital watermarking method, system, device and medium

Country Status (1)

Country Link
CN (1) CN114529441B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115293949A (en) * 2022-07-14 2022-11-04 河南和畅利信息科技有限公司 Image encryption method
CN117255232A (en) * 2023-11-14 2023-12-19 南京信息工程大学 DWT domain robust video watermarking method and system based on self-attention mechanism
CN117495649A (en) * 2024-01-02 2024-02-02 支付宝(杭州)信息技术有限公司 An image processing method, device and equipment
WO2024032158A1 (en) * 2022-08-10 2024-02-15 大连大学 Deep image watermarking method based on mixed frequency-domain channel attention
CN119274241A (en) * 2024-12-11 2025-01-07 齐鲁工业大学(山东省科学院) Dual face counterfeiting active defense method based on frequency limitation

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3401843A1 (en) * 2017-05-11 2018-11-14 Nokia Technologies Oy A method, an apparatus and a computer program product for modifying media content
CN113689318A (en) * 2021-07-30 2021-11-23 南京信息工程大学 A Deep Semi-fragile Watermarking Method for Image Authentication and Adversarial Sample Defense
CN113781284A (en) * 2021-06-30 2021-12-10 华南农业大学 A zero-watermark construction method based on deep attention autoencoder

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3401843A1 (en) * 2017-05-11 2018-11-14 Nokia Technologies Oy A method, an apparatus and a computer program product for modifying media content
CN113781284A (en) * 2021-06-30 2021-12-10 华南农业大学 A zero-watermark construction method based on deep attention autoencoder
CN113689318A (en) * 2021-07-30 2021-11-23 南京信息工程大学 A Deep Semi-fragile Watermarking Method for Image Authentication and Adversarial Sample Defense

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115293949A (en) * 2022-07-14 2022-11-04 河南和畅利信息科技有限公司 Image encryption method
CN115293949B (en) * 2022-07-14 2024-01-02 中技安全科技有限公司 Image encryption method
WO2024032158A1 (en) * 2022-08-10 2024-02-15 大连大学 Deep image watermarking method based on mixed frequency-domain channel attention
CN117255232A (en) * 2023-11-14 2023-12-19 南京信息工程大学 DWT domain robust video watermarking method and system based on self-attention mechanism
CN117255232B (en) * 2023-11-14 2024-01-26 南京信息工程大学 DWT domain robust video watermarking method and system based on self-attention mechanism
CN117495649A (en) * 2024-01-02 2024-02-02 支付宝(杭州)信息技术有限公司 An image processing method, device and equipment
CN119274241A (en) * 2024-12-11 2025-01-07 齐鲁工业大学(山东省科学院) Dual face counterfeiting active defense method based on frequency limitation

Also Published As

Publication number Publication date
CN114529441B (en) 2024-12-03

Similar Documents

Publication Publication Date Title
CN114529441A (en) Image frequency domain digital watermarking method, system, device and medium
CN111598761B (en) Anti-printing shooting image digital watermarking method based on image noise reduction
Hatoum et al. Using deep learning for image watermarking attack
CN113807334B (en) Residual error network-based multi-scale feature fusion crowd density estimation method
CN112507842A (en) Video character recognition method and device based on key frame extraction
Ge et al. A robust document image watermarking scheme using deep neural network
CN116402670B (en) An imperceptible watermark attack method based on generative adversarial networks
JP7499402B2 (en) End-to-End Watermarking System
CN115131188A (en) Robust image watermarking method based on generation countermeasure network
CN115063318A (en) Low-light image enhancement method and related equipment based on adaptive frequency decomposition
Cao et al. Universal screen-shooting robust image watermarking with channel-attention in DCT domain
CN114549273A (en) Self-adaptive robust watermark embedding method and system based on deep neural network
CN112132158A (en) A visual image information embedding method based on self-encoding network
CN112634120A (en) Image reversible watermarking method based on CNN prediction
Liao et al. GIFMarking: The robust watermarking for animated GIF based deep learning
CN112911341B (en) Image processing method, decoder network training method, device, equipment and medium
Yao et al. High invisibility image steganography with wavelet transform and generative adversarial network
CN116630131A (en) Coding and decoding system and method for invisible screen watermark
US20240087075A1 (en) End-to-end watermarking system
Zou et al. Invisible and robust watermarking model based on hierarchical residual fusion multi-scale convolution
CN116781926A (en) Video watermark embedding method and system based on channel space attention mechanism
CN117745544A (en) Image super-resolution method of skin detector
CN116485622A (en) Multi-level Network Deep Learning Robust Blind Watermarking Algorithm and System Combined with CNN-Transformer
Zhang et al. A convolutional neural network-based blind robust image watermarking approach exploiting the frequency domain
Hu et al. Stegaedge: learning edge-guidance steganography

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant