Watermark model compression method and device, equipment and storage medium

The watermark embedding model constructed through model hierarchical pruning and teacher-teaching assistant-student knowledge distillation method solves the problem of excessive watermark model size in the existing technology, enables deployment on mobile devices, and improves the watermark embedding speed. and quality.

CN118709731APending Publication Date: 2024-09-27SOUTHERN UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410829120.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

Existing watermark embedding models based on deep neural networks are large and difficult to deploy on resource-constrained mobile devices.

Method used

Build a watermark embedding model through the model hierarchical pruning method and the knowledge distillation method based on teacher-teaching assistant-student, identify and remove redundant or unimportant parameters and channels, and design a student model with a simpler structure. Through the teacher model and teaching assistant The model trains the student model to improve performance.

Benefits of technology

The size of the watermark embedding model is significantly reduced, allowing it to be deployed in resource-constrained mobile devices while ensuring watermark quality and information extraction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709731A
    Figure CN118709731A
Patent Text Reader

Abstract

The invention discloses a watermark model compression method and device, equipment and a storage medium, and relates to the technical field of image processing, and the method comprises the steps: analyzing each network layer in a preset initial deep neural network model, and obtaining a key network layer; and based on the key network layer of the initial deep neural network model, the watermark embedding model is constructed through the model hierarchical pruning method and the teacher-assistant-student-based knowledge distillation method, the volume of the model can be compressed, and thus the watermark embedding model can be deployed in mobile equipment with limited resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a watermark model compression method, device, equipment and storage medium. Background Art

[0002] Currently, short videos and life sharing platforms are developing rapidly, and the number of self-media users is increasing. However, in the rapid expansion of self-media, copyright issues such as the theft and illegal recording of pictures and video content are becoming increasingly prominent. To deal with these copyright issues, digital watermarking technology has become a mainstream solution.

[0003] Currently, watermark embedding models based on deep neural networks (DNNs) are commonly used. However, existing watermark embedding models are large in size and difficult to deploy on resource-constrained mobile devices.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of this application is to provide a watermark model compression method, device, equipment and storage medium, aiming to solve the technical problem that the current watermark embedding model is large in size and difficult to deploy on resource-constrained mobile devices.

[0006] To achieve the above purpose, the present application proposes a watermark model compression method, the method comprising:

[0007] Analyze each network layer in the preset initial deep neural network model to obtain the key network layer;

[0008] Based on the key network layers of the initial deep neural network model, the watermark embedding model is constructed through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

[0009] In one embodiment, the step of constructing the watermark embedding model based on the key network layer of the initial deep neural network model by the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method comprises:

[0010] Obtain image data;

[0011] The image data is input into a pre-built watermark embedding model to obtain image data embedded with a watermark. The watermark embedding model is constructed by a model hierarchical pruning method and a teacher-assistant-student based knowledge distillation method.

[0012] In one embodiment, the step of analyzing each network layer in the preset initial deep neural network model to obtain the key network layer includes:

[0013] Protecting each network layer in the initial deep neural network model respectively;

[0014] Performing layered pruning on the unprotected network layers in the initial deep neural network model by using the pre-selected model layered pruning method to obtain a second deep neural network model;

[0015] Performing performance tests on several of the second deep neural network models to obtain performance test results;

[0016] The performance test results are analyzed to obtain the key network layer.

[0017] In one embodiment, the step of constructing the watermark embedding model based on the key network layer of the initial deep neural network model by using the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method includes:

[0018] Protecting key network layers of the initial deep neural network model;

[0019] Performing layered pruning on the unprotected network layers in the initial deep neural network model using the pre-selected model layered pruning method to obtain a third deep neural network model;

[0020] The watermark embedding model is constructed based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

[0021] In one embodiment, the step of pruning the unprotected network layer in the deep neural network model by a pre-selected pruning method to obtain a third deep neural network model includes:

[0022] The third deep neural network model is fine-tuned to restore the performance of the third deep neural network model.

[0023] The step of constructing the watermark embedding model based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method comprises:

[0024] The watermark embedding model is constructed based on the initial deep neural network model, the fine-tuned third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

[0025] In one embodiment, the step of constructing the watermark embedding model based on the initial deep neural network model, the fine-tuned third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method comprises:

[0026] Building a teaching assistant model and a student model based on the fine-tuned third deep neural network model;

[0027] The initial deep neural network model is used as a teacher model, and knowledge distillation is performed on the teaching assistant model through the teacher model;

[0028] Fine-tune the distilled teaching assistant model;

[0029] Distilling the student model through the fine-tuned teaching assistant model;

[0030] Fine-tune the distilled student model;

[0031] The fine-tuned student model is used as the watermark embedding model.

[0032] In one embodiment, the teaching assistant model and the student model are constructed based on the third deep neural network model;

[0033] Based on a preset first knowledge distillation rule, blocks and channels in the third deep neural network model are deleted to obtain the teaching assistant model;

[0034] Based on a preset second knowledge distillation rule, blocks and channels in the third deep neural network model are deleted to obtain the student model.

[0035] In addition, to achieve the above purpose, the present application also proposes a watermark model compression device, the watermark model compression device comprising:

[0036] The data analysis module is used to analyze each network layer in the preset initial deep neural network model to obtain the key network layer;

[0037] A model building module is used to construct the watermark embedding model based on the key network layer of the initial deep neural network model through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a watermark model compression device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the watermark model compression method described above.

[0039] In addition, to achieve the above purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the watermark model compression method described above are implemented.

[0040] One or more technical solutions proposed in this application have at least the following technical effects:

[0041] This application constructs a watermark embedding model through a model hierarchical pruning method and a knowledge distillation method based on a teacher-teaching assistant-student. The model hierarchical pruning method can achieve model compression by identifying and removing redundant or unimportant parameters and channels; through the knowledge distillation method, a student model with a simpler structure can be designed to compress the size of the model. Further, the student model can be trained through the teacher model and the teaching assistant model to improve the performance of the model. As a result, the size of the watermark embedding model constructed by the model hierarchical pruning method and the knowledge distillation method based on the teacher-teaching assistant-student is significantly reduced, and can be deployed in resource-constrained mobile devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0044] Figure 1 A schematic diagram of a flow chart provided for the first embodiment of the watermark model compression method of the present application;

[0045] Figure 2 A schematic diagram of the process of hierarchical pruning of the watermark model compression method of this application;

[0046] Figure 3 A schematic diagram of the process of constructing a teaching assistant model and a student model for the watermark model compression method of this application;

[0047] Figure 4 This is a schematic diagram of the module structure of the watermark model compression device according to an embodiment of the present application;

[0048] Figure 5 It is a schematic diagram of the device structure of the hardware operating environment involved in the watermark model compression method in the embodiment of the present application.

[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0052] The main solution of the embodiment of the present application is: to analyze each network layer in the preset initial deep neural network model to obtain the key network layer; based on the key network layer of the initial deep neural network model, the watermark embedding model is constructed by the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

[0053] In this embodiment, for the convenience of description, the following description is made by taking the watermark model compression device as the execution subject.

[0054] Digital watermarking technology is a method of embedding specific information in digital media, which can be divided into two categories: visible watermark and invisible watermark.

[0055] Visible watermarks add visible marks to images or videos; invisible watermarks embed information in an invisible way without affecting the visual quality of the original media.

[0056] Among invisible watermark technologies, the earliest one to appear is the least significant bit (LSB) technology, which encodes information on the lowest bit of digital media and is easy to detect; subsequently, frequency domain-based watermark technologies such as DWT (Discrete Wavelet Transform), DCT (Discrete Cosine Transform) and DFT (Discrete Fourier Transform) appeared one after another. These technologies perform well in watermark embedding effects, but fail to make full use of the information of the original media, limiting the quality of the digital media after embedding the watermark.

[0057] The watermark model based on deep neural network (DNN) is superior to other methods in terms of the quality of digital media after watermarking and the robustness of information extraction, and has outstanding performance on both pictures and videos.

[0058] For example, the MBRS (Enhancing Robustness of DNN-based Watermarking by Mini-Batch of Real and Simulated JPEG Compression) watermark model proposes a new training method for the noise caused by JPEG compression, and shows strong robustness under various image noise attacks.

[0059] In practical applications, considering the impact of watermark embedding on image and video quality, image and video watermarking based on deep neural networks is an ideal choice.

[0060] However, the DNN-based watermark model has a slow watermark embedding speed on mobile devices and a large model size, making it difficult to deploy on resource-constrained mobile devices.

[0061] Specifically, on small mobile devices such as mobile phones and tablets, digital watermark models based on deep neural networks are difficult to deploy due to the large size of the model; and the long watermark encoding time cannot meet the watermark encoding needs of mobile terminal users in real life.

[0062] This is mainly because the digital watermark model based on deep neural network has high spatial and temporal complexity.

[0063] Therefore, there is an urgent need to propose a compression method for the DNN watermark model to reduce the model size and improve performance to meet the deployment requirements on resource-constrained devices.

[0064] The present application provides a solution. The present application constructs a watermark embedding model through a model hierarchical pruning method and a knowledge distillation method based on a teacher-teaching assistant-student. The model hierarchical pruning method can achieve model compression by identifying and removing redundant or unimportant parameters and channels; through the knowledge distillation method, a student model with a simpler structure can be designed to compress the size of the model. Further, the student model can be trained through the teacher model and the teaching assistant model to improve the performance of the model. As a result, the volume of the watermark embedding model constructed by the model hierarchical pruning method and the knowledge distillation method based on the teacher-teaching assistant-student is significantly reduced, and can be deployed in resource-constrained mobile devices.

[0065] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a watermark model compression device, etc. The following takes the watermark model compression device as an example to illustrate this embodiment and the following embodiments.

[0066] Based on this, the embodiment of the present application provides a watermark model compression method, referring to Figure 1 , Figure 1 A flowchart diagram of the first embodiment of the watermark model compression method of the present application is provided.

[0067] In this embodiment, the watermark model compression method includes steps S10 and S20:

[0068] Step S10, analyzing each network layer in the preset initial deep neural network model to obtain the key network layer.

[0069] It should be noted that a neural network model usually consists of multiple network layers.

[0070] In order to compress the model more effectively and specifically, this application uses the model hierarchical pruning method to explore the importance of each network layer of the model, and applies the conclusions of the layer importance obtained by pruning to the student model design obtained by knowledge distillation.

[0071] Furthermore, the process of compressing the image and video watermark model in this application can be divided into: layer importance exploration, model layer pruning, and knowledge distillation.

[0072] Regarding the exploration of layer importance, due to the needs of practical applications, when pruning the original model, the pruning rate should be set higher to minimize the size of the model and speed up the watermark embedding speed of the model.

[0073] While setting a high pruning rate, it is important to maintain the performance of the model. Therefore, the balance between speed and performance can be achieved by protecting the important parts of the network layer (i.e., the key network layer) while pruning the non-important parts. Therefore, using the model layer pruning method, this application explores the importance of each network layer in the model to the quality of watermark embedding and obtains the key network layer.

[0074] Step S20, based on the key network layers of the initial deep neural network model, the watermark embedding model is constructed by the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

[0075] Specifically, the key network layer of the initial deep neural network model can be protected, and the unprotected network layer in the initial deep neural network model can be layered pruned by the pre-selected model layered pruning method to obtain a third deep neural network model, and the watermark embedding model is constructed based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

[0076] This embodiment explores the importance of different layers in the deep neural network model, that is, which network layers are crucial to the quality of the watermark image, and obtains the key network layers. Based on the key network layers, a watermark embedding model is constructed through a model hierarchical pruning method and a teacher-teaching assistant-student based knowledge distillation method. This can ensure the watermark quality as much as possible while compressing the model size.

[0077] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. On this basis, in step S20, based on the key network layer of the initial deep neural network model, after the watermark embedding model is constructed by the model hierarchical pruning method and the teacher-assistant-student knowledge distillation method, the watermark model compression method further includes steps S30 to S40:

[0078] Step S30, obtaining image data;

[0079] It should be noted that image materials include pictures, videos, etc.

[0080] Step S40, inputting the image data into a pre-constructed watermark embedding model to obtain image data embedded with a watermark, wherein the watermark embedding model is constructed by a model hierarchical pruning method and a teacher-assistant-student based knowledge distillation method.

[0081] It should be noted that currently, the commonly used methods for compressing deep neural network models include model layer pruning and knowledge distillation.

[0082] Among them, the model hierarchical pruning method achieves model compression by identifying and removing redundant or unimportant parameters and channels.

[0083] Specifically, an initial deep neural network model may be selected, and the initial deep neural network model may be pruned in layers to obtain a pruned initial deep neural network model.

[0084] It should be noted that knowledge distillation compresses the size of the model by imitating the original model and designing a student model with a simpler structure. Then, the original model is used as the teacher model to train the student model to improve the performance of the student model.

[0085] However, there is a problem with the traditional knowledge distillation method: when the size difference between the teacher model and the student model is large, the effect of using the teacher to train the student model will deteriorate. To address this problem, this application uses the TA (Teacher Assistant) model to make up for the difference between the teacher model and the student model.

[0086] Specifically, as an implementation method, the initial deep neural network model can be used as the teacher model, and the teaching assistant model and the student model can be constructed based on the initial deep neural network model. The teaching assistant model is obtained by distilling the teacher model, and the student model is obtained by distilling the teaching assistant model. Regardless of the size of the teaching assistant model, the distillation effect of using the teaching assistant model is better than directly distilling the teacher model to obtain the student model.

[0087] This embodiment provides a watermark model compression method. This application constructs a watermark embedding model through a model hierarchical pruning method and a knowledge distillation method based on a teacher-teaching assistant-student. The model hierarchical pruning method can achieve model compression by identifying and removing redundant or unimportant parameters and channels; through the knowledge distillation method, a student model with a simpler structure can be designed to compress the size of the model. Further, the student model can be trained through the teacher model and the teaching assistant model to improve the performance of the model. As a result, the size of the watermark embedding model constructed by the model hierarchical pruning method and the knowledge distillation method based on the teacher-teaching assistant-student is significantly reduced, and can be deployed in resource-constrained mobile devices.

[0088] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be repeated in the following. On this basis, step S10 analyzes each network layer in the preset initial deep neural network model, and obtains the key network layers including S11 to S14:

[0089] Step S11, protecting each network layer in the initial deep neural network model respectively;

[0090] Step S12, performing layered pruning on the unprotected network layers in the initial deep neural network model by using the pre-selected model layered pruning method to obtain a second deep neural network model;

[0091] Among them, the model layer pruning method may include but is not limited to the magnitude pruning method, the slimming pruning method, and the Taylor pruning method.

[0092] Among them, the amplitude pruning method evaluates the importance of channels based on the L1 / L2 norm of the weight matrix; the slimming pruning method uses the scaling parameters of the batch normalization layer as the evaluation criterion; and the Taylor pruning method evaluates the importance based on the impact of removing parameters or channels on the loss function.

[0093] Step S13, performing performance tests on a number of the second deep neural network models to obtain performance test results;

[0094] Step S14, analyzing the performance test results to obtain the key network layer.

[0095] It should be noted that this embodiment aims to find the key network layer through experiments.

[0096] During the model pruning process, we selected the method for model pruning and protected different network layers such as the message pre-layer separately to prevent them from being affected by the model layer pruning.

[0097] In this way, the importance of each network layer can be judged by observing the performance of the pruned model. If the performance of the pruned model is significantly better than that of the model with other network layers protected after a network layer is protected, then it can be preliminarily concluded that this network layer is more important. Otherwise, it means that the network layer is less important and can be pruned.

[0098] Specifically, as an implementation, the performance test result may be: the model performance is best when the message pre-layer message_pre_layer is protected, so it can be concluded that message_pre_layer is more important. Therefore, message_pre_layer is a key network layer.

[0099] In addition, the performance test results show that although the size of the model is significantly reduced after pruning, the time it takes to embed watermarks in the model is not significantly reduced. Therefore, it can be concluded that model layered pruning mainly reduces the width of the model, while the depth of the model is not significantly reduced.

[0100] This embodiment explores the importance of different layers in the deep neural network model, that is, which network layers are crucial to the quality of the watermark image, and obtains the key network layers. Based on the key network layers, a watermark embedding model is constructed through a model hierarchical pruning method and a teacher-teaching assistant-student based knowledge distillation method. This can ensure the watermark quality as much as possible while compressing the model size.

[0101] Based on the first embodiment of the present application, in the fourth embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above description, and will not be described in detail later. On this basis, step S20, based on the key network layer of the initial deep neural network model, the watermark embedding model is constructed by the model hierarchical pruning method and the teacher-assistant-student knowledge distillation method, including steps S21, S22, and S24:

[0102] Step S21, protecting the key network layer of the initial deep neural network model;

[0103] Among them, the key network layer can be protected by, but not limited to, the following methods:

[0104] (1) Parameter setting: During the parameter setting process of model pruning, the network layer that needs to be protected is set to “ignore”, that is, the network layer is not affected by model pruning.

[0105] (2) Regularization: By adding regularization terms (such as L1 regularization and L2 regularization), the weight changes of key network layers are limited to make them more stable during training.

[0106] (3) Weight fixing: The weights of key network layers are set to fixed values ​​so that they remain unchanged during training, thereby protecting the feature representation capabilities of these key layers.

[0107] Specifically, the message pre-layer message_pre_layer can be used as a key network layer to protect the message pre-layer of the initial deep neural network.

[0108] Step S22, performing layered pruning on the unprotected network layers in the initial deep neural network model by using the pre-selected model layered pruning method to obtain a third deep neural network model;

[0109] Specifically, the Taylor pruning method can be selected to perform layer-by-layer pruning on the unprotected network layers in the initial deep neural network, that is, to prune all layers including the image processor, the message first layer message_first_layer in the information processor, the convolutional layer and the decoder.

[0110] Reference Figure 2 , Figure 2 This is a flow chart of the hierarchical pruning process of the watermark model compression method of this application.

[0111] Among them, the cover image / video and the message are processed by the encoder to obtain the watermark image / video, and then the watermark image / video is input into the noise layer to obtain the noisy image, and the noisy image is processed by the decoder to obtain the decoded message.

[0112] Among them, the image processor in the encoder, the first layer message_first_layer in the information processor, and the convolutional layer are pruned.

[0113] Among them, all layers in the decoder are pruned. All layers in the decoder include ConvBNReLU (Convolutional Layer, Batch Normalization, Rectified Linear Unit, which is a common neural network layer structure) and SE Block (Squeeze, Excitation, which is a module used to enhance the channel attention mechanism in the neural network).

[0114] Step S24, constructing the watermark embedding model based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

[0115] Specifically, as an implementation method, a teaching assistant model and a student model can be constructed based on the third deep neural network model, with the initial deep neural network model as the teacher model, and the teaching assistant model is subjected to knowledge distillation through the teacher model, the teaching assistant model after distillation is fine-tuned, and the student model is distilled through the fine-tuned teaching assistant model; the student model after distillation is fine-tuned; and the fine-tuned student model is used as the watermark embedding model.

[0116] This embodiment is based on the analysis of the importance of different network layers in the model hierarchical pruning process, and further optimizes the model volume and watermark encoding speed through the model compression technology of knowledge distillation.

[0117] Based on the fourth embodiment of the present application, in the fifth embodiment of the present application, the same or similar contents as those in the fourth embodiment can be referred to the above description, and will not be described in detail later. On this basis, step S22, pruning the unprotected network layer in the deep neural network model by a pre-selected pruning method, and obtaining the third deep neural network model includes step S23:

[0118] Step S23, fine-tuning the third deep neural network model to restore the performance of the third deep neural network model.

[0119] It should be noted that after pruning, the performance of the model may decline, so the pruned third deep neural network model needs to be fine-tuned.

[0120] As an implementation method, the fine-tuning steps may be as follows:

[0121] (1) Prepare data. Make sure there are enough training data sets and validation data sets. The training data is used to fine-tune the model, and the validation data is used to evaluate the model performance.

[0122] (2) Initialize the optimizer. Select a suitable optimizer, such as Adam, SGD, etc. Usually, a smaller learning rate can be selected during fine-tuning to fine-tune the model.

[0123] (3) Set the learning rate. When fine-tuning, a smaller learning rate is usually used (for example, an order of magnitude lower than during original training). This helps to make subtle adjustments while maintaining the current model weights.

[0124] (4) Define the loss function. Select an appropriate loss function based on the specific task, such as cross entropy loss for classification tasks and mean square error loss for regression tasks.

[0125] (5) Training loop. Set the model to training mode and execute the training loop, including forward propagation, loss calculation, backpropagation, and weight update.

[0126] (6) Verify and monitor performance. After each training cycle, use the validation dataset to evaluate the performance of the model. If the validation performance does not improve significantly, consider adjusting the learning rate or terminating the training early.

[0127] (7) Save the best model. Based on the performance on the validation set, save the weights of the best performing model.

[0128] The step S24, constructing the watermark embedding model based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method, comprises:

[0129] Step S241, constructing the watermark embedding model based on the initial deep neural network model, the fine-tuned third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

[0130] Specifically, as an implementation method, a teaching assistant model and a student model can be constructed based on the fine-tuned third deep neural network model, with the initial deep neural network model as the teacher model, and the teaching assistant model is trained through the teacher model, the trained teaching assistant model is fine-tuned, and the student model is trained through the fine-tuned teaching assistant model; the trained student model is fine-tuned; and the fine-tuned student model is used as the watermark embedding model.

[0131] This embodiment can restore the performance of the third deep neural network model by fine-tuning the third deep neural network model, and can also provide a guarantee for the performance of the watermark embedding model subsequently constructed based on the fine-tuned third deep neural network model.

[0132] Based on the fifth embodiment of the present application, in the sixth embodiment of the present application, the same or similar contents as those in the fifth embodiment can be referred to the above description, and will not be described in detail later. On this basis, step S241, based on the initial deep neural network model, the fine-tuned third deep neural network model and the teacher-assistant-student knowledge distillation method, the watermark embedding model is constructed, including steps S2411 to S2416:

[0133] Step S2411, constructing a teaching assistant model and a student model based on the fine-tuned third deep neural network model;

[0134] Step S2412, using the initial deep neural network model as a teacher model, and performing knowledge distillation on the teaching assistant model through the teacher model;

[0135] Step S2413, fine-tuning the distilled teaching assistant model;

[0136] Step S2414, distilling the student model through the fine-tuned teaching assistant model;

[0137] Step S2415, fine-tuning the distilled student model;

[0138] Step S2416, using the fine-tuned student model as the watermark embedding model.

[0139] It should be noted that knowledge distillation aims to obtain a smaller student model with a customized structure. In this application, the design of the student model is achieved by utilizing the conclusions about the importance of layers (i.e., key network layers) obtained from the model layer pruning process. Since the key network layer plays a great role in the coding quality of watermark embedding, the key network layer is correspondingly enlarged in the student model, and other network layers are simplified as much as possible.

[0140] As an implementation, other network layers may be scaled down and key network layers may be scaled up.

[0141] As another implementation, other network layers may be scaled down while the key network layers remain unchanged.

[0142] As another implementation method, other network layers and the key network layer may be reduced, but the key network layer is still relatively large compared to other network layers.

[0143] For step S2411, the teaching assistant model and the student model are constructed based on the fine-tuned third deep neural network model. Figure 3 , Figure 3 A flowchart of constructing a teaching assistant model and a student model for the watermark model compression method of this application.

[0144] The process of building a teaching assistant model can be:

[0145] Among them, the cover picture / video and the message are input into the encoding layer to obtain the watermark picture / video, and then the watermark picture / video is input into the noise layer for processing to obtain the noisy picture / video, and the noisy picture / video is input into the decoding layer to obtain the decoded message.

[0146] Among them, the message pre-layer Message_pre_layer is reduced, and the message first layer Message_first_layer is also reduced. However, since the message pre-layer is a key network layer, the reduction of the message pre-layer is smaller than that of the message first layer, in order to highlight the importance of the message pre-layer in the entire model.

[0147] All network layers in the decoding layer are reduced in size. Specifically, the reduction in the network layer is achieved by reducing the number of blocks and channels in the network layer.

[0148] The process of building a student model is consistent with that of building an assistant model. The student model and assistant model have similar structures, but the number of blocks and channels in each network layer is different.

[0149] After constructing the teaching assistant model and the student model, it is necessary to perform knowledge distillation on the teaching assistant model through the teacher model, and then fine-tune the distilled teaching assistant model, distill the student model through the fine-tuned teaching assistant model, and then fine-tune the distilled student model.

[0150] It should be noted that the specific steps for fine-tuning the trained teaching assistant model and student model are as described in Example 6 of the present application.

[0151] In addition, as an implementation method, when performing knowledge distillation and fine-tuning, the distillation settings and fine-tuning settings of the teaching assistant model and the student model can be kept consistent.

[0152] This embodiment not only utilizes the teacher-teaching assistant-student based knowledge distillation method, but also improves the teacher-teaching assistant-student based knowledge distillation method using the conclusion of layer importance obtained by model pruning, thereby optimizing the model volume and watermark encoding speed.

[0153] Based on the sixth embodiment of the present application, in the seventh embodiment of the present application, the same or similar contents as those in the sixth embodiment can be referred to the above description, and will not be repeated in the following. On this basis, step S2411, constructing the teaching assistant model and the student model based on the fine-tuned third deep neural network model includes steps S24111 to S24112:

[0154] Step S24111, based on a preset first knowledge distillation rule, blocks and channels in the third deep neural network model are deleted to obtain the teaching assistant model;

[0155] Step S24112: based on the preset second knowledge distillation rule, blocks and channels in the third deep neural network model are deleted to obtain the student model.

[0156] Among them, since the constructed student model and teaching assistant model have similar structures, but the number of blocks and channels in each network layer is different, the first knowledge distillation rule and the second knowledge distillation rule can be set. Based on the first knowledge distillation rule, the blocks and channels in the third deep neural network model are deleted to obtain the teaching assistant model. Based on the second knowledge distillation rule, the blocks and channels in the third deep neural network model are deleted to obtain the student model.

[0157] As an implementation method, the first knowledge distillation rule can be weight-based pruning, that is, assigning weights to channels and blocks in the network layer and deleting channels and blocks with smaller weights. The second knowledge distillation rule can be structured pruning, that is, deleting channels and blocks with specific patterns.

[0158] As another implementation, the first knowledge distillation rule may be to subtract a first preset number of channels and blocks, and the second knowledge distillation rule may be to subtract a second preset number of channels and blocks, wherein the second preset number is twice the first preset number.

[0159] The present invention is not only applicable to watermark embedding processing of images, but also to watermark embedding processing of videos. The watermark embedding models of the two media are significantly compressed through this application. A series of experimental results show that the compressed model volume and watermark encoding time are greatly reduced, while ensuring the quality of the watermark and the accuracy of information extraction.

[0160] The experiment for this application is set up as follows:

[0161] (1) The image training dataset and image fine-tuning dataset are set to 10,000 images under RSI-CB128 (Remote Sensing Image Collection Benchmark 128, a remote sensing image dataset), and the image test dataset is set to 1,000 images under Places365-Standard (a dataset suitable for scene recognition tasks). The video training dataset and video fine-tuning dataset are set to 1,500 videos from the Kinetics-600 dataset (a large video action recognition dataset), and the video test dataset is set to 1,000 videos from the Kinetics-600 dataset.

[0162] (2) In this experiment, the image resolution is 128×128, the video resolution is 8×128×128, the watermark length used for testing the image watermark embedding model is 30 bits, and the watermark length used for testing the video watermark embedding model is 96 bits.

[0163] (3) The solution of this application is implemented through PyTorch and tested on NVIDIA A100 80GB to obtain the compressed image watermark embedding model and the compressed video watermark embedding model.

[0164] (4) Watermarks are embedded in the image test dataset using the original image watermark embedding model and the compressed image watermark embedding model, and the obtained image watermarks are evaluated; watermarks are embedded in the video test dataset using the original video watermark embedding model and the compressed video watermark embedding model, and the obtained video watermarks are evaluated.

[0165] Among them, there are four main indicators for evaluating watermarks. The following are the four indicators for evaluating watermarks:

[0166] (4.1) The robustness of the watermark can be obtained by comparing the difference between the original watermark information and the recovered watermark information, that is, the bit error rate (BER).

[0167] (4.2) The quality of the generated watermarked image / video, that is, the invisibility of the watermarking method, can be obtained by calculating the Peak Signal-to-Noise Ratio (PSNR) of the original image / video and the watermarked image / video.

[0168] (4.3) The watermark embedding speed of the model is obtained by calculating the encoding time through actual tests.

[0169] (4.4) Model size, obtained from the size of the compressed model.

[0170] Based on the above settings, the image / video watermark embedding model of this application is experimented, and the experimental results are as follows:

[0171] Experiments were conducted on the image watermark embedding model: after compression, the model size of the image watermark embedding model was reduced from 23.43MB to 1.53MB, and the watermark embedding time was reduced from 5.76ms to 2.17ms. Table 1 below shows the bit error rate BER (peak signal-to-noise ratio PSNR = 31.06) of the image watermark embedding model under different noise attacks:

[0172]

[0173] Table 1

[0174] Among them, the following is an introduction to image noise:

[0175] Identity: Do not do any processing on the watermark image.

[0176] Cropout (0.3): Randomly select a rectangular area in the watermark image, replace the pixels outside the rectangular area with the pixels at the corresponding position in the original image, and the size of the rectangular area is 30% of the watermark image size.

[0177] Dropout (0.3): Each pixel in the watermark image is replaced with the pixel at the corresponding position in the original watermark image with a probability of 70%.

[0178] Crop(0.16): Randomly select a rectangular area in the watermark image, set the pixel values ​​outside the rectangular area to 0, and the size of the rectangular area is 16% of the watermark image size.

[0179] Gassian Filter (2): Perform Gaussian filtering on the watermark image, and the σ value in the Gaussian filter function is 2.

[0180] JPEG(50): Perform JPEG compression on the watermark image, and the quality factor in the JPEG compression algorithm is 50.

[0181] Experiments were conducted on the video watermark embedding model: after compression, the model size of the video watermark embedding model was reduced from 23.66MB to 6.07MB, and the watermark embedding time was reduced from 7.33ms to 4.16ms. Table 2 below shows the BER (PSNR = 35.75) of the video watermark embedding model under different noise attacks:

[0182]

[0183] Table 2

[0184] Among them, the following is an introduction to video noise:

[0185] Identity: Do not do any processing on the watermarked video.

[0186] H264 (CRF=22): The most commonly used video compression encoding format. The compression rate can be adjusted by the CRF parameter. The CRF value range is 0 to 51. The larger the CRF value, the greater the compression rate. The CRF value used in the experiment is 22.

[0187] Gaussian Noise (0.05): Add Gaussian white noise to the video. The intensity of Gaussian noise can be adjusted by the standard deviation. The standard deviation of Gaussian noise used in the experiment is 0.05.

[0188] Gaussian Filter (2.0): Adds a Gaussian blur effect to the video. The strength of the Gaussian filter can be adjusted by the variance. The variance of the Gaussian filter used in the experiment is 2.

[0189] Frame Swap (p=0.5): replace the current video frame with another frame in the video with probability p. The probability p used in the experiment is 50%.

[0190] Frame Average (N=3): Replace the current frame with the average of the current frame and the two frames before and after it.

[0191] Frame Drop (p=0.5): Replace the video frames in the watermarked video with the corresponding video frames in the original video with probability p. The probability p used in the experiment is 50%.

[0192] Crop (p = 0.4): Crop the video frame and only keep the pixel values ​​with a ratio of p. In the experiment, p is 40%.

[0193] Hue(0.3): Change the video hue, the range of change is -0.3 to 0.3.

[0194] In addition, this experiment also tested the robustness of the compressed image / video watermark embedding model under software screen recording attacks. This experiment selected 20 videos from the Kinetics dataset for anti-software screen recording tests. A common screen recording software OBS Studio was used to record the video with default parameters. The results showed that under the attack of the screen recording software, the BER of the compressed model was 1.74%.

[0195] From the experimental results of the image and video watermark embedding models, it can be seen that for both image and video media, the BER of the compressed watermark embedding model does not exceed 5% under various noise attacks, and the watermark embedding time and model size are greatly reduced, and the PSNR is maintained above 30.

[0196] Therefore, the experimental results show that the method of the present application significantly reduces the volume of image and video watermark embedding models and greatly improves the speed of watermark encoding.

[0197] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the watermark model compression method of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.

[0198] This application also provides a watermark model compression device, please refer to Figure 4 , the watermark model compression device comprises:

[0199] The data analysis module 10 is used to analyze each network layer in the preset initial deep neural network model to obtain the key network layer;

[0200] The model construction module 20 is used to construct the watermark embedding model based on the key network layer of the initial deep neural network model through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

[0201] The watermark model compression device provided by the present application adopts the watermark model compression method in the above embodiment, which can solve the technical problem that the current watermark embedding model is large in size and difficult to deploy on resource-constrained mobile devices. Compared with the prior art, the beneficial effects of the watermark model compression device provided by the present application are the same as the beneficial effects of the watermark model compression method provided by the above embodiment, and other technical features in the watermark model compression device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0202] The present application provides a watermark model compression device, which includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the watermark model compression method in the above-mentioned embodiment 1.

[0203] Reference below Figure 5, which shows a schematic diagram of the structure of a watermark model compression device suitable for implementing the embodiment of the present application. The watermark model compression device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The watermark model compression device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0204] like Figure 5 As shown, the watermark model compression device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM) 1004. In RAM 1004, various programs and data required for the operation of the watermark model compression device are also stored. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the watermark model compression device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a watermark model compression device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0205] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0206] The watermark model compression device provided by the present application adopts the watermark model compression method in the above embodiment, which can solve the technical problem that the current watermark embedding model is large in size and difficult to deploy on resource-constrained mobile devices. Compared with the prior art, the beneficial effects of the watermark model compression device provided by the present application are the same as the beneficial effects of the watermark model compression method provided by the above embodiment, and the other technical features in the watermark model compression device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0207] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0208] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present 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.

[0209] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the watermark model compression method in the above embodiment.

[0210] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0211] The computer-readable storage medium may be included in the watermark model compression device; or may exist independently without being assembled into the watermark model compression device.

[0212] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the watermark model compression device, the watermark model compression device: analyzes each network layer in the preset initial deep neural network model to obtain the key network layer; based on the key network layer of the initial deep neural network model, the watermark embedding model is constructed through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

[0213] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0214] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0215] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0216] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned watermark model compression method, and can solve the technical problem that the current watermark embedding model is large in size and difficult to deploy on resource-constrained mobile devices. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the watermark model compression method provided by the above-mentioned embodiment, and will not be repeated here.

[0217] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A watermark model compression method, characterized in that: The method comprises: Analyze each network layer in the preset initial deep neural network model to obtain the key network layer; Based on the key network layers of the initial deep neural network model, the watermark embedding model is constructed through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

2. The method according to claim 1, characterized in that The step of constructing the watermark embedding model based on the key network layer of the initial deep neural network model by the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method comprises: Obtain image data; The image data is input into a pre-built watermark embedding model to obtain image data embedded with a watermark. The watermark embedding model is constructed by a model hierarchical pruning method and a teacher-assistant-student based knowledge distillation method.

3. The method according to claim 1, characterized in that The step of analyzing each network layer in the preset initial deep neural network model to obtain the key network layer includes: Protecting each network layer in the initial deep neural network model respectively; Performing layered pruning on the unprotected network layers in the initial deep neural network model by using the pre-selected model layered pruning method to obtain a second deep neural network model; Performing performance tests on several of the second deep neural network models to obtain performance test results; The performance test results are analyzed to obtain the key network layer.

4. The method according to claim 1, characterized in that The step of constructing the watermark embedding model based on the key network layer of the initial deep neural network model through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method comprises: Protecting key network layers of the initial deep neural network model; Performing layered pruning on the unprotected network layers in the initial deep neural network model using the pre-selected model layered pruning method to obtain a third deep neural network model; The watermark embedding model is constructed based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

5. The method according to claim 4, characterized in that The step of pruning the unprotected network layers in the deep neural network model by a pre-selected pruning method to obtain a third deep neural network model includes: Fine-tuning the third deep neural network model to restore the performance of the third deep neural network model; The step of constructing the watermark embedding model based on the initial deep neural network model, the third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method comprises: The watermark embedding model is constructed based on the initial deep neural network model, the fine-tuned third deep neural network model and the teacher-teaching assistant-student based knowledge distillation method.

6. The method according to claim 5, characterized in that The step of constructing the watermark embedding model based on the initial deep neural network model, the fine-tuned third deep neural network model and the teacher-assistant-student based knowledge distillation method comprises: Building a teaching assistant model and a student model based on the fine-tuned third deep neural network model; The initial deep neural network model is used as a teacher model, and knowledge distillation is performed on the teaching assistant model through the teacher model; Fine-tune the distilled teaching assistant model; Distilling the student model through the fine-tuned teaching assistant model; Fine-tune the distilled student model; The fine-tuned student model is used as the watermark embedding model.

7. The method according to claim 6, characterized in that Constructing a teaching assistant model and a student model based on the third deep neural network model; Based on a preset first knowledge distillation rule, blocks and channels in the third deep neural network model are deleted to obtain the teaching assistant model; Based on a preset second knowledge distillation rule, blocks and channels in the third deep neural network model are deleted to obtain the student model.

8. A watermark model compression device, characterized in that: The device comprises: The data analysis module is used to analyze each network layer in the preset initial deep neural network model to obtain the key network layer; A model building module is used to construct the watermark embedding model based on the key network layer of the initial deep neural network model through the model hierarchical pruning method and the teacher-teaching assistant-student based knowledge distillation method.

9. A watermark model compression device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the watermark model compression method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the watermark model compression method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Robust watermark attack method and system based on neural network

    CN115345768A

  • Detection network lightweight method combining progressive guide distillation and structure reconstruction

    CN117557857A