Watermarking method, apparatus, computer device, readable storage medium and program product
By embedding symmetrical perturbation watermarks into images generated by the diffusion model, the problem of easy theft of generative diffusion model images is solved, and the security and legitimacy verification of images are realized, thereby improving the stability and security of images.
Patent Information
- Application Number
- CN202611237282.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-27
AI Technical Summary
Media data generated by generative diffusion models is at risk of being easily stolen, resulting in insufficient security.
A symmetrical perturbation watermark is injected into the reference image generated by the diffusion model. The security of the image is improved by the symmetrical perturbation watermark, ensuring that the watermark is not removed during the noise removal stage. The watermark key is used for legality verification.
By embedding symmetrical perturbation watermarks into images generated by the diffusion model, the security and stability of the images are improved, ensuring the reliability of image legitimacy verification and preventing images from being stolen at will.
Smart Images

Figure CN123181206A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a watermarking method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Technology
[0002] With the continuous development of artificial intelligence technology, users can generate data such as images, text, audio, and video through generative diffusion models. Various generative diffusion models can generate high-fidelity and highly relevant media data. Users only need to input multimodal prompts into the diffusion model, and the diffusion model can generate data based on the prompts and reference data to obtain the media data desired by the user.
[0003] In related technologies, the media data generated by generative diffusion models is still at risk of being easily stolen, which makes the security of the generated data insufficient. Summary of the Invention
[0004] Therefore, it is necessary to provide a watermarking method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve the security of media data generated by diffusion models, in response to the above-mentioned technical problems.
[0005] In a first aspect, this application provides a watermarking method, comprising: obtaining a first reference image obtained by a diffusion model query, wherein the first reference image is obtained by the diffusion model in response to a prompt message input by a user; determining a watermark key corresponding to the first reference image, and writing a symmetric perturbation watermark onto the first reference image according to the watermark key to obtain a second reference image; and sending the second reference image to the diffusion model, wherein the second reference image is used by the diffusion model to generate a target image corresponding to the prompt message.
[0006] In one embodiment, writing a symmetrical perturbation watermark onto a first reference image according to a watermark key to obtain a second reference image includes: generating noise from the watermark key using a preset noise generation method to obtain target symmetrical perturbation noise. The preset noise generation method includes any one of central symmetrical noise generation, axisymmetric noise generation, rotational symmetrical noise generation, frequency domain noise generation, and texture noise generation; and adding noise to each pixel value in the first reference image using the target symmetrical perturbation noise to obtain the second reference image.
[0007] In one embodiment, the method further includes: normalizing the target symmetrical perturbation noise to obtain normalized symmetrical perturbation noise; adjusting the amplitude of the normalized symmetrical perturbation noise based on a preset intensity to obtain amplitude-adjusted symmetrical perturbation noise; and adding noise to each pixel value of the first reference image using the amplitude-adjusted symmetrical perturbation noise to obtain a second reference image.
[0008] In one embodiment, the process of generating the watermark key includes: obtaining the identification information of the target object; performing hash processing on the identification information to obtain the watermark key.
[0009] In one embodiment, the method further includes: obtaining prompt information; inputting the prompt information into a diffusion model, and querying a first reference image based on the prompt information through the diffusion model.
[0010] In one embodiment, the method further includes: generating a target image based on the prompt information and a second reference image using a diffusion model; and outputting the target image.
[0011] In one embodiment, the method further includes: performing watermark detection on the target image to obtain symmetrical perturbation noise; and performing legality verification on the target image based on the watermark key and the symmetrical perturbation noise to obtain a verification result.
[0012] In one embodiment, watermark detection is performed on the target image to obtain symmetrical perturbation noise, including: inputting the target image into a detection model and extracting the symmetrical perturbation noise corresponding to the target image through the detection model.
[0013] In one embodiment, the training process of the detection model includes: acquiring a training dataset, which includes multiple sample images and label symmetric perturbation noise corresponding to each sample image; and training an initial detection model based on the training dataset to obtain a detection model.
[0014] In one embodiment, the legality verification of the target image is performed based on the watermark key and symmetric perturbation noise to obtain the verification result, including: determining the candidate watermark key corresponding to the symmetric perturbation noise, detecting whether the candidate watermark key is consistent with the watermark key; if the candidate watermark key is consistent with the watermark key, the verification result is determined to be that the verification failed.
[0015] Secondly, this application also provides a watermarking device, comprising: a first image acquisition module, configured to acquire a first reference image obtained by a diffusion model query, the first reference image being obtained by the diffusion model in response to a prompt message input by a user; a second image acquisition module, configured to determine a watermark key corresponding to the first reference image, and write a symmetrical perturbation watermark onto the first reference image according to the watermark key to obtain a second reference image; and an image sending module, configured to send the second reference image to the diffusion model, the second reference image being used by the diffusion model to generate a target image corresponding to the prompt message.
[0016] The watermarking method, apparatus, computer device, computer-readable storage medium, and computer program product in this application, during the process of generating a target image using a diffusion model, first obtain a first reference image obtained by the diffusion model in response to a prompt message input by the user, determine the watermark key corresponding to the first reference image, write a symmetrical perturbation watermark into the first reference image according to the watermark key, obtain a second reference image, and send the second reference image to the diffusion model so that the diffusion model generates the target image corresponding to the prompt message. In this way, the symmetrical perturbation watermark is written into the reference image during the model retrieval stage. The symmetrical perturbation watermark avoids the removal of the watermark during the noise removal stage, improves the stability of the watermark, and thus improves the security of the target image.
[0017] Thirdly, this application provides a watermark detection method, including: acquiring an image to be detected; performing watermark detection on the image to be detected to obtain symmetrical perturbation noise; and performing legality verification on the image to be detected based on the watermark key of the target object and the symmetrical perturbation noise to obtain a verification result.
[0018] In one embodiment, watermark detection is performed on the image to be detected to obtain symmetrical perturbation noise, including: inputting the image to be detected into a detection model, and extracting the symmetrical perturbation noise corresponding to the image to be detected through the detection model.
[0019] In one embodiment, the training process of the detection model includes: acquiring a training dataset, which includes multiple sample images and label symmetric perturbation noise corresponding to each sample image; and training an initial detection model based on the training dataset to obtain a detection model.
[0020] In one embodiment, based on the watermark key of the target object and the symmetric perturbation noise, the legitimacy of the image to be detected is verified to obtain the verification result, including: determining the candidate watermark key corresponding to the symmetric perturbation noise, detecting whether the candidate watermark key is consistent with the watermark key; if the candidate watermark key is consistent with the watermark key, the verification result is determined to be that the verification failed.
[0021] In one embodiment, the method further includes: outputting the verification result to the target object.
[0022] Fourthly, this application also provides a watermark detection device, comprising: an image acquisition module for acquiring an image to be detected; a watermark detection module for performing watermark detection on the image to be detected to obtain symmetrical perturbation noise; and a legality verification module for performing legality verification on the image to be detected based on the watermark key of the target object and the symmetrical perturbation noise to obtain a verification result.
[0023] The watermark detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product of this application acquire an image to be detected, perform watermark detection on the image to be detected, obtain the symmetrical perturbation noise contained in the image to be detected, and perform legality verification on the image to be detected based on the watermark key of the target object and the symmetrical perturbation noise to obtain the verification result. The verification result characterizes whether the image to be detected belongs to the target object, or whether the image to be detected is generated based on the image of the target object. In this way, the long-term retention of the watermark is achieved, and the security of the image generated by the diffusion model is improved.
[0024] Fifthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the methods described in the first or third aspects.
[0025] Sixthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the methods described in the first or third aspects above.
[0026] In a seventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods described in the first or third aspect above. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a diagram illustrating the application environment of a watermarking method in one embodiment;
[0029] Figure 2 This is a flowchart illustrating a watermarking method in one embodiment;
[0030] Figure 3 This is a flowchart illustrating step 202 in one embodiment;
[0031] Figure 4 This is a flowchart illustrating the steps for correcting target symmetric perturbation noise in one embodiment;
[0032] Figure 5 This is a flowchart illustrating the steps for generating a watermark key in one embodiment.
[0033] Figure 6This is a flowchart illustrating the first interaction step in one embodiment;
[0034] Figure 7 This is a flowchart illustrating the second interaction step in one embodiment;
[0035] Figure 8 This is a flowchart illustrating the watermark detection steps in one embodiment;
[0036] Figure 9 This is a flowchart illustrating the noise extraction steps in one embodiment;
[0037] Figure 10 This is a flowchart illustrating the detection model training steps in one embodiment;
[0038] Figure 11 This is a flowchart illustrating step 802 in one embodiment;
[0039] Figure 12 This is a flowchart illustrating the watermarking method in another embodiment;
[0040] Figure 13 This is a structural block diagram of a watermark marking device in one embodiment;
[0041] Figure 14 This is a flowchart illustrating a watermark detection method in one embodiment;
[0042] Figure 15 This is a flowchart illustrating step 1402 in one embodiment;
[0043] Figure 16 This is a flowchart illustrating the training steps of a detection model in one embodiment;
[0044] Figure 17 This is a flowchart illustrating step 1403 in one embodiment;
[0045] Figure 18 This is a flowchart illustrating the verification result output steps in one embodiment;
[0046] Figure 19 This is a structural block diagram of a watermark detection device in one embodiment;
[0047] Figure 20 This is a flowchart illustrating the watermark detection method in another embodiment;
[0048] Figure 21 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0051] The watermarking method provided in this application can be applied to, for example... Figure 1 The application environment shown includes at least a diffusion model 101 and a server 102, and may also include a terminal 103.
[0052] The diffusion model 101 is used to obtain the prompt information input by the user, query the first reference image, and generate the target image corresponding to the prompt information based on the second reference image sent by the server 102. The diffusion model 101 can be deployed in the server 102, or in other servers. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0053] Server 102 is used to obtain the first reference image queried by diffusion model 101, determine the watermark key corresponding to the first reference image, write a symmetric perturbation watermark on the first reference image according to the watermark key to obtain a second reference image, and send the second reference image to diffusion module 101. Server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0054] Terminal 103 can receive prompts input by the user and send them to diffusion model 101 / server 102. Terminal 103 can also receive target images sent by diffusion model 101 / server 102 and display them to the user. Terminal 103 communicates with diffusion model 101 / server 102 via a network. A data storage system can store data that server 102 needs to process. Terminal 103 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. It should be noted that terminal 103 can install a client corresponding to diffusion model 101. Terminal 103 can run this client to receive prompts input by the user and display the target image to the user through the client.
[0055] In real-world scenarios, with the rapid development of generative AI technologies such as diffusion models, image retrieval-enhanced generation technology has gained widespread attention due to its ability to generate high-fidelity, highly relevant images. Diffusion models first use a retrieval system to find the most relevant reference images to the text prompts from the dataset, and then use these reference images to guide the generation process. However, this technology also presents significant security challenges. The generated images are a comprehensive output of the model after "learning" from multiple reference images, making it difficult to trace their style and content origins. They cannot be definitively attributed to any single original reference image or dataset. Therefore, malicious users may use copyrighted image sets as a database to generate and distribute derivative works for commercial misappropriation. Currently, there is a lack of effective technical means to prove such infringement, resulting in image security issues.
[0056] To address this, this application injects a man-made, invisible to human vision but sensitive to the diffusion model into the reference image obtained by the diffusion model query. This "symmetric perturbation watermark" (i.e., perceptible artifact) exists stably in the target image for a long time without affecting the user's viewing experience. This watermark marks the target image generated by the diffusion model, preventing the target image from being misused and improving the security of the target image.
[0057] In one exemplary embodiment, such as Figure 2 As shown, a watermarking method is provided, which can be applied to... Figure 1 The following steps, 201 to 203, are used as an example to illustrate the process of using a server in the example.
[0058] Step 201: Obtain the first reference image obtained from the diffusion model query.
[0059] In real-world scenarios, the diffusion model generates images in response to user input prompts. The diffusion model first queries a reference image library for at least one first reference image that matches the prompt information. Here, the server retrieves the at least one first reference image obtained by the diffusion model.
[0060] In this application, the first reference image is obtained by the diffusion model in response to the prompt information input by the user. The first reference image may be an image in the reference image library that matches the prompt information.
[0061] During the acquisition of the first reference image, the server can proactively retrieve the first reference image obtained by the diffusion model query, or the diffusion model can proactively send the first reference image to the server. The diffusion model can use a retrieval function to calculate the cosine similarity of each image in the image database based on the image's summary and prompt information, and select one or more reference images that are ranked highest according to the cosine similarity.
[0062] Step 202: Determine the watermark key corresponding to the first reference image, and write a symmetrical perturbation watermark on the first reference image according to the watermark key to obtain the second reference image.
[0063] During implementation, the server determines the watermark key corresponding to the first reference image, generates a symmetrical perturbation watermark based on the watermark key, writes the symmetrical perturbation watermark into the first reference image, and obtains the second reference image.
[0064] In this application, the watermark key can represent the identity of the target object, which can be an organization or a user. The watermark key can be generated based on the identification information of the target object, so that each target object can have its own unique watermark key.
[0065] Step 203: Send the second reference image to the diffusion model.
[0066] During implementation, after obtaining the second reference image, the server sends the second reference image to the diffusion model. After receiving the second reference image, the diffusion model generates the target image corresponding to the prompt information based on the prompt information and the second reference image. The specific generation process can be implemented with reference to relevant technologies, and will not be elaborated here.
[0067] It should be noted that during the process of generating the target image based on the second reference image, the diffusion model "learns" and amplifies the symmetrical structure in the symmetrical perturbation watermark. This causes the symmetrical perturbation watermark to be imprinted in the latent features of the target image. Users cannot see the symmetrical perturbation watermark with the naked eye, but it can be detected. Furthermore, the symmetrical perturbation watermark also carries the identification information of the target object, which can determine the object to which the image belongs. Therefore, if an external user directly uses the target object to generate the target image through the diffusion model, it will be directly detected by the watermark key. Even if the external user only uses the target image generated by the diffusion model as the reference image of the diffusion model, the image generated by the external user will also carry the watermark and will be directly detected by the watermark key.
[0068] In the above watermarking method, during the target image generation process of the diffusion model, the first reference image obtained by the diffusion model in response to the prompt information queried by the user input is first acquired, the watermark key corresponding to the first reference image is determined, and a symmetrical perturbation watermark is written into the first reference image according to the watermark key to obtain a second reference image. The second reference image is then sent to the diffusion model so that the diffusion model can generate the target image corresponding to the prompt information. In this way, the symmetrical perturbation watermark is written into the reference image during the model retrieval stage. The symmetrical perturbation watermark avoids the removal of the watermark during the noise removal stage, improves the stability of the watermark, and thus improves the security of the target image.
[0069] Based on the above exemplary embodiment, the following provides a watermarking method in one or more exemplary embodiments, which is applied to... Figure 1 Taking the server in the example, the following content will be used for explanation.
[0070] In the process of writing the symmetrical perturbation watermark, a preset noise generation method can be used first to generate noise from the watermark key to obtain target symmetrical perturbation noise. The target symmetrical perturbation noise is then written into a first reference image to obtain a second reference image. In one optional implementation provided by this application, such as... Figure 3 As shown, step 202 includes steps 301 to 302:
[0071] Step 301: Noise is generated for the watermark key using a preset noise generation method to obtain target symmetrical perturbation noise.
[0072] During implementation, the server determines the noise generation method corresponding to this noise addition, and generates noise for the watermark key using the noise generation method to obtain the target symmetrical perturbation noise. Among them, the preset noise generation method includes any one of the following: centrosymmetric noise generation, axisymmetric noise generation, rotational symmetric noise generation, frequency domain noise generation, and texture noise generation, which is used to construct the noise of the symmetrical structure.
[0073] During execution, the server can first generate a basic noise block based on the watermark key, and then generate the target symmetrical perturbation noise based on the basic noise block using the generation method corresponding to the noise generation method.
[0074] For example, based on the watermark key K AIS Generate basic noise block },in Represents a standard normal distribution, where h and w are the height and width of the basic block. Using the key K... AIS Initialize the random number generator, ensuring N base Reproducible.
[0075] Furthermore, taking centrally symmetric noise as an example, central symmetry can be achieved through mirror replication, see formula (1):
[0076] Formula (1);
[0077] Among them, K AIS For target-symmetric perturbation noise. This represents the left and right mirror functions of a matrix. The function represents the vertical mirroring of a matrix, ensuring... It satisfies central symmetry.
[0078] Step 302: Add noise to each pixel value in the first reference image using target symmetric perturbation noise to obtain the second reference image.
[0079] During implementation, the server uses target symmetric perturbation noise to add noise to each pixel value in the first reference image to obtain the second reference image.
[0080] During execution, the image matrix of the first reference image and the matrix of the target symmetric perturbation noise can be superimposed to add noise to each pixel value in the first reference image to obtain the second reference image.
[0081] For example, for each retrieved reference image (Its pixel values have been normalized to [0,1]), which can be based on A second reference image is obtained.
[0082] Furthermore, the second reference image can be cropped by pixel values, and the cropped second reference image can be sent to the diffusion model.
[0083] For example, pixel value cropping (ensuring the value range is valid): ;in The function sets all values in x greater than b to b and all values less than a to a.
[0084] One optional implementation provided in this application generates target symmetrical perturbation noise based on the watermark key. The noise with a symmetrical structure achieves long-term stable existence in the image, thereby improving the stability of the watermark.
[0085] After obtaining the target symmetrical perturbation noise, the noise can be further normalized and its amplitude adjusted; in one optional implementation provided in this application, such as Figure 4 As shown, the method further includes steps 401 to 403:
[0086] Step 401: Normalize the target symmetrical perturbation noise to obtain the normalized symmetrical perturbation noise.
[0087] During implementation, after obtaining the target symmetrical perturbation noise, the server normalizes the target symmetrical perturbation noise so that the amplitude of the target symmetrical perturbation noise is between [-1, 1].
[0088] During execution, the server can... Normalize the target symmetric perturbation noise.
[0089] Step 402: Adjust the amplitude of the normalized symmetrical disturbance noise based on the preset intensity to obtain the amplitude-adjusted symmetrical disturbance noise.
[0090] In real-world scenarios, the amplitude of [-1,1] may not match the actual application, and the noise may be too obvious and be perceived by the user. To address this, the intensity can be preset, and the amplitude of the symmetrical disturbance noise can be adjusted by the preset intensity. During implementation, the server can adjust the amplitude of the normalized symmetrical disturbance noise based on the preset intensity to obtain the amplitude-adjusted symmetrical disturbance noise.
[0091] During execution, the amplitude-adjusted symmetrical disturbance noise can be obtained by multiplying the intensity factor α with the normalized symmetrical disturbance noise, ensuring that the disturbance is invisible, and normalizing the symmetrical disturbance noise to the range [-α, α].
[0092] Furthermore, step 302 needs to be replaced with step 403: using amplitude-adjusted symmetrical perturbation noise to add noise to each pixel value in the first reference image to obtain the second reference image.
[0093] One optional implementation provided in this application controls the amplitude of the target symmetrical disturbance noise through normalization and amplitude adjustment, ensuring that the target symmetrical disturbance noise is not perceived by the user, thereby improving the user's perception experience.
[0094] In practical scenarios, the watermark key can be determined based on the identification information of the target object, so as to detect whether the image belongs to the target object during the watermark detection process; regarding the watermark key generation process, this application provides an optional implementation method, such as Figure 5 As shown, the process of generating the watermark key includes steps 501 to 502:
[0095] Step 501: Obtain the identification information of the target object.
[0096] During implementation, the server obtains the identification information of the target object; in this application, the identification information can represent the identity of the target object, and the identification information can be numbers, letters, or a combination of numbers and letters.
[0097] Step 502: Hash the identification information to obtain the watermark key.
[0098] During implementation, the server performs hash mapping on the identification information to obtain the watermark key. During execution, the server maps the identification information to a global master key K. AIS The Hash function truncates or maps the output to an integer seed.
[0099] One optional implementation provided in this application generates a watermark key based on the identification information of the target object. During the watermark detection process, the watermark key can be used to detect whether the image belongs to the target object, thereby improving the security of the image generated by the diffusion model.
[0100] In real-world scenarios, before querying the first reference image, the diffusion model can obtain prompts through user interaction, and then query the first reference image based on these prompts; in one optional implementation provided in this application, such as Figure 6 As shown, the method further includes steps 601 to 602:
[0101] Step 601: Obtain the prompt information.
[0102] During implementation, the server obtains prompts input by the user; in the process of obtaining these prompts, the server can also obtain prompts sent by the user through the terminal.
[0103] For example, the server receives prompts from the user via a diffusion model client, such as "eagle, snow-capped mountain, sunrise photo".
[0104] Step 602: Input the prompt information into the diffusion model, and use the diffusion model to query the first reference image based on the prompt information.
[0105] During implementation, the server inputs the prompts sent by the user into the diffusion model, and then uses the diffusion model to query the first reference image based on the prompts, thereby achieving interaction with the user.
[0106] One optional implementation provided in this application involves a server undertaking the interaction function with the user, thereby querying the first reference image based on the cooperation between the server and the diffusion model, which improves the user's perception and interactivity.
[0107] In practical scenarios, the target image can also be generated and output based on the prompt information and the second reference image; in one optional implementation provided by this application, such as Figure 7 As shown, the method further includes steps 701 to 702:
[0108] Step 701: Generate the target image by using a diffusion model based on the prompt information and the second reference image.
[0109] During implementation, the server generates the target image based on the prompt information and the second reference image using a diffusion model.
[0110] Step 702: Output the target image.
[0111] During implementation, the server inputs the target image; during execution, the server can output the target image to the user's terminal, and the user can view the target image through the client corresponding to the diffusion model on the terminal.
[0112] One optional implementation provided in this application involves a server undertaking the interaction function with the user, thereby generating a target image based on the cooperation between the server and the diffusion model, so that the user can view the target image on the client, thus improving the user's perception and interactivity.
[0113] In practical scenarios, after adding a watermark, watermark detection processing can also be performed. The legality of the target image can be verified based on the watermark key to confirm whether the target image belongs to the target object corresponding to the watermark key. In one optional implementation provided by this application, such as... Figure 8 As shown, the method further includes steps 801 to 802:
[0114] Step 801: Perform watermark detection on the target image to obtain symmetrical perturbation noise.
[0115] During implementation, the server extracts the watermark from the target image to obtain the symmetrical perturbation noise contained in the target image.
[0116] During execution, the server can perform watermark extraction processing using a pre-trained detection model to obtain symmetrical perturbation noise, or the server can also perform watermark extraction processing on the target image using a watermark extraction algorithm to obtain symmetrical perturbation noise.
[0117] Step 802: Based on the watermark key and symmetric perturbation noise, the legality of the target image is verified to obtain the verification result.
[0118] During implementation, the server can compare the watermark key and the symmetric perturbation noise to detect the structural similarity between the watermark key and the symmetric perturbation noise. This allows for the verification of the legality of the target image. If the watermark key and the symmetric perturbation noise have similar structures, the verification result indicates that the legality of the target object has failed. If the structures of the watermark key and the symmetric perturbation noise are different, the verification result indicates that the legality of the target object has passed.
[0119] During execution, the server can extract the key corresponding to the symmetric perturbation noise, compare the key with the watermark key, and determine the verification result based on the comparison result. Alternatively, the server can decrypt the watermark key based on the symmetric perturbation noise and determine the verification result based on the decryption result.
[0120] One optional implementation provided in this application detects the watermark of the target image and determines the legitimacy of the target image by detecting whether the watermark has the same structure as the watermark key, thereby improving the reliability of the legitimacy verification.
[0121] In real-world scenarios, during watermark detection, the server can perform watermark detection using a pre-trained detection model; one optional implementation provided in this application is as follows: Figure 9 As shown, watermark detection of the target image includes step 901:
[0122] Step 901: Input the target image into the detection model and extract the corresponding symmetrical perturbation noise of the target image through the detection model.
[0123] During implementation, the server inputs the target image into the detection model, and the detection model extracts the corresponding symmetrical perturbation noise of the target image.
[0124] During execution, the detection model can be a neural network, which is trained to recognize P. AIS Residual characteristics.
[0125] One optional implementation provided in this application extracts symmetrical perturbation noise through a detection model and a pre-trained model, thereby improving the reliability and accuracy of the extracted symmetrical perturbation noise.
[0126] During training, the detection model can be trained based on multiple sample images and the label-symmetric perturbation noise corresponding to each sample image; in one optional implementation provided in this application, such as Figure 10 As shown, the method further includes steps 1001 to 1002:
[0127] Step 1001: Obtain the training dataset.
[0128] During implementation, the model training device acquires the training dataset. The training dataset includes multiple sample images and corresponding label-symmetric perturbation noise for each sample image.
[0129] Step 1002: Train the initial detection model based on the training dataset to obtain the detection model.
[0130] During implementation, the model training device trains the initial detection model based on the training dataset until the initial detection model converges, thus obtaining the detection model.
[0131] During training, the model training device inputs sample images into the initial detection model. The initial detection model extracts watermarks to obtain candidate symmetric perturbation noise. Error is calculated based on the candidate symmetric perturbation noise and the label symmetric perturbation noise. The parameters of the initial detection model are tuned according to the error calculation results. The above steps are repeated until the samples in the training dataset are exhausted, or until the error is less than the error threshold, or until the number of iterations reaches the threshold. The model can be considered to have converged. The final determined model parameters are then configured into the initial detection model to obtain the detection model.
[0132] One optional implementation method provided in this application enables the detection model to extract symmetrical perturbation noise in the image by pre-training the detection model, thereby realizing the extraction of symmetrical perturbation noise and improving data processing efficiency.
[0133] During the legality verification process, the watermark key and candidate watermark keys in the symmetrical perturbation noise corresponding to the target image can be compared, and the verification result is determined based on the comparison result; in one optional implementation provided by this application, such as Figure 11 As shown, step 802 may include steps 1101 to 1102:
[0134] Step 1101: Determine the candidate watermark key corresponding to the symmetrical perturbation noise, and check whether the candidate watermark key is consistent with the watermark key.
[0135] During implementation, the server extracts candidate watermark keys from symmetrical perturbation noise and checks whether the candidate watermark keys have the same structure as the watermark keys.
[0136] During execution, the server can extract noise blocks based on the generation method of symmetric perturbation noise, restore the noise blocks to candidate watermark keys, and check whether the structure of the candidate watermark key is consistent with the watermark key. If they are consistent, the legality verification is determined to be unsuccessful, that is, the target image is the image of the target object and should not be used externally. If they are inconsistent, the legality verification is determined to be successful, that is, the target image is not the image of the target object.
[0137] Step 1102: If the candidate watermark key is consistent with the watermark key, the verification result is determined to be that the verification failed.
[0138] During implementation, if the candidate watermark key matches the watermark key, it indicates that the target image is an image of the target object and should not be used externally. In this case, the verification result is determined to be that the verification failed, that is, the target image is invalid.
[0139] One optional implementation provided in this application compares the candidate watermark key in symmetrical perturbation noise with the watermark key of the target object, and determines whether the target image belongs to the target object based on the comparison result. In this way, watermark detection of the image is realized, thereby improving the security of the image of the target object.
[0140] In one embodiment, see Figure 12 The document illustrates a flowchart of a watermarking method provided in an embodiment of this application, which can be applied to... Figure 1 In the server shown. For example Figure 12 As shown, the watermarking method may include the following steps:
[0141] Step 1201: Obtain the prompt information.
[0142] Step 1202: Input the prompt information into the diffusion model, and use the diffusion model to query the first reference image based on the prompt information.
[0143] Step 1203: Determine the watermark key corresponding to the first reference image, and generate noise for the watermark key using a preset noise generation method to obtain target symmetrical perturbation noise.
[0144] Step 1204: Normalize the target symmetrical perturbation noise to obtain the normalized symmetrical perturbation noise.
[0145] Step 1205: Adjust the amplitude of the normalized symmetrical disturbance noise based on the preset intensity to obtain the amplitude-adjusted symmetrical disturbance noise.
[0146] Step 1206: Add noise to each pixel value of the first reference image using amplitude-adjusted symmetrical perturbation noise to obtain the second reference image.
[0147] Step 1207: Generate the target image by using a diffusion model based on the prompt information and the second reference image, and output the target image.
[0148] It should be noted that any one or more of steps 1201 to 1207 can be combined to form a new implementation method according to the needs of implementation and deployment. Furthermore, any one or more technical features in the technical solution composed of steps 1201 to 1207 can also be combined to form a new implementation method according to the actual deployment needs, or technical features in one or more optional implementations provided by one or more of the above embodiments can be combined to form a new implementation method. These will not be elaborated on here.
[0149] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0150] It should be noted that the above one or more embodiments provide a watermark marking method, and the following one or more embodiments provide a watermark detection method. The two can be referenced each other during implementation. Therefore, when reading about the above watermark marking method, one can refer to the following watermark detection method for implementation, and vice versa.
[0151] Based on the same inventive concept, this application also provides a watermarking device for implementing the watermarking method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of the one or more watermarking device embodiments provided below can be found in the limitations of the watermarking method described above, and will not be repeated here.
[0152] In one exemplary embodiment, such as Figure 13 As shown, a watermarking device is provided, including: a first image acquisition module 1301, a second image acquisition module 1302, and an image sending module 1303, wherein: the first image acquisition module 1301 is used to acquire a first reference image obtained by a diffusion model query, the first reference image being obtained by the diffusion model in response to a prompt message input by a user; the second image acquisition module 1302 is used to determine the watermark key corresponding to the first reference image, and write a symmetrical perturbation watermark onto the first reference image according to the watermark key to obtain a second reference image; the image sending module 1303 is used to send the second reference image to the diffusion model, the second reference image being used by the diffusion model to generate a target image corresponding to the prompt message.
[0153] In one embodiment, the second image acquisition module 1302 is further configured to generate noise for the watermark key using a preset noise generation method to obtain target symmetric perturbation noise. The preset noise generation method includes any one of central symmetric noise generation, axisymmetric noise generation, rotational symmetric noise generation, frequency domain noise generation, and texture noise generation. The target symmetric perturbation noise is used to add noise to each pixel value in the first reference image to obtain the second reference image.
[0154] In one embodiment, the apparatus further includes a normalization unit, an amplitude adjustment unit, and a noise addition unit, wherein: the normalization unit is used to normalize the target symmetrical perturbation noise to obtain normalized symmetrical perturbation noise; the amplitude adjustment unit is used to adjust the amplitude of the normalized symmetrical perturbation noise based on a preset intensity to obtain amplitude-adjusted symmetrical perturbation noise; and the noise addition unit is used to add noise to each pixel value of the first reference image using the amplitude-adjusted symmetrical perturbation noise to obtain a second reference image.
[0155] In one embodiment, the apparatus further includes a watermark key generation unit for obtaining the identification information of the target object and performing hash processing on the identification information to obtain a watermark key.
[0156] In one embodiment, the apparatus further includes a reference image query unit, configured to acquire prompt information, input the prompt information into a diffusion model, and query a first reference image based on the prompt information using the diffusion model.
[0157] In one embodiment, the apparatus further includes a target image generation unit for generating an image based on a prompting information and a second reference image using a diffusion model, obtaining a target image and outputting it.
[0158] In one embodiment, the apparatus further includes a watermark detection unit and a verification unit. The watermark detection unit is used to perform watermark detection on the target image to obtain symmetrical perturbation noise. The verification unit is used to perform legality verification on the target image based on the watermark key and the symmetrical perturbation noise to obtain a verification result.
[0159] In one embodiment, the watermark detection unit includes a model detection unit, which is used to input the target image into the detection model and extract the symmetrical perturbation noise corresponding to the target image through the detection model.
[0160] In one embodiment, a model training unit is further included, which is used to acquire a training dataset and train an initial detection model based on the training dataset to obtain a detection model.
[0161] In one embodiment, the verification unit includes a watermark key verification unit and a result determination unit, wherein: the watermark key verification unit is used to determine the candidate watermark key corresponding to the symmetric perturbation noise and detect whether the candidate watermark key is consistent with the watermark key; the result determination unit is used to determine the verification result as verification failure if the candidate watermark key is consistent with the watermark key.
[0162] Each module in the aforementioned watermarking device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0163] In one exemplary embodiment, such as Figure 14 As shown, a watermark detection method is provided, which is applied to... Figure 1 The following steps are used as an example of the server in the example, including steps 1401 to 1403.
[0164] Step 1401: Obtain the image to be detected.
[0165] During implementation, the server acquires at least one image to be detected. In this application, the image to be detected may be an image published on a public network by an external user. The server can acquire at least one image to be detected based on a preset frequency to detect whether the image to be detected belongs to the target object.
[0166] Step 1402: Perform watermark detection on the image to be detected to obtain symmetrical perturbation noise.
[0167] During implementation, the server performs watermark detection on the image to be detected, resulting in symmetrical perturbation noise.
[0168] During execution, the server can extract watermarks from the image to be detected, thereby obtaining the symmetrical perturbation noise contained in the image.
[0169] During execution, the server can perform watermark extraction processing using a pre-trained detection model to obtain symmetrical perturbation noise. Alternatively, the server can also perform watermark extraction processing on the image to be detected using a watermark extraction algorithm to obtain symmetrical perturbation noise.
[0170] Step 1403: Based on the target object's watermark key and symmetric perturbation noise, perform a legality verification on the image to be detected to obtain the verification result.
[0171] During implementation, the server can compare the watermark key and symmetric perturbation noise of the target object to detect the structural similarity between the watermark key and the symmetric perturbation noise. This allows for the verification of the legality of the target image. If the watermark key and the symmetric perturbation noise have similar structures, the verification result indicates that the legality of the target object has failed. If the structures of the watermark key and the symmetric perturbation noise are different, the verification result indicates that the legality of the target object has passed.
[0172] During execution, the server can extract the key corresponding to the symmetric perturbation noise, compare the key with the watermark key, and determine the verification result based on the comparison result. Alternatively, the server can decrypt the symmetric perturbation noise based on the watermark key and determine the verification result based on the decryption result.
[0173] In the above watermark detection method, the image to be detected is acquired, watermark detection is performed on the image to be detected, and the symmetrical perturbation noise contained in the image to be detected is obtained. Based on the watermark key of the target object and the symmetrical perturbation noise, the legitimacy of the image to be detected is verified to obtain the verification result. The verification result indicates whether the image to be detected belongs to the target object, or whether the image to be detected is generated based on the image of the target object. In this way, the long-term retention of the watermark is achieved, and the security of the image generated by the diffusion model is improved.
[0174] Based on the above exemplary embodiment, the following provides a watermark detection method in one or more exemplary embodiments, which is applied to... Figure 1 Taking the server in the example, the following content will be used for explanation.
[0175] During watermark detection, symmetrical perturbation noise in the image to be detected can be extracted using a detection model; in one optional implementation provided in this application, such as Figure 15 As shown, step 1402 includes step 1501:
[0176] Step 1501: Input the image to be detected into the detection model, and extract the symmetrical perturbation noise corresponding to the target image through the detection model.
[0177] During implementation, the server inputs the image to be detected into the detection model, and the detection model extracts the corresponding symmetrical perturbation noise of the image to be detected.
[0178] During execution, the detection model can be a neural network, which is trained to recognize P. AIS Residual characteristics.
[0179] One optional implementation provided in this application extracts symmetrical perturbation noise through a detection model and a pre-trained model, thereby improving the reliability and accuracy of the extracted symmetrical perturbation noise.
[0180] During training, the detection model can be trained based on multiple sample images and the label-symmetric perturbation noise corresponding to each sample image; in one optional implementation provided in this application, such as Figure 16 As shown, the method further includes steps 1601 to 1602:
[0181] Step 1601: Obtain the training dataset.
[0182] During implementation, the model training device acquires the training dataset. The training dataset includes multiple sample images and corresponding label-symmetric perturbation noise for each sample image.
[0183] Step 1602: Train the initial detection model based on the training dataset to obtain the detection model.
[0184] During implementation, the model training device trains the initial detection model based on the training dataset until the initial detection model converges, thus obtaining the detection model.
[0185] During training, the model training device inputs sample images into the initial detection model. The initial detection model extracts watermarks to obtain candidate symmetric perturbation noise. Error is calculated based on the candidate symmetric perturbation noise and the label symmetric perturbation noise. The parameters of the initial detection model are tuned according to the error calculation results. The above steps are repeated until the samples in the training dataset are exhausted, or until the error is less than the error threshold, or until the number of iterations reaches the threshold. The model can be considered to have converged. The final determined model parameters are then configured into the initial detection model to obtain the detection model.
[0186] One optional implementation method provided in this application enables the detection model to extract symmetrical perturbation noise in the image by pre-training the detection model, thereby realizing the extraction of symmetrical perturbation noise and improving data processing efficiency.
[0187] During the legality verification process, the watermark key can be compared with the candidate watermark key in the symmetrical perturbation noise corresponding to the image to be detected, and the verification result can be determined based on the comparison result; in one optional implementation provided by this application, such as Figure 17 As shown, step 1403 may include steps 1701 to 1702:
[0188] Step 1701: Determine the candidate watermark key corresponding to the symmetrical perturbation noise, and check whether the candidate watermark key is consistent with the watermark key.
[0189] During implementation, the server extracts candidate watermark keys from symmetrical perturbation noise and checks whether the candidate watermark keys have the same structure as the watermark keys.
[0190] During execution, the server can extract noise blocks based on the generation method of symmetric perturbation noise, restore the noise blocks to candidate watermark keys, and check whether the structure of the candidate watermark key is consistent with the watermark key. If they are consistent, the legality verification is determined to be unsuccessful, that is, the image to be detected is the image of the target object and should not be used externally. If they are inconsistent, the legality verification is determined to be successful, that is, the image to be detected is not the image of the target object.
[0191] Step 1702: If the candidate watermark key is consistent with the watermark key, the verification result is determined to be verification failure.
[0192] During implementation, if the candidate watermark key matches the watermark key, it indicates that the image to be detected is an image of the target object and should not be used externally. In this case, the verification result is determined to be that the verification failed, that is, the image to be detected is invalid.
[0193] One optional implementation provided in this application compares the candidate watermark key in symmetrical perturbation noise with the watermark key of the target object, and determines whether the image to be detected belongs to the target object based on the comparison result. In this way, watermark detection of the image is realized, thereby improving the security of the image of the target object.
[0194] In practical scenarios, the verification results can also be output to the user so that the user is aware of the verification result of the image to be detected; in one optional implementation provided in this application, such as Figure 18 As shown, the method also includes step 1801:
[0195] Step 1801: Output the verification results to the target object.
[0196] During implementation, the server can output the verification results to the target object's terminal through the diffusion model's client; the target object can view the verification results through the terminal.
[0197] One optional implementation method provided in this application ensures that users can intuitively view the verification results by outputting the verification results, thereby improving the interactivity of the verification results.
[0198] In one embodiment, see Figure 19 The diagram illustrates a flowchart of a watermark detection method provided in an embodiment of this application, which can be applied to... Figure 1 In the server shown. For example Figure 19 As shown, the watermark detection method may include the following steps:
[0199] Step 1901: Obtain the image to be detected.
[0200] Step 1902: Input the image to be detected into the detection model, and extract the symmetrical perturbation noise corresponding to the image to be detected through the detection model.
[0201] Step 1903: Determine the candidate watermark key corresponding to the symmetrical perturbation noise, and check whether the candidate watermark key is consistent with the watermark key.
[0202] Step 1904: Determine the legality verification result of the image to be detected based on the detection results.
[0203] Step 1905: Output the legality verification result to the target object.
[0204] It should be noted that any one or more of steps 1901 to 1905 can be combined to form a new implementation method according to the needs of implementation and deployment. Furthermore, any one or more technical features in the technical solution composed of steps 1901 to 1905 can also be combined to form a new implementation method according to the actual deployment needs, or technical features in one or more optional implementation methods provided by one or more of the above embodiments can be combined to form a new implementation method. These will not be elaborated on here.
[0205] This application also provides an embodiment for characterizing the feasibility of the above-described watermark marking method and / or watermark detection method: First, the diffusion model generates the target image, and the generation process of the diffusion model can be simplified to a denoising function: ;
[0206] in: It is initial pure noise. It is conditional information, in this example , t is the time step. The model undergoes a denoising process. , conditions Information in the middle (including symmetric perturbations) The structure) is mapped to the target image middle.
[0207] Then, an attack transformation is applied to the target image: the target image Apply an attack transformation function A, such as JPEG compression: Cutting: (That is, retain 95% of the center area); Brightness adjustment: Δ represents a small brightness offset.
[0208] Next, robustness is measured on the target image: the residual strength of the watermark in the image after the attack is measured. The conditions for robust success are: >T.
[0209] Next, a fidelity test is performed on the target image. First, the peak signal-to-noise ratio (PSNR) is calculated to evaluate the perturbated reference image. Compared to the original image The degree of distortion. The calculation process for Peak Signal-to-Noise Ratio (PSNR) is as follows: ;in It is the maximum possible pixel value of the image. Mean squared error: PSNR > 40dB proves that the distortion is extremely low and imperceptible.
[0210] Image quality can then be evaluated from three aspects: brightness, contrast, and structure, with a value range of [value range missing]. The closer to 1, the better. Based on structural similarity (SSIM): Where l, c, and s are comparison functions for brightness, contrast, and structure, respectively. This indicates that the two images are visually almost identical.
[0211] Ultimately, the system generates a highly realistic target image that meets the user's requirements and returns it to the target object. The image is visually flawless, but its latent features have already encoded... A faint residual pattern.
[0212] The beneficial effects of this application include at least the following: extremely high robustness: symmetric perturbation noise is a strong structural prior, which the diffusion model not only finds difficult to eliminate during the denoising process, but also learns and reinforces it, enabling the watermark signal to survive tenaciously and resist various attacks such as JPEG compression, cropping, and color transformation; strong concealment: through the control of a small intensity factor α, the perturbation is visually imperceptible, ensuring the visual quality of the reference image and the final generated image, with no impact on the user experience; traceability and provability: a complete chain of evidence is formed, and only systems that know the key can inject specific patterns, and only by using it can they be detected, making it highly unique and difficult to deny, thereby improving image security.
[0213] Based on the same inventive concept, this application also provides a watermark detection device for implementing the watermark detection method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more watermark detection device embodiments provided below can be found in the limitations of the watermark detection method described above, and will not be repeated here.
[0214] In one exemplary embodiment, such as Figure 20 As shown, a watermark detection device is provided, including: an image acquisition module 2001, a watermark detection module 2002, and a legality verification module 2003, wherein: the image acquisition module 2001 is used to acquire an image to be detected; the watermark detection module 2002 is used to perform watermark detection on the image to be detected to obtain symmetrical perturbation noise; and the legality verification module 2003 is used to perform legality verification on the image to be detected based on the watermark key of the target object and the symmetrical perturbation noise to obtain a verification result.
[0215] In one embodiment, the watermark detection module 2002 is further configured to input the image to be detected into the detection model and extract the symmetrical perturbation noise corresponding to the image to be detected through the detection model.
[0216] In one embodiment, the apparatus further includes a data acquisition unit and a training unit, wherein: the data acquisition unit is used to acquire a training dataset; and the training unit is used to train an initial detection model based on the training dataset to obtain a detection model.
[0217] In one embodiment, the legitimacy verification module includes a key detection unit and a result determination unit, wherein: the key detection unit is used to determine the candidate watermark key corresponding to the symmetric perturbation noise and detect whether the candidate watermark key is consistent with the watermark key; the result determination unit is used to determine the verification result as verification failure if the candidate watermark key is consistent with the watermark key.
[0218] In one embodiment, the apparatus further includes a result output unit for outputting the verification result to the target object.
[0219] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 21 As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores watermark detection and / or watermark marking data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a watermark marking method and / or a watermark detection method.
[0220] Those skilled in the art will understand that Figure 21 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0221] In one exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement one or more embodiments corresponding to the above-described watermark detection method and / or watermark marking method.
[0222] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements one or more embodiments corresponding to the above-described watermark detection method and / or watermark marking method.
[0223] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements one or more embodiments corresponding to the above-described watermark detection method and / or watermark marking method.
[0224] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0225] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0226] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0227] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A watermark marking method, characterized in that, The method includes: Obtain the first reference image obtained by the diffusion model query, wherein the first reference image is obtained by the diffusion model in response to prompt information input by the user; Determine the watermark key corresponding to the first reference image, and write a symmetrical perturbation watermark on the first reference image according to the watermark key to obtain the second reference image; The second reference image is sent to the diffusion model, and the second reference image is used by the diffusion model to generate the target image corresponding to the prompt information.
2. The method according to claim 1, characterized in that, The step of writing a symmetrical perturbation watermark onto the first reference image according to the watermark key to obtain a second reference image includes: The watermark key is noise generated using a preset noise generation method to obtain target symmetric perturbation noise. The preset noise generation method includes any one of central symmetric noise generation, axisymmetric noise generation, rotational symmetric noise generation, frequency domain noise generation, and texture noise generation. The second reference image is obtained by adding noise to each pixel value in the first reference image using the target symmetrical perturbation noise.
3. The method according to claim 2, characterized in that, The method further includes: The symmetrical perturbation noise of the target is normalized to obtain the normalized symmetrical perturbation noise; The amplitude of the normalized symmetrical perturbation noise is adjusted based on a preset intensity to obtain the amplitude-adjusted symmetrical perturbation noise; The step of adding noise to each pixel value of the first reference image using the target symmetrical perturbation noise to obtain the second reference image includes: The second reference image is obtained by adding noise to each pixel value of the first reference image using the amplitude-adjusted symmetrical perturbation noise.
4. The method according to claim 1, characterized in that, The process of generating the watermark key includes: Obtain the identification information of the target object; The identification information is hashed to obtain the watermark key.
5. The method according to claim 1, characterized in that, Before obtaining the first reference image obtained from the diffusion model query, the method further includes: Obtain the aforementioned prompt information; The prompt information is input into the diffusion model, and the diffusion model queries the first reference image based on the prompt information.
6. The method according to claim 1, characterized in that, After sending the second reference image to the diffusion model, the method further includes: The target image is obtained by generating an image based on the prompt information and the second reference image using the diffusion model; Output the target image.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Watermark detection is performed on the target image to obtain symmetrical perturbation noise; Based on the watermark key and the symmetric perturbation noise, the legality of the target image is verified to obtain the verification result.
8. The method according to claim 7, characterized in that, The watermark detection of the target image to obtain symmetrical perturbation noise includes: The target image is input into the detection model, and the symmetric perturbation noise corresponding to the target image is extracted by the detection model.
9. The method according to claim 8, characterized in that, The training process of the detection model includes: Obtain a training dataset, which includes multiple sample images and label-symmetric perturbation noise corresponding to each sample image; The initial detection model is trained based on the training dataset to obtain the detection model.
10. The method according to claim 7, characterized in that, The step of verifying the legitimacy of the target image based on the watermark key and the symmetric perturbation noise to obtain the verification result includes: Determine the candidate watermark key corresponding to the symmetrical perturbation noise, and detect whether the candidate watermark key is consistent with the watermark key; If the candidate watermark key is consistent with the watermark key, the verification result is determined to be verification failure.
11. A watermark detection method, characterized in that, The method includes: Acquire the image to be detected; Watermark detection is performed on the image to be detected to obtain symmetrical perturbation noise; Based on the watermark key of the target object and the symmetric perturbation noise, the legitimacy of the image to be detected is verified to obtain the verification result.
12. The method according to claim 11, characterized in that, The step of performing watermark detection on the image to be detected to obtain symmetrical perturbation noise includes: The image to be detected is input into the detection model, and the symmetric perturbation noise corresponding to the image to be detected is extracted by the detection model.
13. The method according to claim 12, characterized in that, The training process of the detection model includes: Obtain a training dataset, which includes multiple sample images and label-symmetric perturbation noise corresponding to each sample image; The initial detection model is trained based on the training dataset to obtain the detection model.
14. The method according to claim 11, characterized in that, The verification result is obtained by performing a legality verification on the image to be detected based on the watermark key of the target object and the symmetric perturbation noise, including: Determine the candidate watermark key corresponding to the symmetrical perturbation noise, and detect whether the candidate watermark key is consistent with the watermark key; If the candidate watermark key is consistent with the watermark key, the verification result is determined to be verification failure.
15. The method according to claim 11, characterized in that, The method further includes: The verification result is output to the target object.
16. A watermark marking device, characterized in that, The device includes: The first image acquisition module is used to acquire a first reference image obtained by the diffusion model in response to prompt information input by the user. The second image acquisition module is used to determine the watermark key corresponding to the first reference image, and write a symmetrical perturbation watermark into the first reference image according to the watermark key to obtain the second reference image. An image sending module is used to send the second reference image to the diffusion model, wherein the second reference image is used by the diffusion model to generate the target image corresponding to the prompt information.
17. A watermark detection device, characterized in that, The device includes: The image acquisition module is used to acquire the image to be detected; The watermark detection module is used to perform watermark detection on the image to be detected and obtain symmetrical perturbation noise; The legitimacy verification module is used to perform legitimacy verification on the image to be detected based on the watermark key of the target object and the symmetric perturbation noise to obtain the verification result.
18. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10 or 11 to 15.
19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10 or 11 to 15.
20. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10 or 11 to 15.
