Data augmentation method and device, computer device, and storage medium
By calculating the augmented intermediate parameters of the original image and generating the augmented image, the problem of insufficient training data in deep learning is solved, the accuracy and sample diversity of the classification algorithm are improved, and the generalization ability of the model is enhanced.
Patent Information
- Application Number
- CN202011473235.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2040-12-15
AI Technical Summary
Existing deep learning classification algorithms are prone to overfitting when there is insufficient training data. Traditional data augmentation methods have limited effect on enriching the diversity of training samples and are unable to meet the training requirements of network models.
By calculating the augmented intermediate parameters of the original image, including the matrix relationship under different exposure parameters and the derivative value after inputting the network model, augmented images are generated to enrich the diversity of training samples.
The classification accuracy after training the network model is improved, the diversity of training samples is enhanced, and the generalization ability of the model is improved.
Smart Images

Figure CN114638997B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, in particular to a data augmentation method and device, computer equipment and storage medium. BACKGROUND
[0002] The classification algorithm in deep learning is a very general algorithm, which can realize scene classification, object classification and other functions. Because of its simple task and small network model, it will be widely applied to various products. However, there are many types of classification algorithms at present, and the optimization difficulty is high.
[0003] Unlike traditional machine learning, deep learning needs a large number of positive samples for training, so that the machine can learn enough features to achieve "one can deduce three", thereby preventing the phenomenon of overfitting caused by too small data set. When using deep learning network to solve practical problems, the quantity and quality of training data are a bottleneck restricting the effect of the network. For some types of small or difficult to collect data, data augmentation operation is needed to meet the training needs of the deep learning network.
[0004] The traditional data augmentation method includes rotation, mirroring, random cropping, adding noise and other operations. This method does not change the category of the target in essence, and has limited effect on enriching the diversity of training samples. SUMMARY
[0005] The embodiments of the present application provide a data augmentation method, device, computer equipment and storage medium, which generates an augmented image corresponding to an original image by calculating an augmented intermediate parameter for augmenting the original image, thereby enriching the diversity of training samples and improving the classification accuracy of the trained network model.
[0006] In one aspect, the present application provides a data augmentation method, which comprises:
[0007] obtaining an original image collected;
[0008] calculating an augmented intermediate parameter for augmenting the original image, the augmented intermediate parameter being used to generate an intermediate parameter for augmenting the original image under a preset augmentation condition, the augmented intermediate parameter including a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by inputting the original image into a preset network model and then deriving;
[0009] generating an augmented image corresponding to the original image according to the augmented intermediate parameter.
[0010] In some embodiments of the present application, the augmented intermediate parameter comprises a matrix relationship of the original image under different exposure parameters, and the calculation of the augmented intermediate parameter of the original image comprises:
[0011] obtaining augmented images of the original image under preset different exposure parameters to obtain an augmented image library;
[0012] determining a matrix relationship of the original image under different exposure parameters according to the augmented image library.
[0013] In some embodiments of the present application, the determination of the matrix relationship of the original image under different exposure parameters according to the augmented image library comprises:
[0014] determining images of each image in the augmented image library under different exposure parameters;
[0015] respectively determining a mapping relationship between each image in the augmented image library and the image under different exposure parameters;
[0016] determining a most similar image to the original image in the augmented image library according to each mapping relationship, and determining the matrix relationship of the original image under different exposure parameters;
[0017] the generation of the augmented image corresponding to the original image according to the augmented intermediate parameter comprises:
[0018] generating the augmented image of the original image under different exposure parameters based on the matrix relationship.
[0019] In some embodiments of the present application, the determination of the mapping relationship between each image in the augmented image library and the image under different exposure parameters comprises:
[0020] respectively taking each image in the augmented image library as a target augmented image, mapping pixel values of the target augmented image to pixel values of a preset dimension, and the preset dimension is higher than a dimension of the pixel values of the target augmented image;
[0021] after the pixel values of the target augmented image are mapped to the pixel values of the preset dimension, determining the mapping relationship between the target augmented image and the image under different exposure parameters;
[0022] the determination of the most similar image to the original image in the augmented image library according to each mapping relationship, and the determination of the matrix relationship of the original image under different exposure parameters, comprises:
[0023] According to the mapping relationship, it is determined that the target augmented image is transformed into an image matrix after pixel values of a preset dimension are determined;
[0024] The image matrix is minimized to obtain a matrix relationship of the target augmented image under different exposure parameters.
[0025] In some embodiments of the present application, the image matrix is minimized to obtain a matrix relationship of the target augmented image under different exposure parameters, comprising:
[0026] The distance of the color distribution of the target augmented image and the image in the augmented image library is calculated;
[0027] The image in the augmented image library closest to the color distribution of the target augmented image is determined as the closest image;
[0028] The target exposure parameter corresponding to the closest image is determined;
[0029] The matrix relationship of the target augmented image under the target exposure parameter is obtained.
[0030] In some embodiments of the present application, the augmented image corresponding to the original image under different exposure parameters is generated based on the matrix relationship, comprising:
[0031] The distance of the closest image in the original image and the augmented image library is obtained;
[0032] According to the distance, the matrix relationship and a preset fixed parameter, the augmented parameter of the original image is calculated;
[0033] According to the augmented parameter, the original image is augmented to obtain the augmented image corresponding to the original image under different exposure parameters.
[0034] In some embodiments of the present application, the augmented image corresponding to the original image under different exposure parameters is generated based on the matrix relationship, using the following formula:
[0035]
[0036] M=αM s
[0037] α=exp(-d 2 / 2σ 2 )
[0038] Wherein, d is the distance of the closest image in the original image and the augmented image library, σ is a preset fixed parameter, M s is the matrix relationship of the original image under different exposure parameters, and I(in) is an original image, I (out) is an augmented image corresponding to the original image under different exposure parameters, and M is an augmented parameter.
[0039] In some embodiments of the present application, the augmented intermediate parameter includes a derivative value obtained by deriving the original image input into a preset network model, and the calculation of the augmented intermediate parameter for augmenting the original image includes:
[0040] inputting the original image into a preset network model and performing forward processing to obtain a loss value;
[0041] deriving the loss value to obtain a derivative value;
[0042] The generating of the augmented image corresponding to the original image according to the augmented intermediate parameter includes:
[0043] generating a noise image of the original image according to the derivative value;
[0044] taking the noise image as the augmented image corresponding to the original image.
[0045] In another aspect, the present application provides a data augmentation device, which includes:
[0046] an acquisition module configured to acquire an original image collected;
[0047] a calculation module configured to calculate an augmented intermediate parameter for augmenting the original image, the augmented intermediate parameter being used for an intermediate parameter for augmenting the original image generated based on a preset augmented condition, the augmented intermediate parameter including a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by deriving the original image input into a preset network model;
[0048] a generation module configured to generate an augmented image corresponding to the original image according to the augmented intermediate parameter.
[0049] In some embodiments of the present application, the augmented intermediate parameter includes a matrix relationship under different exposure parameters corresponding to the original image, and the calculation module is specifically configured to:
[0050] acquire augmented images of the original image under preset different exposure parameters to obtain an augmented image library;
[0051] determine a matrix relationship under different exposure parameters corresponding to the original image according to the augmented image library.
[0052] In some embodiments of the present application, the calculation module is specifically configured to:
[0053] determine, for each image in the augmented image library, an image of the image under different exposure parameters;
[0054] respectively determine a mapping relationship of each image in the augmented image library and the image under different exposure parameters;
[0055] determine, according to each mapping relationship, an image in the augmented image library that is most similar to the original image, and determine a matrix relationship of the original image under different exposure parameters;
[0056] The generation module is specifically configured to:
[0057] generate an augmented image corresponding to the original image under different exposure parameters based on the matrix relationship.
[0058] In some embodiments of the present application, the calculation module is specifically configured to:
[0059] respectively map pixel values of each image in the augmented image library as a target augmented image to pixel values of a preset dimension, the preset dimension being higher than a dimension of the pixel values of the target augmented image;
[0060] After the pixel values of the target augmented image are mapped to pixel values of a preset dimension, determine a mapping relationship of the target augmented image and the image under different exposure parameters;
[0061] According to the mapping relationship, determine an image matrix of the target augmented image after being transformed to pixel values of a preset dimension;
[0062] minimize changes to the image matrix to obtain a matrix relationship of the target augmented image under different exposure parameters.
[0063] In some embodiments of the present application, the calculation module is specifically configured to:
[0064] calculate a distance of color distribution of the target augmented image and images in the augmented image library;
[0065] determine an image in the augmented image library that is closest to the color distribution of the target augmented image as the most similar image;
[0066] determine a target exposure parameter corresponding to the most similar image;
[0067] obtain a matrix relationship of the target augmented image under the target exposure parameter.
[0068] In some embodiments of the present application, the calculation module is specifically configured to:
[0069] acquire a distance of a nearest image in the augmented image library to the original image;
[0070] calculate an augmented parameter of the original image according to the distance, the matrix relationship and a preset fixed parameter;
[0071] augment the original image according to the augmented parameter to obtain an augmented image of the original image under different exposure parameters.
[0072] In some embodiments of the present application, the calculation module is specifically configured to use the following formula when generating the augmented image of the original image under different exposure parameters based on the matrix relationship:
[0073]
[0074] M = aM s
[0075] a = exp(-d 2 / 2s 2 )
[0076] wherein d is the distance of the nearest image in the augmented image library to the original image, s is the preset fixed parameter, M s is the matrix relationship of the original image under different exposure parameters, I (in) is the original image, I (out) is the augmented image of the original image under different exposure parameters, and M is the augmented parameter.
[0077] In some embodiments of the present application, the augmented intermediate parameter includes a derivative value obtained by deriving the original image input into a preset network model, and the calculation module is specifically configured to:
[0078] input the original image into a preset network model and perform forward processing to obtain a loss value;
[0079] derivate the loss value to obtain a derivative value;
[0080] The generation module is specifically configured to:
[0081] generate a noise image of the original image according to the derivative value;
[0082] use the noise image as the augmented image corresponding to the original image.
[0083] On the other hand, the present application also provides a computer device, which comprises:
[0084] one or more processors;
[0085] a memory; and
[0086] one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the data augmentation method of any one of the first aspect.
[0087] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is loaded by a processor to execute the steps of the data augmentation method of any one of the first aspect.
[0088] The present application enriches the diversity of training samples by calculating the augmentation intermediate parameters for augmenting the original image, such as the matrix relationship under different exposure parameters corresponding to the original image, or / and the derivative value obtained by deriving after inputting the original image into a preset network model, to generate the augmented image corresponding to the original image, thereby improving the accuracy of classification after training the network model. BRIEF DESCRIPTION OF DRAWINGS
[0089] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0090] Figure 1 is a scene schematic diagram of the data augmentation system provided by the embodiments of the present application;
[0091] Figure 2 is an embodiment flowchart of the data augmentation method provided in the embodiments of the present application;
[0092] Figure 3 is an embodiment flowchart of step 202 in the embodiments of the present application;
[0093] Figure 4 is an embodiment flowchart of step 302 in the embodiments of the present application;
[0094] Figure 5is an embodiment structure schematic diagram of a data augmentation device provided in the embodiments of the present application;
[0095] Figure 6 is an embodiment structure schematic diagram of a computer device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0096] The technical solutions in the embodiments of the present application will be clearly and completely described in connection with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person skilled in the art without creative work fall within the protection scope of the present application.
[0097] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features limited by "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "a plurality of" is two or more, unless otherwise explicitly and specifically limited.
[0098] In the present application, the word "exemplary" is used to mean "serving as an example, instance, or illustration." Any implementation described as "exemplary" in the present application is not necessarily to be construed as preferred or advantageous over other implementations. The following description is presented to enable any person skilled in the art to make and use the present application. In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present application. It should be apparent to one skilled in the art, however, that the present application can be practiced without using these specific details. In other instances, well-known structures and processes are not elaborated upon in order to avoid unnecessary detail, which can obscure the description of the present application. Accordingly, the present application is not intended to be limited by the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
[0099] It should be noted that the method of the embodiments of the present application is executed in the computer device, and the processing objects of each computer device exist in the form of data or information, such as time, which is actually time information. It can be understood that if the size, quantity, position and the like are mentioned in the subsequent embodiments, they all exist in the form of corresponding data or information for processing by the computer device, and details are not described here.
[0100] Firstly, some basic concepts involved in the embodiments of the present application are introduced as follows:
[0101] One-Hot encoding: also known as one-bit effective encoding, mainly using N-bit state register to encode N states, each state has its own independent register bit, and only one bit is effective at any time. One-Hot encoding is a representation of categorical variables as binary vectors. This first requires mapping categorical values to integer values. Then, each integer value is represented as a binary vector, except for the index of the integer, which is zero, and it is marked as 1.
[0102] Batch: Batch size is a hyperparameter that defines the number of samples to be processed before updating the internal model parameters. Batch is considered as a loop that iterates over one or more samples and makes predictions. At the end of the batch, the predictions are compared with the expected output variable and the error is calculated. From this error, the update algorithm is used to improve the model, for example, moving down the error gradient. The training dataset can be divided into one or more batches. When all training samples are used to create one batch, the learning algorithm is called batch gradient descent. When the batch size is the size of one sample, the learning algorithm is called stochastic gradient descent. When the batch size is larger than one sample and smaller than the size of the training dataset, the learning algorithm is called mini-batch gradient descent.
[0103] The embodiments of the present application provide a data augmentation method and device, computer equipment and storage medium, which are described in detail below.
[0104] Please refer to Figure 1 , Figure 1 The scene schematic diagram of the data augmentation system provided by the embodiments of the present application can include a computer device 100, and the computer device 100 is integrated with a data augmentation device, such as Figure 1 the computer device in the foregoing.
[0105] In the embodiment of the present application, the computer device 100 is mainly used to obtain a captured original image; calculate augmentation intermediate parameters for augmenting the original image, wherein the augmentation intermediate parameters are used to generate intermediate parameters for augmenting the original image based on preset augmentation conditions, and the augmentation intermediate parameters include matrix relationships under different exposure parameters corresponding to the original image, or / and derivative values obtained by taking the derivative after inputting the original image into a preset network model; and generate an augmented image corresponding to the original image based on the augmentation intermediate parameters.
[0106] In the embodiments of the present application, the computer device 100 may be an independent server, or a server network or server cluster composed of servers. For example, the computer device 100 described in the embodiments of the present application includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. A cloud server is composed of a large number of computers or network servers based on cloud computing.
[0107] It is understood that the terminal 100 used in the embodiments of the present application can be a device that includes both receiving and transmitting hardware, that is, a device that has receiving and transmitting hardware capable of performing two-way communication over a two-way communication link. Such a device may include: a cellular or other communication device with a single-line display, a multi-line display, or a cellular or other communication device without a multi-line display. The terminal 100 can be a desktop terminal or a mobile terminal. The terminal 100 can also be a mobile phone, a tablet computer, a laptop computer, etc.
[0108] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer computer devices as shown in Figure 1 Only one computer device is shown in the figure. It can be understood that the data augmentation system can also include one or more other services, which are not limited here.
[0109] In addition, if Figure 1 As shown, the data augmentation system may further include a memory 200 for storing data, such as stored data, such as the acquired original image, the augmented image corresponding to the original image, and the like.
[0110] It should be noted that Figure 1The scenario diagram of the data augmentation system shown is only an example. The data augmentation system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the data augmentation system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0111] First, an embodiment of the present application provides a data augmentation method, the execution subject of the data augmentation method is a data augmentation device, and the data augmentation device is applied to a computer device. The data augmentation method includes: obtaining a captured original image; calculating augmentation intermediate parameters for augmenting the original image, the augmentation intermediate parameters are used to generate intermediate parameters for augmenting the original image based on preset augmentation conditions, the augmentation intermediate parameters include matrix relationships under different exposure parameters corresponding to the original image, or / and, the derivative value obtained by derivation after the original image is input into a preset network model; generating an augmented image corresponding to the original image according to the augmentation intermediate parameters.
[0112] like Figure 2 FIG. 2 is a flow chart of an embodiment of a data augmentation method in an embodiment of the present application. The data augmentation method includes the following steps 201 to 203:
[0113] 201. Obtain the collected original image.
[0114] The original image may be captured by various imaging devices connected to a computer device. For example, in the logistics field, various imaging devices are installed in logistics outlets to capture images of preset areas of transmission devices (such as conveyor belts and conveyor plates) and sorting devices. These captured images may be the captured original images. It is understood that the captured original images may also be images captured by a computer device via a network, or images received from other computer devices, without limitation herein.
[0115] 202. Calculate an augmentation intermediate parameter for augmenting the original image.
[0116] Among them, the augmentation parameters are parameters that can be directly used to augment the original image, and the augmentation parameters correspond to actual augmentation operations, such as zooming in and out. The augmentation intermediate parameters are intermediate parameters for augmenting the original image generated based on preset augmentation conditions. The augmentation intermediate parameters do not correspond to actual augmentation operations. The augmentation intermediate parameters include the matrix relationship under different exposure parameters corresponding to the original image, or / and the derivative value obtained by derivation after the original image is input into a preset network model.
[0117] 203、generating an augmented image corresponding to the original image according to the augmented intermediate parameter.
[0118] The embodiment of the present application obtains an original image collected; calculates an augmented intermediate parameter for augmenting the original image, the augmented intermediate parameter being used for generating an intermediate parameter for augmenting the original image under a preset augmented condition, the augmented intermediate parameter including a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by derivation after the original image is input into a preset network model; and generates an augmented image corresponding to the original image according to the augmented intermediate parameter. The embodiment of the present application enriches the diversity of training samples and improves the accuracy of classification after training the network model based on the fact that the traditional data augmentation method in the prior art has limited effect on enriching the diversity of training samples, by calculating the augmented intermediate parameter for augmenting the original image, such as the matrix relationship under different exposure parameters corresponding to the original image, or / and the derivative value obtained by derivation after the original image is input into a preset network model, to generate the augmented image corresponding to the original image.
[0119] In the embodiment of the present application, there are multiple augmented intermediate parameters, and correspondingly, there are multiple ways to calculate the augmented intermediate parameter for augmenting the original image in step 202, which are described below by way of example.
[0120] (1) The augmented intermediate parameter includes a matrix relationship under different exposure parameters corresponding to the original image. In this scheme, it is specifically a data augmentation method of manual white balance, which is used to simulate the process of camera imaging to generate an effect image similar to that generated when the camera normally shoots. The data of manual white balance is data generated under the condition of synchronous exposure parameters. At this time, as shown in FIG. 2, the calculation of the augmented intermediate parameter for augmenting the original image in step 202 can specifically include steps 301-302 as follows: Figure 3
[0121] 301. Obtain augmented images of the original image under preset different exposure parameters to obtain an augmented image library.
[0122] The preset different exposure parameters can be set in advance. In one specific embodiment, the preset different exposure parameters can include the following five exposure parameters: 2850K, 3800K, 5500K, 6500K, 7500K, etc.
[0123] By obtaining augmented images of the original image under different preset exposure parameters, an augmented image library can be obtained. For example, different effect images of the original image under exposure parameters such as 2850K, 3800K, 5500K, 6500K, and 7500K are obtained. Five augmented images are generated for each original image, and a total of six images are finally obtained. It should be noted that the augmented image library includes original images and augmented images under different preset exposure parameters. For example, if there are 2000 original images and 10,000 augmented images are generated, the augmented image library contains a total of 12,000 images.
[0124] 302. Determine, based on the augmented image library, matrix relationships corresponding to the original image under different exposure parameters.
[0125] Specifically, such as Figure 4 As shown, the step 302 of determining the matrix relationship under different exposure parameters corresponding to the original image according to the augmented image library may further include:
[0126] 401. For the images in the augmented image library, determine images of each image under different exposure parameters.
[0127] 402. Determine respectively a mapping relationship between each image in the augmented image library and images of the image under different exposure parameters.
[0128] 403 . Determine an image in the augmented image library that is closest to the original image according to each of the mapping relationships, and determine a matrix relationship under different exposure parameters corresponding to the original image.
[0129] The step of generating the augmented image corresponding to the original image according to the augmented intermediate parameters may include generating augmented images corresponding to the original image under different exposure parameters based on the matrix relationship.
[0130] In some embodiments of the present application, respectively determining the mapping relationship between each image in the augmented image library and images of the image under different exposure parameters includes: taking each image in the augmented image library as a target augmented image, mapping the pixel values of the target augmented image to pixel values of a preset dimension; after the pixel values of the target augmented image are mapped to the pixel values of the preset dimension, determining the mapping relationship between the target augmented image and the image under different exposure parameters.
[0131] At this time, the determining, according to the mapping relationship, the image in the augmented image library that is most similar to the original image, and the matrix relationship under different exposure parameters corresponding to the original image includes: determining, according to the mapping relationship, an image matrix of the target augmented image after the pixel value of the target augmented image is mapped to a pixel value of a preset dimension; and obtaining the matrix relationship under different exposure parameters corresponding to the target augmented image by minimizing changes of the image matrix.
[0132] Specifically, the pixel value of the target augmented image is mapped to a pixel value of a preset dimension, where the pixel value of the target augmented image is three-dimensional, that is, includes three parameters R, G and B, and the preset dimension is higher than three-dimensional, that is, can include more parameters in addition to the R, G and B parameters, for example, the target augmented image [R, G, B] can be mapped to a higher dimension [R, G, B, RG, RB, GB, R2, G2, B2] (9 dimensions).
[0133] In some embodiments of the present application, the obtaining the matrix relationship under different exposure parameters corresponding to the target augmented image by minimizing changes of the image matrix includes: calculating a distance between a color distribution of the target augmented image and a color distribution of an image in the augmented image library; determining an image in the augmented image library that is closest to the color distribution of the target augmented image as the most similar image; determining a target exposure parameter corresponding to the most similar image; and obtaining the matrix relationship under the target exposure parameter corresponding to the target augmented image.
[0134] Specifically, the distance between the color distribution of the target augmented image and the color distribution of an image in the augmented image library is calculated; the image in the augmented image library that is closest to the color distribution of the target augmented image is determined as the most similar image, and the distance is the smallest; the M tcorr→t matrix under the exposure parameter corresponding to the most similar image is obtained.
[0135] Since the image in the augmented image library and the target augmented image are both represented by image matrices, the matrix corresponding to them represents the color distribution of the image, and the distance between the color distribution of the image in the augmented image library and the color distribution of the target augmented image represents the distance operation of the corresponding image matrices, the minimum change (that is, the minimum value) of all operation distances can determine the most similar image.
[0136] Specifically, the obtaining the matrix relationship under different exposure parameters corresponding to the target augmented image by minimizing changes of the image matrix is as follows:
[0137]
[0138] where, I t , respectively, where 3 represents RGB, n represents the number of pixels, and t represents different exposure parameters, is a 3x9 nonlinear matrix, is a mapping relationship after the pixel value is transformed to a preset dimension, and the mapping relationship after the transformation is minimized (i.e., the minimum distance between the image in the augmented image library and the color distribution of the target augmented image is taken), so that is obtained.
[0139] In some embodiments of the present application, the generating the augmented image corresponding to the original image under different exposure parameters based on the matrix relationship comprises: obtaining the distance of the closest image in the original image and the augmented image library; calculating the augmented parameter of the original image according to the distance, the matrix relationship and a preset fixed parameter; and augmenting the original image according to the augmented parameter to obtain the augmented image corresponding to the original image under different exposure parameters.
[0140] Specifically, the generating the augmented image corresponding to the original image under different exposure parameters based on the matrix relationship adopts the following formula:
[0141]
[0142] M = aM s
[0143] a = exp(-d 2 / 2s 2 )
[0144] where d is the distance of the closest image in the original image and the augmented image library, s is a preset fixed parameter, M s is the matrix relationship of the original image under different exposure parameters, I (in) is the original image, I (out) is the augmented image corresponding to the original image under different exposure parameters, and M is the calculated augmented parameter.
[0145] As an application scenario with the widest network, the classification network in deep learning exists. At present, there are many kinds of classification networks, and they are distributed on different gits on the Internet. There is no universal platform to collect most of the classification networks. Generally, a deep learning network includes a basic network and a corresponding function network. The basic network extracts features, and the function network performs corresponding processing. The basic network can be generally used, and different function networks such as classification networks and image segmentation networks can be connected afterwards. The benefit of integrating most of the classification networks into a platform is that it can reduce the trial cost of algorithm personnel for different networks, determine the basic network of the classification network at the fastest speed, and provide the speed of algorithm landing business.
[0146] In the embodiments of the present application, the basic network can be configured in the form of parameter configuration. After the efficient net b0-b7, resnet50, resnet101, resnext, resnest, seresnet, mobilenetv2, darknet, hrnet, vgg, shuffle net and various different network configurations are completed, the basic network can be called by configuring different parameters.
[0147] After the network selection and data augmentation are completed, the network training needs to be optimized to obtain a better network. In the embodiments of the present application, a network optimization strategy is designed, and the main innovation point is that cross entropy loss, arc face loss, focal loss, label smoothing, smoothing loss, circle loss, am softmax loss and various loss functions are added in the design of the loss function. These loss functions can be called by one-key parameter configuration.
[0148] Label smoothing is a common method to prevent overfitting in classification problems. Further, in the embodiments of the present application, label smoothing can be modified to adapt to all types of loss functions mentioned above. When the loss functions above are called, whether to load label smoothing can be configured, so as to simultaneously pull up two loss functions to optimize a training task.
[0149] For classification problems, the label is often converted into one hot encoding form before the final loss function is calculated.
[0150] The problem that occurs when one hot encoding is used for classification is that 1) the generalization ability of the model cannot be guaranteed, and overfitting is easy to cause; 2) the full probability and 0 probability encourage the gap between the belonging class and other classes to be as large as possible, and it is difficult to adapt to this situation according to the bounded gradient. The model may over-rely on the predicted class.
[0151] Label smoothing realizes the softening of the label by modifying one hot encoding, and enhances the generalization ability of the network. For example, the standard crosss entropy loss loss function is as follows:
[0152] -y[y log p + (1 - y) log (1 - p)]
[0153] Wherein, y is a predicted value, the label smoothing optimization is that for a probability p, p is a ground truth, the value is 0 or 1, the label smoothing is modified to p=1-epsilon and epsilon, epsilon is a preset fixed parameter (which can be determined in advance based on actual application scenarios), so that when the sample result is a certain class, the information of other classes can be compensated, so as to soften the label information.
[0154] Embodiments of the application design a system that can parameterize call classification network, parameterize call data augmentation strategy, and parameterize call different optimization strategies, an algorithm platform that can let users independently customize network design and optimization of the network, which has the advantages of reducing the trial time of algorithm engineers on different classification networks and improving the landing of algorithms in different businesses.
[0155] (2) The augmented intermediate parameters include derivative values obtained by inputting the original image into a preset network model and deriving, and the step 202 of calculating the augmented intermediate parameters for augmenting the original image can further include the following: inputting the original image into a preset network model and performing forward processing to obtain a loss value; deriving the loss value to obtain a derivative value;
[0156] At this time, the generating of the augmented image corresponding to the original image according to the augmented intermediate parameters includes: generating a noise image of the original image according to the derivative value; and taking the noise image as the augmented image corresponding to the original image.
[0157] An innovation of the embodiments of the application is that two methods of generating training samples of adversarial samples are designed and added to improve the recognition accuracy of the network for abnormal scenes. When the input is disturbed, the image representation does not change greatly, but the model output has a high degree of error answer, which will lead to the decrease of the accuracy of the network. However, it is difficult to achieve accurate determination of this part of data from the network level, so it is necessary to introduce the method of generating adversarial samples to generate disturbance data and training to improve the accuracy of the network for this kind of data. The platform of adding adversarial sample methods such as Deepfool, StepLL, FGSM and CW algorithm is completed, and the parameterization is called.
[0158] Among them, Deepfool is a classic attack method, which first defines the sample robustness and model robustness, and can accurately calculate the perturbation of deep classifier on large-scale data set, so as to reliably quantify the robustness of the classifier. The full name of FGSM is Fast Gradient Sign Method (Fast Gradient Sign Method), in the white box environment, the derivative of the model to the input is calculated, and then the specific gradient direction is obtained by using the sign function, and then multiplied by a step, the "perturbation" obtained by adding the original input is the sample under FGSM attack. The full name of StepLL is Single-Step Least-Likely Class Method, which is also a single-step attack method. Unlike the method of increasing the distance between the image and the real label in FGSM method, this method constrains the distance between the image and the class with the lowest classification probability.
[0159] CW algorithm is generally considered as one of the white-box attack algorithms with the strongest attack ability, and is also an optimization-based adversarial sample generation algorithm. Most of the literature classifies it as a gradient-based attack algorithm, and deepfool, FGSM are in the same category. In fact, it is an optimization-based adversarial sample generation algorithm. The innovation of CW algorithm lies in the definition of the loss function (objective function). In the process of directional attack, the cross entropy is often used as the objective function, and the process of iterative optimization is to continuously reduce the objective function.
[0160] The adversarial sample generation method is usually to solve the following problems:
[0161]
[0162] Where δ is the perturbation, S is the perturbation space, x is the input data of training, y is the output result (label) of training, L(θ,x,y) is the loss function of neural network model, D is the sample distribution of training data, θ is the overall parameter of neural network model (or the parameter set of neural network model), ρ(θ) is the overall objective function, The innermost objective function is represented as Take the minimum value.
[0163] The innermost objective function The objective function of the untargeted label attacker is to find a suitable δ so that the loss function on the sample point (x+δ,y) is as large as possible, so that the loss of the neural network model on its own correct label is particularly large, so as to cause the logistic regression value corresponding to the correct label to be very small. The outer min function represents that the standard training result is minimized.
[0164] Among them, the basic steps of adversarial sample generation are:
[0165] A, the training image is sent into the network and forward is carried out;
[0166] B, the loss value obtained by forward is calculated;
[0167] C, the loss value of forward is derived, and a noise image is generated according to the result of derivation and using some preset noise image generation algorithm;
[0168] D, the original training image is added to the noise image to generate a new image to start normal training.
[0169] Two noise image generation methods are designed in the application, as follows:
[0170] (1) the designed and implemented adversarial sample generation method one: a method for iteratively generating noise images is designed, and the number of iterations needs to be set in advance, and the specific method is realized by using the following formula:
[0171]
[0172] Wherein, t is the number of iterations, Indicates that the derivative of the loss value is taken, and the product x+S Indicates a projection function, and alpha is a preset fixed value, which is preferably 2 / 255 in the embodiment of the application; The noise generated each time will be added to the last training data (wherein the noise generated for the first time will be directly added to the original training image, and the generated data needs to be truncated to keep the data in the original data distribution, and the truncated data is used as new training data) will be sent into the network to re-solve the loss value, and then new noise will be generated according to the loss value. After multiple iterations, a nonlinear disturbance noise image can be generated.
[0173] (2) method two is based on the modification of method (1):
[0174]
[0175] Wherein, E represents taking the mean value, and the difference from the previous version is that the gradient is calculated in this part, and the mean value of the gradient is calculated in the iteration process, and then the disturbance is calculated combined with the mean value. Because the gradient calculated each time is averaged, the noise of each iteration is balanced, thereby optimizing the generation of noise, and the final experimental results show that the effect is better than that of method one.
[0176] Similarly, in order to obtain a better network, the network training needs to be optimized. In the embodiment of the application, a set of network optimization strategies are designed, and the main innovation lies in the design of the loss function. Cross entropy loss, arc face loss, focal loss, label smoothing, smoothing loss, circle loss, am softmax loss and other loss functions are added, and these loss functions can be called by one-key parameter configuration;
[0177] Generally, large deep neural networks are very powerful, but their huge memory consumption and sensitivity to adversarial samples are not ideal. Mixup is a simple solution to alleviate the two problems. Essentially, mixup trains neural networks on convex combinations of pairs of samples and their labels. In this way, mixup regularizes neural networks to enhance linear representations between training samples. Research results show that mixup can improve the generalization ability of the current most advanced neural network architecture, and mixup can reduce the memory of incorrect labels, increase the robustness of adversarial samples, and stabilize the training process of the generative adversarial network. Further, the embodiment of the application improves the mix up of multiple networks, so that it can adapt to all the loss functions mentioned above. When the above loss functions are called, it can be configured whether to load mix up, so as to optimize the training task.
[0178] The steps used by the general mix up are as follows:
[0179] (1) Take a batch of data, that is, an image;
[0180] (2) Take the sequential batch and the reverse batch to combine one by one, obtain two images, and apply i and j in the above formula, the two images correspond to (x i , y i ), (x j , y j );
[0181] (3) Use a random generator to generate λ, λ takes value (0, 1), random value, generate a new batch of images according to the following formula, that is, the mixed up fused image
[0182]
[0183] (4) For the label label, the softening method is to first transform the label into a one hot vector form, then arrange in order and reverse order, and generate a new one hot vector label result according to the formula;
[0184] (5) The newly generated image is sent into the network for forward, and the loss value is solved according to the newly generated one hot vector;
[0185] Another innovative point of the embodiment of the application is that 1. The original image is not changed, and the last layer loss value of the network is calculated by using the above formula, and finally the loss value is solved. 2. The integration of mix up is made into a general basic component, and when other loss value function design methods are called, the method can be called simultaneously to optimize the network.
[0186] It should be noted that in the embodiment of the application, the augmented intermediate parameter can also simultaneously include the matrix relationship under different exposure parameters corresponding to the original image, and the derivative value obtained by deriving the original image input into the preset network model, at this time, the augmented image finally obtained includes the effect image similar to the effect image generated by simulating the camera imaging process when the camera normally shoots, and also includes the perturbation noise image generated by the adversarial sample generation method, which can improve the recognition ability and generalization performance of the neural network image.
[0187] The system in the embodiment of the application can parameterize call a classification network, parameterize call a data augmentation strategy, and parameterize call different optimization strategies, and is an algorithm platform of a network that can enable a user to independently customize network design and optimization. The advantage is that it can reduce the trial time of algorithm engineers on different classification networks and improve the landing of algorithms in different businesses.
[0188] It should be noted that in the embodiment of the application, only the above two data augmentation methods are exemplified, and it can be understood that more data augmentation methods can also be included, for example, more conventional data augmentation methods, specifically, in order to augment the data, the accuracy of the network and the generalization performance of the network are improved; the data augmentation method adds image-level (reversing, rotating, cropping, etc.) and pixel-level (addition, subtraction, multiplication, blurring, contrast enhancement, noise, etc.) and drop method (pixel random drop, image block drop, etc.) augmentation method, and the original image is augmented, which is not limited here.
[0189] In order to better implement the data augmentation method in the embodiment of the application, on the basis of the data augmentation method, the embodiment of the application also provides a data augmentation device, such as Figure 5As shown, the data augmentation apparatus 500 comprises an acquisition module 501, a calculation module 502 and a generation module 503, and specifically as follows:
[0190] The acquisition module 501 is configured to acquire the acquired original image.
[0191] The calculation module 502 is configured to calculate an augmentation intermediate parameter for augmenting the original image, the augmentation intermediate parameter being used to generate an intermediate parameter for augmenting the original image under a preset augmentation condition, the augmentation intermediate parameter comprising a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by derivation after the original image is input into a preset network model.
[0192] The generation module 503 is configured to generate an augmented image corresponding to the original image according to the augmentation intermediate parameter.
[0193] In the embodiments of the present application, the acquisition module 501 acquires the acquired original image; the calculation module 502 calculates an augmentation intermediate parameter for augmenting the original image, the augmentation intermediate parameter being used to generate an intermediate parameter for augmenting the original image under a preset augmentation condition, the augmentation intermediate parameter comprising a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by derivation after the original image is input into a preset network model; and the generation module 503 generates an augmented image corresponding to the original image according to the augmentation intermediate parameter. On the basis of the limited effect of the traditional data augmentation method in the prior art on the diversity of training samples, the present application calculates an augmentation intermediate parameter for augmenting the original image, such as a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by derivation after the original image is input into a preset network model, to generate an augmented image corresponding to the original image, thereby enriching the diversity of training samples and further improving the accuracy of classification after training the network model.
[0194] In some embodiments of the present application, the augmentation intermediate parameter comprises a matrix relationship under different exposure parameters corresponding to the original image, and the calculation module 502 is specifically configured to:
[0195] acquire augmented images of the original image under preset different exposure parameters to obtain an augmented image library;
[0196] determine a matrix relationship under different exposure parameters corresponding to the original image according to the augmented image library.
[0197] In some embodiments of the present application, the calculation module 502 is specifically configured to:
[0198] determine an image under different exposure parameters for each image in the augmented image library.
[0199] determine a mapping relationship between each image in the augmented image library and an image of the image under different exposure parameters respectively;
[0200] determine, according to each mapping relationship, an image closest to the original image in the augmented image library, and determine a matrix relationship of the original image under different exposure parameters;
[0201] The generation module 503 is specifically configured to:
[0202] generate an augmented image corresponding to the original image under different exposure parameters based on the matrix relationship.
[0203] In some embodiments of the present application, the calculation module 502 is specifically configured to:
[0204] map pixel values of each image in the augmented image library as a target augmented image to pixel values of a preset dimension respectively;
[0205] After the pixel values of the target augmented image are mapped to pixel values of a preset dimension, determine a mapping relationship between the target augmented image and an image of the image under different exposure parameters;
[0206] According to the mapping relationship, determine an image matrix of the target augmented image after the target augmented image is transformed to pixel values of a preset dimension;
[0207] minimize changes to the image matrix to obtain a matrix relationship corresponding to the target augmented image under different exposure parameters.
[0208] In some embodiments of the present application, the calculation module 502 is specifically configured to:
[0209] calculate the distance of the color distribution of the target augmented image and the images in the augmented image library;
[0210] determine the image closest to the target augmented image in color distribution in the augmented image library as the closest image;
[0211] determine a target exposure parameter corresponding to the closest image;
[0212] obtain a matrix relationship of the target augmented image under the target exposure parameter.
[0213] In some embodiments of the present application, the calculation module is specifically configured to:
[0214] obtain the distance between the original image and the closest image in the augmented image library;
[0215] According to the distance, the matrix relationship, and a preset fixed parameter, an augmented parameter of the original image is calculated;
[0216] According to the augmented parameter, the original image is augmented to obtain an augmented image corresponding to the original image under different exposure parameters.
[0217] In some embodiments of the present application, the calculation module is specifically configured to use the following formula when generating the augmented image corresponding to the original image under different exposure parameters based on the matrix relationship:
[0218]
[0219] M = aM s
[0220] a = exp(-d 2 / 2s 2 )
[0221] wherein d is the distance of the closest image in the original image and the augmented image library, s is a preset fixed parameter, M s is the matrix relationship under different exposure parameters corresponding to the original image, I (in) is the original image, and I (out) is the augmented image corresponding to the original image under different exposure parameters.
[0222] In some embodiments of the present application, the augmented intermediate parameter includes a derivative value obtained by inputting the original image into a preset network model and performing derivation, and the calculation module 502 is specifically configured to:
[0223] input the original image into a preset network model and perform forward processing to obtain a loss value;
[0224] derivate the loss value to obtain a derivative value;
[0225] The generation module 503 is specifically configured to:
[0226] generate a noise image of the original image according to the derivative value;
[0227] use the noise image as the augmented image corresponding to the original image.
[0228] The present application also provides a computer device integrating any one of the data augmentation apparatuses provided by the embodiments of the present application, and the computer device comprises:
[0229] one or more processors;
[0230] a memory; and
[0231] One or more application programs, wherein the one or more application programs are stored in the memory and configured to perform the steps of the data augmentation method in any of the above data augmentation method embodiments by the processor.
[0232] The embodiments of the present application also provide a computer device integrating any of the data augmentation apparatuses provided by the embodiments of the present application. As shown in FIG. 6, it shows a structural schematic diagram of a computer device related to the embodiments of the present application, in particular: Figure 6
[0233] The computer device can include a processor 601 with one or more processing cores, a memory 602 with one or more computer readable storage media, a power supply 603, an input unit 604, and the like. Those skilled in the art can understand that the computer device structure shown in FIG. 6 does not constitute a limitation on the computer device, which can include more or fewer components than those shown in the figure, or combine certain components, or different component arrangements. Among them: Figure 6
[0234] The processor 601 is the control center of the computer device, which connects all parts of the computer device through various interfaces and lines, and performs various functions of the computer device and processes data by running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, thereby overall monitoring the computer device. Optionally, the processor 601 can include one or more processing cores; preferably, the processor 601 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application program, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 601.
[0235] The memory 602 can be used to store software programs and modules, and the processor 601 performs various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 can mainly include a storage program area and a storage data area, wherein the storage program area can store the operating system, at least one application program required by the function (such as sound playing function, image playing function, etc.), etc.; the storage data area can store data created according to the use of the computer device, etc. In addition, the memory 602 can include a high-speed random access memory, and can also include a non-volatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 602 can also include a memory controller to provide the processor 601 with access to the memory 602.
[0236] The computer device further includes a power supply 603 for supplying power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, so that the power management system can be used to manage charging, discharging, power consumption management and the like. The power supply 603 can also include one or more DC or AC power sources, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
[0237] The computer device can also include an input unit 604 for receiving input digital or character information, and generating keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0238] Although not shown, the computer device can also include a display unit and the like, which will not be described here. In particular, in the present embodiment, the processor 601 in the computer device loads one or more executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and runs the application programs stored in the memory 602 by the processor 601, thereby implementing various functions, such as:
[0239] obtaining a collected original image;
[0240] computing an augmented intermediate parameter for augmenting the original image, the augmented intermediate parameter being used to generate an intermediate parameter for augmenting the original image under a preset augmentation condition, the augmented intermediate parameter including a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by deriving after inputting the original image into a preset network model;
[0241] generating an augmented image corresponding to the original image according to the augmented intermediate parameter.
[0242] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by instructions controlling related hardware, which can be stored in a computer readable storage medium and loaded and executed by a processor.
[0243] To this end, an embodiment of the present application provides a computer readable storage medium, which can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the data augmentation methods provided by the embodiments of the present application. For example, the computer program loaded by the processor can execute the following steps:
[0244] obtaining a collected original image;
[0245] calculating an augmented intermediate parameter for augmenting the original image, the augmented intermediate parameter being used for generating an intermediate parameter for augmenting the original image under a preset augmentation condition, the augmented intermediate parameter including a matrix relationship under different exposure parameters corresponding to the original image, or / and a derivative value obtained by deriving after inputting the original image into a preset network model;
[0246] generating an augmented image corresponding to the original image according to the augmented intermediate parameter.
[0247] In the above embodiments, the description of each embodiment has its own focus. The parts not described in detail in a certain embodiment can be referred to the detailed description of other embodiments above, which will not be described here again.
[0248] In the implementation, each unit or structure above can be implemented as an independent entity, or can be combined as the same or several entities, and the specific implementation of each unit or structure above can be referred to the method embodiments above, which will not be described here again.
[0249] The specific implementation of each operation above can be referred to the embodiments above, which will not be described here again.
[0250] The data augmentation method, device, computer device and storage medium provided by the embodiments of the present application are described in detail above, and the principle and implementation mode of the present application are described by applying specific examples. The above embodiment is only used to help understand the method and its core idea; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as the limitation of the present application.
Claims
1. A data augmentation method, characterized in that: The method comprises: Obtain the collected original image; Calculating augmentation intermediate parameters for augmenting the original image, the augmentation intermediate parameters being used to generate intermediate parameters for augmenting the original image based on preset augmentation conditions, the augmentation intermediate parameters including matrix relationships under different exposure parameters corresponding to the original image, or / and derivative values obtained by taking the derivative of the original image after inputting it into a preset network model; generating an augmented image corresponding to the original image according to the augmented intermediate parameters; The calculating of the augmentation intermediate parameters for augmenting the original image includes: Obtaining augmented images of the original image under different preset exposure parameters to obtain an augmented image library; For the images in the augmented image library, determining images of each image under different exposure parameters; Taking each image in the augmented image library as a target augmented image, mapping pixel values of the target augmented image to pixel values of a preset dimension, where the preset dimension is higher than the dimension of the pixel values of the target augmented image; After the pixel values of the target augmented image are mapped to pixel values of a preset dimension, determining a mapping relationship between the target augmented image and the image under different exposure parameters; Determining, according to the mapping relationship, an image matrix after the target augmented image is transformed into pixel values of a preset dimension; Minimize the change of the image matrix to obtain the matrix relationship under different exposure parameters corresponding to the target augmented image.
2. The data augmentation method according to claim 1, wherein: Generating an augmented image corresponding to the original image according to the augmented intermediate parameters includes: An augmented image under different exposure parameters corresponding to the original image is generated based on the matrix relationship.
3. The data augmentation method according to claim 1, wherein: The minimizing the change of the image matrix to obtain the matrix relationship under different exposure parameters corresponding to the target augmented image includes: Calculating a distance between the color distribution of the target augmented image and the images in the augmented image library; Determine an image in the augmented image library that is closest to the target augmented image in color distribution as the closest image; Determining target exposure parameters corresponding to the most similar image; Obtain a matrix relationship under the target exposure parameters corresponding to the target augmented image.
4. The data augmentation method according to claim 2, wherein: Generating the augmented image corresponding to the original image under different exposure parameters based on the matrix relationship includes: Get the distance between the original image and the closest image in the augmented image library; Calculating augmentation parameters for the original image according to the distance, the matrix relationship, and preset fixed parameters; The original image is augmented according to the augmentation parameters to obtain augmented images under different exposure parameters corresponding to the original image.
5. The data augmentation method according to claim 1, wherein: The augmented intermediate parameters include derivative values obtained by taking the original image as input into a preset network model, and the calculation of the augmented intermediate parameters for augmenting the original image includes: Input the original image into the preset network model and perform forward processing to obtain the loss value; Derivative the loss value to obtain a derivative value; Generating an augmented image corresponding to the original image according to the augmented intermediate parameters includes: generating a noise image of the original image according to the derivative value; The noise image is used as the augmented image corresponding to the original image.
6. A data augmentation device, characterized in that: The device comprises: An acquisition module is used to acquire the collected original image; a calculation module, configured to calculate augmentation intermediate parameters for augmenting the original image, wherein the augmentation intermediate parameters are used to generate intermediate parameters for augmenting the original image based on preset augmentation conditions, and the augmentation intermediate parameters include matrix relationships under different exposure parameters corresponding to the original image, or / and derivative values obtained by taking the derivative of the original image after inputting it into a preset network model; A generating module, configured to generate an augmented image corresponding to the original image according to the augmented intermediate parameters; Wherein, the computing module is used to: Obtaining augmented images of the original image under different preset exposure parameters to obtain an augmented image library; For the images in the augmented image library, determining images of each image under different exposure parameters; Taking each image in the augmented image library as a target augmented image, mapping pixel values of the target augmented image to pixel values of a preset dimension, where the preset dimension is higher than the dimension of the pixel values of the target augmented image; After the pixel values of the target augmented image are mapped to pixel values of a preset dimension, determining a mapping relationship between the target augmented image and the image under different exposure parameters; Determining, according to the mapping relationship, an image matrix after the target augmented image is transformed into pixel values of a preset dimension; Minimize the change of the image matrix to obtain the matrix relationship under different exposure parameters corresponding to the target augmented image.
7. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the data augmentation method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the data augmentation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Automobile image data processing method and device and readable storage medium
CN109190504A
A vehicle multi-attribute detection method based on single-network multi-task learning
CN109886147A
Image enhancement method and device and storage medium
CN109919869A