Watermark embedding method and device based on model quantization, equipment and storage medium
By selecting feature channels with a smoothing coefficient less than a threshold in the initial model, determining the watermark quantization step size, and embedding watermark information, the problem of watermarks being easily destroyed during model quantization is solved, and the reliability and integrity of the watermark are achieved.
Patent Information
- Application Number
- CN202411672389.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-11-21
AI Technical Summary
During model quantization, watermark information is easily damaged or difficult to detect, resulting in the quantized model failing to effectively maintain the existence and integrity of the watermark, thus reducing the reliability of the watermark.
By determining the smoothing coefficients of the feature channels in the initial model, feature channels with smoothing coefficients less than a preset threshold are selected as initial feature channels. The watermark quantization step size is determined based on the parameters of these channels, and the watermark information is embedded into the initial parameters. At the same time, standard quantization processing is performed on other channels to ensure the integrity and reliability of the watermark information.
Without affecting the model quantization accuracy, reliable embedding and detection of watermark information were achieved, improving the integrity and reliability of the watermark in the quantized model.
Smart Images

Figure CN119579386B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of watermark embedding technology, and in particular to a watermark embedding method, apparatus, device and storage medium based on model quantization. Background Technology
[0002] Model quantization is a method for compressing network parameters by converting the floating-point algorithm of a neural network into a fixed-point algorithm, thereby reducing the model size and speeding up inference. Watermark embedding refers to embedding specific identification information (watermark) into the relevant model to perform copyright verification, integrity verification, or track the model's origin and usage when needed.
[0003] In the process of model quantization in related technologies, the weights and structure of the model are usually compressed and simplified. This process may cause the watermark information embedded in the model to be destroyed or become difficult to detect, making it impossible for the quantized model to effectively maintain the existence and integrity of the watermark, thus reducing the reliability of the watermark in the quantized model. Summary of the Invention
[0004] The main objective of this application is to propose a watermark embedding method, apparatus, device, and storage medium based on model quantization, which can improve the reliability of watermarks in the quantized model.
[0005] To achieve the above objectives, a first aspect of this application proposes a watermark embedding method based on model quantization, the method comprising:
[0006] Obtain the initial model to be embedded with the watermark, and the watermark information used to embed the initial model;
[0007] Determine the channel smoothing coefficients corresponding to each feature channel in any processing layer of the initial model, and determine the feature channels whose channel smoothing coefficients are less than a preset smoothing threshold as the initial feature channels;
[0008] The watermark quantization step size is determined based on multiple first initial parameters of the initial feature channel, and the watermark information is embedded into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters.
[0009] The standard quantization step size is determined based on multiple second initial parameters of the initial feature channel. The second initial parameters of the remaining feature channels other than the initial feature channel are quantized based on the standard quantization step size to obtain the corresponding second target parameters.
[0010] Based on the first target parameter and the second target parameter, the target model after watermark information embedding and model quantization is obtained.
[0011] In some embodiments, the first initial parameter is determined by the following steps, including:
[0012] The weight parameters of the initial feature channels are used as multiple first initial parameters representing static invariance; or,
[0013] Obtain sample input data for quantization training of the initial model, and use the product of the sample input data and each weight parameter as multiple first initial parameters to characterize dynamic changes.
[0014] In some embodiments, after obtaining the target model with watermark information embedded and model quantization completed, the method further includes:
[0015] Obtain the verification watermark parameters and verification quantization parameters corresponding to the sample input data;
[0016] When the difference between the first target parameter and the verification watermark parameter is less than a preset first threshold, and the difference between the second target parameter and the verification quantization parameter is less than a preset second threshold, the quantization accuracy of the target model is determined to meet the standard.
[0017] In some embodiments, the watermark quantization step size is determined based on a plurality of first initial parameters of the initial feature channels, including:
[0018] Obtain the quantization range information of the initial model;
[0019] From the multiple initial parameters of the initial feature channel, determine the first extremum parameter with the largest value and the second extremum parameter with the smallest value;
[0020] Calculate the first parameter difference between the first extreme value parameter and the second extreme value parameter. Based on the ratio of the first parameter difference to the quantization range information, obtain the watermark quantization step size used to quantize the first initial parameter.
[0021] In some embodiments, watermark information is embedded into multiple first initial parameters based on the watermark quantization step size to obtain corresponding first target parameters, including:
[0022] The watermark information is divided into multiple sub-watermark information, and the watermark quantization step size is updated based on the multiple sub-watermark information to obtain multiple updated quantization step sizes.
[0023] For each first initial parameter, calculate the second parameter difference between the first initial parameter and the second maximum / minimum parameter, and determine the ratio between the second parameter difference and any update quantization step size as the sub-watermark model parameter obtained after embedding the watermark with the first initial parameter.
[0024] The parameters of multiple sub-watermark models obtained based on the embedding of all updated quantization steps are determined to form the complete first target parameters.
[0025] In some embodiments, the watermark quantization step size is updated based on multiple sub-watermark information to obtain multiple updated quantization step sizes, including:
[0026] The watermark quantization step size is amplified to obtain the amplified quantization step size, which contains multiple original quantization information arranged sequentially from high bit to low bit.
[0027] The sub-watermark information is converted to obtain the watermark quantization information.
[0028] Clear the preset number of original quantization information bits at the low end of the amplified quantization step size, and replace the cleared original quantization information with watermarked quantization information to obtain the replaced amplified quantization step size;
[0029] The updated quantization step size is obtained by scaling the replacement amplified quantization step size.
[0030] In some embodiments, the first target parameter includes a head parameter representing the starting position of the first target parameter and a tail parameter representing the ending position of the first target parameter;
[0031] After embedding the watermark information into multiple initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters, the process also includes:
[0032] Insert a preset start identifier before the header parameters. The start identifier is used to identify the starting position of the first target parameter.
[0033] A preset end identifier is inserted after the tail parameter. The end identifier is used to identify the end position of the first target parameter.
[0034] In some embodiments, after obtaining the target model with watermark information embedded and model quantization completed, the method further includes:
[0035] Extract the encoding information one by one from the multiple model parameters after quantization;
[0036] When the same encoded information as the initial identifier information is extracted, watermark information is extracted starting from the next model parameter;
[0037] The watermark extraction is complete when the same encoded information as the end identifier is extracted.
[0038] To achieve the above objectives, a second aspect of this application provides a model-quantized watermark embedding apparatus, the apparatus comprising:
[0039] The acquisition module is used to acquire the initial model to be embedded with the watermark, and the watermark information used to embed the initial model;
[0040] The channel determination module is used to determine the channel smoothing coefficients corresponding to each feature channel in any processing layer of the initial model, and to determine the feature channels whose channel smoothing coefficients are less than a preset smoothing threshold as the initial feature channels.
[0041] The first target parameter determination module is used to determine the watermark quantization step size based on multiple first initial parameters of the initial feature channel, and to embed the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters.
[0042] The second target parameter determination module is used to determine the standard quantization step size based on multiple second initial parameters of the initial feature channel, and to quantize the second initial parameters of the other feature channels except the initial feature channel based on the standard quantization step size to obtain the corresponding second target parameters.
[0043] The target quantization module is used to obtain the target model after watermark information embedding and model quantization based on the first target parameter and the second target parameter.
[0044] To achieve the above objectives, a third aspect of the present application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method of the first aspect described above.
[0045] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method of the first aspect described above.
[0046] The watermark embedding method, apparatus, device, and storage medium proposed in this application based on model quantization obtain an initial model to be embedded with a watermark and watermark information for embedding the initial model; determine the channel smoothing coefficients corresponding to each feature channel in any processing layer of the initial model, and determine the feature channels whose channel smoothing coefficients are less than a preset smoothing threshold as initial feature channels. By selecting feature channels with smoother parameters for watermark embedding, the reliability of watermark embedding is improved, and the stability of the final target model is enhanced; a watermark quantization step size is determined based on multiple first initial parameters of the initial feature channels, and watermark information is embedded into multiple first initial parameters based on the watermark quantization step size to obtain corresponding first target parameters; a standard quantization step size is determined based on multiple second initial parameters of the initial feature channels, and the second initial parameters of the remaining feature channels other than the initial feature channels are quantized based on the standard quantization step size to obtain corresponding second target parameters; based on the first target parameters and the second target parameters, the target model after watermark information embedding and model quantization is obtained. Thus, this application can complete the embedding of watermark information with almost no impact on the model quantization accuracy, while ensuring the integrity of the embedded watermark information and thus its reliability. Attached Figure Description
[0047] Figure 1 This is an optional flowchart of the model-quantized watermark embedding method provided in the embodiments of this application;
[0048] Figure 2 This is a flowchart of an optional first initial parameter determination process for a watermark embedding method based on model quantization provided in this application embodiment;
[0049] Figure 3 yes Figure 1 A flowchart of the implementation of step 103 in the process;
[0050] Figure 4 yes Figure 1 Another implementation flowchart of step 103 in the process;
[0051] Figure 5 yes Figure 4 Another implementation flowchart of step 401 in the diagram;
[0052] Figure 6 yes Figure 1 A flowchart of the implementation following step 105;
[0053] Figure 7 yes Figure 1 A flowchart of the implementation following step 103;
[0054] Figure 8 yes Figure 1Another implementation flowchart following step 105;
[0055] Figure 9 This is an optional PTQ static weight quantization flowchart of the watermark embedding method based on model quantization provided in the embodiments of this application;
[0056] Figure 10 This is an optional flowchart of the model-quantized watermark embedding device provided in the embodiments of this application;
[0057] Figure 11 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0059] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0061] In model deployment, model quantization is a crucial optimization step. A streamlined model reduces the demands on the GPU memory and computing power of edge devices. This is achieved by compressing network parameters, converting the floating-point algorithm of the neural network into a fixed-point algorithm, thereby reducing model size and accelerating inference. For example, when embedding an edge intelligent control system into different devices, the computing power and memory resources of these devices vary. Therefore, the corresponding models of the edge intelligent control system need to be quantized to ensure that models based on different degrees of quantization can run efficiently on their respective devices.
[0062] Furthermore, model watermark embedding is a technique used for model copyright protection. It identifies the model's owner by embedding specific watermark information within the model, preventing unauthorized copying and use. Model quantization presents significant challenges to watermark embedding. In related technologies, the model's weights and structure are typically compressed and simplified during the quantization process. This process may cause the watermark information embedded in the model to be corrupted or become difficult to detect, making it impossible for the quantized model to effectively maintain the existence and integrity of the watermark, thus reducing the reliability of the watermark in the quantized model.
[0063] Based on this, embodiments of this application provide a watermark embedding method, apparatus, device, and storage medium based on model quantization, which can improve the reliability of watermarks in the quantized model.
[0064] It should be noted that in this application embodiment, when information related to user characteristics, such as basic user information or user identity, is required, the user's permission or consent will be obtained first. Furthermore, the collection, use, and processing of this data will comply with relevant laws, regulations, and standards. Additionally, when this application embodiment needs to obtain sensitive personal information of a user, the user's individual permission or consent will be obtained first. Only after obtaining the user's individual permission or consent will the necessary data for the normal operation of this application embodiment be obtained. For example, when obtaining the initial model to be embedded with a watermark, the consent of the relevant management personnel of the initial model will be obtained first. When obtaining watermark information for embedding the initial model, since the watermark information may be the ID number, name, or other characters of the relevant management personnel, the consent of the user involved in the watermark information will also be obtained first; otherwise, the initial model and watermark information cannot be used in this application embodiment. Furthermore, all other relevant data obtained by the item recommendation device of this application are legal and authorized data, and will not be elaborated upon here.
[0065] In this application embodiment, the description will focus on a model-quantized watermark embedding device (hereinafter referred to as "watermark embedding device" for ease of description), which can be integrated into a computer device, such as a server. Figure 1 As shown, Figure 1 This is an optional flowchart of a model-quantized watermark embedding method (hereinafter referred to as "watermark embedding method") provided in an embodiment of this application. Figure 1 The method may include, but is not limited to, the following steps 101 to 105. When the watermark embedding device executes the prediction method, the specific process is as follows. It should be noted that this embodiment... Figure 2The order of steps 101 to 105 is not specifically limited. The order of steps can be adjusted or some steps can be reduced or added according to actual needs.
[0066] Step 101: Obtain the initial model to be embedded with the watermark, and the watermark information used to embed the initial model.
[0067] Step 101 will be described in detail below.
[0068] In the context of model watermark embedding, the initial model refers to the original carrier to which the watermark is to be embedded. The initial model can have different instances depending on the actual situation. For example, the initial model can be an image processing model, a video encoding model, or an audio analysis model. This application embodiment does not limit the type of the initial model.
[0069] The watermark information used to identify information (such as copyright information) can be relevant identifiable information such as the name, ID card information, or passport information of the initial model owner. Furthermore, to embed the watermark information into the initial model, it undergoes information conversion processing, such as converting it into a binary bitstream. It should be noted that the watermark information can be specifically selected according to the actual situation, and the processing operations performed on the watermark information can also be adaptively adjusted according to the actual situation; this application embodiment does not impose any limitations in this regard.
[0070] In some embodiments, since the parameters to be quantized depend on the structure and quantization granularity of the initial model, it is necessary to first analyze the selected initial model to adaptively determine the watermark information suitable for embedding in the initial model. For example, the parameters to be quantized in a given initial model include 48 convolutional weight tensors, 48 pairs of batch normalized parameter tensors, 1 fully connected weight tensor, and 33 dynamically generated activation value tensors, from which the following information can be obtained:
[0071] 1) For tensor-based weight quantization, there are at most about 100 quantization parameters;
[0072] 2) For channel-based weight quantization, depending on the number of channels in the statistical convolutional layer, there may be tens of thousands of weight quantization parameters.
[0073] 3) For activation value quantization based on tensor granularity, there are a maximum of 33 quantization parameters;
[0074] 4) For activation value quantization based on channel granularity, there are hundreds of quantization parameters.
[0075] Furthermore, since the parameters to be quantized in different initial models are usually different, it is necessary to determine the amount of quantization information by analyzing the initial model. Then, based on the amount of quantization information, watermark information for embedding in the initial model is selected from multiple candidate watermark information.
[0076] In one feasible approach, to minimize the impact of watermark embedding on other quantization parameters of the initial model, the length (bit length) of the watermark information is limited to 5% of the length (bit length) of all quantization parameters. For example, the total amount of information to be quantized = 256 (convolutional layers) + 128 (fully connected layers) + 64 (activation layers) = 448 bits; therefore, the maximum length of the embedded watermark information = 448 * 5% = 22.4 bits (in practical applications, integer bits such as 22 or 23 bits are often used, depending on the specific implementation and not subject to limitation); then, watermark information with a length less than the maximum embedding watermark information can be selected from multiple candidate watermark information and used as the watermark information for embedding into the initial model.
[0077] Furthermore, if multiple watermark information entries are all shorter than the maximum watermark information length, considering the need to enhance model copyright protection and support more complex copyright tracking and authentication, the longer watermark information entry should be prioritized. Alternatively, if the maximum watermark information length allows, multiple watermark information entries can be concatenated to maximize the number of watermark identifiers without affecting the model's quantization accuracy. It should be noted that the total maximum length of watermark information in the initial model and the number of identifiers included in the watermark information are set based on actual circumstances. This application's embodiments are merely illustrative and do not constitute specific limitations.
[0078] Step 102: Determine the channel smoothing coefficients corresponding to each feature channel in any processing layer of the initial model, and determine the feature channels whose channel smoothing coefficients are less than the preset smoothing threshold as the initial feature channels.
[0079] Step 102 is described in detail below.
[0080] The initial model includes multiple processing layers, such as convolutional layers, activation layers, and fully connected layers. Multiple feature channels are selected based on a preset smoothing threshold. Specifically, the channel smoothing coefficient characterizes the smoothness of the data within a corresponding feature channel. A higher channel smoothing coefficient means that the data changes relatively smoothly within that feature channel, without significant fluctuations or abrupt changes; conversely, a lower smoothing coefficient means that the data within that feature channel fluctuates significantly and has more uncertainty. Based on this, feature channels with smoother parameters are selected as initial feature channels. By selecting feature channels with smoother parameters for watermark embedding, the reliability of the watermark embedding is improved, and the stability of the final target model is enhanced.
[0081] For example, by the following formula <1> The corresponding channel smoothness index for each feature channel is calculated:
[0082]
[0083] Where N represents the total number of parameter points in the feature channel, x i Used to represent the i-th parameter point.
[0084] It should be noted that the preset smoothing threshold is set according to the actual situation, and this application embodiment does not impose any restrictions on it.
[0085] Step 103: Determine the watermark quantization step size based on multiple first initial parameters of the initial feature channel, and embed the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters.
[0086] Step 103 will be described in detail below.
[0087] The parameters in the initial feature channels are called the first initial parameters. During the process of model quantization and watermark embedding, the corresponding watermark quantization step size is adaptively determined based on the first initial parameters of each initial feature channel, which greatly reduces the probability of watermark information distortion, thereby ensuring that the watermark information is not easily lost or tampered with during transmission or processing, and improving the robustness of watermark embedding.
[0088] In some embodiments, such as Figure 2 As shown, Figure 2 This is a flowchart of an optional first initial parameter determination process for a model-quantized watermark embedding method provided in this application embodiment. The first initial parameter is determined through the following steps 201 to 202:
[0089] Step 201: Use multiple weight parameters of the initial feature channels as multiple first initial parameters that represent static invariance.
[0090] Step 202, or, obtain sample input data for quantization training of the initial model, and use the multiplication of the sample input data and each weight parameter as multiple first initial parameters to represent dynamic changes.
[0091] Steps 201 to 202 are described in detail below.
[0092] The initial model includes various types of first initial parameters. For example, the first initial parameters can be statically unchanged weight parameters or dynamically changing activation value parameters that change continuously during processing. When implementing watermark embedding, the weight parameters can be directly used as the first initial parameters to be processed. Alternatively, during the quantization training of the initial model, the product of the sample input data used for quantization training and the weight parameters (activation value parameters) can be used as the first initial parameters to be processed. Or, the first initial parameters can be both weight parameters and activation value parameters. In this case, the watermark information will be embedded simultaneously into the first initial parameters, which are represented as both weight parameters and activation value parameters.
[0093] Furthermore, model quantization includes the following two commonly used methods:
[0094] (1) Post-Training Quantization (PTQ): A method for quantizing an initial model that has completed training. PTQ does not require retraining the model, so it can be applied to already deployed models or models trained in other ways. PTQ typically uses a small amount of calibration data to adjust the weights and activation values in the model to ensure that the quantized model still has high accuracy during the inference stage.
[0095] (2) Quantization-Aware Training (QAT): A method that considers the quantization effect during the initial model training process. Unlike PTQ, QAT introduces quantization operations during training, and the model takes quantization error into account during training. PTQ usually simulates quantization operations during training and adjusts the model weights through the backpropagation algorithm, so that the model can maintain high accuracy in the inference stage after quantization.
[0096] Different model quantization methods and the selection of different types of initial parameters for watermark embedding will correspond to different complete quantization processes. The following example uses PTQ static weight quantization for watermark embedding (assuming channel quantization) to illustrate the common parts of several complete quantization processes. Differences will be explained after describing the common parts:
[0097] In some embodiments, such as Figure 3 As shown, Figure 3 yes Figure 1 A flowchart of step 103 in the figure, which determines the watermark quantization step size based on multiple first initial parameters of the initial feature channel, includes the following steps 301 to 303:
[0098] Step 301: Obtain the quantization range information of the initial model.
[0099] Step 302: Determine the first maximum / minimum parameter with the largest value and the second maximum / minimum parameter from the multiple first initial parameters of the initial feature channel.
[0100] Step 303: Calculate the first parameter difference between the first extreme value parameter and the second extreme value parameter. Based on the ratio of the first parameter difference to the quantization range information, obtain the watermark quantization step size used to quantize the first initial parameter.
[0101] Steps 301 to 303 are described in detail below.
[0102] In some embodiments, by the following formula <2> Calculate and determine the initial watermark quantization step size origin_step for the feature channels:
[0103]
[0104] Among them, (2) n -1) represents the quantization range information of the initial model; max_val is the first extreme value parameter, min_val is the second extreme value parameter; (max_val-min_val) is the difference between the first parameters.
[0105] In some embodiments, such as Figure 4 As shown, Figure 4 yes Figure 1 Another implementation flowchart of step 103 in the above process involves embedding the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters, including the following steps 401 to 403:
[0106] Step 401: Divide the watermark information into multiple sub-watermark information, and update the watermark quantization step size based on the multiple sub-watermark information to obtain multiple updated quantization step sizes.
[0107] Step 401 is described in detail below.
[0108] In some embodiments, a single first initial parameter is usually insufficient to embed complete watermark information. Therefore, preprocessing of the watermark information is required, including dividing the watermark information into multiple smaller sub-watermark information. Generally, sub-watermark information is selected sequentially in order that it can be pieced together to form complete watermark information. Then, the watermark quantization step size determined in step 303 is updated based on the selected sub-watermark information to obtain the updated quantization step size used to quantize the first initial parameter. The specific steps are as follows:
[0109] In some embodiments, such as Figure 5 As shown, Figure 5 yes Figure 4Another implementation flowchart of step 401 in the diagram updates the watermark quantization step size based on multiple sub-watermark information to obtain multiple updated quantization step sizes, including the following steps 501 to 504:
[0110] Step 501: The watermark quantization step size is amplified to obtain the amplified quantization step size, wherein the amplified quantization step size contains multiple original quantization information arranged sequentially from high bit to low bit.
[0111] Step 502: Perform information conversion processing on the sub-watermark information to obtain watermark quantization information.
[0112] Step 503: Clear the preset number of original quantization information bits in the low-order bits of the amplified quantization step size, and replace the cleared original quantization information with watermarked quantization information to obtain the replaced amplified quantization step size.
[0113] Step 504: Scaling the replacement amplified quantization step size to obtain the updated quantization step size.
[0114] Steps 501 to 504 are described in detail below.
[0115] In some embodiments, by embedding the watermark information into the amplified watermark quantization step size, and then using the quantization step size after watermark embedding and scaling to quantize the first initial parameter, it is possible to reduce the perception of watermark information by the quantized model while realizing watermark embedding in the model quantization.
[0116] For example, the updated quantization step size is obtained through the following steps ① to ③:
[0117] ①step_int=int(origin_step*(2**24)), which enlarges the origin_step obtained in step 303 to a fixed-point representation (assuming the fixed-point number is set to 2**24) to obtain the enlarged quantization step size. Multiple original quantization information arranged sequentially from high bit to low bit constitute the enlarged quantization step size.
[0118] ②updated_step=(step_int&~(0b111111))|watermark_bits, where watermark_bits is the watermark quantization information obtained by information conversion processing of the sub-watermark information. The information conversion processing is used to convert the sub-watermark information into a bit string that is easy to embed. By performing a bitwise inversion operation (~) on step_int in step ①, and then performing a bitwise AND operation (&) with the binary mask 0b111111, the preset number of original quantization information bits in the lower bits are cleared. Then, watermark_bits (watermark quantization information) is inserted into the cleared bits of step_int by a bitwise OR operation (|) to obtain the updated replacement amplified quantization step size updated_step. It should be noted that this example uses clearing the lower 6 bits. The actual amount of original quantization information cleared is specifically set according to the length of the converted sub-watermark information. This embodiment of the application does not impose any restrictions.
[0119] ③watermark_scale = updated_step / (2**24), based on the scale of the amplification process, the replacement amplification quantization step size step_int is scaled to obtain the updated quantization step size watermark_scale.
[0120] Understandably, although the update quantization step size and the initial watermark quantization step size are almost unchanged in floating-point representation, using the watermark quantization step size to quantize the first initial parameter can ensure that the watermark information is embedded without affecting the accuracy of model quantization.
[0121] Step 402: For each first initial parameter, calculate the second parameter difference between the first initial parameter and the second maximum / minimum parameter, and determine the ratio between the second parameter difference and any update quantization step size as the sub-watermark model parameter obtained after watermark embedding of the first initial parameter.
[0122] Step 403: Determine the parameters of the multiple sub-watermark models obtained based on all updated quantization step embeddings, which are the complete first target parameters.
[0123] After understanding the method for determining the update quantization step size, step 401 continues to describe steps 402 to 403 in detail.
[0124] In some embodiments, by the following formula <3> The sub-watermark model parameter quant_weight is obtained by embedding watermark information into each of the first initial parameters and then quantizing it.
[0125]
[0126] Where `round` represents the rounding function; `watermark_scal` is the update quantization step size; and `current`... val The currently selected first initial parameter; min val The second extreme value parameter is the one with the smallest value among the multiple first initial parameters of the current initial feature channel; (current val -min val ) represents the difference in the second parameter.
[0127] Furthermore, for each first initial parameter, watermark embedding quantization processing is performed using different update quantization step sizes to obtain multiple sub-watermark model parameters, thereby forming the complete watermark embedding quantized first target parameter. If the first initial parameter of a single processing layer cannot complete the embedding of the complete watermark information, then the first initial parameter of the new processing layer is then subjected to watermark embedding processing to continue embedding the remaining watermark information. The specific implementation method for watermark embedding processing of the first initial parameter of the new processing layer is similar to step 103, and will not be repeated here.
[0128] Furthermore, in order to facilitate the embedding and subsequent extraction of watermark information, multiple first initial parameters are sequentially subjected to watermark embedding quantization processing in a specified order. The specified order can be the logical order in which the processing layer processes the input data, or the initial feature channels from the beginning to the end.
[0129] Step 104: Determine the standard quantization step size based on multiple second initial parameters of the initial feature channel, and quantize the second initial parameters of the remaining feature channels other than the initial feature channel based on the standard quantization step size to obtain the corresponding second target parameters.
[0130] Step 105: Based on the first target parameter and the second target parameter, obtain the target model after watermark information embedding and model quantization.
[0131] Steps 104 to 105 are described in detail below.
[0132] In some embodiments, the parameters in the remaining feature channels other than the initial feature channel are determined as the second initial parameters, which are parameters that do not require watermarking information to be embedded; the standard quantization step size is calculated based on a method similar to steps 301 to 303, and the quantization range information used to determine the standard quantization step size is usually the same as the quantization range information used to determine the watermark quantization step size; the second target parameter obtained after quantization of the second initial parameter is determined based on a method similar to steps 402 to 403.
[0133] Furthermore, based on the first target parameter after watermark information embedding and the second target parameter obtained after standard quantization operation, a model-based watermark embedding method is completed, thereby obtaining the target model.
[0134] In related technologies, directly embedding watermarks into the quantized low-precision model can significantly affect the accuracy of the quantized model, thus impacting its practical application and limiting the usability of the embedded watermark information. In contrast, the watermark embedding method proposed in this application can embed watermark information with almost no impact on the model's quantization accuracy, while ensuring the integrity of the embedded watermark information and thus its reliability.
[0135] In some embodiments, such as Figure 6 As shown, Figure 6 yes Figure 1 A flowchart following step 105 in the process includes the following steps 601 to 602 after obtaining the target model with the watermark information embedded and the model quantized:
[0136] Step 601: Obtain the verification watermark parameters and verification quantization parameters corresponding to the sample input data.
[0137] Step 602: When the difference between the first target parameter and the verification watermark parameter is less than a preset first threshold, and the difference between the second target parameter and the verification quantization parameter is less than a preset second threshold, the quantization accuracy of the target model is determined to be up to standard.
[0138] Steps 601 to 602 are described in detail below.
[0139] In some embodiments, in order to evaluate the performance of the model after watermark embedding and quantization, it is also necessary to verify the quantization accuracy of the target model. The verification of quantization accuracy includes two aspects: watermark embedding quantization verification and standard quantization verification.
[0140] Furthermore, the sample input data is used to test or verify the quantization accuracy of the target model. The sample input data can be randomly generated or come from a specific dataset. The validation watermark parameter is used to characterize the expected output result after watermark embedding quantization of the sample input data, and the validation quantization parameter is used to characterize the expected output result after standard quantization operation without watermark embedding of the sample input data.
[0141] Furthermore, the first threshold is used to characterize the degree of difference between the acceptable first target parameter and the verification watermark parameter, and the second threshold is used to characterize the degree of difference between the acceptable second target parameter and the verification quantization parameter. When both conditions are met, it indicates that the target model can complete the embedding of watermark information without affecting the accuracy of parameter quantization.
[0142] In some embodiments, such as Figure 7 As shown, Figure 7 yes Figure 1 A flowchart following step 103 in the previous section, after embedding the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters, also includes the following steps 701 to 702:
[0143] Step 701: Insert a preset start identifier before the header parameter. The start identifier is used to identify the starting position of the first target parameter.
[0144] Step 702: Insert a preset end identifier after the tail parameter. The end identifier is used to identify the end position of the first target parameter.
[0145] Steps 701 to 702 are described in detail below.
[0146] In some embodiments, the first target parameter includes a head parameter representing the start position of the first target parameter and a tail parameter representing the end position of the first target parameter. Both the start and end identifiers are represented using unique data such as unique strings, number sequences, or special symbols to ensure accurate identification during subsequent watermark information extraction without confusion with other parameters.
[0147] The header parameter consists of a preset number of characters from the header of the first target parameter, and the tail parameter consists of a preset number of characters from the tail of the first target parameter. Furthermore, according to the embedding order of the multiple sub-watermark information, the first one embedded is the header, and the last one embedded is the tail.
[0148] For example, if the header parameter of the first target parameter is at position Y, then start identifier information obtained through special encoding is directly inserted at positions (Y-3), (Y-2), and (Y-1), or the lowest 6 bits of the quantization step size at these three positions are set to a specific 18-bit string; similarly, if the tail parameter of the first target parameter is at position Z, then end identifier information obtained through special encoding is directly inserted at positions (Z+1), (Z+2), and (Z+3), or the lowest 6 bits of the quantization step size at these three positions are set to a specific 18-bit string.
[0149] In some embodiments, such as Figure 8 As shown, Figure 8 yes Figure 1 Another implementation flowchart following step 105 includes the following steps 801 to 803 after obtaining the target model with embedded watermark information and quantized model:
[0150] Step 801: Extract the encoding information from the multiple model parameters after quantization one by one.
[0151] Step 802: When the encoded information that is the same as the starting identifier information is extracted, the watermark information is extracted starting from the next model parameter.
[0152] Step 803: The watermark information extraction is completed when the same encoded information as the end identifier information is extracted.
[0153] Steps 801 to 803 are described in detail below.
[0154] Here, model parameters refer to the parameters in the target model obtained after model quantization. Typically, since it's visually impossible to distinguish which model parameters embed watermark information, it's necessary to identify the location of the watermark information using start and end identifiers. When the same encoded information as the start identifier is extracted, it indicates that watermark information is embedded in subsequent model parameters, and watermark information extraction begins from the next model parameter. Typically, if the watermark information is embedded in the lower 6 bits of the first initial parameter, the embedded content is restored based on the lower 6 bits of the model parameter until the same encoded information as the end identifier is extracted, at which point the watermark information extraction is considered complete. In the embodiments of this application, the model parameters can be the watermark quantization step size and the standard quantization step size.
[0155] Furthermore, the extraction of the weighted quantization step size watermark for PTQ relies on the 18-bit bit string marking encoding of the watermark start embedding, the fixed number of weight amplification points, and the preset smoothing threshold; the extraction of the activation value quantization step size watermark for PTQ relies on the calibration dataset and the fixed number of weight amplification points; the extraction of the quantization step size watermark for QAT relies on the fixed number of weight amplification points. The following takes the extraction of the weighted quantization step size watermark for PTQ as an example. The other two methods have less watermark extraction and require the location of the watermark embedding start position.
[0156] (1) Read the quantization step size of the three channels in sequence, read the combined 18-bit bit string, and determine whether it is consistent with the watermark start embedding 18-bit bit string mark encoding. If it is consistent, it means that the start position of watermark embedding has been found.
[0157] (2) Starting from the next quantization step, determine whether the smoothing exponent of the dequantized channel weight is less than the WM embedding threshold. If so, it means that the watermark is embedded in the current quantization step and extract it.
[0158] (3) Read the last three quantization steps, read the combined 18-bit bit string, and determine whether it is consistent with the watermark end embedding 18-bit bit string mark encoding. If it is consistent, it means that the end position of watermark embedding has been found.
[0159] like Figure 9 As shown, Figure 9This is an optional PTQ static weight quantization flowchart of the watermark embedding method based on model quantization provided in this application embodiment. When PTQ is selected as the model quantization method for the initial model, and static weights are selected as the target quantization and watermark embedding object (first case), the target model is obtained through the following steps:
[0160] (1) If the channel smoothing index of the current Xth feature channel is less than the preset smoothing threshold, the feature channel is determined to be the initial feature channel.
[0161] (2) Determine the watermark quantization step size based on multiple first initial parameters in the initial feature channel;
[0162] (3) The watermark information is embedded based on the watermark quantization step size. If the watermark information cannot be completely embedded in a single first initial parameter, the watermark information is split and the split sub-watermark information is embedded into multiple first initial parameters.
[0163] (4) After the current watermark information is embedded, check whether the preset watermark information is completely embedded. If not, repeat steps (1) to (4); if yes, proceed to step (5).
[0164] (5) Obtain the first target parameter that embeds the complete watermark information, and insert an identifier as a marker before the start position and after the end position of the watermark information;
[0165] (6) Perform standard quantization on other second initial parameters that do not require watermarking information to obtain the second target parameters;
[0166] (7) Obtain and save the target model based on the first target parameter and the second target parameter.
[0167] In some embodiments, when PTQ is selected as the initial model quantization method and dynamic activation values are selected as the target quantization and watermark embedding object (second case), compared to the first case, the activation values in the second case will change differently depending on the input data. Therefore, watermark information can be embedded at the activation values based on the verification data to track or verify the model usage and ensure that the model is correctly applied to the specified dataset. That is, in the second case, when determining the watermark quantization step size, it is necessary to dynamically determine the extreme activation values to determine the watermark quantization step size in this case. The extreme value calculation methods for different datasets are as follows:
[0168] ① Global minimum and maximum value method:
[0169] min = min(min1,...,minx) and max = max(max1,...,maxx); where min represents the minimum value function, mini(i = 1, 2, ...,x); and max represents the minimum value function, maxi(i = 1, 2, ...,x).
[0170] ② Batch maximum and minimum value method:
[0171] min = average(min1,...,minx), max = average(max1,...,maxx); where average is the average function;
[0172] ③ Percentile method: min = 10%th(sort(min1,...,minx,max1,...,maxx)); max = 90%th(sort(min1,...,minx,max1,...,maxx)); where 10%th represents the top 10%, 90%th represents the top 90%, and sort is the sorting function;
[0173] ④ KL divergence method: First, collect the floating-point histogram of activation values for each processing layer. Then, use the KL divergence method to find the cutoff point where the difference between the quantized distribution and the original distribution is minimal. By adjusting the interval of the histogram, find the mini and maxi values that minimize the quantization error. It should be noted that these values may not be extreme points in the activation values, but rather the result of statistical optimization.
[0174] Furthermore, the second scenario also requires selecting different extremum calculation methods based on different datasets to determine the standard quantization step size used for quantizing the second initial parameter. Of course, the extremum calculation methods for different datasets can be set according to actual circumstances, and this embodiment does not impose any limitations on this. The other steps for obtaining the target model in the second scenario are similar to those in the first scenario and will not be repeated here.
[0175] In some embodiments, when QTA is selected as the model quantization method for the initial model and static weights are selected as the target quantization and watermark embedding object (the third case), the processing steps are similar to those in the first case. The difference is that since QTA takes into account the impact of quantization operations during model training, the third case does not need to evaluate the inference accuracy of the model after embedding the watermark. That is, after the complete embedding of the watermark information is completed, the start and end positions of the watermark information are directly marked.
[0176] In some embodiments, when QTA is selected as the model quantization method for the initial model and dynamic activation values are selected as the target quantization and watermark embedding object (fourth case), the processing steps are similar to those in the second case. The difference is that since QTA takes into account the impact of quantization operations during model training, the fourth case does not need to evaluate the inference accuracy of the model after embedding the watermark. That is, after the complete embedding of the watermark information is completed, the start and end positions of the watermark information are directly marked.
[0177] like Figure 10 As shown, Figure 10 This is an optional flowchart of a model-quantized watermark embedding device provided in this application embodiment. The watermark embedding device includes the following modules 901 to 906:
[0178] The acquisition module 901 is used to acquire the initial model to be embedded with the watermark and the watermark information used to embed the initial model.
[0179] The channel determination module 902 is used to determine the channel smoothing coefficients corresponding to each feature channel in any processing layer of the initial model, and to determine the feature channels whose channel smoothing coefficients are less than a preset smoothing threshold as the initial feature channels.
[0180] The first target parameter determination module 903 is used to determine the watermark quantization step size based on multiple first initial parameters of the initial feature channel, and to embed the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters.
[0181] The second target parameter determination module 904 is used as a watermark model parameter determination module. It is used to determine the standard quantization step size based on multiple second initial parameters of the initial feature channel, and to quantize the second initial parameters of the other feature channels except the initial feature channel based on the standard quantization step size to obtain the corresponding second target parameters.
[0182] The target quantization module 905 is used to obtain the target model after watermark information embedding and model quantization based on the first target parameter and the second target parameter.
[0183] The watermark embedding method, apparatus, device, and storage medium proposed in this application based on model quantization obtain an initial model to be embedded with a watermark and watermark information for embedding the initial model; determine the channel smoothing coefficients corresponding to each feature channel in any processing layer of the initial model, and determine the feature channels whose channel smoothing coefficients are less than a preset smoothing threshold as initial feature channels. By selecting feature channels with smoother parameters for watermark embedding, the reliability of watermark embedding is improved, and the stability of the final target model is enhanced; a watermark quantization step size is determined based on multiple first initial parameters of the initial feature channels, and watermark information is embedded into multiple first initial parameters based on the watermark quantization step size to obtain corresponding first target parameters; a standard quantization step size is determined based on multiple second initial parameters of the initial feature channels, and the second initial parameters of the remaining feature channels other than the initial feature channels are quantized based on the standard quantization step size to obtain corresponding second target parameters; based on the first target parameters and the second target parameters, the target model after watermark information embedding and model quantization is obtained. Thus, this application can complete the embedding of watermark information with almost no impact on the model quantization accuracy, while ensuring the integrity of the embedded watermark information and thus its reliability.
[0184] The specific implementation of this watermark embedding device is basically the same as the specific embodiment of the watermark embedding method described above, and will not be repeated here.
[0185] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described watermark embedding method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0186] like Figure 11 As shown, Figure 11 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. The electronic device includes:
[0187] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0188] The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 using the watermark embedding method of the embodiments of this application.
[0189] Input / output interface 1003 is used to implement information input and output;
[0190] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0191] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);
[0192] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0193] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described watermark embedding method.
[0194] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0195] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0196] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0197] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0198] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0199] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0200] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0201] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0202] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0203] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0204] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0205] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A watermark embedding method based on model quantization, characterized in that, The method includes: Obtain the initial model to be embedded with the watermark, and the watermark information used to embed the initial model; Determine the channel smoothing coefficient corresponding to each feature channel in any processing layer of the initial model, and determine the feature channels whose channel smoothing coefficient is less than a preset smoothing threshold as initial feature channels; The watermark quantization step size is determined based on multiple first initial parameters of the initial feature channel, and the watermark information is embedded into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters. A standard quantization step size is determined based on multiple second initial parameters of the initial feature channel. The second initial parameters of the remaining feature channels other than the initial feature channel are quantized based on the standard quantization step size to obtain the corresponding second target parameters. Based on the first target parameter and the second target parameter, the target model after the watermark information embedding and model quantization are obtained.
2. The method according to claim 1, characterized in that, The first initial parameter is determined through the following steps, the steps of which include: The multiple weight parameters of the initial feature channels are used as multiple first initial parameters that represent static invariance; or, Obtain sample input data for quantization training of the initial model, and use the product of the sample input data and each of the weight parameters as multiple first initial parameters representing dynamic changes.
3. The method according to claim 2, characterized in that, After obtaining the target model after completing the watermark information embedding and model quantization, the method further includes: Obtain the verification watermark parameters and verification quantization parameters corresponding to the sample input data; When the difference between the first target parameter and the verification watermark parameter is less than a preset first threshold, and the difference between the second target parameter and the verification quantization parameter is less than a preset second threshold, the quantization accuracy of the target model is determined to meet the standard.
4. The method according to claim 1, characterized in that, The determination of the watermark quantization step size based on multiple first initial parameters of the initial feature channel includes: Obtain the quantization range information of the initial model; From the plurality of first initial parameters of the initial feature channel, determine the first maximum / minimum parameter with the largest value and the second maximum / minimum parameter with the smallest value; Calculate the first parameter difference between the first extreme value parameter and the second extreme value parameter, and obtain the watermark quantization step size used to quantize the first initial parameter based on the ratio of the first parameter difference to the quantization range information.
5. The method according to claim 4, characterized in that, The step of embedding the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters includes: The watermark information is divided into multiple sub-watermark information, and the watermark quantization step size is updated based on the multiple sub-watermark information to obtain multiple updated quantization step sizes. For each of the first initial parameters, calculate the second parameter difference between the first initial parameter and the second maximum / minimum parameter, and determine the ratio between the second parameter difference and any of the update quantization steps as the sub-watermark model parameters obtained after embedding the watermark of the first initial parameter. The parameters of the multiple sub-watermark models obtained based on all the updated quantization step embeddings are determined to be the complete first target parameters.
6. The method according to claim 5, characterized in that, The step of updating the watermark quantization step size based on multiple sub-watermark information results in multiple updated quantization step sizes, including: The watermark quantization step size is amplified to obtain an amplified quantization step size, wherein the amplified quantization step size contains multiple original quantization information arranged sequentially from high bit to low bit. The sub-watermark information is processed by information conversion to obtain watermark quantization information; Clear the preset number of original quantization information bits at the low level of the amplified quantization step size, and replace the cleared original quantization information with the watermark quantization information to obtain the replacement amplified quantization step size; The updated quantization step size is obtained by scaling the replacement amplification quantization step size.
7. The method according to claim 6, characterized in that, The first target parameter includes a head parameter that represents the starting position of the first target parameter and a tail parameter that represents the ending position of the first target parameter; After embedding the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters, the method further includes: A preset start identifier is inserted before the header parameter, and the start identifier is used to identify the starting position of the first target parameter; A preset end identifier is inserted after the tail parameter, and the end identifier is used to identify the end position of the first target parameter.
8. The method according to claim 7, characterized in that, After obtaining the target model after completing the watermark information embedding and model quantization, the method further includes: Extract the encoding information one by one from the multiple model parameters after quantization; When the encoded information that is the same as the starting identifier information is extracted, the watermark information is extracted starting from the next model parameter; The extraction of the watermark information is completed when the encoded information that is the same as the end identifier information is extracted.
9. A watermark embedding device based on model quantization, characterized in that, The device includes: The acquisition module is used to acquire the initial model to be embedded with the watermark and the watermark information for embedding the initial model; The channel determination module is used to determine the channel smoothing coefficient corresponding to each feature channel in any processing layer of the initial model, and to determine the feature channels whose channel smoothing coefficient is less than a preset smoothing threshold as initial feature channels; The first target parameter determination module is used to determine the watermark quantization step size based on multiple first initial parameters of the initial feature channel, and to embed the watermark information into multiple first initial parameters based on the watermark quantization step size to obtain the corresponding first target parameters. The second target parameter determination module is used as a watermark model parameter determination module to determine a standard quantization step size based on multiple second initial parameters of the initial feature channel, and to quantize the second initial parameters of the feature channels other than the initial feature channel based on the standard quantization step size to obtain the corresponding second target parameters. The target quantization module is used to obtain the target model after the watermark information embedding and model quantization are completed, based on the first target parameter and the second target parameter.
10. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Logarithm quantization-based information hiding method, logarithm quantization-based information extraction method and related device
CN107977921A
Device for embedding electronic watermark information
JP2002304184A