Image data generation method, model training method, device, equipment and medium

By constructing the objective function and using the feature map information and noise images of the initial neural network model to perform iterative operations to generate image data for training, the problem of difficulty in obtaining the original data set during fine-tuning of the convolutional neural network model is solved, and the accuracy of the model is improved. Accuracy and training efficiency.

CN114140619BActive Publication Date: 2024-09-06LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111278700.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-31
Publication Date
2024-09-06
Estimated Expiration
2041-10-31

AI Technical Summary

Technical Problem

Existing convolutional neural network models require a large amount of original data sets during model fine-tuning, which makes it difficult to obtain, resulting in reduced model accuracy and inability to effectively improve the accuracy of the initial neural network model.

Method used

By constructing an objective function containing the first regular term and the second regular term, using the feature map information and noise images in the pre-trained initial neural network model, multiple iterative operations are performed to generate image data to avoid obtaining the original data set. difficulty, improving model accuracy.

Benefits of technology

It reduces the difficulty of obtaining training data, and the generated image data is close to the original data, which improves the retraining efficiency and accuracy of the initial neural network model and avoids the loss of model accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114140619B
    Figure CN114140619B
Patent Text Reader

Abstract

This application discloses an image data generation method, model training method, apparatus, device, and medium. The method includes: constructing an objective function containing a first regularization term and a second regularization term; obtaining a pre-trained initial neural network model, and then extracting pre-saved feature map information from the normalization layer of the initial neural network model; creating a noisy image, using the noisy image as the initial iteration image, and then extracting the feature map of the initial iteration image; using the feature map of the initial iteration image, the pre-saved feature map information, and the initial iteration image as initial iteration parameters, and performing multiple iterative operations on the objective function based on a preset number of iterations to generate corresponding image data, so as to retrain the initial neural network model using the image data as training data. Through the above scheme, the difficulty of obtaining the original dataset can be avoided, thereby improving the accuracy of the initial neural network model.
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, and in particular to an image data generation method, a model training method, a device, equipment and a medium. Background Art

[0002] With the rapid development and application of artificial intelligence and deep neural network models, convolutional neural models have been widely used, but their shortcomings are also obvious, such as large number of parameters, large amount of calculation, and memory usage. Model fine-tuning can alleviate the problems of large number of parameters, large amount of calculation, and high memory usage of existing convolutional neural networks. It has "potential" advantages such as compressing parameters for neural networks, improving speed, and reducing memory usage. However, when fine-tuning the model, the single precision will be optimized to a lower precision, which greatly reduces the accuracy of the model. At present, the loss of model accuracy is reduced through model fine-tuning methods. The basic principle of this method is to use the original data set to "retrain" the model a small amount to improve accuracy, but in actual applications, the original data set is usually huge and difficult to obtain, so it cannot be put into practice.

[0003] In summary, how to avoid the difficulty in obtaining the original data set and thereby improve the accuracy of the initial neural network model is a problem to be solved in this field. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide an image data generation method, model training method, device, equipment and medium, which can avoid the difficulty of obtaining the original data set and thus improve the accuracy of the initial neural network model. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a method for generating image data, comprising:

[0006] Constructing an objective function including a first regularization term and a second regularization term; wherein the first regularization term uses an iterative image as a variable parameter, the second regularization term uses a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on a function value of the objective function;

[0007] Obtaining a pre-trained initial neural network model, and then extracting pre-saved feature map information from a normalization layer of the initial neural network model;

[0008] Creating a noise image, using the noise image as a first iteration image, and then extracting a feature map of the first iteration image;

[0009] The feature map of the first iteration image, the pre-saved feature map information and the first iteration image are used as first iteration parameters, and multiple iterative operations are performed on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

[0010] Optionally, constructing an objective function including a first regularization term and a second regularization term includes:

[0011] Based on the pre-trained initial neural network model and the pre-specified image category to be generated, constructing a classification loss function corresponding to the initial neural network model;

[0012] Constructing a first regularization term for controlling the natural characteristics of an image with the iterative image as a variable parameter, and constructing a second regularization term for controlling the realism of an image with the feature map of the iterative image as a variable parameter;

[0013] Construct an objective function including the first regularization term, the second regularization term and the classification loss function.

[0014] Optionally, constructing a first regularization term for controlling natural characteristics of an image with the iterated image as a variable parameter includes:

[0015] Taking the iterative image as a variable parameter, a global variance and an L2 regularization term are constructed respectively, and corresponding weight coefficients are assigned to the global variance and the L2 regularization term to obtain a first regularization term for controlling the natural characteristics of the image.

[0016] Optionally, the constructing a second regularization term for controlling the image fidelity with the feature map of the iterated image as a variable parameter includes:

[0017] A feature map information calculation function is constructed with the feature map of the iterated image as a variable parameter, and a second regularization term for controlling image fidelity is constructed based on the difference between the feature map information calculation function and the pre-saved feature map information.

[0018] Optionally, extracting the pre-saved feature map information from the normalization layer of the initial neural network model includes:

[0019] Extracting pre-saved feature map mean information and feature map variance information from the normalization layer of the initial neural network model;

[0020] Correspondingly, the feature map of the iterated image is used as a variable parameter to construct a feature map information calculation function, and a second regularization term for controlling the image fidelity is constructed based on the difference between the feature map information calculation function and the pre-saved feature map information, including:

[0021] Taking the feature map of the iterative image as a variable parameter, respectively constructing a feature map mean function and a feature map variance function;

[0022] Constructing a first L2 regularization term based on a difference between the feature graph mean function and the feature graph mean information, and constructing a second L2 regularization term based on a difference between the feature graph variance function and the feature graph variance information;

[0023] A second regularization term for controlling image realism is constructed, which includes the first L2 regularization term and the second L2 regularization term.

[0024] Optionally, before performing multiple iterative operations on the objective function based on a preset number of iterations to generate corresponding image data, the method further includes:

[0025] Determine hyperparameter information for configuring the objective function, and configure the objective function using the hyperparameter information; wherein one or more parameter information of a learning rate, a batch size, and a number of iterations is determined as the hyperparameter information.

[0026] In a second aspect, the present application discloses a neural network model training method, comprising:

[0027] Get a pre-trained initial neural network model;

[0028] Determine the image requirements based on the training accuracy requirements;

[0029] Repeating the aforementioned disclosed image data generation method multiple times based on the image demand to obtain a training data set containing a corresponding number of image data;

[0030] The initial neural network model is retrained using the training data set to obtain an optimized neural network model.

[0031] In a third aspect, the present application discloses an image data generating device, comprising:

[0032] A function construction module, used to construct an objective function including a first regularization term and a second regularization term; wherein the first regularization term uses an iteration image as a variable parameter, the second regularization term uses a feature map of the iteration image as a variable parameter, and the iteration image of a non-initial iteration is an image constructed based on a function value of the objective function;

[0033] A feature map information extraction module, used to obtain a pre-trained initial neural network model, and then extract pre-saved feature map information from a normalization layer of the initial neural network model;

[0034] An iterative image creation module, used for creating a noise image, taking the noise image as a first iterative image, and then extracting a feature map of the first iterative image;

[0035] An image data generation module is used to use the feature map of the first iteration image, the pre-saved feature map information and the first iteration image as first iteration parameters, and to perform multiple iterative operations on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

[0036] In a fourth aspect, the present application discloses an image data generating device, comprising:

[0037] Memory, used to store computer programs;

[0038] The processor is used to execute the computer program to implement the steps of the image data generating method disclosed above.

[0039] In a fifth aspect, the present application discloses a computer-readable storage medium, characterized in that it is used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed image data generation method are implemented.

[0040] It can be seen that the present application first constructs an objective function including a first regularization term and a second regularization term; wherein the first regularization term takes an iterative image as a variable parameter, the second regularization term takes a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on the function value of the objective function; a pre-trained initial neural network model is obtained, and then pre-saved feature map information is extracted from a normalization layer of the initial neural network model; a noise image is created, and the noise image is used as a first iteration image, and then a feature map of the first iteration image is extracted; the feature map of the first iteration image, the pre-saved feature map information and the first iteration image are used as first iteration parameters, and multiple iterative operations are performed on the objective function based on a preset number of iterations to generate corresponding image data, so that the initial neural network model can be retrained using the image data as training data. It can be seen that the present application creates an objective function including a first regularization term and a second regularization term, and inputs the feature map information, the noise image and the feature map of the noise image pre-saved in the pre-trained initial neural network model into the objective function to generate image data corresponding to the pre-trained initial neural network model as training data. Therefore, there is no need to obtain the original data of the pre-trained initial neural network model, thereby reducing the difficulty of obtaining training data. In addition, by performing multiple iterative operations on the objective function based on a preset number of iterations to ensure that the acquired image data is closer to the original data, the image data can be used as training data to improve the efficiency of subsequent re-training of the initial neural network model using the training data set. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0042] Figure 1 This is a flow chart of an image data generating method disclosed in this application;

[0043] Figure 2 A flowchart of a specific method for generating image data disclosed in this application;

[0044] Figure 3 A flowchart of a neural network model training method disclosed in this application;

[0045] Figure 4 A flowchart of a specific neural network model training method disclosed in this application;

[0046] Figure 5 This is a schematic diagram of the structure of an image data generating device disclosed in this application;

[0047] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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.

[0049] Currently, the method to reduce the loss of model accuracy is to "retrain" the pre-trained initial neural network model with a small amount of original data set to improve accuracy. However, in practical applications, the original data set is usually huge and difficult to obtain, so it is not practical.

[0050] To this end, the present application accordingly provides an image data generation method that can avoid the difficulty in obtaining the original data set, thereby improving the accuracy of the initial neural network model.

[0051] See also Figure 1 As shown, the embodiment of the present application discloses a method for generating image data, including:

[0052] Step S11: construct an objective function including a first regularization term and a second regularization term; wherein the first regularization term takes an iterative image as a variable parameter, the second regularization term takes a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on the function value of the objective function.

[0053] In this embodiment, the objective function including the first regularization term and the second regularization term may include: based on the pre-trained initial neural network model and the pre-specified image category to be generated, constructing a classification loss function corresponding to the initial neural network model; constructing a first regularization term for controlling the natural characteristics of the image with the iterative image as a variable parameter, and constructing a second regularization term for controlling the realism of the image with the feature map of the iterative image as a variable parameter; constructing an objective function including the first regularization term, the second regularization term and the classification loss function. It can be understood that the pre-specified image category to be generated can be based on the initial neural network model to take all categories as the image category to be generated, or it can be a targeted selection of an image category to be generated. For example, in this embodiment, a category defined in the ImageNet dataset can be arbitrarily selected as the image category to be generated.

[0054] Step S12: Obtain a pre-trained initial neural network model, and then extract pre-saved feature map information from the normalization layer of the initial neural network model.

[0055] It can be understood that, in this embodiment, after extracting the pre-saved feature map information from the normalization layer of the initial neural network model, the pre-saved feature map information is extracted to obtain feature map mean information and feature map variance information. For example, the feature map mean information and feature map variance information related to the original data set are extracted from the batch normalization layer of the convolutional neural network (CNN) model, so that the feature map mean information and the feature map variance information are subsequently input into the objective function.

[0056] Step S13: creating a noise image, and using the noise image as the first iteration image, and then extracting a feature map of the first iteration image.

[0057] In this embodiment, the noise image created may be a random noise image, and the size is set based on the preset image requirements. For example, in this embodiment, the size is set to 224×224. It should be noted that since the objective function needs to perform multiple iterations before the corresponding image data is subsequently generated, the created noise image is only used as the initial iteration image. Therefore, it can be understood that the feature map extracted from the noise image is also only the feature map of the initial iteration image.

[0058] Step S14: using the feature map of the first iteration image, the pre-saved feature map information and the first iteration image as first iteration parameters, and performing multiple iteration operations on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

[0059] In this embodiment, before the target function is iterated multiple times based on the preset number of iterations to generate the corresponding image data, it specifically includes: determining the hyperparameter information for configuring the target function, and configuring the target function using the hyperparameter information; wherein, one or more parameter information of the learning rate (LR), batch size (Batchsize) and the number of iterations (Epoch) is determined as the hyperparameter information. In this embodiment, the hyperparameter can be set based on the preset training accuracy requirements. When the training is stable, the batch size is set to a high value to reduce the variance of the random gradient and reduce the introduced noise. For example, in this embodiment, the learning rate is first set to 0.05, the batch size is set to 512, and the number of iterations is set to 10,000. Then, the feature map of the first iteration image, the pre-saved feature map information and the first iteration image are input into the target function, and an iterative operation with the number of iterations of 10,000 is performed, and finally the image data is obtained as the training data.

[0060] It can be understood that when it is expected that the image category to be generated includes all defined categories, all categories are sequentially used as pre-specified image categories to be generated, and then a classification loss function corresponding to the initial neural network model is constructed based on the pre-trained initial neural network model and the pre-specified image category to be generated, and then an objective function including the first regularization term, the second regularization term and the classification loss function is constructed, and the above steps S12, S13 and S14 are repeated to generate a corresponding image data set. For example, all defined categories in the ImageNet data set are sequentially used as pre-specified image categories to be generated, and after repeating the above steps, 100 to 1000 image data are finally obtained. This embodiment can make the generated image data more comprehensive by taking all defined categories as pre-specified image categories to be generated, and the image data is used as training data, so that the training data is more reliable, and the initial neural network model trained again by the training data can maintain good accuracy.

[0061] It can be seen that the present application first constructs an objective function including a first regularization term and a second regularization term; wherein the first regularization term takes an iterative image as a variable parameter, the second regularization term takes a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on the function value of the objective function; a pre-trained initial neural network model is obtained, and then pre-saved feature map information is extracted from a normalization layer of the initial neural network model; a noise image is created, and the noise image is used as a first iteration image, and then a feature map of the first iteration image is extracted; the feature map of the first iteration image, the pre-saved feature map information and the first iteration image are used as first iteration parameters, and multiple iterative operations are performed on the objective function based on a preset number of iterations to generate corresponding image data, so that the initial neural network model can be retrained using the image data as training data. It can be seen that the present application creates an objective function including a first regularization term and a second regularization term, and inputs the feature map information, noise image and feature map of the noise image pre-saved in the pre-trained initial neural network model into the objective function to generate image data corresponding to the pre-trained initial neural network model as training data. Therefore, there is no need to obtain the original data of the pre-trained initial neural network model, thereby reducing the difficulty of obtaining training data. In addition, by performing multiple iterative operations on the objective function based on a preset number of iterations to ensure that the acquired image data is closer to the original data, the image data can be used as training data, thereby improving the efficiency of subsequent re-training of the initial neural network model using the training data set.

[0062] See also Figure 2 As shown, the embodiment of the present invention discloses a specific method for generating image data. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically:

[0063] Step S21: constructing a first regularization term for controlling the natural characteristics of an image with the iterative image as a variable parameter.

[0064] In this embodiment, the construction of the first regularization term for controlling the natural characteristics of the image with the iterative image as a variable parameter may include: using the iterative image as a variable parameter, respectively constructing a global variance and an L2 regularization term, and assigning corresponding weight coefficients to the global variance and the L2 regularization term to obtain the first regularization term for controlling the natural characteristics of the image. In this embodiment, the global variance can reduce the difference between each point in the image and the surrounding up, down, left, and right, and the L2 regularization term can prevent the generated image from overfitting and make the image more harmonious. Wherein, the formula of the first regularization term is as follows:

[0065]

[0066] The above refers to the first regularization term, is the global variance (TV is also called total variance, i.e. global variance), is the L2 regularization term, α TV and are the weight coefficients of the global variance and L2 regularization term, respectively.

[0067] Step S22: constructing a second regularization term for controlling the image fidelity with the feature map of the iterated image as a variable parameter.

[0068] In this embodiment, the construction of a second regularization term for controlling the image realism with the feature map of the iterative image as a variable parameter includes: constructing a feature map information calculation function with the feature map of the iterative image as a variable parameter, and constructing a second regularization term for controlling the image realism based on the difference between the feature map information calculation function and the pre-saved feature map information.

[0069] In this embodiment, the feature map of the iterative image is used as a variable parameter to construct a feature map information calculation function, and a second regularization term for controlling the image realism is constructed based on the difference between the feature map information calculation function and the pre-saved feature map information, including: using the feature map of the iterative image as a variable parameter, respectively constructing a feature map mean function and a feature map variance function; constructing a first L2 regularization term based on the difference between the feature map mean function and the pre-saved feature map mean information subsequently extracted from the normalization layer of the initial neural network model, and constructing a second L2 regularization term based on the difference between the feature map variance function and the pre-saved feature map variance information subsequently extracted from the normalization layer of the initial neural network model; constructing a second regularization term for controlling the image realism that includes the first L2 regularization term and the second L2 regularization term. Specifically, the formula of the second regularization term is:

[0070]

[0071] in, The above is the second regular term, x l is the l-th layer feature map of the iterated image, Mean(x l ) is the mean function of the feature map of the first layer, Var(x l ) is the variance function of the feature map at layer l, μ l To pre-save the mean information of the feature map of the lth layer, To pre-save the variance information of the feature map of the lth layer, the ||·||2 operator is an L2 regularization calculation.

[0072] Step S23: constructing an objective function including the first regularization term and the second regularization term; the iterative image of the non-initial iteration is an image constructed based on the function value of the objective function.

[0073] In this embodiment, it is first necessary to construct an objective function for generating image data, and the objective function needs to include the following two items: a first regularization term with the iterated image as a variable parameter and a second regularization term with the feature map of the iterated image as a variable parameter. It should be noted that the iterative image of the non-initial iteration is an image constructed based on the function value of the objective function. That is, in this embodiment, the final image data is generated by iterating the constructed objective function multiple times, and, except for the first iteration, for each subsequent iteration, the above objective function uses the image constructed by the function value output by the objective function after the previous iteration as the input value of this iteration, so as to achieve the purpose of continuous iterative updating in this way.

[0074] It should be noted that the objective function in this embodiment includes not only the first regularization term and the second regularization term, but also a classification loss function that represents the degree of difference between the predicted data and the actual data, i.e., the robustness of the model, wherein the classification function is constructed based on a pre-trained initial neural network model and a pre-specified image category to be generated. The smaller the classification loss function, the better the robustness of the model. The specific objective function formula is as follows:

[0075]

[0076] Among them, the above x * represents the objective function, H represents the length of the iteration image size, W represents the width of the iteration image, C is the RGB (R (red), G (green), B (blue)) channel, represents the domain of the iterated image, L(·) is the classification loss function of the pre-trained initial neural network model, φ(x) is the initial neural network model, φ0 is the pre-specified image category to be generated, is the first regularization term, is the second regularization term.

[0077] Step S24: Obtain a pre-trained initial neural network model, and then extract pre-saved feature map information from the normalization layer of the initial neural network model.

[0078] Step S25: Create a noise image, use the noise image as the first iteration image, and then extract a feature map of the first iteration image.

[0079] Step S26: Using the feature map of the first iteration image, the pre-saved feature map information and the first iteration image as first iteration parameters, and performing multiple iteration operations on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

[0080] Among them, for more specific processing procedures of the above steps S24, S25 and S26, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0081] It can be seen that the role of the global variance in the first regularization term in the embodiment of the present application is to ensure that the difference between each pixel in the image and its surrounding pixels is not too large, and the role of the L2 regularization term is to make the generated image more harmonious. Through the setting of the global variance and the L2 regularization term, the first regularization term can control the natural characteristics of the image, that is, the first regularization term can make the generated image more similar to the natural image. Because the second regularization term makes the generated image more realistic, the generated image data is closer to the original data of the initial neural network model, so it is guaranteed that the generated image data can replace the original data of the initial neural network model, thereby reducing the difficulty of subsequent retraining of the initial neural network model and ensuring the accuracy of the initial neural network model after subsequent retraining.

[0082] See also Figure 3 As shown, the embodiment of the present application discloses a neural network model training method, including:

[0083] Step S31: Obtain a pre-trained initial neural network model.

[0084] In this embodiment, before retraining the model, an initial neural network model that has been trained with the original data set must first be obtained.

[0085] Step S32: Determine the image requirement according to the training accuracy requirement.

[0086] In this embodiment, the above training accuracy requirement is the accuracy that the neural network model needs to achieve after training, and the image demand is determined based on the accuracy requirement. It is understandable that when training the model, the more comprehensive the training data, the better the performance of the trained model, that is, the higher the accuracy, but at the same time, too much training data will also bring more calculation and memory usage. Therefore, it is necessary to determine the amount of training data according to specific needs, and when the training accuracy requirement is not too high, to obtain the appropriate image demand, so as to avoid excessive calculation and memory usage.

[0087] Step S33: Repeat the aforementioned disclosed image data generation method multiple times based on the image demand to obtain a training data set containing a corresponding number of image data.

[0088] In this embodiment, after the image requirement is determined according to the training accuracy requirement, a corresponding number of image data are generated by the aforementioned disclosed image data generation method, so that these image data can be sorted and used as a training data set.

[0089] Step S34: retraining the initial neural network model using the training data set to obtain an optimized neural network model.

[0090] In this embodiment, Figure 4 As shown, after obtaining a training data set corresponding to the image demand, the initial neural network model is iteratively retrained using the training data set, that is, the model is fine-tuned to obtain an optimized neural network model.

[0091] In this embodiment, after obtaining the optimized neural network model, it can also include: verifying the optimized neural network model to determine the accuracy reduction rate of the optimized neural network model compared to the initial neural network model. In the case of medium and high bit retraining, the accuracy of the optimized neural network model should be the same as that of the initial neural network model, and in the case of ultra-low bits, that is, less than or equal to 4 bits, the accuracy reduction rate of the optimized neural network model compared to the initial neural network model should be maintained at 10%. When the accuracy reduction rate of the optimized neural network model is too high compared to the initial neural network model, the optimized neural network model cannot be accepted for use.

[0092] It can be seen that the embodiment of the present application first obtains a pre-trained initial neural network model; determines the image demand according to the training accuracy requirement; repeatedly executes the aforementioned disclosed image data generation method multiple times based on the image demand to obtain a training data set containing a corresponding number of image data; and retrains the initial neural network model using the training data set to obtain an optimized neural network model. It can be seen that the present application can obtain training data for training the initial neural network model by repeatedly executing the aforementioned disclosed image data generation method multiple times based on the image demand, without obtaining the original data of the pre-trained initial neural network model, thereby avoiding the problem of being unable to train the initial neural network model again due to the difficulty in obtaining the original data. Moreover, since the image demand is determined according to the training accuracy requirement, efficient training of the initial neural network model is achieved, and good accuracy can be maintained.

[0093] See also Figure 5 As shown, the embodiment of the present application discloses an image data generating device, including:

[0094] A function construction module 11 is used to construct an objective function including a first regularization term and a second regularization term; wherein the first regularization term uses an iterative image as a variable parameter, the second regularization term uses a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on a function value of the objective function;

[0095] A feature map information extraction module 12 is used to obtain a pre-trained initial neural network model, and then extract pre-saved feature map information from a normalization layer of the initial neural network model;

[0096] An iterative image creation module 13, used for creating a noise image, taking the noise image as a first iterative image, and then extracting a feature map of the first iterative image;

[0097] The image data generation module 14 is used to use the feature map of the first iteration image, the pre-saved feature map information and the first iteration image as first iteration parameters, and to perform multiple iterative operations on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

[0098] It can be seen that the present application first constructs an objective function including a first regularization term and a second regularization term; wherein the first regularization term takes an iterative image as a variable parameter, the second regularization term takes a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on the function value of the objective function; a pre-trained initial neural network model is obtained, and then pre-saved feature map information is extracted from a normalization layer of the initial neural network model; a noise image is created, and the noise image is used as a first iteration image, and then a feature map of the first iteration image is extracted; the feature map of the first iteration image, the pre-saved feature map information and the first iteration image are used as first iteration parameters, and multiple iterative operations are performed on the objective function based on a preset number of iterations to generate corresponding image data, so that the initial neural network model can be retrained using the image data as training data. It can be seen that the present application creates an objective function including a first regularization term and a second regularization term, and inputs the feature map information, noise image and feature map of the noise image pre-saved in the pre-trained initial neural network model into the objective function to generate image data corresponding to the pre-trained initial neural network model as training data. Therefore, there is no need to obtain the original data of the pre-trained initial neural network model, thereby reducing the difficulty of obtaining training data. In addition, by performing multiple iterative operations on the objective function based on a preset number of iterations to ensure that the acquired image data is closer to the original data, the image data can be used as training data, thereby improving the efficiency of subsequent re-training of the initial neural network model using the training data set.

[0099] In some specific embodiments, the function construction module 11 includes:

[0100] The classification loss function construction unit is used to construct a classification loss function corresponding to the initial neural network model based on the pre-trained initial neural network model and the pre-specified image category to be generated.

[0101] An objective function construction unit is used to construct a first regularization term for controlling the natural characteristics of an image with the iterative image as a variable parameter, and to construct a second regularization term for controlling the realism of an image with a feature map of the iterative image as a variable parameter; and to construct an objective function including the first regularization term, the second regularization term and the classification loss function.

[0102] In some specific embodiments, the function construction module 11 includes:

[0103] The first regularization term creation unit is used to construct the global variance and L2 regularization terms respectively with the iterative image as a variable parameter, and assign corresponding weight coefficients to the global variance and the L2 regularization term to obtain a first regularization term for controlling the natural characteristics of the image.

[0104] The second regularization term creation unit is used to construct a feature map information calculation function with the feature map of the iterated image as a variable parameter, and to construct a second regularization term for controlling the image realism based on the difference between the feature map information calculation function and the pre-saved feature map information.

[0105] In some specific embodiments, the second regularization term creation unit includes:

[0106] The mean variance information extraction unit is used to extract the pre-saved feature map mean information and feature map variance information from the normalization layer of the initial neural network model.

[0107] The mean-variance function construction unit is used to respectively construct a feature map mean function and a feature map variance function using the feature map of the iterative image as a variable parameter.

[0108] An L2 regularization term construction unit is used to construct a first L2 regularization term based on the difference between the feature map mean function and the feature map mean information, and to construct a second L2 regularization term based on the difference between the feature map variance function and the feature map variance information.

[0109] The second regularization term construction unit is used to construct a second regularization term including the first L2 regularization term and the second L2 regularization term for controlling the realism of the image.

[0110] In some specific embodiments, the image data generating module 14 includes:

[0111] A hyperparameter configuration unit is used to determine hyperparameter information used to configure the objective function, and configure the objective function using the hyperparameter information; wherein one or more parameter information among a learning rate, a batch size, and a number of iterations is determined as the hyperparameter information.

[0112] Figure 6 A schematic diagram of the structure of a computer device provided by an example of the present invention. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the image data generation method performed by the computer device disclosed in any of the above embodiments.

[0113] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the computer device 20; the communication interface 24 can create a data transmission channel between the computer device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0114] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0115] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0116] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the computer device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, and it can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the image data generation method performed by the computer device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data received by the computer device and transmitted from an external device, the data 223 can also include data collected by its own input and output interface 25, etc.

[0117] Furthermore, an embodiment of the present invention also discloses a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the method steps performed in the image data generation process disclosed in any of the aforementioned embodiments are implemented.

[0118] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0119] The above is a detailed introduction to an image data generation method, model training method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for generating image data, characterized in that: include: Constructing an objective function including a first regularization term and a second regularization term; wherein the first regularization term uses an iterative image as a variable parameter, the second regularization term uses a feature map of the iterative image as a variable parameter, and the iterative image of a non-initial iteration is an image constructed based on a function value of the objective function; Obtaining a pre-trained initial neural network model, and then extracting pre-saved feature map information from a normalization layer of the initial neural network model; Creating a noise image, using the noise image as a first iteration image, and then extracting a feature map of the first iteration image; The feature map of the first iteration image, the pre-saved feature map information and the first iteration image are used as first iteration parameters, and multiple iterative operations are performed on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

2. The image data generating method according to claim 1, characterized in that: The constructing of the objective function including the first regularization term and the second regularization term includes: Based on the pre-trained initial neural network model and the pre-specified image category to be generated, constructing a classification loss function corresponding to the initial neural network model; Constructing a first regularization term for controlling the natural characteristics of an image with the iterative image as a variable parameter, and constructing a second regularization term for controlling the realism of an image with the feature map of the iterative image as a variable parameter; Construct an objective function including the first regularization term, the second regularization term and the classification loss function.

3. The image data generating method according to claim 2, characterized in that: The constructing of a first regularization term for controlling the natural characteristics of an image with the iterated image as a variable parameter comprises: Taking the iterative image as a variable parameter, a global variance and an L2 regularization term are constructed respectively, and corresponding weight coefficients are assigned to the global variance and the L2 regularization term to obtain a first regularization term for controlling the natural characteristics of the image.

4. The image data generating method according to claim 2, characterized in that: The constructing of a second regularization term for controlling the image fidelity with the feature map of the iterated image as a variable parameter comprises: A feature map information calculation function is constructed with the feature map of the iterated image as a variable parameter, and a second regularization term for controlling image fidelity is constructed based on the difference between the feature map information calculation function and the pre-saved feature map information.

5. The image data generating method according to claim 4, characterized in that: The extracting the pre-saved feature map information from the normalization layer of the initial neural network model includes: Extracting pre-saved feature map mean information and feature map variance information from the normalization layer of the initial neural network model; Correspondingly, the feature map of the iterated image is used as a variable parameter to construct a feature map information calculation function, and a second regularization term for controlling the image fidelity is constructed based on the difference between the feature map information calculation function and the pre-saved feature map information, including: Taking the feature map of the iterative image as a variable parameter, respectively constructing a feature map mean function and a feature map variance function; Constructing a first L2 regularization term based on a difference between the feature graph mean function and the feature graph mean information, and constructing a second L2 regularization term based on a difference between the feature graph variance function and the feature graph variance information; A second regularization term for controlling image realism is constructed, which includes the first L2 regularization term and the second L2 regularization term.

6. The image data generating method according to any one of claims 1 to 5, characterized in that: Before performing multiple iterative operations on the objective function based on a preset number of iterations to generate corresponding image data, the method further includes: Determine hyperparameter information for configuring the objective function, and configure the objective function using the hyperparameter information; wherein one or more parameter information of a learning rate, a batch size, and a number of iterations is determined as the hyperparameter information.

7. A neural network model training method, characterized in that: include: Get a pre-trained initial neural network model; Determine the image requirements based on the training accuracy requirements; Repeating the image data generation method according to any one of claims 1 to 6 for multiple times based on the image demand to obtain a training data set containing a corresponding number of image data; The initial neural network model is retrained using the training data set to obtain an optimized neural network model.

8. An image data generating device, characterized in that: include: A function construction module, used to construct an objective function including a first regularization term and a second regularization term; wherein the first regularization term uses an iteration image as a variable parameter, the second regularization term uses a feature map of the iteration image as a variable parameter, and the iteration image of a non-initial iteration is an image constructed based on a function value of the objective function; A feature map information extraction module, used to obtain a pre-trained initial neural network model, and then extract pre-saved feature map information from a normalization layer of the initial neural network model; An iterative image creation module, used for creating a noise image, taking the noise image as a first iterative image, and then extracting a feature map of the first iterative image; An image data generation module is used to use the feature map of the first iteration image, the pre-saved feature map information and the first iteration image as first iteration parameters, and to perform multiple iterative operations on the objective function based on a preset number of iterations to generate corresponding image data, so as to use the image data as training data to retrain the initial neural network model.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the image data generating method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: Used to store a computer program; wherein, when the computer program is executed by a processor, the steps of the image data generating method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Small target classification method based on deconvolution neural network

    CN110472667A

  • Image processing method and device, neural network training method and device and computer equipment

    CN111028153A

  • Systems and methods for semi-supervised depth estimation according to an arbitrary camera

    US20210004974A1

  • Knowledge distillation and gradient pruning-based compression of artificial intelligence-based base caller

    WO2021168014A1