Robust watermarking method of diffusion model based on error correction code

By combining Reed-Solomon error-correcting codes, cryptographic randomization, and distribution-preserving sampling techniques, the problem of balancing robustness and generation quality under attacks in diffusion model watermarking technology is solved, achieving efficient and reliable watermark embedding and extraction.

CN121810472APending Publication Date: 2026-04-07YUNNAN PROVINCIAL BIG DATA CO LTD

Patent Information

Application Number
CN202610289619.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-11
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing diffusion model watermarking technology struggles to balance maintaining the quality of generated images with robustness against various attacks. In particular, it suffers from a high failure rate in watermark extraction when facing attacks such as JPEG compression, noise, and cropping, and the application of error correction codes is insufficient.

Method used

The watermark message is encoded using Reed-Solomon error correction code. By combining cryptographic randomization and distribution-preserving sampling techniques, the pseudo-random bit stream is embedded into the initial Gaussian latent space of the diffusion model. The watermarked image is generated through the diffusion model, and the original watermark information is recovered during extraction using the error correction capability of the Reed-Solomon decoder.

Benefits of technology

It significantly improves the robustness of watermarks without affecting the quality of the generated images, enabling them to resist attacks such as JPEG compression, noise, and cropping, ensuring reliable watermark extraction and copyright protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121810472A_ABST
    Figure CN121810472A_ABST
Patent Text Reader

Abstract

The invention relates to a robust watermarking method of a diffusion model based on an error correction code, which belongs to the technical field of large model watermarking, and comprises the following steps of: encoding a watermark message by using a Reed-Solomon error correction code to generate a code word containing redundancy check information; carrying out randomization processing on the code word to generate a pseudo-random bit stream; embedding the pseudo-random bit stream into a variable of an initial Gaussian potential space of a diffusion model by adopting a distribution preserving sampling technology; and finally, generating an image with a watermark through a denoising process of the diffusion model. When the watermark is extracted, reverse diffusion processing is carried out on an image which is possibly damaged to recover an approximate value of a potential space variable, a code word which is possibly damaged is extracted from the approximate value, and original watermark information is recovered by utilizing the error correction capability of a Reed-Solomon decoder. On the premise of keeping the generation performance, the robustness of the watermark to compression, noise, cutting and other potential tampering attacks is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a robust watermarking method based on a diffusion model of error correction codes, belonging to the field of large-scale watermarking technology. Background Technology

[0002] With the rapid development of generative artificial intelligence technology, text-to-image models represented by Latent Diffusion Models (LDMs), such as Stable Diffusion, have demonstrated powerful image synthesis capabilities, profoundly changing the way digital content is created and disseminated. These models can generate high-quality, highly realistic images based on simple text descriptions, greatly lowering the barrier to content creation. Researching and developing a technology capable of effectively tagging, authenticating, and tracing the source of AI-generated content has become an important development direction in the field of artificial intelligence security. Among many solutions, digital watermarking technology is considered a key means to address the above challenges. However, existing watermarking technologies for generative models have significant limitations. Traditional post-processing watermarking techniques embed watermarks by modifying pixel values ​​or transform domain coefficients after image generation, which inevitably leads to a decrease in image quality. Another type of watermarking technology is based on model fine-tuning, which embeds watermarks by fine-tuning components such as the decoder of the diffusion model. Although this improves image fidelity, it usually requires expensive model retraining for different watermark messages, resulting in high computational costs and a lack of flexibility. To overcome the shortcomings of the aforementioned methods, some training-free methods have been proposed, which directly embed watermarks into the initial latent space variables at the starting point of the generation process. Among them, the technique represented by "Gaussian Shading" has achieved a significant breakthrough. This method, through an innovative "distribution-preserving sampling" technique, ensures that the variables in the initial latent space after watermark embedding are statistically indistinguishable from the original standard Gaussian distribution, thus theoretically achieving "loss-free" watermark embedding, i.e., without degrading the quality of the generated media. However, although the "Gaussian Shading" method performs well in terms of fidelity, its robustness still faces a key technical bottleneck. The watermark extraction process of this method heavily relies on an approximate reverse diffusion process (such as DDIM inverse) to recover the variables of the initial latent space from the image. This reverse process is highly sensitive to the pixel-level integrity of the image. When an image is subjected to common post-processing attacks, such as lossy JPEG compression, noise injection, or image cropping, the pixel-level perturbations introduced by these attacks are preserved or even amplified during the reverse process. This results in a significant deviation between the variables in the recovered latent space and the original embedding, causing the watermark bit error rate (BER) to rise sharply and leading to watermark extraction failure.

[0003] Furthermore, existing technologies have significant shortcomings in utilizing error-correcting codes to address such specific error patterns. Forward Error Correction (FEC), especially Reed-Solomon error-correcting codes, excels in that it does not process individual bits, but rather groups bits and processes symbols composed of multiple bits. A burst error of tens of bits may only corrupt a few symbols. Because Reed-Solomon error-correcting codes are designed to correct a certain number of symbol errors, they can resist this error pattern, which is most common in digital media, with extremely high efficiency. Due to its powerful ability to correct "burst errors" (i.e., errors occurring in multiple consecutive bits), it has been widely used in data storage (such as CDs and DVDs) and digital communications. Errors introduced by attacks such as JPEG compression manifest as bursts in data streams. Although the Gaussian coloring method itself employs a simple "voting" mechanism, its function is equivalent to the most basic repeating code, but this is far from sufficient to cope with complex attack patterns. How to deeply integrate powerful error correction mechanisms like RS codes with advanced lossless watermarking embedding technology to build a closed-loop system that can maintain generation quality while resisting real-world attacks remains a technical challenge that urgently needs to be solved.

[0004] Therefore, this invention innovatively proposes a robust, performance-loss-free diffusion model watermarking method based on error-correcting codes. This method combines Reed-Solomon coding, cryptographic randomization, and distribution-preserving sampling techniques. On the one hand, it can inherit the advantage of the Gaussian coloring method without sacrificing model generation performance. On the other hand, through the powerful error-correcting capability of RS codes, it significantly improves the robustness of watermarks after being subjected to various attacks such as JPEG compression, noise, and cropping, providing a more reliable and powerful technical guarantee for the copyright protection and source tracing of generative artificial intelligence content. Summary of the Invention

[0005] To address the problem in existing technologies, namely the difficulty in balancing the maintenance of generated image quality and robustness against various attacks, this invention provides a robust watermarking method based on an error-correcting code diffusion model. This method is a robust diffusion model watermarking method that effectively balances computational efficiency.

[0006] The method of this invention first encodes the original watermark message using Reed-Solomon error-correcting codes, generating a codeword with strong error resistance by adding redundant check information to cope with bit errors caused by image attacks (such as JPEG compression, noise, and cropping) during the extraction process. Next, the codeword is cryptographically randomized using an encryption key and a stream cipher algorithm (such as ChaCha20), converting it into a statistically uniformly distributed pseudo-random bit stream. This step is a key prerequisite to ensure that the watermark embedding process does not affect the model generation performance. Subsequently, a distribution-preserving sampling technique is used to embed this pseudo-random bit stream into the variables of the initial Gaussian latent space of the diffusion model. This technique strictly maintains the original statistical distribution of the variables in the latent space while introducing watermark information, thus theoretically guaranteeing the quality of the generated image. Finally, an image with an imperceptible watermark is generated through the standard denoising process of the diffusion model. When extracting the watermark, the system performs reverse diffusion processing on the potentially damaged image to recover approximate values ​​of variables in the latent space. From these approximate values, it extracts potentially damaged codewords and finally utilizes the powerful error correction capabilities of the Reed-Solomon decoder, especially its excellent ability to correct sudden errors, to recover the original watermark information. This forms a complete, efficient, and highly robust closed-loop processing system against various attacks.

[0007] The technical solution of this invention is as follows: Firstly, this invention provides a robust watermarking method based on a diffusion model of error-correcting codes, comprising:

[0008] S1. Use Reed-Solomon error correction codes to perform targeted pre-correction coding on the watermark message to generate codewords containing redundant verification information;

[0009] S2. Randomize the codeword, transforming the codeword with algebraic structure into statistically indistinguishable pseudo-random noise and generating a pseudo-random bit stream;

[0010] S3. A distribution-preserving sampling technique is used to embed the pseudo-random bitstream into the variables of the initial Gaussian latent space of the diffusion model without loss while maintaining statistical equivalence;

[0011] S4. Achieve training-free, generalized generation of watermarked images through the denoising process of the diffusion model;

[0012] S5. When extracting the watermark, the potentially damaged image is reverse diffused to restore the approximate values ​​of the variables in the latent space and extract the potentially damaged codewords. The error correction capability of the Reed-Solomon decoder is then used to restore the original watermark information.

[0013] Furthermore, S1 specifically includes:

[0014] S11. Encode the watermark message using Reed-Solomon error correction codes to generate codewords containing redundant check information;

[0015] S12. All operations of the Reed-Solomon error-correcting code are performed in the Galois field. Each symbol is composed of It consists of k bits; let the original watermark message s contain k symbols. These symbols are considered as a message polynomial. The coefficient;

[0016] S13. Generator polynomial in Reed-Solomon error correction codes It is a predefined number of times A polynomial, shared by the encoder and decoder, whose roots are in a finite field. A series of consecutive elements;

[0017]

[0018] Where n represents the total length of the encoded codeword, and x is the generator polynomial. The formal variable is used to construct the mathematical expression of the polynomial, and b is the starting index for generating the polynomial roots, which determines the starting position of this set of consecutive roots in the finite field. It is an element in a finite field and also a generator polynomial. The root;

[0019] S14. The check symbol is calculated using polynomial division, resulting in the final codeword polynomial. It consists of k message symbols and nk check symbols, and the total length of the encoded codeword is n.

[0020]

[0021] This is how it is constructed. Can be Divisible This represents the modular operation of a polynomial.

[0022] Furthermore, S2 specifically includes:

[0023] S21. A cryptographic key is used to randomize the codewords generated in S1 to ensure that the watermark embedding process does not affect the quality of the generated image; the ChaCha20 stream cipher algorithm is used to disguise the codewords as unstructured random noise. The ChaCha20 stream cipher algorithm generates an unpredictable pseudo-random bitstream of the same length as the codewords from a short key K and a one-time random number Nonce, called the keystream; Nonce, abbreviated as... ;

[0024] S22. First, the stream cipher algorithm generates a keystream based on the key and the nonce. :

[0025]

[0026] Then, type the words Performing a bitwise XOR operation with the key stream yields a pseudo-random bit stream m:

[0027]

[0028] Based on the characteristics of computationally secure stream ciphers, m is statistically indistinguishable from a truly random bit stream, following a uniform distribution.

[0029] Furthermore, S3 specifically includes:

[0030] S31. Using a distribution-preserving sampling method based on the inverse cumulative distribution function of the standard Gaussian distribution, the pseudo-random bitstream is embedded into variables that embed the watermark information into the initial Gaussian latent space of the diffusion model. Meanwhile, it strictly maintains its overall statistical distribution as a standard Gaussian distribution. This achieves lossless embedding; the probability density function of the standard Gaussian distribution is divided into... There are equal probability intervals; each l bits in the pseudo-random bit stream m is interpreted as an integer i, which determines which interval the sampling must take;

[0031] S32. The distribution is a standard Gaussian distribution, and its probability density function is: The cumulative distribution function (CDF) is Inverse CDF: Maps a probability value p back to a specific value on a Gaussian distribution;

[0032] Sampling formula:

[0033]

[0034] Where ppf represents the quantile function in the inverse CDF process. These are the variables in the final generated latent space that carry watermark information. It is an integer extracted from the pseudo-random bit stream m, representing the watermark information. From standard uniform distribution Random numbers are sampled to ensure uniform sampling within the selected interval;

[0035] S33. All sampling points Marginal probability distribution and original Gaussian distribution They are mathematically equivalent;

[0036] = .

[0037] Furthermore, S4 specifically includes:

[0038] S41. Generate a watermarked image through a diffusion model denoising process, using a standard, unmodified diffusion model, from the variables in the noise latent space carrying the watermark. To generate the final image, The data is directly input into any pre-trained latent diffusion model, which performs its regular iterative denoising process. The final image is generated by the VAE decoder. The VAE decoder maps the variables of this abstract noisy latent space back to the pixel space, ultimately generating an image with an imperceptible watermark. ;

[0039] S42. Denoising: The denoising process is an iterative process, starting from the time step... To 0, at each time step U-Net model Predict the noise added to the variables in the latent space;

[0040] Specifically, DDIM sampling is performed: DDIM sampling is an image generation method in diffusion models; it is used to extract images from noisy latent variables. Stepwise denoising to generate variables in a clean latent space During the process, DDIM sampling defines how to start from the current time step. noisy latent variables Calculate the previous step latent variables ;

[0041] A typical deterministic sampling step is represented as follows:

[0042]

[0043] Where c is the conditional information of the text prompt, and α is the predefined noise scheduling parameter;

[0044] S43. Decoding: After T-step denoising, a clean latent space of variables is obtained. VAE decoder Map it back to pixel space:

[0045] .

[0046] Furthermore, S5 specifically includes:

[0047] S51. Extract watermarks and perform error correction from an image that may be vulnerable to attack. In the process, the original watermark information s is recovered. The original watermark message s contains k symbols. These symbols are considered as a message polynomial. The coefficients; this process is the inverse operation of the embedding process and adds a final error correction step;

[0048] S52. First, use the VAE encoder. Mapping the image back to latent space:

[0049]

[0050] in, The image is after Reed-Solomon encoding;

[0051] S53. Next, reverse diffusion processing of DDIM is performed. Using the reverse formula of DDIM, from... Noise is added incrementally to estimate the variables in the original watermark-carrying noise latent space. ;

[0052]

[0053] After T iterations, we obtain Where c is the conditional information of the text prompt, α is the predefined noise scheduling parameter, and t is the time step;

[0054] S54. Extract the pseudo-random bitstream, and... Apply the inverse mapping of the sampling formula to each dimension:

[0055]

[0056] All By splicing them together, we obtain a pseudo-random bitstream that may be corrupted. ;

[0057] S55. Using the same key K and a one-time random number Nonce, or simply N, N pairs Decryption was performed to recover the potentially corrupted RS codewords. :

[0058]

[0059] in, It is a key stream generated by a stream cipher algorithm based on a key and a nonce;

[0060] S56. Perform Reed-Solomon decoding:

[0061] Calculate the syndrome: Represented as a damaged codeword polynomial over the Galois field and calculate One companion: ; in, , This represents the primitive element of the Galois field, which is the fundamental element of the field for RS code decoding. Indicates the starting index for the adjoint calculation. This indicates the maximum number of error symbols that can be corrected in an RS codeword. Indicates the first One accompanying expression;

[0062] Error localization and correction: The Berlekamp-Massey algorithm is used to solve for the error localization polynomial from the adjoint equation. and error value polynomial ; The reciprocal of the root indicates the location of the error sign. Then, it is used to calculate the incorrect value, where b is the starting index for generating the polynomial roots. It is the maximum number of symbol errors that can be corrected during the design of RS codes;

[0063] Restoration: Correction Error symbols in the original codeword polynomial are obtained. ;

[0064] Extract message: The first k coefficients are the recovered original watermark message. .

[0065] Secondly, the present invention also provides a robust watermarking system based on an error-correcting code diffusion model, the system comprising: a module for executing the robust watermarking method based on an error-correcting code diffusion model.

[0066] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the robust watermarking method based on an error-correcting code diffusion model.

[0067] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the robust watermarking method based on an error-correcting code diffusion model.

[0068] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the robust watermarking method based on an error-correcting code diffusion model.

[0069] The beneficial effects of this invention are:

[0070] 1. This invention is based on a framework that deeply integrates classical error correction coding theory and advanced generative model watermarking technology, making it possible to embed watermarks with both high robustness and no performance loss into content generated by diffusion models. On the one hand, by using Reed-Solomon error correction codes for pre-coding before watermark embedding, it solves the problem that existing lossless watermarking technologies (such as "Gaussian coloring") fail to extract watermarks when faced with common image attacks such as JPEG compression, noise, and cropping due to a significant increase in bit error rate (BER). Reed-Solomon error correction codes are particularly good at correcting sudden errors caused by these attacks, thereby repairing damaged information and ensuring that the watermark can still be accurately recovered under harsh conditions. On the other hand, by combining the error correction mechanism with distributed preserving sampling technology, it solves the fundamental contradiction that traditional robust watermarking methods usually sacrifice image generation quality.

[0071] 2. Without modifying the core components of the diffusion model or introducing any additional training costs, this invention ensures that the generated image after embedding the watermark is indistinguishable in quality from the original model. In addition, this invention has the advantages of modularity and no training required, and can be flexibly integrated into the existing diffusion model workflow as a plug-and-play component, which greatly reduces deployment costs and technical barriers, and provides a practical and efficient solution for large-scale, traceable AIGC content protection. Attached Figure Description

[0072] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0073] Figure 1 This is a flowchart illustrating a robust watermarking method based on a diffusion model of error-correcting codes provided by the present invention.

[0074] Figure 2 This is a flowchart illustrating the architecture of a robust watermarking method based on a diffusion model of error-correcting codes provided by the present invention.

[0075] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention.

[0076] The labels in the diagram are as follows:

[0077] 310 - Processor; 320 - Communication interface; 330 - Memory; 340 - Communication bus. Detailed Implementation

[0078] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other.

[0079] It should be noted that the executing entity of the embodiments of the present invention can be various types of terminals. The terminal can be a computer, smartphone, tablet computer, wearable device, personal digital assistant (PDA), mobile internet device (MID), or other terminal capable of text processing. The present invention does not impose any restrictions on this.

[0080] Example 1: As Figures 1-2 As shown, this embodiment of the invention provides a robust watermarking method based on a diffusion model of error-correcting codes, comprising:

[0081] S1. Use Reed-Solomon error correction codes to perform targeted pre-correction coding on the watermark message to generate codewords containing redundant verification information;

[0082] Furthermore, S1 specifically includes:

[0083] S11. Many simple error-correcting codes (such as Hamming codes) can effectively handle single-bit errors, but they fail immediately in the face of burst errors. The excellence of Reed-Solomon error-correcting codes lies in the fact that they do not process individual bits, but rather group bits to process symbols composed of multiple bits. A burst error of tens of bits may only corrupt a few symbols; because Reed-Solomon error-correcting codes are designed to correct a certain number of symbol errors, they can resist this most common error pattern in digital media with extremely high efficiency. Encoding watermarked messages using Reed-Solomon error-correcting codes generates codewords containing redundant check information. This step aims to add mathematical redundancy to the original, fragile watermark information, making it resistant to errors that may occur in subsequent processes. This greatly enhances the robustness of the watermark.

[0084] S12. All operations of the Reed-Solomon error-correcting code are performed within a finite mathematical structure—the Galois field. Each symbol is composed of It consists of k bits; let the original watermark message s contain k symbols. These symbols are considered as a message polynomial. The coefficient;

[0085] S13. Generator polynomial in Reed-Solomon error correction codes It is a predefined number of times A polynomial, shared by the encoder and decoder, whose roots are in a finite field. A series of consecutive elements;

[0086]

[0087] Where n represents the total length of the encoded codeword, and x is the generator polynomial. The formal variable is used to construct the mathematical expression of the polynomial, and b is the starting index for generating the polynomial roots, which determines the starting position of this set of consecutive roots in the finite field. It is an element in a finite field and also a generator polynomial. The root;

[0088] S14. The check symbol is calculated using polynomial division, resulting in the final codeword polynomial. It consists of k message symbols and nk check symbols, and the total length of the encoded codeword is n.

[0089]

[0090] This is how it is constructed. Can be Divisible This represents the modular operation of a polynomial.

[0091] S2. Randomize the codeword, transforming the codeword with algebraic structure into statistically indistinguishable pseudo-random noise and generating a pseudo-random bit stream;

[0092] This invention ensures that the watermark embedding process does not affect the quality of the generated image. The RS codewords have a predictable algebraic structure; directly using them would disrupt the standard Gaussian distribution of the initial noise in the diffusion model. This step disguises them as unstructured random noise through encryption. This step employs a symmetric encryption algorithm called a stream cipher. This algorithm generates an unpredictable pseudo-random bit stream, called the keystream, of the same length as the codewords, from a short key K and a one-time random number Nonce.

[0093] Furthermore, S2 specifically includes:

[0094] S21. The codewords generated in S1 are randomized using an encryption key to ensure that the watermark embedding process does not affect the quality of the generated image. The codewords of the Reed-Solomon error-correcting code have a predictable algebraic structure; directly using them would disrupt the standard Gaussian distribution of the initial noise in the diffusion model. Therefore, this step uses the ChaCha20 stream cipher algorithm to disguise the codewords as unstructured random noise. The ChaCha20 stream cipher algorithm generates an unpredictable pseudo-random bitstream of the same length as the codewords from a short key K and a one-time random number Nonce, called the keystream. Nonce, abbreviated as... ;

[0095] S22. First, the stream cipher algorithm generates a keystream based on the key and the nonce. :

[0096]

[0097] Then, type the words Performing a bitwise XOR operation with the key stream yields a pseudo-random bit stream m:

[0098]

[0099] Based on the characteristics of computationally secure stream ciphers, m is statistically indistinguishable from a truly random bit stream, following a uniform distribution.

[0100] S3. A distribution-preserving sampling technique is used to embed the pseudo-random bitstream into the variables of the initial Gaussian latent space of the diffusion model without loss while maintaining statistical equivalence;

[0101] Furthermore, S3 specifically includes:

[0102] S31. Using a distribution-preserving sampling method based on the standard Gaussian distribution inverse cumulative distribution function (ppf), the pseudo-random bitstream is embedded into variables that embed the watermark information into the initial Gaussian latent space of the diffusion model. Meanwhile, it strictly maintains its overall statistical distribution as a standard Gaussian distribution. This achieves lossless embedding; the probability density function of the standard Gaussian distribution is divided into... There are equal probability intervals; each l bits in the pseudo-random bit stream m is interpreted as an integer i, which determines which interval the sampling must take;

[0103] S32. The distribution is a standard Gaussian distribution, and its probability density function is: The cumulative distribution function (CDF) is Inverse CDF: Maps a probability value p back to a specific value on a Gaussian distribution;

[0104] Sampling formula:

[0105]

[0106] Where ppf represents the quantile function in the inverse CDF process. These are the variables in the final generated latent space that carry watermark information. It is an integer extracted from the pseudo-random bit stream m, representing the watermark information. From standard uniform distribution Random numbers are sampled to ensure uniform sampling within the selected interval;

[0107] S33. Although a single sampling is constrained to a specific interval, since i is uniformly random, all intervals have an equal probability of being selected. Therefore, all sampling points... Marginal probability distribution and original Gaussian distribution They are mathematically equivalent;

[0108] = .

[0109] The probability density function of the standard Gaussian distribution is divided into: In a pseudo-random bit stream m, each l bits are interpreted as an integer i, which determines which interval the sampling must take place within.

[0110] S4. Achieve training-free, generalized generation of watermarked images through the denoising process of the diffusion model;

[0111] Furthermore, S4 specifically includes:

[0112] S41. Generate a watermarked image through a diffusion model denoising process, using a standard, unmodified diffusion model, from the variables in the noise latent space carrying the watermark. The final image is generated because S3 guarantees... The statistical distribution of normal sampling The same, therefore can The data is directly input into any pre-trained latent diffusion model, which performs its regular iterative denoising process. The final image is generated by the VAE decoder. The VAE decoder maps the variables of this abstract noisy latent space back to the pixel space, ultimately generating an image with an imperceptible watermark. ;

[0113] S42. Denoising: The denoising process is an iterative process, starting from time step... To 0, at each time step U-Net model Predict the noise added to the variables in the latent space;

[0114] Specifically, DDIM sampling is performed: DDIM (Denoising Diffusion Implicit Models) sampling is an image generation method in diffusion models; it involves sampling from noisy latent variables. Stepwise denoising to generate variables in a clean latent space During the process, DDIM sampling defines how to start from the current time step. noisy latent variables Calculate the previous step latent variables ;

[0115] A typical deterministic sampling step is represented as follows:

[0116]

[0117] Where c is the conditional information of the text prompt, and α is the predefined noise scheduling parameter;

[0118] S43. Decoding: After T-step denoising, a clean latent space of variables is obtained. VAE decoder Map it back to pixel space:

[0119] .

[0120] S5. When extracting the watermark, the potentially damaged image is reverse diffused to restore the approximate values ​​of the variables in the latent space and extract the potentially damaged codewords. The error correction capability of the Reed-Solomon decoder is then used to restore the original watermark information.

[0121] Furthermore, S5 specifically includes:

[0122] S51. Extract watermarks and perform error correction from an image that may be compromised (compressed, noise-added, cropped, etc.). In the process, the original watermark information s is recovered. The original watermark message s contains k symbols. These symbols are considered as a message polynomial. The coefficients; this process is the inverse operation of the embedding process and adds a final error correction step;

[0123] S52.VAE Encoding: First, use the VAE encoder. Mapping the image back to latent space:

[0124]

[0125] in, The image is after Reed-Solomon encoding;

[0126] S53. Next, reverse diffusion processing of DDIM is performed. Using the reverse formula of DDIM, from... Noise is added incrementally to estimate the variables in the original watermark-carrying noise latent space. This is an approximate process and will introduce errors;

[0127]

[0128] After T iterations, we obtain Where c is the conditional information of the text prompt, α is the predefined noise scheduling parameter, and t is the time step;

[0129] S54. Extract the pseudo-random bitstream, and... Apply the inverse mapping of the sampling formula to each dimension:

[0130]

[0131] All By splicing them together, we obtain a pseudo-random bitstream that may be corrupted. ;

[0132] S55. Decryption: Using the same key K and a one-time random number Nonce, or simply N, N pairs... Decryption was performed to recover the potentially corrupted RS codewords. :

[0133]

[0134] in, It is a key stream generated by a stream cipher algorithm based on a key and a nonce;

[0135] S56. Perform Reed-Solomon decoding:

[0136] Syndrome Calculation: [The sentence is incomplete and requires more context to translate accurately.] Represented as a damaged codeword polynomial over the Galois field and calculate One companion: ; in, , This represents the primitive element of the Galois field, which is the fundamental element of the field for RS code decoding. Indicates the starting index for the adjoint calculation. This indicates the maximum number of error symbols that can be corrected in an RS codeword. Indicates the first One accompanying expression;

[0137] Error localization and correction: The Berlekamp-Massey algorithm is used to solve for the error localization polynomial from the adjoint equation. and error value polynomial ; The reciprocal of the root indicates the location of the error sign. Then, it is used to calculate the incorrect value, where b is the starting index for generating the polynomial roots. It is the maximum number of symbol errors that can be corrected during the design of RS codes;

[0138] Restoration: Correction Error symbols in the original codeword polynomial are obtained. ;

[0139] Extract message: The first k coefficients are the recovered original watermark message. .

[0140] Reed-Solomon decoding is a sophisticated, multi-step algebraic process whose core objective is to detectively identify the location and value of errors from a potentially corrupted codeword using pre-embedded redundant information (check bits), repair them, and ultimately recover the original, intact watermark information.

[0141] The following is a detailed breakdown of the process:

[0142] This is the first step in decoding, and also the diagnostic step; the decoder checks the received codewords through a series of calculations. The health status of the code. If the code is intact, all diagnostic results (i.e., synapses) will be zero. If an error exists, the synapses will be non-zero, and these values ​​contain all the clues needed to fix the error.

[0143] 1. Polynomial representation: First, the received codewords, which may be corrupted... Treat it as a polynomial The coefficient;

[0144]

[0145] 2. Calculation: The decoder will calculate 2d syndrome values. Where d is the maximum number of symbol errors that can be corrected during the design of the RS code ( Each synergy It is by receiving the polynomial In a finite field elements in The value is obtained by evaluating the given information. Here... It is a primitive element of a finite field, and It is the generator polynomial used during encoding. The root.

[0146] Mathematical formula:

[0147]

[0148] If all the adjoints All equal to 0, which means It can be If the result is integer division, the decoder determines that the received codeword is error-free, and the decoding process ends.

[0149] If at least one of the syndromes is not zero, it indicates that an error occurred during the transmission or storage of the codeword. This set of non-zero syndrome values ​​constitutes the sole input for the next step of error location and correction.

[0150] Step 2: Error Location and Correction;

[0151] Objective: This is the core of the entire decoding process. It uses the syntactic equation obtained in the first step to accurately identify which symbols are wrong (location) and how they are wrong (evaluation).

[0152] Step 3: Solve the key equations and locate the erroneous polynomials. ;

[0153] The adjoint equation itself is a solution to a complex system of equations concerning the error location and error value. To solve this puzzle, we need to find a key diagnostic tool—the Error Locator Polynomial, denoted as... The special thing about this polynomial is that the reciprocal of its root precisely indicates the location where the error occurred.

[0154] Algorithm: The most classic and efficient algorithm for solving this polynomial is the Berlekamp-Massey algorithm. This is an iterative algorithm that takes a sequence of adjoints as input, processes each adjoint and calculates the discrepancy, progressively constructing the polynomial with the smallest order that satisfies the key equation. .

[0155] Key Equation: This equation describes the adjoint and error-location polynomial. And another one called the Error Evaluator Polynomial. The fundamental relationship between them. The essence of the Berlekamp-Massey algorithm is to efficiently solve this system of equations, thereby obtaining... and The coefficient.

[0156] Step 4: Locate the error position; with the error location polynomial... The next step is to use it to find the location of the error.

[0157] This process is typically performed using Chien Search. It is a very straightforward exhaustive search: it searches for all possible positions within a finite field (…). Substitute them one by one as variables The test will be conducted in the middle.

[0158] Mathematical formula:

[0159] For each symbol position (From 0 to n-1), calculate The value of . If the result is 0, then it means that in the codeword of the . An error occurred at one location. Through this process, we can obtain a set of all error locations.

[0160] Step 5: Calculate the error values. Now we know which positions have incorrect signs, but we also need to know the specific values ​​they represent, that is, the magnitude or difference of each error. This requires using the obtained error value polynomial. .

[0161] Algorithm: The Forney algorithm is used to accurately calculate the error value at each error location.

[0162] For each known error location (The corresponding domain element is) ), its error value It can be calculated using the following formula:

[0163]

[0164] in, It is an error-locating polynomial The formal derivative of . This formula uses the values ​​of the inverse elements of two polynomials at the incorrect positions to precisely calculate the difference that needs to be corrected.

[0165] Now we have all the necessary information: the received corrupted codewords, the exact locations of all errors, and the precise difference that needs to be corrected at each location.

[0166] We subtract all the error values ​​calculated in the previous step from the received codeword at the corresponding error positions, thereby recovering the original, error-free codeword.

[0167] First, based on the found error location and error value, an error polynomial is constructed. This polynomial has non-zero coefficients only at known error locations, and the values ​​of these coefficients are the corresponding error values.

[0168] Then, the original codeword polynomial is recovered by polynomial subtraction. :

[0169]

[0170] exist In such a finite field, subtraction is equivalent to addition, and both are implemented using a bitwise XOR operation. Therefore, the actual operation involves XORing the error value with the corresponding corrupted sign.

[0171] Then, from the perfectly fixed codeword polynomial From this, we extract the original watermark information s' that we ultimately need.

[0172] Because the encoding uses systematic code, where the original k symbols remain unchanged and nk check symbols are appended, the extraction process is very simple.

[0173] Repaired codeword polynomial It contains coefficients of n symbols. The coefficients representing the original k message symbols are located in the higher-order terms of the polynomial. We only need to read these k coefficients to obtain the recovered original watermarked message s'.

[0174] At this point, the entire decoding and error correction process is complete. Even if the original codeword suffers damage of up to t symbols during transmission, we can still accurately recover the original watermark information. Furthermore, a comparison of the advantages and disadvantages of different methods is shown in Table 1.

[0175] Table 1 compares the advantages and disadvantages of different methods.

[0176]

[0177] The present invention also provides a robust watermarking system based on an error-correcting code diffusion model, the system comprising: a module for executing the robust watermarking method based on an error-correcting code diffusion model.

[0178] This invention also provides an electronic device. Figure 3An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include a processor 310, a communication interface 320, a memory 330, and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute the robust watermarking method based on an error-correcting code diffusion model.

[0179] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or 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 various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0180] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the robust watermarking method based on an error-correcting code diffusion model.

[0181] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the robust watermarking method based on an error-correcting code diffusion model described in the first aspect above.

[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0183] The above-described contents can be implemented individually or in various combinations, and these variations are all within the protection scope of this invention.

[0184] It should be noted that in this invention, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" or any other variations thereof is intended to cover non-exclusive inclusion, such that an article or device comprising a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the article or device comprising said element.

[0185] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. The present invention has been described in detail with reference to preferred embodiments. Those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications and substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A robust watermarking method based on a diffusion model of error-correcting codes, characterized in that: include: S1. Use Reed-Solomon error correction codes to perform targeted pre-correction coding on the watermark message to generate codewords containing redundant verification information; S2. Randomize the codeword, transforming the codeword with algebraic structure into statistically indistinguishable pseudo-random noise and generating a pseudo-random bit stream; S3. A distribution-preserving sampling technique is used to embed the pseudo-random bitstream into the variables of the initial Gaussian latent space of the diffusion model without loss while maintaining statistical equivalence; S4. Achieve training-free, generalized generation of watermarked images through the denoising process of the diffusion model; S5. When extracting the watermark, the potentially damaged image is reverse diffused to restore the approximate values ​​of the variables in the latent space and extract the potentially damaged codewords. The error correction capability of the Reed-Solomon decoder is then used to restore the original watermark information.

2. The robust watermarking method based on a diffusion model of error-correcting codes according to claim 1, characterized in that: S1 specifically includes: S11. Encode the watermark message using Reed-Solomon error correction codes to generate codewords containing redundant check information; S12. All operations of the Reed-Solomon error-correcting code are performed in the Galois field. Each symbol is composed of It consists of k bits; let the original watermark message s contain k symbols. These symbols are considered as a message polynomial. The coefficient; S13. Generator polynomial in Reed-Solomon error correction codes It is a predefined number of times A polynomial, shared by the encoder and decoder, whose roots are in a finite field. A series of consecutive elements; ; Where n represents the total length of the encoded codeword, and x is the generator polynomial. The formal variable is used to construct the mathematical expression of the polynomial, and b is the starting index for generating the polynomial roots, which determines the starting position of this set of consecutive roots in the finite field. It is an element in a finite field and also a generator polynomial. The root; S14. The check symbol is calculated using polynomial division, resulting in the final codeword polynomial. It consists of k message symbols and nk check symbols, and the total length of the encoded codeword is n. ; This is how it is constructed. Can be Divisible This represents the modular operation of a polynomial.

3. The robust watermarking method based on a diffusion model of error-correcting codes according to claim 1, characterized in that: S2 specifically includes: S21. A cryptographic key is used to randomize the codewords generated in S1 to ensure that the watermark embedding process does not affect the quality of the generated image; the ChaCha20 stream cipher algorithm is used to disguise the codewords as unstructured random noise. The ChaCha20 stream cipher algorithm generates an unpredictable pseudo-random bitstream of the same length as the codewords from a short key K and a one-time random number Nonce, called the keystream; Nonce, abbreviated as... ; S22. First, the stream cipher algorithm generates a keystream based on the key and the nonce. : ; Then, type the words Performing a bitwise XOR operation with the key stream yields a pseudo-random bit stream m: ; Based on the characteristics of computationally secure stream ciphers, m is statistically indistinguishable from a truly random bit stream, following a uniform distribution.

4. A robust watermarking method based on a diffusion model of error-correcting codes according to claim 1, characterized in that: S3 specifically includes: S31. Using a distribution-preserving sampling method based on the inverse cumulative distribution function of the standard Gaussian distribution, the pseudo-random bitstream is embedded into variables that embed the watermark information into the initial Gaussian latent space of the diffusion model. Meanwhile, it strictly maintains its overall statistical distribution as a standard Gaussian distribution. This achieves lossless embedding; the probability density function of the standard Gaussian distribution is divided into... There are equal probability intervals; each l bits in the pseudo-random bit stream m is interpreted as an integer i, which determines which interval the sampling must take place in; S32. The distribution is a standard Gaussian distribution, and its probability density function is: The cumulative distribution function (CDF) is Inverse CDF: Maps a probability value p back to a specific value on a Gaussian distribution; Sampling formula: ; Where ppf represents the quantile function in the inverse CDF process. These are the variables in the final generated latent space that carry watermark information. It is an integer extracted from the pseudo-random bit stream m, representing the watermark information. From standard uniform distribution Random numbers are sampled to ensure uniform sampling within the selected interval; S33. All sampling points Marginal probability distribution and original Gaussian distribution They are mathematically equivalent; = 。 5. A robust watermarking method based on a diffusion model of error-correcting codes according to claim 1, characterized in that: S4 specifically includes: S41. Generate a watermarked image through a diffusion model denoising process, using a standard, unmodified diffusion model, from the variables in the noise latent space carrying the watermark. To generate the final image, The data is directly input into any pre-trained latent diffusion model, which performs its regular iterative denoising process. The final image is generated by the VAE decoder. The VAE decoder maps the variables of this abstract noisy latent space back to the pixel space, ultimately generating an image with an imperceptible watermark. ; S42. Denoising: The denoising process is an iterative process, starting from the time step... Up to 0, at each time step U-Net model Predict the noise added to the variables in the latent space; Specifically, DDIM sampling is performed: DDIM sampling is an image generation method in diffusion models; it is used to extract images from noisy latent variables. Stepwise denoising to generate variables in a clean latent space During the process, DDIM sampling defines how to start from the current time step. noisy latent variables Calculate the previous step latent variables ; A typical deterministic sampling step is represented as follows: ; Where c is the conditional information of the text prompt, and α is the predefined noise scheduling parameter; S43. Decoding: After T-step denoising, a clean latent space of variables is obtained. VAE decoder Map it back to pixel space: 。 6. A robust watermarking method based on a diffusion model of error-correcting codes according to claim 1, characterized in that: S5 specifically includes: S51. Extract watermarks and perform error correction from an image that may be vulnerable to attack. In the process, the original watermark information s is recovered. The original watermark message s contains k symbols. These symbols are considered as a message polynomial. The coefficients; this process is the inverse operation of the embedding process and adds a final error correction step; S52. First, use the VAE encoder. Mapping the image back to latent space: ; in, The image is after Reed-Solomon encoding; S53. Next, reverse diffusion processing of DDIM is performed. Using the reverse formula of DDIM, from... Noise is added incrementally to estimate the variables in the original watermark-carrying noise latent space. ; ; After T iterations, we obtain Where c is the conditional information of the text prompt, α is the predefined noise scheduling parameter, and t is the time step; S54. Extract the pseudo-random bitstream, and... Apply the inverse mapping of the sampling formula to each dimension: ; All By splicing them together, we obtain a pseudo-random bitstream that may be corrupted. ; S55. Using the same key K and a one-time random number Nonce, or simply N, N pairs Decryption was performed to recover the potentially corrupted RS codewords. : ; in, It is a key stream generated by a stream cipher algorithm based on a key and a nonce; S56. Perform Reed-Solomon decoding: Calculate the syndrome: Represented as a damaged codeword polynomial over the Galois field and calculate One companion: ; in, , This represents the primitive element of the Galois field, which is the fundamental element of the field for RS code decoding. Indicates the starting index for the adjoint calculation. This indicates the maximum number of error symbols that can be corrected in an RS codeword. Indicates the first One accompanying expression; Error localization and correction: The Berlekamp-Massey algorithm is used to solve for the error localization polynomial from the adjoint equation. and error value polynomial ; The reciprocal of the root indicates the location of the error sign. Then, it is used to calculate the incorrect value, where b is the starting index for generating the polynomial roots. It is the maximum number of symbol errors that can be corrected during the design of RS codes; Restoration: Correction Error symbols in the original codeword polynomial are obtained. ; Extract message: The first k coefficients are the recovered original watermark message. .

7. A robust watermarking system based on a diffusion model of error-correcting codes, characterized in that, The system includes a module for performing a robust watermarking method based on an error-correcting code diffusion model as described in any one of claims 1 to 6.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements a robust watermarking method based on a diffusion model of error-correcting codes as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a robust watermarking method based on a diffusion model of error-correcting codes as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements a robust watermarking method based on a diffusion model of error-correcting codes as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Compressed video-oriented double-domain watermark marking method and system

    CN118250471A

  • Diffusion model robust watermarking method based on affine coupling flow accurate coding

    CN120746810A

  • Watermark embedding and extracting method for protecting documents

    US20190130080A1

Cited By

  • Diffusion model oriented generative image watermarking processing method

    CN122134538A