Model training method, encoding method, decoding method and device
By performing cyclic consistency loss training on the initial encoder model, the target encoder model is obtained, which solves the problem of the impact of digital watermark embedding on image quality, and achieves a high-quality watermark embedding effect.
Patent Information
- Application Number
- CN202210550999.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2042-05-18
AI Technical Summary
When the prior art embeds digital watermarks into images, it is easy to have a significant impact on image quality, resulting in a decline in the quality of the original image.
The sample watermark information and the sample carrier image are encoded through the initial encoder model to obtain the encoded image, and the initial encoder model is trained using the cyclic consistency loss to obtain the target encoder model. When embedding target watermark information, this model can effectively reduce the impact on the original image quality of the image to be encoded.
In the process of embedding watermark information, the original image quality of the image to be encoded is maintained as much as possible, and the negative impact of watermark embedding on image quality is reduced.
Smart Images

Figure CN117156152B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a model training method, encoding method, decoding method and device. Background Art
[0002] With the booming development of mobile Internet, massive amounts of data have begun to be transmitted through this open channel. During network transmission, data can be easily converted, changed, copied, and distributed. The various forms of processing and dissemination methods make it difficult to trace the true ownership and copyright of data, and others can easily prove their ownership through secondary creation methods such as changes and deletions. Therefore, watermarking, as a technology for protecting copyright and maintaining content authentication, has been introduced into various scenarios related to copyright protection of information.
[0003] Compared with the traditional single watermark of identification type, digital watermark is invisible, carries a large amount of information, can be customized, and is beautiful. It can not only minimize the impact on users' perception, but also play the role of marking copyright ownership and tracing the source of leakage.
[0004] In order to protect the copyright of an image or video, a digital watermark is often added to the image. In the related art, the encoder trained by the encoder training method relies on embedding the digital watermark into the image, which has a great impact on the quality of the image. Summary of the invention
[0005] The embodiments of the present application provide a model training method, encoding method, decoding method and device, which can train the initial encoder model based on the cyclic consistency loss of the sample carrier image and the encoded image obtained after encoding the sample watermark information and the sample carrier image through the initial encoder model. The target encoder model obtained through training can effectively reduce the impact of the target encoder model on the original image quality of the image to be encoded after the target watermark information is embedded in the image to be encoded.
[0006] In one aspect, a model training method is provided, the method comprising: obtaining a sample carrier image and sample watermark information;
[0007] Encoding the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information;
[0008] Decoding the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model;
[0009] Determine, according to the coded image and the sample carrier image, first loss information corresponding to the coded image and the sample carrier image, wherein the first loss information is cycle consistency loss information;
[0010] Determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information;
[0011] The initial encoder model is trained based on the first loss information and the second loss information to obtain a target encoder model, and the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information.
[0012] On the other hand, there is provided an encoding method, comprising:
[0013] Obtain the image to be encoded and the target watermark information;
[0014] Encoding the to-be-encoded image and the target watermark information through the target encoder model to obtain a target encoded image in which the target watermark information is embedded;
[0015] The target encoder model is obtained by training the initial encoder model according to the model training method described in the first aspect.
[0016] On the other hand, a decoding method is provided, comprising:
[0017] Obtaining a target coded image in which target watermark information has been embedded;
[0018] Decoding the target coded image by a target decoder model to extract the target watermark information from the target coded image;
[0019] Among them, the target decoder model obtains a sample carrier image and sample watermark information for a model training device; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; and obtains the result by training the initial decoder model based on the first loss information and the second loss information.
[0020] On the other hand, a model training device is provided, comprising:
[0021] A first acquisition unit, used to acquire a sample carrier image and sample watermark information;
[0022] A first encoding unit, configured to encode the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information;
[0023] a first decoding unit, configured to decode the encoded image by using an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model;
[0024] A first determining unit, configured to determine first loss information corresponding to the coded image and the sample carrier image according to the coded image and the sample carrier image, wherein the first loss information is cycle consistency loss information;
[0025] A second determining unit, configured to determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information;
[0026] A training unit is used to train the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model, wherein the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information.
[0027] In another aspect, there is provided an encoding device, comprising:
[0028] A second acquisition unit, used to acquire the image to be encoded and target watermark information;
[0029] A second encoding unit, configured to encode the image to be encoded and the target watermark information through the target encoder model to obtain a target encoded image in which the target watermark information is embedded;
[0030] The target encoder model is obtained by training the initial encoder model according to the model training method described in the first aspect.
[0031] In another aspect, a decoding device is provided, comprising:
[0032] A third acquisition unit is used to acquire a target coded image in which target watermark information has been embedded;
[0033] a second decoding unit, configured to decode the target coded image through a target decoder model to extract the target watermark information from the target coded image;
[0034] Among them, the target decoder model obtains a sample carrier image and sample watermark information for a model training device; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; and obtains the result by training the initial decoder model based on the first loss information and the second loss information.
[0035] On the other hand, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is suitable for being loaded by a processor to execute the steps in the method described in any of the above embodiments.
[0036] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores a computer program, and the processor executes the steps in the method described in any of the above embodiments by calling the computer program stored in the memory.
[0037] On the other hand, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the steps in the method described in any of the above embodiments are implemented.
[0038] The embodiment of the present application obtains a sample carrier image and sample watermark information; then encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; then decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; according to the encoded image and the sample carrier image, first loss information corresponding to the encoded image and the sample carrier image is determined, and the first loss information is cycle consistency loss information; then the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information are used to determine the second loss information; then the initial encoder model is trained based on the first loss information and the second loss information to obtain a target encoder model, and the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information. In the embodiment of the present application, the initial encoder model can be trained based on the cycle consistency loss of the sample carrier image and the encoded image obtained after encoding the sample watermark information and the sample carrier image through the initial encoder model. The target encoder model obtained through training can effectively reduce the impact of the target encoder model on the original image quality of the image to be encoded after the target watermark information is embedded in the image to be encoded. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 A schematic diagram of the structure of the model training system provided in an embodiment of the present application.
[0041] Figure 2a A first flow chart of the model training method provided in an embodiment of the present application.
[0042] Figure 2b A second flow chart of the model training method provided in an embodiment of the present application.
[0043] Figure 3 A flowchart of the encoding method provided in an embodiment of the present application.
[0044] Figure 4 A flowchart of a decoding method provided in an embodiment of the present application.
[0045] Figure 5 A schematic diagram of the structure of the model training device provided in an embodiment of the present application.
[0046] Figure 6 A schematic diagram of the structure of the encoding device provided in an embodiment of the present application.
[0047] Figure 7 A schematic diagram of the structure of a decoding device provided in an embodiment of the present application.
[0048] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0050] The embodiments of the present application provide a model training method, encoding method, decoding method and device. Specifically, the model training method of the embodiments of the present application can be performed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a smart phone, a tablet computer, a laptop computer, an intelligent voice interaction device, a smart home appliance, a wearable smart device, an aircraft, an intelligent vehicle terminal and other devices. The terminal can also include a client, which can be a video client, a browser client or an instant messaging client. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0051] The embodiments of the present application can be applied to various scenarios such as network media, images, data security, cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0052] First, some nouns or terms that appear in the description of the embodiments of the present application are explained as follows:
[0053] Artificial Intelligence (AI): It is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0054] Machine Learning (ML): It is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0055] Deep Learning (DL): It is a branch of machine learning and an algorithm that attempts to use multiple processing layers containing complex structures or composed of multiple nonlinear transformations to perform high-level abstraction of data. Deep learning is to learn the inherent laws and representation levels of training sample data. The information obtained in the learning process is of great help in interpreting data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have analytical learning capabilities like humans and to be able to recognize data such as text, images, and sounds. Deep learning is a complex machine learning algorithm that has achieved results in speech and image recognition that far exceed previous related technologies.
[0056] Hyperparameters: In the context of machine learning, hyperparameters are parameters whose values are set before starting the learning process, rather than parameter data obtained through training. Typically, hyperparameters need to be optimized to select a set of optimal hyperparameters for the learning machine to improve learning performance and results.
[0057] Neural Network (NN): A deep learning model in the field of machine learning and cognitive science that imitates the structure and function of biological neural networks.
[0058] Image steganography: It is a technique and science about information hiding. Information hiding means not letting anyone other than the intended recipient know about the transmission event or content of the information. Image steganography refers to the technology of hiding information in an image and recovering the original information from the image through additional means.
[0059] Watermark information: information that needs to be embedded in the image, commonly in the form of a picture of a station logo or platform logo, a string of company or department name, or an identity string of the video or image itself. CNN: Convolutional Neural Networks, a type of feedforward neural network with a deep structure that includes convolutional calculations. Convolutional neural networks have representation learning capabilities and can perform translation-invariant classification of input information according to their hierarchical structure.
[0060] GAN: Generative Adversarial Nets, a type of deep learning model, mainly used for unsupervised learning on complex distributions. The model framework usually contains at least two modules: a generation module and a discrimination module. The two modules learn from each other through game learning and eventually produce better output.
[0061] Encoder: Encoder is used to embed watermark information into the carrier image and minimize the impact on the image quality of the carrier image.
[0062] Decoder: Decoder, used to extract watermark information from the embedded image.
[0063] Robustness: It is used to evaluate the degree of watermark information retention after the image embedded with watermark is subjected to various attacks. High robustness means that the watermark information can still be well preserved after the image is subjected to attacks (noise, encoding, image compression, etc.).
[0064] Detection rate: the ratio of the number of images from which watermark information is successfully extracted to the total number of test images.
[0065] Mode collapse: During the training process of GAN, due to unscientific parameter initialization or defects in the loss function design, the generated images have a single style and lack diversity.
[0066] PSNR: Peak signal-to-noise ratio, Peak signal-to-noise ratio is an engineering term that represents the ratio of the maximum possible power of a signal to the destructive noise power that affects its representation accuracy. Since many signals have a very wide dynamic range, the peak signal-to-noise ratio is often expressed in logarithmic decibel units. Peak signal-to-noise ratio is often used as a measure of signal reconstruction quality in fields such as image compression, and it is often simply defined by MSE (Mean Square Error).
[0067] Smart transportation fully utilizes new generation information technologies such as the Internet of Things, spatial perception, cloud computing, and mobile Internet in the entire transportation field, and comprehensively applies theories and tools such as transportation science, system methods, artificial intelligence, and knowledge mining. It aims to achieve comprehensive perception, deep integration, proactive service, and scientific decision-making. By building a real-time dynamic information service system, it deeply mines transportation-related data, forms a problem analysis model, and achieves improvements in the industry's resource allocation optimization capabilities, public decision-making capabilities, industry management capabilities, and public service capabilities. It promotes safer, more efficient, more convenient, more economical, more environmentally friendly, and more comfortable operation and development of transportation, and drives the transformation and upgrading of transportation-related industries.
[0068] Intelligent Traffic System (ITS), also known as Intelligent Transportation System, effectively and comprehensively applies advanced science and technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) to transportation, service control and vehicle manufacturing, strengthens the connection between vehicles, roads and users, and thus forms a comprehensive transportation system that ensures safety, improves efficiency, improves the environment and saves energy.
[0069] Cloud technology: refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of technical network systems require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately. All kinds of industry data require strong system backing support, which can only be achieved through cloud computing.
[0070] This solution has developed a digital watermark embedding-detection algorithm based on the generative adversarial network, which has high concealment, strong anti-attack and good stability. It can be applied to various copyright protection scenarios such as images and videos, and provides technical support for copyright protection of many businesses.
[0071] Figure 1 A structural diagram of a model training system provided in an embodiment of the present application, wherein the model training system includes a terminal 10 and a server 20, etc.; the terminal 10 and the server 20 are connected via a network, for example, via a wired or wireless network connection, etc.
[0072] Among them, the terminal 10 can be used to display a graphical user interface. Among them, the terminal 10 is used to interact with the user through a graphical user interface, for example, by downloading and installing the corresponding client through the terminal 10 and running it, for example, by calling the corresponding applet and running it, for example, by logging into the website to present the corresponding graphical user interface, etc. In an embodiment of the present application, the terminal 10 can be used by relevant objects, such as relevant personnel, to upload images to be encoded and target watermark information to be embedded in the images to be encoded. Among them, in the model training stage, the terminal 10 can also allow relevant objects to upload sample carrier images and sample watermark information to be embedded in the sample carrier image. The terminal 10 can send the sample carrier image and the sample watermark information to the server 20, so that the server 20 trains the initial encoder model and feeds back the target encoder model obtained by training to the terminal 10.
[0073] Optionally, the server 20 may also store the target encoder model locally, and after obtaining the original image to be encoded and the target watermark information to be embedded in the original image, encode the image to be encoded and the target watermark information to obtain an encoding result including the target encoded image. After determining the encoding result, the server 20 may store, distribute, and process the encoding result.
[0074] Optionally, the terminal 10 itself may also directly train the initial encoder model according to the sample carrier image uploaded by the relevant object and the sample watermark information to be embedded in the sample carrier image to obtain the target encoder model, and after obtaining the image to be encoded and the target watermark information to be embedded in the image to be encoded, encode the image to be encoded and the target watermark information to obtain a coding result containing the target encoded image.
[0075] Optionally, the terminal 10 may also send its trained target encoder model to the server 20, so that after the server 20 obtains the image to be encoded and the target watermark information to be embedded in the image to be encoded, it encodes the image to be encoded and the target watermark information to obtain an encoding result including the target encoded image.
[0076] The following takes the server 20 for training the initial encoder model as an example to illustrate the present solution. Specifically, when performing model training, the server 20 can be specifically used to: obtain a sample carrier image and sample watermark information; encode the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decode the encoded image through the initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determine first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; train the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model.
[0077] The specific implementation methods are described in detail below. It should be noted that the description order of the following embodiments is not intended to limit the priority order of the embodiments.
[0078] Each embodiment of the present application provides a model training method, which can be executed by a terminal or a server, or jointly by a terminal and a server; the embodiments of the present application are described by taking the execution of the model training method by a server as an example. Figure 2a A flow chart of a model training method provided in an embodiment of the present application, the method comprising:
[0079] S201, obtaining a sample carrier image and sample watermark information.
[0080] The aforementioned sample carrier image is any image to be embedded with sample watermark information, and the sample watermark information may be text information, image information, etc. The aforementioned sample carrier image may be any image in a sample carrier image set, wherein the sample carrier image set is a set of sample carrier images used to train a target encoder model.
[0081] S202: Encode the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information.
[0082] The initial encoder model may include a first network unit and a second network unit. In S202, encoding the sample carrier image and the sample watermark information by the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information includes:
[0083] Extracting features of the sample carrier image through the first network unit to obtain a feature image corresponding to the sample carrier image;
[0084] The characteristic image and the sample watermark information are encoded through the second network unit to obtain an encoded image corresponding to the sample carrier image and the sample watermark information.
[0085] Optionally, the first network unit performs feature extraction on the sample carrier image to obtain image features of the sample carrier image, and generates a corresponding feature image based on the image features. Among them, image features mainly include color features, texture features, shape features and spatial relationship features of the image. Color feature is a global feature that describes the surface properties of the scene corresponding to the image or image area; texture feature is also a global feature that also describes the surface properties of the scene corresponding to the image or image area; shape features have two types of representation methods, one is contour feature, and the other is regional feature. The contour feature of the image is mainly for the outer boundary of the object, while the regional feature of the image is related to the entire shape area; spatial relationship features can be the spatial position or relative direction relationship between multiple targets segmented from the image. These relationships can also be divided into connection / adjacency relationships, overlap / overlapping relationships, and inclusion / inclusion relationships.
[0086] Optionally, the number of the aforementioned feature images may be one or more.
[0087] Optionally, in the aforementioned S202, encoding the sample carrier image and the sample watermark information by using an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information can be achieved by the following formula:
[0088] Y = F2(F1(X)+m1);
[0089] Among them, X is the sample carrier image; m1 is the sample watermark information; F1() is the function corresponding to the first network unit that determines the corresponding feature image based on the sample carrier image; F2() is the function corresponding to the second network unit that determines the encoded image based on the feature image and the sample watermark information; Y is the encoded image.
[0090] Optionally, F1() may also be the first network unit itself, F2() may also be the second network unit itself, and the first network unit and the second network unit may be two independent CNN networks.
[0091] After extracting the image features of the sample carrier image through the aforementioned F1(), the areas and features in the sample carrier image that are easily destroyed and easily observed after superimposing the sample watermark information can be removed to screen out stable areas and features that have little impact on image quality, among which the areas that have little impact on image quality may include areas with richer textures or smoother areas.
[0092] Through the aforementioned F2(), the characteristic image and the sample watermark information can be superimposed, and the superimposed result can be encoded to generate a coded image.
[0093] S203. Decode the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model.
[0094] The initial decoder model corresponds to the initial encoder model. For example, the functions corresponding to the functional modules in the initial decoder model are inverse to the functions corresponding to the functional modules in the initial encoder model to implement the decoding process. For example, the initial encoder model is used to embed the sample watermark information into the sample carrier image to obtain the encoded image; the initial decoder model is used to extract the decoded watermark information from the encoded image, wherein, ideally, the decoded watermark information is the same as the sample watermark information.
[0095] Optionally, in the aforementioned S203, decoding the encoded image by using the initial decoder model to obtain the decoded watermark information corresponding to the encoded image can be implemented by the following formula:
[0096]
[0097] Wherein, Y is a coded image, and may also be a noisy coded image obtained after further embedding preset noise information; D() is a decoding function corresponding to the initial decoder model, and may specifically be a CNN network with decoding function; To decode the watermark information, the decoded watermark information is the watermark information obtained after the encoded image Y with the watermark is decoded.
[0098] S204. Determine first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, where the first loss information is cycle consistency loss information.
[0099] Specifically, in S204, first loss information corresponding to the coded image and the sample carrier image is determined according to the coded image and the sample carrier image, including S2041-S2043 (not shown in the figure):
[0100] S2041. Process the encoded image through a third network unit to obtain a first image;
[0101] S2042, processing the sample carrier image by the third network unit to obtain a second image;
[0102] S2043. Determine first loss information corresponding to the encoded image and the sample carrier image using the first image, the second image, and the sample carrier image.
[0103] Optionally, in S2041, processing the encoded image by a third network unit to obtain a first image includes:
[0104] The encoded image is used as the input of the function corresponding to the third network unit, and the function corresponding to the third network unit is executed to obtain the first image.
[0105] Optionally, the third network unit may be a CNN network.
[0106] Specifically, the coded image is processed by the third network unit to obtain the first image, which can be achieved by the following formula:
[0107]
[0108] Wherein, Y is the coded image; FF is the function corresponding to the third network unit, which may be a function for removing watermark information in the coded image; is the first image.
[0109] Optionally, in S2042, processing the sample carrier image by a third network unit to obtain a second image includes:
[0110] The sample carrier image is used as the input of the function corresponding to the third network unit, and the function corresponding to the third network unit is executed to obtain the second image.
[0111] Specifically, the sample carrier image is processed by the third network unit to obtain the second image, which can be achieved by the following formula:
[0112]
[0113] Wherein, X is the sample carrier image; FF is the function corresponding to the third network unit, which may be a function for removing watermark information in the sample carrier image; For the second image.
[0114] For the aforementioned third network unit, the third network unit is an auxiliary network, which can be used to remove the watermark information in the coded image, and can also be used to keep the sample carrier image as it is. For example, when the input is a coded image, the output is the first image after removing the watermark information in the coded image; when the input is a sample carrier image, the output is the second image. Through this method, when the input of the third network unit is a coded image, the output first image can be as much as possible the image after removing the watermark information in the coded image, and the output image (first image) needs to be infinitely close to the input image (coded image) under the constraint of the loss function. This process forms a closed loop, that is, the cycle consistency of the network, that is, the output first image is as close as possible to the sample carrier image, reducing the impact on the image quality of the sample carrier image. When the input is a sample carrier image, the output second image is kept as original as possible, and no redundant operations are applied to the sample carrier image, so that the output image (second image) is the original image (sample carrier image) without watermark information, rather than other garbled images. After adding the third network unit module, the network can better constrain the encoder by decoding the image, preventing the encoder from ignoring the maintenance of image quality during the watermark embedding process and avoiding the generation of noisy and mosaic images.
[0115] Optionally, the first loss information includes: first sub-loss information and second sub-loss information; in S2043, the first loss information corresponding to the coded image and the sample carrier image is determined using the first image, the second image, and the sample carrier image, including S31-S33 (not shown in the figure):
[0116] S31, determining first sub-loss information corresponding to the encoded image using the first image and the sample carrier image;
[0117] S32, using the second image and the sample carrier image to determine second sub-loss information corresponding to the sample carrier image;
[0118] S33: Take the sum of the first sub-loss information and the second sub-loss information as the first loss information.
[0119] In some optional embodiments of the present application, determining the first sub-loss information corresponding to the encoded image by using the first image and the sample carrier image may include:
[0120] Calculating the second norm of the first image and the sample carrier image to obtain a first value;
[0121] The first value is used as the first sub-loss information.
[0122] For example, determining the first sub-loss information corresponding to the encoded image using the first image and the sample carrier image may be implemented by the following formula:
[0123]
[0124] Among them, X is the sample carrier image; is the first image; LC1 is the first sub-loss information.
[0125] In some optional embodiments of the present application, determining the second sub-loss information corresponding to the sample carrier image by using the second image and the sample carrier image may include:
[0126] Calculating the second norm of the second image and the sample carrier image to obtain a second value;
[0127] The second value is used as second sub-loss information.
[0128] For example, using the second image and the sample carrier image to determine the second sub-loss information corresponding to the sample carrier image can be achieved by the following formula:
[0129]
[0130] Where X is the sample carrier image; is the second image; LC1 is the second sub-loss information.
[0131] S205. Determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information.
[0132] Optionally, in the aforementioned S205, determining the second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information includes S2051-S2054 (not shown in the figure):
[0133] S2051. Determine image reconstruction loss information corresponding to the sample carrier image and the encoded image using the sample carrier image and the encoded image.
[0134] In some optional embodiments of the present application, in the aforementioned S2051, determining the image reconstruction loss information corresponding to the sample carrier image and the encoded image by using the sample carrier image and the encoded image may include:
[0135] Calculating the difference between the sample carrier image and the encoded image to obtain a first difference value;
[0136] Calculate the second norm of the first difference to obtain a third value;
[0137] Calculating a peak signal-to-noise ratio value for the sample carrier image and the encoded image;
[0138] Summing the third value and the peak signal-to-noise ratio value to obtain a summation result;
[0139] The summation result is used as the image reconstruction loss information.
[0140] For example, using the sample carrier image and the coded image to determine the image reconstruction loss information corresponding to the sample carrier image and the coded image may be implemented by the following formula:
[0141] LI = ||XY||2 + PSNR(X,Y);
[0142] Among them, X is the sample carrier image; Y is the encoded image; PSNR() is the peak signal-to-noise ratio function; LI is the image reconstruction loss information.
[0143] S2052: Determine adversarial loss information corresponding to the sample carrier image and the encoded image using the sample carrier image, the encoded image, and a preset discriminator.
[0144] Optionally, in S2052, using the sample carrier image, the encoded image, and a preset discriminator to determine adversarial loss information corresponding to the sample carrier image and the encoded image may include:
[0145] Inputting the sample carrier image and the coded image into the discriminator, and executing the discriminator to obtain a discrimination result;
[0146] The adversarial loss information corresponding to the sample carrier image and the encoded image is determined according to the discrimination result.
[0147] Optionally, determining the adversarial loss information corresponding to the sample carrier image and the encoded image according to the discrimination result may be implemented by the following formula:
[0148] LG=E[logD X ]+E[log(1-D Y )];
[0149] Among them, D X is the corresponding output result when the input of the discriminator is the sample carrier image; D Y is the output result corresponding to the encoded image when the input of the discriminator is the expected function; LG is the adversarial loss information.
[0150] S2053: Determine watermark reconstruction loss information corresponding to the sample watermark information and the decoded watermark information by using the sample watermark information and the decoded watermark information.
[0151] Optionally, in the aforementioned S2053, using the sample watermark information and the decoded watermark information to determine watermark reconstruction loss information corresponding to the sample watermark information and the decoded watermark information includes:
[0152] Calculate the second norm of the second difference between the sample watermark information and the decoded watermark information to obtain a fourth value;
[0153] The fourth value is used as watermark reconstruction loss information corresponding to the sample watermark information and the decoded watermark information.
[0154] For example, by using the sample watermark information and the decoded watermark information, determining the watermark reconstruction loss information corresponding to the sample watermark information and the decoded watermark information can be achieved by the following formula:
[0155]
[0156] Among them, m1 is the sample watermark information; is the decoding watermark information; LM is the watermark reconstruction loss information.
[0157] S2054. Determine second loss information based on the image reconstruction loss information, the adversarial loss information, and the watermark reconstruction loss information.
[0158] Optionally, in S2054, determining the second loss information based on the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information includes:
[0159] Obtaining a first preset weight corresponding to the image reconstruction loss information;
[0160] Obtaining a second preset weight corresponding to the adversarial loss information;
[0161] Obtaining a third preset weight corresponding to the watermark reconstruction loss information;
[0162] The second loss information is determined according to the first preset weight, the second preset weight, the third preset weight, the image reconstruction loss information, the adversarial loss information, and the watermark reconstruction loss information.
[0163] Specifically, determining the second loss information according to the first preset weight, the second preset weight, the third preset weight, the image reconstruction loss information, the adversarial loss information, and the watermark reconstruction loss information includes:
[0164] Calculating the product of the first preset weight and the image reconstruction loss information to obtain a first product result;
[0165] Calculate the product of the second preset weight and the adversarial loss information to obtain a second product result;
[0166] Calculating the product of the third preset weight and the watermark reconstruction loss information to obtain a third product result;
[0167] The sum of the first multiplication result, the second multiplication result, and the third multiplication result is used as the third loss information.
[0168] For example, determining the second loss information according to the first preset weight, the second preset weight, the third preset weight, the image reconstruction loss information, the adversarial loss information, and the watermark reconstruction loss information may be implemented by the following formula:
[0169] LOSS=w1*LI+w2*LG+w3*LM;
[0170] Among them, w1 is the first preset weight; w2 is the second preset weight; w3 is the third preset weight, LI is the image reconstruction loss information, LG is the adversarial loss information, and LM is the watermark reconstruction loss information.
[0171] S206. Train the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model, wherein the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information.
[0172] Optionally, in the aforementioned S206, training the initial encoder model based on the first loss information and the second loss information includes:
[0173] Obtaining a fourth preset weight corresponding to the first sub-loss information;
[0174] Obtaining a fifth preset weight corresponding to the second sub-loss information;
[0175] determining a total loss result according to the fourth preset weight, the fifth preset weight, the first sub-loss information, the second sub-loss information, and the second loss information;
[0176] If the total loss result is less than a preset threshold, the training of the initial encoder model is completed;
[0177] If the total loss result is not less than a preset threshold, the hyperparameters related to the parameters in the initial encoder model are adjusted, and the execution step is returned to encode the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information, until the loss result is less than the preset threshold, the training of the initial encoder model is completed.
[0178] The purpose of adjusting the hyperparameters related to the parameters in the initial encoder model is to adjust the parameters in the initial encoder model.
[0179] Optionally, the hyperparameter related to the parameters in the initial encoder model may also be a learning rate corresponding to the initial encoder model training process.
[0180] Among them, the learning rate is an important hyperparameter in supervised learning and deep learning. It determines whether the objective function can converge to the local minimum and when it converges to the minimum. A suitable learning rate can make the objective function converge to the local minimum in a suitable time. The learning rate is a hyperparameter that updates the network weights before the gradient of the loss function. The lower the learning rate, the slower the weight update speed and the slower the loss function changes.
[0181] In some optional embodiments of the present application, determining a total loss result according to the fourth preset weight, the fifth preset weight, the first sub-loss information, the second sub-loss information, and the second loss information includes:
[0182] Calculating the product of the fourth preset weight and the first sub-loss information to obtain a fourth product result;
[0183] Calculating the product of the fifth preset weight and the second sub-loss information to obtain a fifth product result;
[0184] The first multiplication result, the fifth multiplication result, and the second loss information are summed to obtain the total loss result.
[0185] Among them, the total loss result may include multiple loss results.
[0186] Optionally, the first multiplication result, the second multiplication result, the third multiplication result, the fourth multiplication result, and the fourth multiplication result are respectively the first loss result, the second loss result, the third loss result, the fourth loss result, and the fifth loss result in the total loss result. That is, the total loss result includes the first loss result, the second loss result, the third loss result, the fourth loss result, and the fifth loss result.
[0187] In some optional embodiments of the present application, adjusting hyperparameters related to parameters in the initial encoder model includes:
[0188] Obtaining loss results corresponding to the first sub-loss information, the second sub-loss information, the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information, respectively, to obtain a plurality of loss results;
[0189] Determining a target loss result with the largest value among the multiple loss results;
[0190] Adjusting the target weight corresponding to the target loss result;
[0191] Among them, the target weight corresponding to the target loss result is a hyperparameter related to the parameters in the initial encoder model.
[0192] Specifically, adjusting the target weight corresponding to the target loss result includes controlling the target weight corresponding to the target loss result to increase.
[0193] Optionally, the target weight corresponding to the aforementioned target loss result is the weight corresponding to the loss information used to determine the target loss result.
[0194] For example, when the target loss result is the fifth multiplication result, the target weight is the fifth preset weight corresponding to the second sub-loss information.
[0195] Optionally, the method further includes: training the initial decoder model based on the first loss information and the second loss information to obtain a target decoder model, wherein the target decoder model is used to decode the target encoded image to extract the target watermark information from the target encoded image.
[0196] In some optional embodiments of the present application, optionally, training the initial decoder model based on the first loss information and the second loss information includes:
[0197] Obtaining a fourth preset weight corresponding to the first sub-loss information;
[0198] Obtaining a fifth preset weight corresponding to the second sub-loss information;
[0199] determining a total loss result according to the fourth preset weight, the fifth preset weight, the first sub-loss information, the second sub-loss information, and the second loss information;
[0200] If the total loss result is less than a preset threshold, the training of the initial decoder model is completed;
[0201] If the total loss result is not less than a preset threshold, the hyperparameters related to the parameters in the initial decoder model are adjusted, and the execution step is returned to encode the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information, until the loss result is less than the preset threshold, the training of the initial decoder model is completed.
[0202] The purpose of adjusting the hyperparameters related to the parameters in the initial decoder model is to adjust the parameters in the initial decoder model.
[0203] Optionally, the hyperparameter related to the parameters in the initial decoder model may also be a learning rate corresponding to the initial decoder model training process.
[0204] In some optional embodiments of the present application, determining a total loss result according to the fourth preset weight, the fifth preset weight, the first sub-loss information, the second sub-loss information, and the second loss information includes:
[0205] Calculating the product of the fourth preset weight and the first sub-loss information to obtain a fourth product result;
[0206] Calculating the product of the fifth preset weight and the second sub-loss information to obtain a fifth product result;
[0207] The first multiplication result, the fifth multiplication result, and the second loss information are summed to obtain the total loss result.
[0208] Among them, the total loss result may include multiple loss results.
[0209] Optionally, the first multiplication result, the second multiplication result, the third multiplication result, the fourth multiplication result, and the fourth multiplication result are respectively the first loss result, the second loss result, the third loss result, the fourth loss result, and the fifth loss result in the total loss result.
[0210] The total loss result includes multiple loss results: a first loss result, a second loss result, a third loss result, a fourth loss result and a fifth loss result.
[0211] In some optional embodiments of the present application, adjusting the hyperparameters related to the parameters in the initial decoder model includes:
[0212] Obtaining loss results corresponding to the first sub-loss information, the second sub-loss information, the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information, respectively, to obtain a plurality of loss results;
[0213] Determining a target loss result with the largest value among the multiple loss results;
[0214] Adjusting the target weight corresponding to the target loss result;
[0215] Among them, the target weight corresponding to the target loss result is a hyperparameter related to the parameters in the initial decoder model.
[0216] Specifically, adjusting the target weight corresponding to the target loss result includes controlling the target weight corresponding to the target loss result to increase.
[0217] Optionally, the target weight corresponding to the aforementioned target loss result is the weight corresponding to the loss information used to determine the target loss result.
[0218] For example, when the target loss result is the fifth multiplication result, the target weight is the fifth preset weight corresponding to the second sub-loss information.
[0219] It should be noted that in the present application, the parameters of the initial encoder model and the parameters of the initial decoder model are adjusted accordingly. Therefore, the adjustment of the parameters of the initial encoder model and the adjustment of the parameters of the initial decoder model can be performed in any order or simultaneously.
[0220] Optionally, when determining the aforementioned LI, PSNR is used to represent the ratio of the maximum possible power of the signal to the destructive noise power that affects its representation accuracy. Since many signals have a very wide dynamic range, the peak signal-to-noise ratio is often expressed in logarithmic decibel units.
[0221] PSNR can be defined by the mean square error (MSE). For two m×n monochrome images X and Y (sample carrier image and encoded image), if one is a noise approximation of the other, then their mean square error can be defined as:
[0222]
[0223] Wherein, X is the sample carrier image; Y is the encoded image, and the image sizes of X and Y are the same; m2 is the length of the image; n is the width of the image; (i, j) is the pixel coordinate in the image, such as i is the horizontal coordinate and j is the vertical coordinate.
[0224] For example, the specific calculation of PSNR is as follows:
[0225]
[0226] Where MAX is the maximum value representing the color of an image point, which is 255 if each sample point is represented by 8 bits. For color images with three RGB values per point, the determination of the peak signal-to-noise ratio is similar, except that the mean square error is the sum of all variances divided by the image size and then divided by 3.
[0227] According to the mathematical properties of mean square error, during the training process of the encoder, mean square error tends to compare the error of each pixel and minimize the distortion of each pixel. Although this calculation method that focuses too much on the local area can better preserve the image in specific details, it is easy to have large areas of color blocks when targeting the whole picture. Therefore, this application introduces an additional PSNR loss function to ensure the degree of image quality preservation at the macro level.
[0228] In an embodiment of the present application, from the perspective of the data flow path of the input image, that is, the sample carrier image, the input image is encoded to generate a watermarked image, and the watermarked image is generated by the third generation decoded image. The decoded image needs to be infinitely close to the input image under the constraint of the loss function. This process forms a closed loop, which is the cycle consistency of the network. In addition, the third network unit not only accepts the encoded image as input, but also accepts the sample carrier image as input, constraining the decoded image to be as close to the sample carrier image as possible. The purpose is to normalize the role of the third network unit so that its output image is a sample carrier image without watermark information, rather than other garbled images. After adding the third network unit module, the network can better constrain the encoder through the decoded image to prevent the encoder from ignoring the maintenance of image quality during the process of embedding watermarks, and avoid generating noisy and mosaic pictures.
[0229] In addition, in the cycle consistency loss, this scheme uses square loss to constrain the network so that the encoded image after the encoder model is as close to the sample carrier image as possible.
[0230] In this application, a specific analysis of these loss functions shows that the watermark reconstruction loss information is used to compare the difference between the watermark information extracted by the decoder model and the original watermark information, thereby helping the decoder model to obtain a better watermark extraction effect. The image reconstruction loss information is used to compare the difference between the encoded image generated by the encoder model and the sample carrier image. Its purpose is to make the carrier image generated by the encoder model as similar as possible to the sample carrier image, reducing the image quality impact caused by watermark embedding. The adversarial loss information is a conventional loss function of the adversarial generation network. Its function is to guide the network training direction, let the network converge, and help the encoder model generate regular images instead of garbled code.
[0231] Through the solution of this application, there is no need to manually design the details of the embedding and detection algorithms. You only need to design the loss function and specify the training data to obtain the desired watermark embedding module and watermark extraction module through training. This end-to-end approach greatly improves R&D efficiency and saves R&D costs. In addition, there is no need to manually adjust the parameters of the watermark algorithm. You can use deep learning to adjust the parameters and quickly obtain a set of optimal parameters.
[0232] Moreover, introducing PSNR as an evaluation criterion in the loss function can effectively reduce the image quality loss. In addition, the third network unit proposed in this scheme guides the data reflux to form a loop by comparing the output image of the encoder model with the original image, preventing the encoder model from focusing only on hidden information during training and ignoring the impact on image quality.
[0233] Optionally, a noise layer can be added between the encoder model and the decoder model, or can be added to other locations, such as before the sample carrier image is fed into the encoder model, different noises can be applied to the sample carrier image to expand the diversity of the data. Or before the encoded image or the sample carrier image is fed into the discriminator, a noise layer can also be added to interfere with the discriminator's judgment of the real image or the generated image, so as to improve the quality of the final generated image.
[0234] Optionally, the first network unit, the second network unit, or the third network unit in the present application is not limited to a specific CNN structure, such as ResNet, MobileNet, etc. Any network can be applied to the watermark embedding detection result proposed in this solution, and a network of the order of magnitude corresponding to the amount of data can be selected based on the amount of training data.
[0235] It should be noted that the initial decoder model in the embodiment of the present application corresponds to the initial encoder model. When the target encoder model is obtained through training, the target decoder model is also obtained accordingly.
[0236] The following combination Figure 2b To further explain this plan, Figure 2b A second flow chart of the model training method provided in the embodiment of the present application is shown in FIG. Figure 2b As shown, the model training device can obtain a sample carrier image and sample watermark information; extract features of the sample carrier image through the first network unit in the encoder model to obtain a feature image corresponding to the sample carrier image; encode the feature image and the sample watermark information through the second network unit in the encoder model to obtain an encoded image; decode the encoded image through the decoder model to obtain decoded watermark information corresponding to the encoded image;
[0237] According to the encoded image and the sample carrier image, first loss information LC corresponding to the encoded image and the sample carrier image is determined, wherein the first loss information is cycle consistency loss information; image reconstruction loss information LI corresponding to the sample carrier image and the encoded image is determined using the sample carrier image and the encoded image; adversarial loss information LG corresponding to the sample carrier image and the encoded image is determined using the sample carrier image, the encoded image, and a preset discriminator; watermark reconstruction loss information LM corresponding to the sample watermark information and the decoded watermark information is determined using the sample watermark information and the decoded watermark information; an encoder model is trained based on the image reconstruction loss information LI, the adversarial loss information LG, the watermark reconstruction loss information LM, and the first loss information LC to obtain a target encoder model.
[0238] All of the above technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described in detail here.
[0239] The embodiment of the present application obtains a sample carrier image and sample watermark information; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, wherein the first loss information is cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; trains the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model, and the initial encoder model can be trained based on the encoded image obtained after the sample watermark information and the sample carrier image are encoded by the initial encoder model, and the cycle consistency loss of the sample carrier image, and the target encoder model obtained by training can effectively reduce the impact of the target encoder model on the original image quality of the image to be encoded after the target watermark information is embedded in the image to be encoded.
[0240] Each embodiment of the present application provides a coding method, which can be executed by a terminal or a server, or by a terminal and a server together; the embodiments of the present application are described by taking the coding method executed by a terminal as an example. Figure 3 A schematic diagram of a flow chart of an encoding method provided in an embodiment of the present application, the encoding method includes S301-S302:
[0241] S301, obtaining the image to be encoded and target watermark information;
[0242] S302, encoding the image to be encoded and the target watermark information through the target encoder model to obtain a target encoded image in which the target watermark information is embedded;
[0243] The target encoder model is obtained by training the initial encoder model according to any of the aforementioned model training methods.
[0244] Optionally, the above method further includes: sending the target coded image to a target device.
[0245] The target device may be a terminal or other device.
[0246] By embedding the target watermark information into the image to be encoded through the encoding method, the influence of the target encoder model on the original image quality of the encoded image after the target watermark information is embedded into the image to be encoded can be effectively reduced.
[0247] The specific implementation methods corresponding to this embodiment can be found in the above content and will not be repeated here.
[0248] Each embodiment of the present application provides a decoding method, which can be executed by a terminal or a server, or by a terminal and a server together; the embodiments of the present application are described by taking the decoding method executed by a terminal as an example. Figure 4 A schematic diagram of a decoding method provided in an embodiment of the present application, the decoding method includes S401-S402:
[0249] S401, obtaining a target coded image in which target watermark information has been embedded;
[0250] S402, decoding the target coded image by a target decoder model to extract the target watermark information from the target coded image;
[0251] Among them, the target decoder model obtains a sample carrier image and sample watermark information for a model training device; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; and obtains the result by training the initial decoder model based on the first loss information and the second loss information.
[0252] The target coded image is obtained by encoding the coded image and the target watermark information through the target encoder model. The training of the target encoder model and the training of the target decoder model are both realized by relying on the cycle consistency loss determined according to the sample carrier image and the encoder image, wherein the coded image is obtained by encoding the sample carrier image and the sample watermark information through the initial encoder model; the target decoder model obtained by training the aforementioned cycle consistency loss information decodes the target coded image, thereby ensuring the authenticity of the target watermark information restored after decoding the target coded image through the target decoder model.
[0253] The specific implementation methods corresponding to this embodiment can be found in the above content and will not be repeated here.
[0254] It should be noted that the relevant data mentioned in this application, such as target watermark information, sample carrier images uploaded by related objects, sample watermark information and other data, when the embodiments of this application are applied to specific products or technologies, need to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0255] Figure 5 A schematic diagram of the structure of a model training device provided in an embodiment of the present application, wherein the model training device 50 comprises:
[0256] A first acquisition unit 51 is used to acquire a sample carrier image and sample watermark information;
[0257] A first encoding unit 52 is used to encode the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information;
[0258] A first decoding unit 53, configured to decode the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model;
[0259] A first determining unit 54 is used to determine first loss information corresponding to the coded image and the sample carrier image according to the coded image and the sample carrier image, wherein the first loss information is cycle consistency loss information;
[0260] A second determining unit 55, configured to determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information;
[0261] The training unit 56 is used to train the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model, and the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information.
[0262] Optionally, the initial encoder model may include a first network unit and a second network unit, and the first encoding unit 52, when used to encode the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information, is specifically used to:
[0263] Extracting features of the sample carrier image through the first network unit to obtain a feature image corresponding to the sample carrier image;
[0264] The characteristic image and the sample watermark information are encoded through the second network unit to obtain an encoded image corresponding to the sample carrier image and the sample watermark information.
[0265] Optionally, when the first determining unit 54 is used to determine the first loss information corresponding to the coded image and the sample carrier image according to the coded image and the sample carrier image, it is specifically used to:
[0266] Processing the encoded image through a third network unit to obtain a first image;
[0267] Processing the sample carrier image through the third network unit to obtain a second image;
[0268] First loss information corresponding to the coded image and the sample carrier image is determined using the first image, the second image, and the sample carrier image.
[0269] Optionally, the first loss information includes: first sub-loss information and second sub-loss information; when the first determination unit 54 is used to determine the first loss information corresponding to the encoded image and the sample carrier image using the first image, the second image, and the sample carrier image, it is specifically used to:
[0270] Determining first sub-loss information corresponding to the encoded image using the first image and the sample carrier image;
[0271] Determine second sub-loss information corresponding to the sample carrier image using the second image and the sample carrier image;
[0272] The sum of the first sub-loss information and the second sub-loss information is used as the first loss information.
[0273] Optionally, the second determining unit 55, when used to determine the second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information, is specifically used to:
[0274] Determine image reconstruction loss information corresponding to the sample carrier image and the encoded image using the sample carrier image and the encoded image;
[0275] Determine adversarial loss information corresponding to the sample carrier image and the encoded image using the sample carrier image, the encoded image, and a preset discriminator;
[0276] Determine watermark reconstruction loss information corresponding to the sample watermark information and the decoded watermark information by using the sample watermark information and the decoded watermark information;
[0277] The second loss information is determined based on the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information.
[0278] Optionally, the second determination unit 55, when used to determine the adversarial loss information corresponding to the sample carrier image and the encoded image using the sample carrier image, the encoded image, and a preset discriminator, is specifically used to:
[0279] Inputting the sample carrier image and the coded image into the discriminator, and executing the discriminator to obtain a discrimination result;
[0280] The adversarial loss information corresponding to the sample carrier image and the encoded image is determined according to the discrimination result.
[0281] Optionally, the second determining unit 55, when used to determine the second loss information based on the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information, is specifically used to:
[0282] Obtaining a first preset weight corresponding to the image reconstruction loss information;
[0283] Obtaining a second preset weight corresponding to the adversarial loss information;
[0284] Obtaining a third preset weight corresponding to the watermark reconstruction loss information;
[0285] The second loss information is determined according to the first preset weight, the second preset weight, the third preset weight, the image reconstruction loss information, the adversarial loss information, and the watermark reconstruction loss information.
[0286] Optionally, the training unit 56, when used to train the initial encoder model based on the first loss information and the second loss information, is specifically used to:
[0287] Obtaining a fourth preset weight corresponding to the first sub-loss information;
[0288] Obtaining a fifth preset weight corresponding to the second sub-loss information;
[0289] determining a total loss result according to the fourth preset weight, the fifth preset weight, the first sub-loss information, the second sub-loss information, and the second loss information;
[0290] If the total loss result is less than a preset threshold, the training of the initial encoder model is completed;
[0291] If the total loss result is not less than a preset threshold, the hyperparameters related to the parameters in the initial encoder model are adjusted, and the execution step is returned to encode the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information, until the loss result is less than the preset threshold, the training of the initial encoder model is completed.
[0292] Optionally, the training unit 56, when used to adjust the hyperparameters related to the parameters in the initial encoder model, is specifically used to:
[0293] Obtaining loss results corresponding to the first sub-loss information, the second sub-loss information, the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information, respectively, to obtain a plurality of loss results;
[0294] Determining a target loss result with the largest value among the multiple loss results;
[0295] Adjusting the target weight corresponding to the target loss result;
[0296] Among them, the target weight corresponding to the target loss result is a hyperparameter related to the parameters in the initial encoder model.
[0297] Optionally, the model training device 50 is further used for:
[0298] The initial decoder model is trained based on the first loss information and the second loss information to obtain a target decoder model, and the target decoder model is used to decode the target encoded image to extract the target watermark information from the target encoded image.
[0299] Optionally, the aforementioned model training device 50 is also used for:
[0300] Obtain the image to be encoded and the target watermark information;
[0301] Encoding the to-be-encoded image and the target watermark information through the target encoder model to obtain a target encoded image in which the target watermark information is embedded;
[0302] The target coded image is sent to a target device.
[0303] Each unit in the above-mentioned model training device 50 can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned units can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above-mentioned units.
[0304] The model training device 50 can be integrated in a terminal or server that has a storage device and a processor and has computing capabilities, or the model training device 50 is the terminal or server.
[0305] The specific implementation methods corresponding to this embodiment can be found in the above content and will not be repeated here.
[0306] Figure 6 A schematic diagram of the structure of an encoding device provided in an embodiment of the present application, wherein the encoding device 60 includes:
[0307] The second acquisition unit 61 is used to acquire the image to be encoded and the target watermark information;
[0308] A second encoding unit 62 is used to encode the image to be encoded and the target watermark information through the target encoder model to obtain a target encoded image in which the target watermark information is embedded;
[0309] The target encoder model is obtained by training the initial encoder model according to any of the aforementioned model training methods.
[0310] Each unit in the encoding device 60 may be implemented in whole or in part by software, hardware, or a combination thereof. Each unit may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor may call and execute operations corresponding to each unit.
[0311] The encoding device 60 may be integrated in a terminal or server that has a storage device and a processor and has computing capabilities, or the encoding device 60 is the terminal or server.
[0312] The specific implementation methods corresponding to this embodiment can be found in the above content and will not be repeated here.
[0313] Figure 7 A schematic diagram of the structure of a decoding device provided in an embodiment of the present application, wherein the decoding device 70 includes:
[0314] The third acquisition unit 71 is used to acquire the target coded image in which the target watermark information is embedded;
[0315] A second decoding unit 72, configured to decode the target coded image through a target decoder model to extract the target watermark information from the target coded image;
[0316] Among them, the target decoder model obtains a sample carrier image and sample watermark information for a model training device; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; and obtains the result by training the initial decoder model based on the first loss information and the second loss information.
[0317] Each unit in the above decoding device 70 can be implemented in whole or in part by software, hardware or a combination thereof. Each unit can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each unit.
[0318] The decoding device 70 may be integrated in a terminal or server that has a storage device and a processor and has computing capabilities, or the decoding device 70 is the terminal or server.
[0319] The specific implementation methods corresponding to this embodiment can be found in the above content and will not be repeated here.
[0320] All of the above technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described in detail here.
[0321] Optionally, the present application further provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0322] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application, which computer device may be Figure 1 The terminal or server shown. Figure 8 As shown, the computer device 800 may include: a communication interface 801, a memory 802, a processor 803 and a communication bus 804. The communication interface 801, the memory 802, and the processor 803 communicate with each other through the communication bus 804. The communication interface 801 is used for the device 700 to communicate data with external devices. The memory 802 can be used to store software programs and modules, and the processor 803 runs the software programs and modules stored in the memory 802, such as the software programs of the corresponding operations in the aforementioned method embodiments.
[0323] Optionally, the processor 803 can call the software program and module stored in the memory 802 to perform the following operations: obtain a sample carrier image and sample watermark information; encode the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decode the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determine first loss information corresponding to the encoded image and the sample carrier image based on the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; train the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model, the target encoder model being used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information.
[0324] Optionally, the processor 803 can also call the software program and module stored in the memory 802 to perform the following operations: obtain the image to be encoded and the target watermark information; encode the image to be encoded and the target watermark information through a target encoder model to obtain a target encoded image embedded with the target watermark information; wherein the target encoder model is obtained by training the initial encoder model according to the model training method described in any of the above items.
[0325] Optionally, the processor 803 may also call software programs and modules stored in the memory 802 to perform the following operations: obtaining a target coded image embedded with target watermark information; decoding the target coded image through a target decoder model to extract the target watermark information from the target coded image; wherein the target decoder model is a model training device that obtains a sample carrier image and sample watermark information; encoding the sample carrier image and the sample watermark information through an initial encoder model to obtain a coded image corresponding to the sample carrier image and the sample watermark information; decoding the coded image through an initial decoder model to obtain a decoded watermark information corresponding to the coded image, wherein the initial decoder model corresponds to the initial encoder model; determining first loss information corresponding to the coded image and the sample carrier image according to the coded image and the sample carrier image, the first loss information being cycle consistency loss information; determining second loss information using the sample carrier image, the coded image, the sample watermark information, and the decoded watermark information; and obtaining the loss information by training the initial decoder model based on the first loss information and the second loss information.
[0326] The present application also provides a computer-readable storage medium for storing a computer program. The computer-readable storage medium can be applied to a computer device, and the computer program enables the computer device to execute the corresponding process in the model training method in the embodiment of the present application, which will not be described here for the sake of brevity.
[0327] The present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the corresponding process in the model training method in the embodiment of the present application, which will not be described here for the sake of brevity.
[0328] The present application also provides a computer program, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the corresponding process in the model training method in the embodiment of the present application, which will not be repeated here for the sake of brevity.
[0329] It should be understood that the processor of the embodiment of the present application may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and performed. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, and other mature storage media in the art. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0330] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0331] It should be understood that the above-mentioned memory is exemplary but not restrictive. For example, the memory in the embodiments of the present application may also be static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is to say, the memory in the embodiments of the present application is intended to include but not limited to these and any other suitable types of memory.
[0332] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0333] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0334] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0335] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0336] In addition, each functional unit in the embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0337] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer or a server) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0338] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A model training method, characterized in that: include: Obtain sample carrier image and sample watermark information; Encoding the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; Decoding the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; Determine, according to the coded image and the sample carrier image, first loss information corresponding to the coded image and the sample carrier image, wherein the first loss information is cycle consistency loss information; Determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; The initial encoder model is trained based on the first loss information and the second loss information to obtain a target encoder model, wherein the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information; The determining, according to the coded image and the sample carrier image, first loss information corresponding to the coded image and the sample carrier image comprises: Processing the encoded image through a third network unit to obtain a first image; Processing the sample carrier image through the third network unit to obtain a second image, wherein the third network unit is an auxiliary network, used to remove the watermark information of the encoded image and to keep the sample carrier image intact; First loss information corresponding to the coded image and the sample carrier image is determined using the first image, the second image, and the sample carrier image.
2. The method according to claim 1, characterized in that The initial encoder model includes a first network unit and a second network unit, and encoding the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information includes: Extracting features of the sample carrier image through the first network unit to obtain a feature image corresponding to the sample carrier image; The characteristic image and the sample watermark information are encoded through the second network unit to obtain an encoded image corresponding to the sample carrier image and the sample watermark information.
3. The method according to claim 1, characterized in that The first loss information includes: first sub-loss information and second sub-loss information; the using the first image, the second image, and the sample carrier image to determine the first loss information corresponding to the coded image and the sample carrier image includes: Determining first sub-loss information corresponding to the encoded image using the first image and the sample carrier image; Determine second sub-loss information corresponding to the sample carrier image using the second image and the sample carrier image; The sum of the first sub-loss information and the second sub-loss information is used as the first loss information.
4. The method according to claim 3, characterized in that The determining of the second loss information by using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information comprises: Determine image reconstruction loss information corresponding to the sample carrier image and the encoded image using the sample carrier image and the encoded image; Determine adversarial loss information corresponding to the sample carrier image and the encoded image using the sample carrier image, the encoded image, and a preset discriminator; Determine watermark reconstruction loss information corresponding to the sample watermark information and the decoded watermark information by using the sample watermark information and the decoded watermark information; The second loss information is determined based on the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information.
5. The method according to claim 4, characterized in that The method of using the sample carrier image, the encoded image, and a preset discriminator to determine adversarial loss information corresponding to the sample carrier image and the encoded image includes: Inputting the sample carrier image and the coded image into the discriminator, and executing the discriminator to obtain a discrimination result; The adversarial loss information corresponding to the sample carrier image and the encoded image is determined according to the discrimination result.
6. The method according to claim 4, characterized in that The determining the second loss information based on the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information comprises: Obtaining a first preset weight corresponding to the image reconstruction loss information; Obtaining a second preset weight corresponding to the adversarial loss information; Obtaining a third preset weight corresponding to the watermark reconstruction loss information; The second loss information is determined according to the first preset weight, the second preset weight, the third preset weight, the image reconstruction loss information, the adversarial loss information, and the watermark reconstruction loss information.
7. The method according to claim 4, characterized in that The training of the initial encoder model based on the first loss information and the second loss information includes: Obtaining a fourth preset weight corresponding to the first sub-loss information; Obtaining a fifth preset weight corresponding to the second sub-loss information; determining a total loss result according to the fourth preset weight, the fifth preset weight, the first sub-loss information, the second sub-loss information, and the second loss information; If the total loss result is less than a preset threshold, the training of the initial encoder model is completed; If the total loss result is not less than a preset threshold, the hyperparameters related to the parameters in the initial encoder model are adjusted, and the execution step is returned to encode the sample carrier image and the sample watermark information through the initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information, until the loss result is less than the preset threshold, the training of the initial encoder model is completed.
8. The method according to claim 7, characterized in that The step of adjusting hyperparameters related to parameters in the initial encoder model comprises: Obtaining loss results corresponding to the first sub-loss information, the second sub-loss information, the image reconstruction loss information, the countermeasure loss information, and the watermark reconstruction loss information, respectively, to obtain a plurality of loss results; Determining a target loss result with the largest value among the multiple loss results; Adjusting the target weight corresponding to the target loss result; Among them, the target weight corresponding to the target loss result is a hyperparameter related to the parameters in the initial encoder model.
9. The method according to claim 1, characterized in that: The method further comprises: The initial decoder model is trained based on the first loss information and the second loss information to obtain a target decoder model, and the target decoder model is used to decode the target encoded image to extract the target watermark information from the target encoded image.
10. A coding method, characterized in that: include: Obtain the image to be encoded and the target watermark information; Encoding the image to be encoded and the target watermark information through a target encoder model to obtain a target encoded image in which the target watermark information is embedded; The target encoder model is obtained by training the initial encoder model according to the model training method described in any one of claims 1-9.
11. A decoding method, characterized in that: include: Obtaining a target coded image in which target watermark information has been embedded; Decoding the target coded image by a target decoder model to extract the target watermark information from the target coded image; Wherein, the target decoder model is a model training device that obtains a sample carrier image and sample watermark information; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; and obtains the result by training the initial decoder model based on the first loss information and the second loss information; The determining, according to the coded image and the sample carrier image, first loss information corresponding to the coded image and the sample carrier image comprises: Processing the encoded image through a third network unit to obtain a first image; Processing the sample carrier image through the third network unit to obtain a second image, wherein the third network unit is an auxiliary network, used to remove the watermark information of the encoded image and to keep the sample carrier image intact; First loss information corresponding to the coded image and the sample carrier image is determined using the first image, the second image, and the sample carrier image.
12. A model training device, characterized in that: include: A first acquisition unit, used to acquire a sample carrier image and sample watermark information; A first encoding unit, configured to encode the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; a first decoding unit, configured to decode the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; A first determining unit, configured to determine first loss information corresponding to the coded image and the sample carrier image according to the coded image and the sample carrier image, wherein the first loss information is cycle consistency loss information; A second determining unit, configured to determine second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; a training unit, configured to train the initial encoder model based on the first loss information and the second loss information to obtain a target encoder model, wherein the target encoder model is used to encode the image to be encoded and the target watermark information to obtain a target encoded image embedded with the target watermark information; The determining, according to the coded image and the sample carrier image, first loss information corresponding to the coded image and the sample carrier image comprises: Processing the encoded image through a third network unit to obtain a first image; Processing the sample carrier image through the third network unit to obtain a second image, wherein the third network unit is an auxiliary network, used to remove the watermark information of the encoded image and to keep the sample carrier image intact; First loss information corresponding to the coded image and the sample carrier image is determined using the first image, the second image, and the sample carrier image.
13. A coding device, characterized in that: include: A second acquisition unit, used to acquire the image to be encoded and target watermark information; A second encoding unit, configured to encode the image to be encoded and the target watermark information through a target encoder model to obtain a target encoded image in which the target watermark information is embedded; The target encoder model is obtained by training the initial encoder model according to the model training method described in any one of claims 1-9.
14. A decoding device, characterized in that: include: A third acquisition unit is used to acquire a target coded image in which target watermark information has been embedded; a second decoding unit, configured to decode the target coded image through a target decoder model to extract the target watermark information from the target coded image; Wherein, the target decoder model is a model training device that obtains a sample carrier image and sample watermark information; encodes the sample carrier image and the sample watermark information through an initial encoder model to obtain an encoded image corresponding to the sample carrier image and the sample watermark information; decodes the encoded image through an initial decoder model to obtain decoded watermark information corresponding to the encoded image, wherein the initial decoder model corresponds to the initial encoder model; determines first loss information corresponding to the encoded image and the sample carrier image according to the encoded image and the sample carrier image, the first loss information being cycle consistency loss information; determines second loss information using the sample carrier image, the encoded image, the sample watermark information, and the decoded watermark information; and obtains the result by training the initial decoder model based on the first loss information and the second loss information; The determining, according to the coded image and the sample carrier image, first loss information corresponding to the coded image and the sample carrier image comprises: Processing the encoded image through a third network unit to obtain a first image; Processing the sample carrier image through the third network unit to obtain a second image, wherein the third network unit is an auxiliary network, used to remove the watermark information of the encoded image and to keep the sample carrier image intact; First loss information corresponding to the coded image and the sample carrier image is determined using the first image, the second image, and the sample carrier image.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps in the method according to any one of claims 1 to 9, or claim 10, or claim 11.
16. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the processor is used to execute the steps in the method of any one of claims 1 to 9, or claim 10, or claim 11 by calling the computer program stored in the memory.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps in the method of any one of claims 1 to 9, or claim 10, or claim 11 are implemented.
Citation Information
Patent Citations
Watermark removal model training method and device, computer equipment and storage medium
CN112330522A
Digital watermark training method and device, equipment and storage medium
CN114445256A