Model adversarial training method and device based on dynamic low-dimensional subspace

Through the construction and updating of dynamic low-dimensional subspaces, the problem of poor robustness in existing model training is solved, the defense capabilities of adversarial samples and the stability of the model are improved, and efficient training effects under adversarial attacks are achieved.

CN118587532AActive Publication Date: 2024-09-03GUANGDONG UNIV OF TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410861178.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-03
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

Existing model training methods based on adversarial examples result in poor model robustness. Especially when faced with carefully designed small perturbations, the accuracy of the model is prone to drop sharply, making it difficult to defend against adversarial attacks.

Method used

A model adversarial training method based on dynamic low-dimensional subspace is adopted. By obtaining the adversarial image training set, the dynamic low-dimensional subspace is constructed and updated, and the model parameters are adjusted in real time to improve the robustness of the model. Specific steps include conventional adversarial training of adversarial image training sets, construction and updating of dynamic low-dimensional subspaces, optimization and updating of model gradients, ensuring that dynamic low-dimensional subspaces are regularly updated during training.

Benefits of technology

It improves the robustness of the model and the timing of adversarial training, prevents catastrophic overfitting, enhances the stability and reliability of the model in the face of potential threats, and improves the defense capabilities of adversarial samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587532A
    Figure CN118587532A
Patent Text Reader

Abstract

The invention discloses a model adversarial training method and device based on a dynamic low-dimensional subspace, and the method comprises the steps: constructing the dynamic low-dimensional subspace according to a model parameter training track, and determining a model gradient according to an adversarial image training set through a deep neural network model and a preset minimization loss function; updating the second intermediate deep neural network model, determining a third intermediate deep neural network model and a corresponding third intermediate model parameter, and carrying out real-time statistics on a current subspace updating moment; if the current subspace updating moment meets the preset subspace updating condition, updating the dynamic low-dimensional subspace by adopting a third intermediate model parameter, and determining a new dynamic low-dimensional subspace; performing model training according to the new dynamic low-dimensional subspace, and determining a target deep neural network model; the technical problem that the robustness of the model is poor due to an existing adversarial sample-based model training method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a model adversarial training method and device based on dynamic low-dimensional subspace. Background Art

[0002] In recent years, artificial intelligence technology with deep learning as its core has achieved excellent results in computer vision and speech recognition. Especially in the field of computer vision, deep neural networks represented by convolutional neural networks are widely used in practical scenarios.

[0003] However, some researchers have found that although the current deep learning model can achieve very high accuracy in image classification tasks, it is very easy to be misled by carefully designed small perturbations, which causes the accuracy of the model to drop sharply, achieving the purpose of deceiving the deep learning model. This small perturbation that is basically imperceptible to the human eye is called an adversarial perturbation. Adding adversarial perturbations to clean samples is called an adversarial sample. It can be seen that the existence of adversarial samples brings great security risks to the actual implementation of deep learning models, especially for application scenarios with high security requirements, such as face ticket inspection, face payment, autonomous driving, etc.

[0004] Most existing model training methods based on adversarial samples limit single-step adversarial training to a specific subspace to control the rapid growth of the gradient norm. However, the low-dimensional subspace on which this process relies has not been adjusted after the first setting, showing low temporal consistency and resulting in poor model robustness. Summary of the invention

[0005] The present invention provides a model adversarial training method and device based on dynamic low-dimensional subspace, which are used to solve the technical problem that the existing model training method based on adversarial samples leads to poor model robustness.

[0006] A model adversarial training method based on dynamic low-dimensional subspace provided by the first aspect of the present invention, including:

[0007] Obtain an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model;

[0008] According to the model parameter training trajectory, dynamic low-dimensional subspace is constructed, and the model parameters of the first intermediate deep neural network model are backtracked to determine the second intermediate deep neural network model;

[0009] The second intermediate deep neural network model and the preset minimization loss function are used to determine the model gradient based on the adversarial image training set;

[0010] The second intermediate deep neural network model is updated using the model gradient and the dynamic low-dimensional subspace, a third intermediate deep neural network model and corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time;

[0011] Determine whether the current subspace update time meets the preset subspace update conditions;

[0012] If the current subspace update time meets the preset subspace update condition, the dynamic low-dimensional subspace is updated using the third intermediate model parameter to determine a new dynamic low-dimensional subspace;

[0013] The third intermediate deep neural network model is modeled using the new dynamic low-dimensional subspace and the adversarial image training set to determine the target deep neural network model.

[0014] Optionally, the step of inputting the adversarial image training set into a preset deep neural network model for conventional adversarial training and determining a model parameter training trajectory and a first intermediate deep neural network model comprises:

[0015] The adversarial image training set is divided and multiple adversarial image training subsets are determined;

[0016] Based on the preset minimization loss function, each of the adversarial image training subsets is sequentially input into the preset deep neural network model to update model parameters, and determine a plurality of first model parameters and an initial deep neural network model;

[0017] Sampling a plurality of the first model parameters, outputting a plurality of initial model parameters, and counting the number of first model training times in real time;

[0018] It is determined whether the number of training times of the first model reaches the preset first training times threshold;

[0019] If so, the model parameter training trajectory is constructed using each of the initial model parameters, and the initial deep neural network model is used as the first intermediate deep neural network model.

[0020] Optionally, the step of constructing a dynamic low-dimensional subspace according to the model parameter training trajectory includes:

[0021] The training trajectory of the model parameter is centralized and the training trajectory of the centralized model parameter is determined;

[0022] Spectral decomposition of the centralized model parameter training trajectory is performed to determine multiple eigenvalues;

[0023] Substitute each of the said eigenvalue into the preset linear equations to calculate the eigenvectors corresponding to each of the said eigenvalue;

[0024] Take each of the said eigenvalue as the corresponding singular value, and take the eigenvectors corresponding to each of the said eigenvalue as singular value vectors;

[0025] Sort each of the said singular values in descending order, and select the top preset number of singular values as target singular values;

[0026] Construct a dynamic low-dimensional subspace using each of the said target singular values and the corresponding singular value vectors.

[0027] Optionally, the step of determining the model gradient by using the second intermediate deep neural network model and the preset minimization loss function according to the adversarial image training set includes:

[0028] Input the adversarial image training set into the second intermediate deep neural network model for prediction to output a model prediction result;

[0029] Substitute the model prediction result into the preset minimization loss function and take the derivative to determine the model gradient.

[0030] Optionally, the step of updating the second intermediate deep neural network model by using the model gradient and the dynamic low-dimensional subspace to determine the third intermediate deep neural network model and the corresponding third intermediate model parameters includes:

[0031] Project the model gradient onto the dynamic low-dimensional subspace to determine a subspace gradient;

[0032] Optimize the model parameters of the second intermediate deep neural network model by using the subspace gradient and a preset learning rate to determine the third intermediate deep neural network model and the third intermediate model parameters corresponding to the third intermediate deep neural network model.

[0033] Optionally, the step of updating the dynamic low-dimensional subspace by using the third intermediate model parameters to determine a new dynamic low-dimensional subspace includes:

[0034] Sample the third intermediate model parameters and the historical moment model parameter set to determine a plurality of subspace model parameters;

[0035] Construct a subspace model parameter training trajectory by using each of the said subspace model parameters;

[0036] Insert the subspace model parameter training trajectory into the model parameter training trajectory to determine a new model parameter training trajectory;

[0037] Construct a new dynamic low-dimensional subspace according to the new model parameter training trajectory.

[0038] Optionally, the step of using the new dynamic low-dimensional subspace and the adversarial image training set to perform model training on the third intermediate deep neural network model to determine a target deep neural network model includes:

[0039] Using the third intermediate deep neural network model and the preset minimization loss function to calculate the target loss value according to the adversarial image training set, and counting the number of second model training times in real time;

[0040] Determine whether the target loss value converges or whether the second model training times reaches a preset second training times threshold;

[0041] If the target loss value reaches convergence or the second model training times reaches a preset second training times threshold, the third intermediate deep neural network model is used as the target deep neural network model;

[0042] If the target loss value does not reach convergence and the second model training times do not reach the preset second training times threshold, then using the third intermediate deep neural network model and the preset minimization loss function to determine a new model gradient according to the adversarial image training set;

[0043] Optimizing model parameters of the third intermediate deep neural network model using the new model gradient and the new dynamic low-dimensional subspace to determine a new third intermediate deep neural network model;

[0044] The preset minimization loss function and the new third intermediate deep neural network model are used to calculate the target loss value according to the adversarial image training set, and the number of second model training times is counted in real time; until the target loss value converges or the number of second model training times reaches a preset second training times threshold;

[0045] A new third intermediate deep neural network model determined when the target loss value converges or the second model training times reaches a preset second training times threshold is used as the target deep neural network model.

[0046] A second aspect of the present invention provides a model adversarial training device based on a dynamic low-dimensional subspace, comprising:

[0047] An acquisition module is used to acquire an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model;

[0048] According to the module, it is used to construct a dynamic low-dimensional subspace according to the model parameter training trajectory, and backtrack the model parameters of the first intermediate deep neural network model to determine the second intermediate deep neural network model;

[0049] An adopting module, configured to adopt the second intermediate deep neural network model and a preset minimization loss function to determine a model gradient according to the adversarial image training set;

[0050] An updating module, configured to update the second intermediate deep neural network model using the model gradient and the dynamic low-dimensional subspace, determine a third intermediate deep neural network model and corresponding third intermediate model parameters, and count the current subspace update time in real time;

[0051] A judging module, used to judge whether the current subspace updating moment meets the preset subspace updating condition;

[0052] A determination module, configured to update the dynamic low-dimensional subspace using the third intermediate model parameter to determine a new dynamic low-dimensional subspace if the current subspace update moment meets the preset subspace update condition;

[0053] A target module is used to perform model training on the third intermediate deep neural network model using the new dynamic low-dimensional subspace and the adversarial image training set to determine a target deep neural network model.

[0054] A third aspect of the present invention provides a computer device, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the model adversarial training method based on dynamic low-dimensional subspace as described in any one of the above items.

[0055] The fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the model adversarial training method based on dynamic low-dimensional subspace as described in any one of the above items are implemented.

[0056] It can be seen from the above technical solutions that the present invention has the following advantages:

[0057] The above technical scheme of the present invention provides a model adversarial training method based on dynamic low-dimensional subspace, firstly, an adversarial image training set is obtained, and the adversarial image training set is input into a preset deep neural network model for conventional adversarial training, and the model parameter training trajectory and the first intermediate deep neural network model are determined; then, a dynamic low-dimensional subspace is constructed according to the model parameter training trajectory, and the model parameters of the first intermediate deep neural network model are back-traced to determine the second intermediate deep neural network model; the second intermediate deep neural network model and the preset minimization loss function are used to determine the model gradient according to the adversarial image training set; the second intermediate deep neural network model is updated using the model gradient and the dynamic low-dimensional subspace, the third intermediate deep neural network model and the corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time; the current subspace is judged Whether the update time meets the preset subspace update conditions; if the current subspace update time meets the preset subspace update conditions, the third intermediate model parameters are used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace; finally, the new dynamic low-dimensional subspace and the adversarial image training set are used to train the third intermediate deep neural network model to determine the target deep neural network model; based on the above scheme, while the second intermediate deep neural network model is updated by the target loss value and the dynamic low-dimensional subspace, the third intermediate model parameters are used to update the dynamic low-dimensional subspace based on the current subspace update time and the preset subspace update conditions to determine a new dynamic low-dimensional subspace. This process will regularly update the dynamic low-dimensional subspace during model training, thereby improving the timing of the low-dimensional subspace and further improving the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0059] Figure 1 A flowchart of the steps of a model adversarial training method based on a dynamic low-dimensional subspace provided by an embodiment of the present invention;

[0060] Figure 2 A flowchart of another model adversarial training method based on dynamic low-dimensional subspace provided by an embodiment of the present invention;

[0061] Figure 3 A schematic diagram of a flow chart of a model adversarial training method based on a dynamic low-dimensional subspace provided in an embodiment of the present invention;

[0062] Figure 4 A schematic diagram of a gradient-based adversarial attack process provided by an embodiment of the present invention;

[0063] Figure 5 A schematic diagram of the process of adversarial training provided by an embodiment of the present invention;

[0064] Figure 6 A structural block diagram of a model adversarial training device based on dynamic low-dimensional subspace provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The embodiments of the present invention provide a model adversarial training method and device based on a dynamic low-dimensional subspace, which are used to solve the technical problem that the existing model training method based on adversarial samples leads to poor robustness of the model.

[0066] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0067] See also Figure 1 , Figure 1 A flowchart of the steps of a model adversarial training method based on a dynamic low-dimensional subspace provided in an embodiment of the present invention.

[0068] The present invention provides a model adversarial training method based on dynamic low-dimensional subspace, comprising:

[0069] Step 101: Obtain an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model.

[0070] The adversarial image training set is training data obtained after the image dataset is sequentially divided, data enhanced, and processed by adversarial attacks, wherein the image dataset may be image datasets such as cifar10 (Canadian Institute for Advanced Research 10) / cifar100 (Canadian Institute For Advanced Research 100).

[0071] Specifically, the adversarial image training set is divided to determine multiple adversarial image training subsets; based on a preset minimization loss function, each adversarial image training subset is sequentially input into a preset deep neural network model to update model parameters, and multiple first model parameters and an initial deep neural network model are determined; multiple first model parameters are sampled, multiple initial model parameters are output, and the number of model training times is counted in real time; it is determined whether the number of model training times reaches a preset training number threshold; if so, each initial model parameter is used to construct a model parameter training trajectory And the initial deep neural network model is used as the first intermediate deep neural network model, where, is the model parameter under the first sampling, is the model parameter under the second sampling, is the model parameter under the tth sampling, t is the number of samplings, and the preset minimization loss function is as follows:

[0072]

[0073] Where L is the cross entropy function; f(x adv ,w) is the prediction result output by the deep neural network model; x adv is the adversarial image (adversarial sample); w is the model parameter of the deep neural network model; y is the label corresponding to the clean sample (clean image); f is the deep neural network model; Z is the loss value corresponding to the adversarial image.

[0074] For example, assuming that the preset training times threshold is 65, the sampling strategy is to sample twice for each model training epoch, and finally when the conventional adversarial training of the model stops, the model parameter training trajectory can be obtained.

[0075] In this embodiment, an adversarial image training set is obtained, and the adversarial image training set is input into a preset deep neural network model for conventional adversarial training to determine a model parameter training trajectory and a first intermediate deep neural network model.

[0076] Step 102: construct a dynamic low-dimensional subspace according to the model parameter training trajectory, and backtrack the model parameters of the first intermediate deep neural network model to determine the second intermediate deep neural network model.

[0077] Specifically, the model parameter training trajectory is centralized to determine the centralized model parameter training trajectory. The centralization process is as follows:

[0078]

[0079] in, is the centralized model parameter; t is the number of sampling times; is the model parameter at the tth sampling.

[0080] Furthermore, the centralized model parameter training trajectory is spectrally decomposed to determine multiple eigenvalues, wherein the spectral decomposition process is specifically as follows:

[0081]

[0082] Among them, det is the matrix calculation function; T is the transpose; is the centralized model parameter training trajectory; λ is the eigenvalue; I is the unit matrix.

[0083] Furthermore, each eigenvalue is substituted into a preset linear equation system to calculate the eigenvector corresponding to each eigenvalue, wherein the preset linear equation system is specifically:

[0084]

[0085] Among them, T is the transpose; is the centralized model parameter training trajectory; λ is the eigenvalue; I is the unit matrix; v is the eigenvector.

[0086] Furthermore, the eigenvalues ​​are taken as singular values, that is, let λ = σ 2 , take the eigenvector corresponding to each eigenvalue as the singular value vector, sort each singular value in descending order, and select the singular value of the first preset number d as the target singular value Get the singular value vector [v1,v2,…,v d ], using each target singular value and the corresponding singular value vector to construct a dynamic low-dimensional subspace. Specifically, each target singular value and the corresponding singular value vector are substituted into the low-dimensional subspace orthogonal basis calculation formula to obtain multiple low-dimensional subspace orthogonal bases. The low-dimensional subspace P = [u1, u2, ..., u d ]; Among them, the low-dimensional subspace orthogonal basis operation formula is specifically:

[0087]

[0088] Among them, u i is the orthogonal basis of the i-th low-dimensional subspace; σ i is the i-th target singular value; is the centralized model parameter training trajectory; v i is the singular value vector corresponding to the i-th target singular value.

[0089] Furthermore, the model parameters of the first intermediate deep neural network model are backtracked to determine the second intermediate deep neural network model. Specifically, the model parameters of the first intermediate deep neural network model are replaced by the model parameters obtained by the first sampling in the model parameter training trajectory obtained through the above steps, thereby completing the update of the model parameters of the first intermediate deep neural network model and obtaining the second intermediate deep neural network model, that is, Among them, w0 is the model parameter of the second intermediate deep neural network model, It is the model parameter obtained under the first sampling in the model parameter training trajectory.

[0090] In this embodiment, a dynamic low-dimensional subspace is constructed according to the model parameter training trajectory, and the model parameters of the first intermediate deep neural network model are backtracked to determine the second intermediate deep neural network model.

[0091] Step 103: Use the second intermediate deep neural network model and the preset minimization loss function to determine the model gradient according to the adversarial image training set.

[0092] Specifically, the adversarial image training set is input into the second intermediate deep neural network model for prediction, and the model prediction result is output; the model prediction result is substituted into the preset minimization loss function and derived to determine the model gradient; wherein the model gradient processing process is specifically as follows:

[0093]

[0094] in, is the model gradient when the number of training times is k; n is the number of adversarial image data in the adversarial image training subset, that is, the batch size; L is the cross entropy function; is the prediction result output by the deep neural network model when the number of training times is k; is the i-th adversarial image data (adversarial sample) in the adversarial image training subset; w k is the model parameter of the deep neural network model when the number of training times is k; y is the label corresponding to the clean sample; f is the deep neural network model.

[0095] In this embodiment, a second intermediate deep neural network model and a preset minimization loss function are used to determine the model gradient based on the adversarial image training set.

[0096] Step 104: Use model gradient and dynamic low-dimensional subspace to update the second intermediate deep neural network model, determine the third intermediate deep neural network model and the corresponding third intermediate model parameters, and count the current subspace update time in real time.

[0097] It should be noted that the model gradient Project to dynamic low-dimensional subspace and determine subspace gradient Subspace gradient The model parameters of the second intermediate deep neural network model are optimized with a preset learning rate α to determine the third intermediate deep neural network model and the third intermediate model parameters corresponding to the third intermediate deep neural network model, wherein the subspace gradient The optimization process of the model parameters of the deep neural network model with the preset learning rate α is as follows:

[0098]

[0099] Among them, w k+1 is the model parameter of the deep neural network model when the number of training times is k+1, that is, the model parameter optimized based on the subspace gradient and the preset learning rate; w k is a model parameter of the deep neural network model when the number of training times is k; α is a preset learning rate, which is set as needed, for example, it can be set to 0.1, and the present invention is not limited thereto; P is a dynamic low-dimensional subspace; is the subspace gradient.

[0100] In this embodiment, the model gradient and dynamic low-dimensional subspace are used to update the second intermediate deep neural network model, the third intermediate deep neural network model and the corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time.

[0101] Step 105: Determine whether the current subspace update time meets the preset subspace update condition.

[0102] It should be noted that the preset subspace update condition is that if the time interval between the current subspace update moment and the moment when the previous current subspace update moment meets the preset subspace update condition reaches the preset time interval, it indicates that the current subspace update moment meets the preset subspace update condition; if the time interval between the current subspace update moment and the moment when the previous current subspace update moment meets the preset subspace update condition does not reach the preset time interval, it indicates that the current subspace update moment does not meet the preset subspace update condition; among which, if the moment when the current subspace update moment meets the preset subspace update condition is the first moment when the preset subspace update condition is met, then the moment when the previous current subspace update moment meets the preset subspace update condition is the moment when the model parameter training trajectory is obtained based on conventional adversarial training and the dynamic low-dimensional subspace is constructed.

[0103] In this embodiment, it is determined whether the current subspace update time meets the preset subspace update condition.

[0104] Step 106: If the current subspace update time meets the preset subspace update condition, the third intermediate model parameter is used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace.

[0105] Specifically, the third intermediate model parameter and the historical moment model parameter set are sampled to determine multiple subspace model parameters, wherein the historical moment model parameter set includes multiple historical moment model parameters, and the historical moment model parameters are model parameters retained between the moment when the last current subspace update moment meets the preset subspace update condition and the moment when the current subspace update moment meets the preset subspace update condition, after the model parameters of the deep neural network model are updated based on the dynamic low-dimensional subspace; if the moment when the current subspace update moment meets the preset subspace update condition is the first moment when the preset subspace update condition is met, then the moment when the model parameter training trajectory is obtained based on conventional adversarial training and the dynamic low-dimensional subspace is constructed is used as the moment when the last current subspace update moment meets the preset subspace update condition.

[0106] Furthermore, each subspace model parameter is used to construct a subspace model parameter training trajectory; the subspace model parameter training trajectory is inserted into the model parameter training trajectory, that is, the sampled model parameter trajectory is added to the original model parameter trajectory of the conventional adversarial training to obtain a new model parameter training trajectory; a new dynamic low-dimensional subspace is constructed according to the new model parameter training trajectory; wherein, the construction principle of constructing a new dynamic low-dimensional subspace according to the new model parameter training trajectory is consistent with the construction principle of step 102, and will not be elaborated here.

[0107] In this embodiment, if the current subspace update time meets the preset subspace update condition, the third intermediate model parameter is used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace.

[0108] Step 107: Use the new dynamic low-dimensional subspace and the adversarial image training set to perform model training on the third intermediate deep neural network model to determine the target deep neural network model.

[0109] Specifically, a third intermediate deep neural network model and a preset minimization loss function are used to calculate the target loss value according to the adversarial image training set, and the number of second model training times is counted in real time to determine whether the target loss value converges or whether the second model training times reaches the preset second training times threshold; if the target loss value converges or the second model training times reaches the preset second training times threshold, the third intermediate deep neural network model is used as the target deep neural network model; if the target loss value does not converge and the second model training times does not reach the preset second training times threshold, the third intermediate deep neural network model and the preset minimization loss function are used to train the adversarial image set. training set, determine the new model gradient, use the new model gradient and the new dynamic low-dimensional subspace to optimize the model parameters of the third intermediate deep neural network model, and determine the new third intermediate deep neural network model; use the preset minimization loss function and the new third intermediate deep neural network model to calculate the target loss value according to the adversarial image training set, and count the number of second model training times in real time; until the target loss value converges or the second model training times reaches the preset second training times threshold; the new third intermediate deep neural network model determined when the target loss value converges or the second model training times reaches the preset second training times threshold is used as the target deep neural network model.

[0110] Among them, the adversarial image training set will be divided into multiple adversarial image training subsets and input into the third intermediate deep neural network model for prediction in sequence. One adversarial image training subset corresponds to one model prediction result. If the calculated target loss value converges according to the model prediction result corresponding to the current adversarial image training subset, it means that the deep neural network model has been trained and the input of the adversarial image training subset is stopped.

[0111] In this embodiment, a new dynamic low-dimensional subspace and an adversarial image training set are used to perform model training on the third intermediate deep neural network model to determine the target deep neural network model.

[0112] In an embodiment of the present invention, the present invention provides a model adversarial training method based on a dynamic low-dimensional subspace, firstly, an adversarial image training set is obtained, and the adversarial image training set is input into a preset deep neural network model for conventional adversarial training, and a model parameter training trajectory and a first intermediate deep neural network model are determined; then, a dynamic low-dimensional subspace is constructed according to the model parameter training trajectory, and the model parameters of the first intermediate deep neural network model are back-traced to determine a second intermediate deep neural network model; the second intermediate deep neural network model and a preset minimization loss function are used to determine the model gradient according to the adversarial image training set; the second intermediate deep neural network model is updated using the model gradient and the dynamic low-dimensional subspace, a third intermediate deep neural network model and the corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time; and the current subspace is judged. whether the current subspace update moment meets the preset subspace update condition; if the current subspace update moment meets the preset subspace update condition, the third intermediate model parameters are used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace; finally, the new dynamic low-dimensional subspace and the adversarial image training set are used to train the third intermediate deep neural network model to determine the target deep neural network model; based on the above scheme, while the second intermediate deep neural network model is updated by the target loss value and the dynamic low-dimensional subspace, the third intermediate model parameters are used to update the dynamic low-dimensional subspace based on the current subspace update moment and the preset subspace update condition to determine a new dynamic low-dimensional subspace. This process will regularly update the dynamic low-dimensional subspace during model training, thereby improving the timing of the low-dimensional subspace and further improving the robustness of the model.

[0113] See also Figure 2 , Figure 2 A flowchart of the steps of another model adversarial training method based on dynamic low-dimensional subspace provided in an embodiment of the present invention.

[0114] The present invention provides a model adversarial training method based on dynamic low-dimensional subspace, comprising:

[0115] Step 201: Obtain an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model.

[0116] It should be noted that the adversarial image training set is the training data obtained after the image data set is divided, data enhanced, and adversarial attacked in sequence. Specifically, after the image data set is divided, an image training set, an image verification set, and an image test set are obtained. The image training set is data enhanced to obtain an enhanced image training set. Based on the deep neural network model, an adversarial attack is performed on the samples to obtain adversarial samples, that is, the enhanced image training set and the image verification set are adversarially attacked by the fast gradient sign method to obtain the adversarial image training set and the adversarial image verification set. The image test set is attacked by the projected gradient method to obtain the adversarial image test set; wherein, the adversarial image training set is used for conventional adversarial training of subsequent models and training based on dynamic low-dimensional subspaces (low-dimensional subspace adversarial training), and the adversarial image test set and the adversarial image verification set are used to test and verify the model performance of the trained target deep neural network model; wherein, the process of adversarial attack based on the fast gradient sign method can be expressed as:

[0117]

[0118] Among them, x adv is the adversarial image; x is a clean sample; sgn is the sign function; ∈ is the perturbation size. When L2 norm is used, ∈ is usually 128 / 255. ∞ norm, ∈ is usually taken as 8 / 255; w is the model parameter of the deep neural network model; y is the label corresponding to the clean sample.

[0119] Furthermore, the process of using the projected gradient method to attack the image test set to obtain the adversarial image test set can be expressed as:

[0120]

[0121] Among them, x t+1 is the adversarial image test set; x t is the image test set; α is the perturbation step size, which is usually 15 / 255 when L2 norm is used. ∞ norm, usually 2 / 255; t is the number of iterations, which can be set to 10; ∏ is the projection operation, that is, the adversarial image test set finally needs to be in x t -∈ to x t +∈ is within this range; ∈ is the perturbation size. When using the L2 norm, ∈ is usually 128 / 255. When using L ∞ norm, ∈ is usually taken as 8 / 255; w is the model parameter of the deep neural network model; y is the label corresponding to the clean sample.

[0122] Furthermore, step 201 may include the following sub-steps:

[0123] S11, dividing the adversarial image training set to determine multiple adversarial image training subsets;

[0124] S12, based on a preset minimization loss function, inputting each adversarial image training subset into a preset deep neural network model in sequence to update model parameters, and determining a plurality of first model parameters and an initial deep neural network model;

[0125] S13, sampling multiple first model parameters, outputting multiple initial model parameters, and counting the number of first model training times in real time;

[0126] S14, determining whether the first model training times reaches a preset first training times threshold;

[0127] S15. If yes, construct a model parameter training trajectory using each initial model parameter, and use the initial deep neural network model as the first intermediate deep neural network model.

[0128] It should be noted that, based on the preset minimization loss function, after the adversarial image training set is divided into multiple adversarial image training subsets, the preset deep neural network model is sequentially input for conventional adversarial training, and the model is trained until catastrophic overfitting occurs. If catastrophic overfitting occurs at epoch=65, the preset first training times threshold of conventional adversarial training can be set to 65, and the training stops when the first model training times reaches 65. During the training, the model parameters are sampled to obtain the model parameter training trajectory; wherein, the preset first training times threshold can be set as needed, and the present invention is not limited thereto.

[0129] In this embodiment, an adversarial image training set is obtained, and the adversarial image training set is input into a preset deep neural network model for conventional adversarial training to determine a model parameter training trajectory and a first intermediate deep neural network model.

[0130] Step 202: construct a dynamic low-dimensional subspace according to the model parameter training trajectory, and backtrack the model parameters of the first intermediate deep neural network model to determine the second intermediate deep neural network model.

[0131] It should be noted that the low-dimensional subspace adversarial training of the deep neural network model is performed based on the dynamic low-dimensional subspace. By restricting the gradient descent of the adversarial training of the deep neural network model to the subspace P = [u1,u2,…,u d ] to implement it.

[0132] Further, step 202 may include the following sub-steps:

[0133] S21, centralize the model parameter training trajectory and determine the centralized model parameter training trajectory;

[0134] S22, performing spectral decomposition on the centralized model parameter training trajectory to determine multiple eigenvalues;

[0135] S23, substituting each eigenvalue into a preset linear equation system, and calculating the eigenvector corresponding to each eigenvalue;

[0136] S24, taking each eigenvalue as the corresponding singular value, and taking the eigenvector corresponding to each eigenvalue as the singular value vector;

[0137] S25, sorting the singular values ​​in descending order, and selecting the singular values ​​of the first preset number of digits as the target singular values;

[0138] S26. Use each target singular value and the corresponding singular value vector to construct a dynamic low-dimensional subspace.

[0139] In this embodiment, a dynamic low-dimensional subspace is constructed according to the model parameter training trajectory, and the model parameters of the first intermediate deep neural network model are backtracked to determine the second intermediate deep neural network model.

[0140] Step 203: input the adversarial image training set into the second intermediate deep neural network model for prediction, and output the model prediction result.

[0141] In this embodiment, the adversarial image training set is input into the second intermediate deep neural network model for prediction, and the model prediction result is output.

[0142] Step 204: Substitute the model prediction result into the preset minimization loss function and derive it to determine the model gradient.

[0143] In this embodiment, the model prediction result is substituted into a preset minimization loss function and derived to determine the model gradient.

[0144] Step 205: Use model gradient and dynamic low-dimensional subspace to update the second intermediate deep neural network model, determine the third intermediate deep neural network model and the corresponding third intermediate model parameters, and count the current subspace update time in real time.

[0145] Further, step 205 may include the following sub-steps:

[0146] S51, projecting the model gradient into a dynamic low-dimensional subspace to determine the subspace gradient;

[0147] S52. Optimize the model parameters of the second intermediate deep neural network model using subspace gradient and preset learning rate, and determine the third intermediate deep neural network model and the third intermediate model parameters corresponding to the third intermediate deep neural network model.

[0148] In this embodiment, the model gradient and dynamic low-dimensional subspace are used to update the second intermediate deep neural network model, the third intermediate deep neural network model and the corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time.

[0149] Step 206: Determine whether the current subspace update time meets the preset subspace update condition.

[0150] It should be noted that if the current subspace update time does not meet the preset subspace update conditions, the dynamic low-dimensional subspace will not be updated, and the model parameters updated based on the subspace gradient and the preset learning rate corresponding to the current subspace update time will be retained for subsequent updates to the dynamic low-dimensional subspace. The third intermediate deep neural network model is then used as the new second intermediate deep neural network model, and the process jumps to step 203 until the target loss value converges. The new third intermediate deep neural network model determined when the target loss value converges is used as the target deep neural network model.

[0151] In this embodiment, it is determined whether the current subspace update time meets the preset subspace update condition.

[0152] Step 207: If the current subspace update time meets the preset subspace update condition, the third intermediate model parameter is used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace.

[0153] It should be noted that when conducting low-dimensional subspace adversarial training, the model parameters of the deep neural network model can also be sampled during low-dimensional subspace adversarial training according to the same sampling strategy as that for conventional adversarial training, and the sampled model parameter training trajectory is added to the original model parameter training trajectory and centralized when the preset subspace update condition is met at the previous subspace update moment; repeat the above steps to limit the adversarial training to the dynamic low-dimensional subspace, and train the model until the target loss value converges or the second model training times reaches a preset second training times threshold, wherein the preset second training times threshold can be set as needed, and the present invention is not limited to this.

[0154] Further, step 207 may include the following sub-steps:

[0155] S71, sampling the third intermediate model parameter and the historical moment model parameter set to determine a plurality of subspace model parameters;

[0156] S72, constructing a subspace model parameter training trajectory using each subspace model parameter;

[0157] S73, inserting the subspace model parameter training trajectory into the model parameter training trajectory to determine a new model parameter training trajectory;

[0158] S74. Construct a new dynamic low-dimensional subspace based on the new model parameter training trajectory.

[0159] In this embodiment, if the current subspace update time meets the preset subspace update condition, the third intermediate model parameter is used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace.

[0160] Step 208: Use the new dynamic low-dimensional subspace and the adversarial image training set to perform model training on the third intermediate deep neural network model to determine the target deep neural network model.

[0161] Further, step 208 may include the following sub-steps:

[0162] S81, using the third intermediate deep neural network model and the preset minimization loss function to calculate the target loss value according to the adversarial image training set, and counting the number of second model training times in real time;

[0163] S82, judging whether the target loss value converges or whether the second model training times reaches a preset second training times threshold;

[0164] S83, if the target loss value reaches convergence or the second model training times reaches a preset second training times threshold, the third intermediate deep neural network model is used as the target deep neural network model;

[0165] S84, if the target loss value does not reach convergence and the second model training times do not reach the preset second training times threshold, a third intermediate deep neural network model and a preset minimization loss function are used to determine a new model gradient according to the adversarial image training set;

[0166] S85. Optimize the model parameters of the third intermediate deep neural network model using the new model gradient and the new dynamic low-dimensional subspace to determine a new third intermediate deep neural network model;

[0167] S86, using a preset minimization loss function and a new third intermediate deep neural network model to calculate a target loss value according to the adversarial image training set, and counting the number of second model training times in real time; until the target loss value converges or the number of second model training times reaches a preset second training times threshold;

[0168] S87. Use the new third intermediate deep neural network model determined when the target loss value converges or the second model training times reaches a preset second training times threshold as the target deep neural network model.

[0169] In this embodiment, a new dynamic low-dimensional subspace and an adversarial image training set are used to perform model training on the third intermediate deep neural network model to determine the target deep neural network model.

[0170] For example, see Figure 3 First, a clean sample, i.e., an image data set, is obtained, and after data preprocessing of the image data set, an adversarial attack is performed to obtain an adversarial sample, i.e., an adversarial image training set. An initial dynamic low-dimensional subspace is constructed according to the adversarial image training set and a deep neural network; low-dimensional subspace adversarial training is performed on the deep neural network according to the dynamic low-dimensional subspace and the adversarial image training set. During the low-dimensional subspace adversarial training, the updated model parameters are sampled, and the low-dimensional subspace is updated at a certain time interval. Specifically, the dynamic low-dimensional subspace is updated regularly, i.e., when performing low-dimensional subspace adversarial training, the model parameters are also sampled, and the sampled model parameter trajectory is added to the model parameter trajectory of the original conventional adversarial training. The current model parameter trajectory is spectrally decomposed at a certain interval to obtain a dynamic low-dimensional subspace that is more suitable for adversarial training at the current time; the adversarial training is limited to the dynamic low-dimensional subspace until the model training converges or reaches a preset condition.

[0171] As a comparison of technical effects, we can refer to the existing technology. The existing process of generating adversarial samples is adversarial attack. Since researchers found that deep learning models are very vulnerable to adversarial samples, many adversarial attack methods have been proposed. Generally, the existing adversarial attack methods can be divided into white-box attack and black-box attack according to the attacker's understanding of the model. The present invention is related to white-box attack. Please refer to Figure 4 In a white-box attack, the attacker can access all the information of the attacked model, including the model's network structure, model weights, gradient information, etc. The classic white-box attack is based on model gradients, including the Fast Gradient Sign Method (FGSM) based on a single-step gradient and the Projected Gradient Descent (PGD) based on a multi-step gradient. This type of method mainly uses the back-propagation gradient of the loss function to modify the input image to increase the loss function value, thereby causing the model to misclassify. The specific process is as follows: Figure 4 In contrast, in a black-box attack, the attacker cannot obtain the internal information of the attacked model and can only query the output of the model by inputting data.

[0172] Furthermore, the fast gradient sign method is based on maximizing the model loss function, adding a small perturbation to the original clean sample, so that the model produces incorrect classification on the perturbed sample. The formula is as follows:

[0173]

[0174] Among them, x is a clean sample, sgn is a sign function, ∈ is the perturbation size, L is a loss function, which can be a cross entropy or square error function, f is a deep neural network, w is a deep neural network parameter, and y is the label corresponding to the clean sample. Therefore, the fast gradient sign method is to add a perturbation of size ε to the clean sample (clean image) x in the direction of gradient ascent.

[0175] Furthermore, the defense method based on adversarial training is currently one of the most effective methods to improve the adversarial robustness of the model, which aims to minimize the risk of the model under the worst-case perturbation. This method uses adversarial samples as training sets to train the model, that is, to allow adversarial samples to participate in model training to improve the adversarial robustness of the model. Figure 5 The internal maximization is the process of attacking and generating adversarial samples, and the external minimization is the process of inputting adversarial samples as training sets into the model for parameter update and gradient descent. The specific process is as follows Figure 5 As shown; adversarial training is a maximum minimization problem, and the optimization goal is as follows:

[0176]

[0177] Among them, B(x,∈) is the norm ball with perturbation radius ∈; δ is the perturbation added to the clean sample; L is the loss function; f is the deep neural network.

[0178] Furthermore, according to the internal maximization, that is, the type of attack method used to generate adversarial samples, adversarial training can be divided into single-step adversarial training and multi-step adversarial training. For example, using the fast gradient symbol method to generate adversarial samples is single-step adversarial training, and using the projected gradient descent method to generate adversarial samples is multi-step adversarial training. Since multi-step adversarial training uses adversarial samples generated by multiple iterations to train the model, its defense capabilities are usually stronger in the face of more complex adversarial attack methods, and the model is more robust. However, its computational overhead is high and the training time is also long, which is not practical for large-scale deep neural networks and large data sets. Then, single-step adversarial training appears to be simple and efficient, and can improve the robustness of the model while maintaining a low computational complexity. Therefore, based on the consideration of computational cost and training time, single-step adversarial training based on the fast gradient symbol method is often more in line with actual scenarios.

[0179] Although single-step adversarial training can effectively improve the robustness of the model, it encounters a very thorny problem during the training process: catastrophic overfitting. During single-step adversarial training, adversarial samples generated by the projected gradient descent method are usually used as test sets to test the robustness of the model. However, during training, catastrophic overfitting is found to occur: the robust accuracy of the model against the projected gradient descent attack suddenly drops to 0%.

[0180] Furthermore, for the catastrophic overfitting problem, the existing solution that is most similar to the present invention is: subspace adversarial training. This solution uses the close relationship between the rapid growth of the gradient norm of each sample and catastrophic overfitting, and limits the rapid growth of the gradient norm by limiting the single-step adversarial training to a subspace, thereby solving the catastrophic overfitting problem and improving the robustness of the model.

[0181] During training, after each sample is input into the model, it will have a corresponding gradient after back propagation. The formula for the average gradient norm of the sample is as follows:

[0182]

[0183] Where n is the number of adversarial samples, that is, the batch size; L is the cross entropy function; is the prediction result output by the deep neural network model when the number of training times is k; is the i-th adversarial sample; w k is the model parameter of the deep neural network model when the number of training times is k; y is the label corresponding to the clean sample; f is the deep neural network model.

[0184] The rapid growth of the gradient norm of each sample is closely related to catastrophic overfitting: before catastrophic overfitting occurs in single-step adversarial training, the gradient norm of each sample remains at a small value, but when catastrophic overfitting occurs, the gradient norm suddenly increases sharply and remains at a larger value thereafter.

[0185] Therefore, based on the above connection, this scheme aims to limit the gradient norm of each sample to prevent catastrophic overfitting. It limits the gradient norm of the sample by limiting the adversarial training to a low-dimensional subspace instead of the entire parameter space, thus successfully preventing catastrophic overfitting and improving the robustness of the model. Among them, the key steps of this scheme are to obtain the low-dimensional subspace of the model parameter trajectory and limit the adversarial training to the subspace.

[0186] Furthermore, the specific steps of obtaining the low-dimensional subspace of the model parameter trajectory are as follows: ① In the process of model adversarial training, the model parameters are sampled according to a certain strategy as the model discrete parameter training trajectory {w1,w2,...,w t}, where t is the number of sampling times, and vector w t The length of is the number of model parameters n. ② Align the sampled model parameter vectors into a parameter matrix W and center it; ③ Find a matrix consisting of P = [e1, e2, ..., e d] to cover W. In deep neural networks, the number of model parameters n is usually significantly greater than t and d. Regarding step ③, it aims to find a subspace with the smallest distance from the projection. Using the norm, it can be expressed as maximizing the variance of the projection, as shown in the following formula:

[0187]

[0188] Among them, tr is the trace function; I is the identity matrix.

[0189] Furthermore, this is a standard principal component analysis problem, which can be solved by WW T The eigenvectors corresponding to the first d eigenvalues ​​(arranged from large to small) are the orthogonal basis of the required low-dimensional subspace. However, WW T is an n×n matrix, which is not only very difficult to store, but also very expensive to decompose. It can be noted that because n is much larger than t, WW T is low rank. Therefore, we can consider the singular value decomposition of W, as shown in the following formula:

[0190] W=UΣV T ;

[0191] Where Σ is the singular value diagonal matrix, Σ=diag(σ1,σ2,...,σ t ), U=[u1,u2,...,u n ], the first d columns of U are the required orthogonal basis of the low-dimensional subspace, V = [v1,v2,...,v t ].

[0192] Since W and W T Basically, it has the same singular value decomposition, so we can calculate v first i , i = 1, ..., d, which uses W T The spectral decomposition of W can be obtained, and W T W is a t×t matrix. Compared with the number of model parameters n, t is the number of sampling times, which is much smaller than n, so W T The storage and computation cost of W is very low. Finally, we can get the vector

[0193] In summary, step ③ can be achieved by the following method: T W performs spectral decomposition and obtains the first d singular values ​​(arranged from large to small) The corresponding singular value vector [v1,v2,…,v d ], and according to The orthogonal basis P of the d-dimensional subspace is obtained as [u1,u2,…,u d ].

[0194] Furthermore, we extract the gradient of the model back propagation in adversarial training And the gradient Projecting onto the subspace we get Therefore, the process of subspace adversarial training is as follows: first conduct a regular adversarial training to obtain a subspace, then trace the model parameters back to the original starting point, re-perform adversarial training, and restrict them to the subspace; however, the subspace used in this scheme has never been updated since it was first obtained, and the temporal nature of the subspace is low. As time goes by, it may not be able to adapt to changes in data distribution or the gradual optimization of the model during training, which will affect subsequent adversarial training to a certain extent.

[0195] In view of the above problems, the present invention proposes a model adversarial training method based on a dynamic low-dimensional subspace. The present invention limits the single-step adversarial training to a dynamic low-dimensional subspace, which is dynamically updated during training and has higher time sequence, which is more conducive to model adversarial training. In addition, there is no significant difference between the training time and the computational cost, and high efficiency is maintained. Because although the low-dimensional subspace is updated multiple times during training, its computational complexity is very low, mainly involving the spectral decomposition of a t×t matrix and the product of two matrices, and the total time complexity is O(t 3 +t 2 n+t 2 n), the GPU can greatly speed up the matrix operations involved. Compared with the training of deep neural networks, the time consumption is negligible. At the same time, the training effect of the present invention does not depend on the choice of learning rate, and there is no additional regularization coefficient that needs to be set, which simplifies the parameter adjustment process of the model. More importantly, the present invention is better in improving the robustness of the model. The problem of poor robust generalization of adversarial training is alleviated, and the robustness to unknown attacks (CW attacks, AA attacks) is also improved. Therefore, the present invention also improves the robust generalization performance of the model, so that the model can maintain higher stability and reliability when facing various potential threats.

[0196] Therefore, the present invention can effectively prevent the catastrophic overfitting problem of single-step adversarial training, and further improve the model robustness, accuracy and robust generalization performance.

[0197] In an embodiment of the present invention, the present invention provides a model adversarial training method based on a dynamic low-dimensional subspace, firstly, an adversarial image training set is obtained, and the adversarial image training set is input into a preset deep neural network model for conventional adversarial training, and a model parameter training trajectory and a first intermediate deep neural network model are determined; then, a dynamic low-dimensional subspace is constructed according to the model parameter training trajectory, and the model parameters of the first intermediate deep neural network model are back-traced to determine a second intermediate deep neural network model; the second intermediate deep neural network model and a preset minimization loss function are used to determine the model gradient according to the adversarial image training set; the second intermediate deep neural network model is updated using the model gradient and the dynamic low-dimensional subspace, a third intermediate deep neural network model and the corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time; and the current subspace is judged. whether the current subspace update moment meets the preset subspace update condition; if the current subspace update moment meets the preset subspace update condition, the third intermediate model parameters are used to update the dynamic low-dimensional subspace to determine a new dynamic low-dimensional subspace; finally, the new dynamic low-dimensional subspace and the adversarial image training set are used to train the third intermediate deep neural network model to determine the target deep neural network model; based on the above scheme, while the second intermediate deep neural network model is updated by the target loss value and the dynamic low-dimensional subspace, the third intermediate model parameters are used to update the dynamic low-dimensional subspace based on the current subspace update moment and the preset subspace update condition to determine a new dynamic low-dimensional subspace. This process will regularly update the dynamic low-dimensional subspace during model training, thereby improving the timing of the low-dimensional subspace and further improving the robustness of the model.

[0198] See also Figure 6 , Figure 6 A structural block diagram of a model adversarial training device based on dynamic low-dimensional subspace provided in an embodiment of the present invention.

[0199] The present invention provides a model adversarial training device based on dynamic low-dimensional subspace, comprising:

[0200] An acquisition module 601 is used to acquire an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model;

[0201] According to module 602, a dynamic low-dimensional subspace is constructed according to the model parameter training trajectory, and the model parameters of the first intermediate deep neural network model are backtracked to determine the second intermediate deep neural network model;

[0202] Adopting module 603, for using the second intermediate deep neural network model and the preset minimization loss function to determine the model gradient according to the adversarial image training set;

[0203] An updating module 604 is used to update the second intermediate deep neural network model using a model gradient and a dynamic low-dimensional subspace, determine a third intermediate deep neural network model and corresponding third intermediate model parameters, and count the current subspace update time in real time;

[0204] A determination module 605 is used to determine whether the current subspace update time meets the preset subspace update condition;

[0205] A determination module 606 is used to update the dynamic low-dimensional subspace using the third intermediate model parameter to determine a new dynamic low-dimensional subspace if the current subspace update time meets the preset subspace update condition;

[0206] The target module 607 is used to use the new dynamic low-dimensional subspace and the adversarial image training set to perform model training on the third intermediate deep neural network model to determine the target deep neural network model.

[0207] Furthermore, the acquisition module 601 is specifically used for:

[0208] Divide the adversarial image training set to determine multiple adversarial image training subsets;

[0209] Based on a preset minimization loss function, each adversarial image training subset is sequentially input into a preset deep neural network model to update model parameters, and a plurality of first model parameters and an initial deep neural network model are determined;

[0210] Sampling a plurality of first model parameters, outputting a plurality of initial model parameters, and counting the number of first model training times in real time;

[0211] Determine whether the first model training times reaches a preset first training times threshold;

[0212] If so, each initial model parameter is used to construct a model parameter training trajectory, and the initial deep neural network model is used as the first intermediate deep neural network model.

[0213] Further, according to module 602, it is specifically used to:

[0214] Centralize the model parameter training trajectory and determine the centralized model parameter training trajectory;

[0215] Perform spectral decomposition on the centralized model parameter training trajectory to determine multiple eigenvalues;

[0216] Substitute each eigenvalue into the preset linear equation system and calculate the eigenvector corresponding to each eigenvalue;

[0217] Taking each eigenvalue as the corresponding singular value and taking the eigenvector corresponding to each eigenvalue as the singular value vector;

[0218] Sort the singular values ​​in descending order, and select the singular values ​​of the first preset number of digits as the target singular values;

[0219] Each target singular value and the corresponding singular value vector are used to construct a dynamic low-dimensional subspace.

[0220] Further, module 603 is used to:

[0221] Input the adversarial image training set into the second intermediate deep neural network model for prediction, and output the model prediction results;

[0222] Substitute the model prediction results into the preset minimization loss function and derive it to determine the model gradient.

[0223] Further, the update module 604 is specifically used for:

[0224] Project the model gradient into a dynamic low-dimensional subspace and determine the subspace gradient;

[0225] The model parameters of the second intermediate deep neural network model are optimized using subspace gradient and preset learning rate, and the third intermediate deep neural network model and the third intermediate model parameters corresponding to the third intermediate deep neural network model are determined.

[0226] Further, the determination module 606 is specifically configured to:

[0227] Sampling the third intermediate model parameter and the historical moment model parameter set to determine a plurality of subspace model parameters;

[0228] The subspace model parameter training trajectory is constructed using each subspace model parameter;

[0229] Inserting the subspace model parameter training trajectory into the model parameter training trajectory to determine a new model parameter training trajectory;

[0230] Construct a new dynamic low-dimensional subspace based on the new model parameter training trajectory.

[0231] Furthermore, the target module 607 is specifically used for:

[0232] The third intermediate deep neural network model and the preset minimization loss function are used to calculate the target loss value according to the adversarial image training set, and the number of training times of the second model is counted in real time;

[0233] Determine whether the target loss value converges or whether the second model training times reaches a preset second training times threshold;

[0234] If the target loss value reaches convergence or the second model training times reaches a preset second training times threshold, the third intermediate deep neural network model is used as the target deep neural network model;

[0235] If the target loss value does not reach convergence and the second model training times do not reach the preset second training times threshold, a third intermediate deep neural network model and a preset minimization loss function are used to determine a new model gradient based on the adversarial image training set;

[0236] The model parameters of the third intermediate deep neural network model are optimized by using a new model gradient and a new dynamic low-dimensional subspace to determine a new third intermediate deep neural network model;

[0237] Using a preset minimization loss function and a new third intermediate deep neural network model, the target loss value is calculated according to the adversarial image training set, and the number of second model training times is counted in real time; until the target loss value converges or the number of second model training times reaches a preset second training times threshold;

[0238] A new third intermediate deep neural network model determined when the target loss value converges or the second model training times reaches a preset second training times threshold is used as the target deep neural network model.

[0239] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0240] An embodiment of the present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory; when the computer program is executed by the processor, the processor executes the steps of the model adversarial training method based on dynamic low-dimensional subspace as in any of the above embodiments.

[0241] An embodiment of the present invention also provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, the steps of the model adversarial training method based on dynamic low-dimensional subspace as in any of the above embodiments are implemented.

[0242] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0243] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0244] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A model adversarial training method based on dynamic low-dimensional subspace, characterized in that: include: Obtain an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model; Constructing a dynamic low-dimensional subspace according to the model parameter training trajectory, and backtracking the model parameters of the first intermediate deep neural network model to determine a second intermediate deep neural network model; Determine a model gradient according to the adversarial image training set using the second intermediate deep neural network model and a preset minimization loss function; The second intermediate deep neural network model is updated using the model gradient and the dynamic low-dimensional subspace, a third intermediate deep neural network model and corresponding third intermediate model parameters are determined, and the current subspace update time is counted in real time; Determining whether the current subspace update time meets the preset subspace update condition; If the current subspace update time meets the preset subspace update condition, the dynamic low-dimensional subspace is updated using the third intermediate model parameter to determine a new dynamic low-dimensional subspace; The third intermediate deep neural network model is trained using the new dynamic low-dimensional subspace and the adversarial image training set to determine a target deep neural network model.

2. The model adversarial training method based on dynamic low-dimensional subspace according to claim 1, characterized in that: The step of inputting the adversarial image training set into a preset deep neural network model for conventional adversarial training and determining a model parameter training trajectory and a first intermediate deep neural network model comprises: Dividing the adversarial image training set to determine a plurality of adversarial image training subsets; Based on the preset minimization loss function, each of the adversarial image training subsets is sequentially input into the preset deep neural network model to update model parameters, and determine a plurality of first model parameters and an initial deep neural network model; Sampling a plurality of the first model parameters, outputting a plurality of initial model parameters, and counting the number of first model training times in real time; Determine whether the first model training times reaches a preset first training times threshold; If so, each of the initial model parameters is used to construct a model parameter training trajectory, and the initial deep neural network model is used as the first intermediate deep neural network model.

3. The model adversarial training method based on dynamic low-dimensional subspace according to claim 1, characterized in that: The step of constructing a dynamic low-dimensional subspace according to the model parameter training trajectory comprises: Centralizing the model parameter training trajectory to determine a centralized model parameter training trajectory; Performing spectral decomposition on the centralized model parameter training trajectory to determine a plurality of eigenvalues; Substituting each of the eigenvalues ​​into a preset linear equation system, and calculating the eigenvector corresponding to each of the eigenvalues; Taking each of the eigenvalues ​​as a corresponding singular value, and taking an eigenvector corresponding to each of the eigenvalues ​​as a singular value vector; Sorting the singular values ​​in descending order, and selecting the singular values ​​of the first preset number of digits as target singular values; A dynamic low-dimensional subspace is constructed using each of the target singular values ​​and the corresponding singular value vectors.

4. The model adversarial training method based on dynamic low-dimensional subspace according to claim 1, characterized in that: The step of using the second intermediate deep neural network model and the preset minimization loss function to determine the model gradient according to the adversarial image training set includes: Inputting the adversarial image training set into the second intermediate deep neural network model for prediction, and outputting the model prediction result; Substitute the model prediction result into the preset minimization loss function and derive it to determine the model gradient.

5. The model adversarial training method based on dynamic low-dimensional subspace according to claim 1, characterized in that: The step of updating the second intermediate deep neural network model by using the model gradient and the dynamic low-dimensional subspace to determine a third intermediate deep neural network model and corresponding third intermediate model parameters includes: Projecting the model gradient to the dynamic low-dimensional subspace to determine the subspace gradient; The subspace gradient and the preset learning rate are used to optimize the model parameters of the second intermediate deep neural network model, and a third intermediate deep neural network model and third intermediate model parameters corresponding to the third intermediate deep neural network model are determined.

6. The model adversarial training method based on dynamic low-dimensional subspace according to claim 1, characterized in that: The step of updating the dynamic low-dimensional subspace by using the third intermediate model parameter to determine a new dynamic low-dimensional subspace comprises: Sampling the third intermediate model parameter and the historical moment model parameter set to determine a plurality of subspace model parameters; Using each of the subspace model parameters to construct a subspace model parameter training trajectory; Inserting the subspace model parameter training trajectory into the model parameter training trajectory to determine a new model parameter training trajectory; A new dynamic low-dimensional subspace is constructed according to the new model parameter training trajectory.

7. The model adversarial training method based on dynamic low-dimensional subspace according to claim 1, characterized in that: The step of using the new dynamic low-dimensional subspace and the adversarial image training set to perform model training on the third intermediate deep neural network model to determine the target deep neural network model includes: Using the third intermediate deep neural network model and the preset minimization loss function to calculate the target loss value according to the adversarial image training set, and counting the number of second model training times in real time; Determine whether the target loss value converges or whether the second model training times reaches a preset second training times threshold; If the target loss value reaches convergence or the second model training times reaches a preset second training times threshold, the third intermediate deep neural network model is used as the target deep neural network model; If the target loss value does not reach convergence and the second model training times do not reach the preset second training times threshold, then using the third intermediate deep neural network model and the preset minimization loss function to determine a new model gradient according to the adversarial image training set; Optimizing model parameters of the third intermediate deep neural network model using the new model gradient and the new dynamic low-dimensional subspace to determine a new third intermediate deep neural network model; The preset minimization loss function and the new third intermediate deep neural network model are used to calculate the target loss value according to the adversarial image training set, and the number of second model training times is counted in real time; until the target loss value converges or the number of second model training times reaches a preset second training times threshold; A new third intermediate deep neural network model determined when the target loss value converges or the second model training times reaches a preset second training times threshold is used as the target deep neural network model.

8. A model adversarial training device based on dynamic low-dimensional subspace, characterized in that: include: An acquisition module is used to acquire an adversarial image training set, and input the adversarial image training set into a preset deep neural network model for conventional adversarial training, and determine a model parameter training trajectory and a first intermediate deep neural network model; According to the module, it is used to construct a dynamic low-dimensional subspace according to the model parameter training trajectory, and backtrack the model parameters of the first intermediate deep neural network model to determine the second intermediate deep neural network model; An adopting module, configured to adopt the second intermediate deep neural network model and a preset minimization loss function to determine a model gradient according to the adversarial image training set; An updating module, configured to update the second intermediate deep neural network model using the model gradient and the dynamic low-dimensional subspace, determine a third intermediate deep neural network model and corresponding third intermediate model parameters, and count the current subspace update time in real time; A judging module, used to judge whether the current subspace updating moment meets the preset subspace updating condition; A determination module, configured to update the dynamic low-dimensional subspace using the third intermediate model parameter to determine a new dynamic low-dimensional subspace if the current subspace update moment meets the preset subspace update condition; A target module is used to perform model training on the third intermediate deep neural network model using the new dynamic low-dimensional subspace and the adversarial image training set to determine a target deep neural network model.

9. A computer device, characterized in that: It includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the model adversarial training method based on dynamic low-dimensional subspace as described in any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by the processor, the steps of the model adversarial training method based on dynamic low-dimensional subspace as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Image classification method based on subspace projection and dictionary learning

    CN109117860A

  • Low-rank discriminant feature subspace learning method

    CN109522956A

  • Network abnormal point detection method based on hyperbolic space

    CN115664970A

  • Optimizing Supervised Generative Adversarial Networks via Latent Space Regularizations

    US20230289608A1