Method for training neural network, data processing method and related device

By alternating training and search strategies, the enhanced strategy neural network is used to generate high-quality strategies, which solves the problem of low sampling efficiency in the existing technology, improves the training efficiency and performance of the neural network, and achieves higher-quality data enhancement effects. .

CN112633459BActive Publication Date: 2024-09-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910904970.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-24
Publication Date
2024-09-20
Estimated Expiration
2039-09-24

AI Technical Summary

Technical Problem

Existing data augmentation technology has low sampling efficiency in neural network training, resulting in low training efficiency and difficulty in quickly finding optimized strategies to improve network performance.

Method used

By alternately training the target neural network and the search strategy, the generated strategy changes with the state of the target neural network, and uses the enhanced strategy neural network to update parameters based on machine learning to generate higher-quality strategies for data enhancement, improving the efficiency of data enhancement and network performance.

Benefits of technology

Significantly improve the training efficiency and performance of neural networks, continuously discover weaknesses and generate higher-quality strategies through confrontation, improve the effect of data enhancement, and improve the robustness and accuracy of the network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112633459B
    Figure CN112633459B
Patent Text Reader

Abstract

The technical solution in the present application is applied to the field of artificial intelligence. The present application provides a method for training a neural network, a method for data processing using a neural network trained by the method, and related devices. The training method of the present application trains the target neural network in an adversarial manner, so that the strategy search module can continuously discover the weaknesses of the target neural network, and generate higher-quality strategies based on the weaknesses, and perform data enhancement based on the strategies to obtain higher-quality data, based on which a higher-quality target neural network can be trained. The data processing method of the present application uses the aforementioned target neural network for data processing, and can obtain more accurate processing results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and more specifically, to a method for training a neural network, a data processing method and related devices. Background Art

[0002] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.

[0003] With the rapid development of artificial intelligence technology, neural networks, such as deep neural networks, have made great achievements in the processing and analysis of various media signals such as images, videos, and voices in recent years. A neural network with good performance generally requires a large amount of training data to obtain relatively ideal results. When the amount of data is limited, data augmentation can be used to increase the diversity of training samples, improve the robustness of the network model, and avoid overfitting.

[0004] Data augmentation is the process of transforming existing data, such as flipping, translating, or rotating it, to create more data.

[0005] Currently, data augmentation includes offline augmentation and online augmentation. Offline augmentation refers to directly processing the data set, and the number of data is equal to the product of the augmentation factor and the number of original data sets. This method is often used in scenarios with very small data sets. Online augmentation, also known as dynamic augmentation, is mainly used for larger data sets. Online augmentation performs corresponding changes on the small batch of data that will be input into the model to obtain more data.

[0006] In the existing data enhancement technology, a data enhancement method is proposed, in which a search space is designed, which includes one or more strategies, each strategy includes multiple sub-strategies, each sub-strategy consists of two operations, each operation is an image processing function similar to translation, rotation or shearing, and each operation has two hyperparameters, one hyperparameter is the probability of applying the operation, and the other hyperparameter is the magnitude of applying the operation. The data enhancement method uses a search algorithm to find better strategies from the search space, so that the neural network trained according to these better measurements can obtain higher verification accuracy.

[0007] More specifically, the search space includes 16 operations such as x-coordinate shearing (ShearX), y-coordinate shearing (ShearY), x-axis coordinate flipping (TranslateX), y-coordinate flipping (Translate Y), rotation, automatic contrast, inversion, equalization, exposure, layering, contrast, color, brightness, clarity, cutout, and sample pairing. The amplitude of each operation is discretized into 10 discrete values ​​(uniform spacing), and the probability of each operation is discretized into 11 values ​​(uniform distribution). Therefore, searching for each sub-strategy becomes (16*10*11) 2 Since a strategy includes 5 sub-strategies, searching for strategies in the search space becomes a problem of searching for a possible combination in (16*10*11) 10 Combinations (ie (16*10*11) 10 The problem of searching for one possible combination among ) strategies.

[0008] The search strategy algorithm consists of two components, one is the recursive neural network controller, and the other is the training algorithm of the approximate strategy optimization algorithm. The controller is for the above (16*10*11) 10 The algorithm samples from the strategies, and uses the sampled enhanced strategies to perform data enhancement on the sub-training set. The data obtained by data enhancement is then used to train the sub-model to obtain a feedback signal. After the feedback signal is fed back to the controller, the controller performs strategy sampling based on the feedback signal. The above process is repeated until the algorithm converges or reaches the termination condition. After the search is completed, the five strategies with the best performance are selected from all the sampled strategies to form a group of 25 sub-strategies. This group of 25 sub-strategies is then used to enhance the training data of the target model, so as to train the target model based on the enhanced training data.

[0009] The above method usually requires more than 15,000 samplings to obtain a better strategy. In other words, the strategy sampling efficiency of the above strategy search algorithm is relatively low. Since the training data of the target model is obtained by sampling according to the above strategy search algorithm, the low sampling efficiency of the above strategy search algorithm makes the training efficiency of the target model low. Summary of the invention

[0010] The present application provides a neural network training method, a neural network data processing method and related devices, which help to improve the training efficiency and improve the performance of the neural network.

[0011] In a first aspect, the present application provides a neural network training method, the method comprising: generating an i-th batch strategy according to an i-1th group of loss values, the i-1th group of loss values ​​being the value output by the loss function of the target neural network after training with an i-1th batch of enhanced training sets, i being successively taken from 2 to N, and N being a preset positive integer; performing data augmentation on the original training set of the target neural network according to the i-th batch strategy to obtain an i-th batch of enhanced training sets; training the target neural network according to the i-th batch of enhanced training sets to obtain an i-th group of loss values; and outputting a neural network obtained by training the target neural network according to the Nth batch of enhanced training sets.

[0012] The method of the embodiment of the present application alternately trains the target neural network and the search strategy so that the generated strategy can change with the change of the state of the target neural network, so that the enhanced training set obtained according to the strategy can be more consistent with the training process of the target neural network, thereby significantly improving the performance of the target neural network. In addition, the training device can improve the generation efficiency of the strategy, thereby improving the training efficiency of the target neural network.

[0013] In addition, since the target neural network trained by this method can be an actual business neural network, the strategy search and business neural network training can be completed alternately and synchronously, which helps to improve the training efficiency and improve the performance of the business neural network.

[0014] Normally, the i-th batch strategy needs to satisfy the following requirements: after the i-th batch of enhanced training sets obtained by the i-th batch strategy enhancement are input into the target neural network, the loss function value of the target neural network inference output on the i-th batch of enhanced training sets should be greater than the loss function value of the target neural network inference output on the i-1-th batch of enhanced training sets after the i-th batch of enhanced training sets are input into the target neural network. After the i-th batch of enhanced training sets obtained by the i-th batch strategy enhancement are used to train the target neural network, they should be smaller than the loss value of the target neural network.

[0015] That is to say, this method trains the target neural network in an adversarial manner, can continuously discover the weaknesses of the target neural network, generate higher quality strategies based on the weaknesses, and perform data enhancement based on the strategies to obtain higher quality data, based on which a higher quality target neural network can be trained.

[0016] In combination with the first aspect, in a first possible implementation method, generating the i-th batch of strategies according to the i-1th group of loss values ​​includes: generating the i-th batch of strategies according to the enhanced strategy neural network and the i-1th group of loss values, wherein the i-1 group of loss values ​​is used to guide the enhanced strategy neural network to update parameters based on a machine learning method, and the enhanced strategy neural network includes a long-short time memory unit, a normalization module and a sampling module, and the long-short time memory unit is used to: map the operation information output by the sampling module in the previous time step into an M-dimensional vector, M is the length of the information set to which the operation information to be output by the sampling module in the current time step belongs, the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long-short time memory unit, the information set is an operation type set, an operation probability set or an operation amplitude set, and the sampling module is used to sample and output one of the M operation information according to the probability distribution.

[0017] In combination with the first possible implementation, in a second possible implementation, the sampling module outputs a single-bit effective encoding of the operation information in the previous time step. The enhanced strategy neural network further includes a word vector embedding module, which is used to: map the single-bit effective encoding vector of the operation information output by the sampling module in the previous time step to a vector in the real number field; the long-short time memory unit is specifically used to: map the vector output by the word vector embedding module to the M-dimensional vector.

[0018] In combination with the first aspect, in a third possible implementation, the method further includes: using the target neural network trained by the i-1th batch of enhanced training sets to infer the original training sets to obtain the i-th batch of features of the data in the original training sets in the target neural network. Wherein, generating the i-th batch of strategies according to the i-1th group of loss values ​​includes: generating the i-th batch of strategies according to the i-1th group of loss values ​​and the i-th batch of features.

[0019] In combination with the third possible implementation manner, in a fourth possible implementation manner, generating the i-th batch of strategies according to the i-1th group of loss values ​​and the i-th batch of features includes: generating the i-th batch of strategies according to the enhanced strategy neural network, the i-th batch of features and the i-1th group of loss values, wherein the i-1th group of loss values ​​and the i-th batch of features are used to guide the enhanced strategy neural network to update parameters based on a machine learning method, the enhanced strategy neural network includes a long and short time memory unit, a normalization module, a sampling module and a splicing module, the splicing module is used to splice the i-th batch of features and the operation information output by the sampling module in the previous time into a vector, the long and short time memory unit is used to obtain an M-dimensional vector according to the vector mapping output by the splicing module, M is the length of the information set to which the operation information to be output by the sampling module at the current time step belongs, the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long and short time memory unit, the information set is an operation type set, an operation probability set or an operation amplitude set, and the sampling module is used to sample and output one of the M operation information according to the probability distribution.

[0020] In combination with the fourth possible implementation, in a fifth possible implementation, the sampling module outputs a one-bit effective encoding of the operation information in the previous time step. The enhanced strategy neural network further includes a word vector embedding module, which is used to map the one-bit effective encoding vector of the operation information output by the sampling module in the previous time step to a vector in the real number field; the long short-term memory unit is specifically used to convert the vector output by the word vector embedding module into the M-dimensional vector.

[0021] In a second aspect, the present application provides a data processing method, including: obtaining data to be processed; processing the data to be processed according to a target neural network, the target neural network being obtained through N trainings, and in the i-th training of the N trainings, the target neural network being trained through the i-th batch of enhanced training sets, the i-th batch of enhanced training sets being the training sets obtained by enhancing the original training sets with the i-th batch of strategies, the i-th batch of strategies being strategies generated according to the i-1th group of loss values, the i-1th group of loss values ​​being the values ​​output by the loss function of the target neural network when the target neural network is trained according to the i-1th batch of enhanced training sets, and N is a preset positive integer.

[0022] The method can process data according to the target neural network trained by the method in the first aspect, thereby improving processing performance. For example, when the target neural network is an image classification network, since the target neural network trained by the method in the first aspect has higher performance, the result of image classification according to the target neural network is more accurate.

[0023] In combination with the second aspect, in a first possible implementation method, the i-th batch of strategies is generated according to the enhanced strategy neural network and the i-1th group of loss values, and the i-1th group of loss values ​​is used to guide the enhanced strategy neural network to update parameters based on a machine learning method. The enhanced strategy neural network includes a long-short time memory unit, a normalization module and a sampling module. The long-short time memory unit is used to: map the operation information output by the sampling module in the previous time step into an M-dimensional vector, where M is the length of the information set to which the operation information to be output by the sampling module in the current time step belongs; the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long-short time memory unit, and the information set is an operation type set, an operation probability set or an operation amplitude set; the sampling module is used to sample and output one of the M operation information according to the probability distribution.

[0024] In combination with the first possible implementation, in a second possible implementation, the sampling module outputs a single-bit effective encoding of the operation information in the previous time step. The enhanced strategy neural network further includes a word vector embedding module, which is used to map the single-bit effective encoding vector of the operation information output by the sampling module in the previous time step to a vector in the real number field; the long short-term memory unit is specifically used to map the vector output by the word vector embedding module to the M-dimensional vector.

[0025] In combination with the second aspect, in a third possible implementation method, the i-th batch of strategies is generated based on the i-1th group of loss values ​​and the i-th batch of features, and the i-th batch of features is obtained by inferring the original training set using the target neural network trained with the i-1th batch of enhanced training set.

[0026] In combination with the third possible implementation, in a fourth possible implementation, the i-th batch of strategies is generated according to the enhanced strategy neural network, the i-th batch of features and the i-1th group of loss values, wherein the i-1th group of loss values ​​and the i-th batch of features are used to guide the enhanced strategy neural network to update parameters based on a machine learning method, the enhanced strategy neural network includes a long and short time memory unit, a normalization module, a sampling module and a splicing module, the splicing module is used to splice the i-th batch of features and the operation information output by the sampling module in the previous time into a vector, the long and short time memory unit is used to map the vector output by the splicing module into an M-dimensional vector, M is the length of the information set to which the operation information to be output by the sampling module at the current time step belongs, the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long and short time memory unit, the information set is an operation type set, an operation probability set or an operation amplitude set, and the sampling module is used to sample and output one of the M operation information according to the probability distribution.

[0027] In combination with the fourth possible implementation, in a fifth possible implementation, the sampling module outputs a one-bit effective encoding of the operation information in the previous time step. The enhanced strategy neural network further includes a word vector embedding module, which is used to map the one-bit effective encoding vector of the operation information output by the sampling module in the previous time step to a vector in the real number field; the long short-term memory unit is specifically used to convert the vector output by the word vector embedding module into the M-dimensional vector.

[0028] In a third aspect, a neural network training device is provided, the device comprising a module for executing the method in the first aspect or any one of the implementations of the first aspect.

[0029] According to a fourth aspect, a data processing device is provided, the device comprising a module for executing the method in the second aspect or any one of the implementations of the second aspect.

[0030] In a fifth aspect, a neural network training device is provided, the device comprising: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute the method in the first aspect or any one of the implementations of the first aspect.

[0031] In a sixth aspect, a data processing device is provided, comprising: a memory for storing programs; a processor for executing the programs stored in the memory, and when the program stored in the memory is executed, the processor is used to execute the method in the second aspect or any one of the implementations of the second aspect.

[0032] In a seventh aspect, a computer-readable medium is provided, which stores instructions for execution by a device, wherein the instructions are used to implement the method in any one of the implementation modes of the first aspect to the second aspect.

[0033] In an eighth aspect, a computer program product comprising instructions is provided, and when the computer program product is run on a computer, the computer is enabled to execute a method in any one of the implementations of the first to second aspects above.

[0034] In a ninth aspect, a chip is provided, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface and executes a method in any one of the implementation modes of the first to second aspects above.

[0035] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in any one of the implementation methods of the first aspect to the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a structural diagram of the system architecture provided by the embodiment of the present application;

[0037] Figure 2 is a schematic structural diagram of a training device according to an embodiment of the present application;

[0038] Figure 3 is a schematic deployment diagram of a training device according to another embodiment of the present application;

[0039] Figure 4 is a schematic deployment diagram of a training device according to another embodiment of the present application;

[0040] Figure 5 is a schematic structural diagram of a data processing device according to an embodiment of the present application;

[0041] Figure 6 is a schematic flow chart of a training method according to an embodiment of the present application;

[0042] Figure 7 is a schematic flow chart of a training method according to another embodiment of the present application;

[0043] Figure 8 is a schematic structural diagram of a strategy search neural network according to an embodiment of the present application;

[0044] Fig. 9 is a schematic flow chart of a training method according to another embodiment of the present application;

[0045] Fig.10 is a schematic flow chart of a training method according to another embodiment of the present application;

[0046] Fig.11 is a schematic structural diagram of a strategy search neural network according to another embodiment of the present application;

[0047] Fig.12 is a schematic structural diagram of a strategy search neural network according to another embodiment of the present application;

[0048] Fig.13 is a schematic flow chart of a data processing method according to an embodiment of the present application;

[0049] Fig.14 is a schematic structural diagram of a device according to an embodiment of the present application;

[0050] Fig.15 It is a schematic structural diagram of a strategy search neural network according to another embodiment of the present application. DETAILED DESCRIPTION

[0051] The solution of this application can be applied in many fields of artificial intelligence, such as smart terminals, smart manufacturing, smart transportation, smart homes, smart medical care, smart security, autonomous driving, safe cities, etc. The following is a brief introduction to three commonly used application scenarios.

[0052] Application scenario 1: Assisted / autonomous driving system

[0053] The data processing network is trained using the training method of the embodiment of the present application, and the data processing network is applied in the advanced driving assistant system (ADAS) and the autonomous driving system (ADS) to process the input road picture, so as to identify different objects in the road picture. For example, the sensor data processing network is applied to detect and avoid pedestrians or obstacles on the road, especially to avoid collision with pedestrians.

[0054] Application scenario 2: Safe city / video surveillance system

[0055] A data processing network is trained using the training method of the embodiment of the present application, and the data processing network is used in the safe city system and the video surveillance system to perform real-time target detection (detecting pedestrians or vehicles), mark the detection results, and store the detection results in the analysis unit of the system to find criminal suspects, missing persons, and specific vehicles, etc.

[0056] Application scenario three: Smart terminal (album classification, image recognition, etc.)

[0057] The album classification neural network is trained using the training method of the embodiment of the present application, and then the album classification neural network is used on a smart terminal (such as a smart phone, tablet computer, etc.) to classify pictures, thereby labeling pictures of different categories for easy viewing and searching by users. In addition, the classification labels of these pictures can also be provided to the album management system for classification management, saving the user's management time, improving the efficiency of album management, and enhancing the user experience.

[0058] The embodiments of the present application involve related applications of neural networks. In order to better understand the solutions of the embodiments of the present application, the relevant terms and other related concepts of the neural network that may be involved in the embodiments of the present application are first introduced below.

[0059] (1) Neural Network

[0060] A neural network can be composed of neural units. A neural unit can be a s The output of the operation unit with the intercept 1 as input can be shown as formula (1-1):

[0061]

[0062] Where, s = 1, 2, ... n, n is a natural number greater than 1, W s For x s , b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.

[0063] (2) Deep Neural Networks

[0064] A deep neural network (DNN), also known as a multi-layer neural network, can be understood as a neural network with multiple hidden layers. According to the position of different layers, the neural network inside the DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.

[0065] Although DNN looks complicated, the work of each layer is not complicated. In simple terms, it can be expressed as the following linear relationship: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since DNN has many layers, the coefficient W and the offset vector The number of these parameters is also relatively large. The definitions of these parameters in DNN are as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input.

[0066] In summary, the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as

[0067] It should be noted that the input layer does not have a W parameter. In a deep neural network, more hidden layers allow the network to better describe complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks. Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (the weight matrix formed by many layers of vector W).

[0068] (3) Classifier

[0069] Many neural network structures have a classifier at the end to classify objects in the image. The classifier is generally composed of a fully connected layer and a softmax function (which can be called a normalized exponential function, or simply a normalization function), which can output the probability of different categories based on the input.

[0070] (4) Convolutional Neural Network (CNN)

[0071] Convolutional neural network is a deep neural network with convolution structure. Convolutional neural network contains a feature extractor composed of convolution layer and subsampling layer. The feature extractor can be regarded as a filter, and the convolution process can be regarded as using a trainable filter to convolve with an input image or convolution feature plane (feature map). Convolution layer refers to the neuron layer in convolutional neural network that performs convolution processing on the input signal. In the convolution layer of convolutional neural network, a neuron can only be connected to some neurons in the adjacent layer. A convolution layer usually contains several feature planes, and each feature plane can be composed of some rectangular arranged neural units. The neural units in the same feature plane share weights, and the shared weights here are convolution kernels. Shared weights can be understood as the way to extract image information is independent of position. The implicit principle is that the statistical information of a part of the image is the same as that of other parts. This means that the image information learned in a part can also be used in another part. So for all positions on the image, we can use the same learned image information. In the same convolution layer, multiple convolution kernels can be used to extract different image information. Generally speaking, the more convolution kernels there are, the richer the image information reflected by the convolution operation.

[0072] The convolution kernel can be initialized in the form of a matrix of random size, and the convolution kernel can obtain reasonable weights through learning during the training process of the convolutional neural network. In addition, the direct benefit of shared weights is to reduce the connections between the layers of the convolutional neural network, while reducing the risk of overfitting.

[0073] (5) Back propagation algorithm

[0074] Convolutional neural networks can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the error loss information is back-propagated to update the parameters in the initial super-resolution model, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.

[0075] (6) Recurrent neural networks (RNN)

[0076] The purpose of RNNs is to process sequence data. In the traditional neural network model, from the input layer to the hidden layer and then to the output layer, the layers are fully connected, and the nodes between each layer are disconnected. However, this ordinary neural network is powerless for many problems. For example, if you want to predict the next word in a sentence, you generally need to use the previous word, because the previous and next words in a sentence are not independent. The reason why RNNs are called recurrent neural networks is that the current output of a sequence is also related to the previous output. The specific manifestation is that the network will remember the previous information and apply it to the calculation of the current output, that is, the nodes between the hidden layers are no longer disconnected but connected, and the input of the hidden layer includes not only the output of the input layer but also the output of the hidden layer at the previous moment. In theory, RNNs can process sequence data of any length.

[0077] The training of RNN is the same as the training of traditional artificial neural network (ANN). The BP error back propagation algorithm is also used, but there is a difference. If the RNNs are expanded, the parameters W, U, and V are shared, while traditional neural networks are not. And when using the gradient descent algorithm, the output of each step depends not only on the network of the current step, but also on the state of the network of the previous steps. For example, at t=4, it is necessary to pass back three steps, and various gradients need to be added to the next three steps. This learning algorithm is called the time-based back propagation algorithm.

[0078] (6) Loss Function

[0079] In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it predict a lower value, and keep adjusting until the deep neural network can predict the target value we really want or a value very close to the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.

[0080] (7) Strategy

[0081] A strategy consists of one or more sub-strategies. A sub-strategy consists of one or more operations. An operation is an image processing function such as translation, rotation, or shearing. An operation has two hyperparameters, one hyperparameter is the probability of applying the operation, and the other hyperparameter is the magnitude of applying the operation.

[0082] The operations in the sub-strategy can include any of the following: x-coordinate shearing, y-coordinate shearing, x-axis coordinate flipping, y-coordinate flipping, rotation, auto contrast, inversion, balance, exposure, layering, contrast, color, brightness, clarity, cutout, sample pairing, etc.

[0083] It can be understood that when a sub-strategy includes multiple operations, the types of these multiple operations can be the same.

[0084] (8) Data augmentation

[0085] Data augmentation is the process of transforming existing data, such as flipping, translating, or rotating it, to create more data.

[0086] (9) Neural network model

[0087] A neural network model is a type of mathematical computational model that mimics the structure and function of a biological neural network (the central nervous system of an animal). A neural network model can include a variety of neural network layers with different functions, each layer including parameters and calculation formulas. Depending on the calculation formula or function, different layers in the neural network model have different names. For example, the layer that performs convolution calculations is called a convolution layer, which is often used to extract features from input signals (e.g., images).

[0088] A neural network model can also be composed of multiple existing neural network models. Neural network models with different structures can be used in different scenarios (for example, classification, recognition, or image segmentation) or provide different effects when used in the same scenario. The different structures of neural network models specifically include one or more of the following: different numbers of network layers in the neural network model, different orders of each network layer, and different weights, parameters, or calculation formulas in each network layer.

[0089] There are many different neural network models with high accuracy in the industry for application scenarios such as recognition, classification, or image segmentation. Among them, some neural network models can be trained with a specific training set to complete a task alone or in combination with other neural network models (or other functional modules) to complete a task. Some neural network models can also be directly used to complete a task alone or in combination with other neural network models (or other functional modules) to complete a task.

[0090] In the embodiments of the present application, the neural network model is referred to as a neural network.

[0091] (10) Edge devices

[0092] Edge devices refer to any device with computing and network resources between the data source and the cloud center. For example, a mobile phone is an edge device between a person and the cloud center, and a gateway is an edge device between a smart home and the cloud center. In an ideal environment, edge devices refer to devices that analyze or process data near the data source. Since there is no data flow, network traffic and response time are reduced.

[0093] The edge device in the embodiment of the present application may be a mobile phone with computing capabilities, a tablet personal computer (TPC), a media player, a smart home, a laptop computer (LC), a personal digital assistant (PDA), a personal computer (PC), a camera, a video camera, a smart watch, a wearable device (WD) or an autonomous driving vehicle, etc. It is understandable that the embodiment of the present application does not limit the specific form of the edge device.

[0094] (11) Reasoning

[0095] Inference is relative to training. It means that after the neural network inputs data, the neural network outputs the value of the loss function, feature map and other information without updating the parameters of the neural network.

[0096] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0097] Figure 1 Schematic diagram of the system architecture of the embodiment of the present application. Figure 1 As shown, the system architecture 100 includes a data processing device 110 , a training device 120 , a database 130 , a client device 140 , a data storage system 150 , and a data acquisition system 160 .

[0098] The data acquisition device 160 is used to collect training data. For example, the training data may include training images and annotation data, wherein the annotation data provides the coordinates of the bounding box of the target object in the training image. After collecting the training data, the data acquisition device 160 stores the training data in the database 130, and the training device 120 trains the target model / rule 101 based on the training data maintained in the database 130.

[0099] The target model / rule 101 in the embodiment of the present application may specifically be a neural network. It should be noted that, in actual applications, the training data maintained in the database 130 may not all come from the data acquisition device 160, but may also be received from other devices. It should also be noted that the training device 120 may not necessarily train the target model / rule 101 entirely based on the training data maintained by the database 130, but may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.

[0100] For an exemplary structure of the training device 120, see Figure 2 For an exemplary deployment of the training device 120, see Figure 6 or Figure 7 .

[0101] The target model / rule 101 trained by the training device 120 can be applied to different systems or devices, such as Figure 1 The execution device 110 shown in FIG. 1 is a schematic diagram of the structure of the data processing device 110. Figure 8 For an exemplary deployment of the data processing device 110, see Fig. 9 .

[0102] The data processing device 110 may be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, augmented reality (AR) / virtual reality (VR), a vehicle terminal, etc., or a chip that can be applied to the above devices, or a server or cloud, etc.

[0103] exist Figure 1 In the embodiment, the data processing device 110 is configured with an input / output (I / O) interface 112 for data interaction with an external device, and a user can input data to the I / O interface 112 through a client device 140. For example, a user can input data to be processed, such as an image to be processed, through the client device 140. In addition, the data processing device 110 includes a calculation module 111 and an acquisition module 113, and the calculation module 111 includes a target model / rule 101. The acquisition module 113 is used to acquire data to be processed.

[0104] When the data processing device 110 preprocesses the input data, or when the computing module 111 of the data processing device 110 performs calculations and other related processing, the data processing device 110 can call the data, code, etc. in the data storage system 150 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 150.

[0105] Finally, the I / O interface 112 presents the processing results, such as the target detection results calculated by the target model / rule 101, to the client device 140, thereby providing them to the user.

[0106] It can be understood that the data processing device 110 and the client device in the embodiment of the present application can be the same device, for example, the same terminal device.

[0107] It is worth noting that the training device 120 can generate corresponding target models / rules 101 based on different training data for different goals or different tasks (or businesses), and the corresponding target models / rules 101 can be used to achieve the above goals or complete the above tasks, thereby providing users with the desired results.

[0108] exist Figure 1 In the embodiment, the user can manually give input data, and the manual giving can be operated through the interface provided by the I / O interface 112. In another case, the client device 140 can automatically send input data to the I / O interface 112. If the client device 140 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 140. The user can view the results output by the execution device 110 on the client device 140, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 140 can also be used as a data acquisition terminal to collect the input data of the input I / O interface 112 and the output results of the output I / O interface 112 as shown in the figure as new sample data, and store them in the database 130. Of course, it is also possible not to collect through the client device 140, but the I / O interface 112 directly stores the input data of the input I / O interface 112 and the output results of the output I / O interface 112 as new sample data in the database 130.

[0109] Understandably, Figure 1 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 1 In the embodiment, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110.

[0110] Figure 22 is a schematic structural diagram of a neural network training device 200 according to an embodiment of the present application. The training device 200 may include a strategy search module 210, a data enhancement module 220, and a training module 230. The strategy search module 210 is used in S610 to implement the corresponding function; the data enhancement module is used to execute S620 to implement the corresponding function; and the training module 230 is used to execute S630 to implement the corresponding function.

[0111] Optionally, the training device 200 may further include a reasoning module 240, and the reasoning module 240 is used in S840 to implement corresponding functions.

[0112] Figure 3 : This is a deployment diagram of a training device provided in an embodiment of the present application. The training device can be deployed in a cloud environment. The cloud environment is an entity that uses basic resources to provide cloud services to users in a cloud computing model. The cloud environment includes a cloud data center and a cloud service platform. The cloud data center includes a large number of basic resources (including computing resources, storage resources, and network resources) owned by a cloud service provider. The computing resources included in the cloud data center can be a large number of computing devices (such as servers). The training device can be a server in a cloud data center for training a target neural network. The training device can also be a virtual machine created in a cloud data center for training a target neural network. The training device can also be a software device deployed on a server or virtual machine in a cloud data center, which is used to train a target neural network. The software device can be distributedly deployed on multiple servers, or distributedly deployed on multiple virtual machines, or distributedly deployed on virtual machines and servers. For example, the policy search module 210, the data enhancement module 220, the training module 230, and the reasoning module 240 in the training device 200 can be distributedly deployed on multiple servers, or distributedly deployed on multiple virtual machines, or distributedly deployed on virtual machines and servers. For another example, when the data enhancement module 220 includes multiple sub-modules, these multiple sub-modules can be deployed on multiple servers, or distributedly deployed on multiple virtual machines, or distributedly deployed on virtual machines and servers.

[0113] like Figure 3As shown, the training device can be abstracted by the cloud service provider into a cloud service for training neural networks and provided to users on the cloud service platform. After the user purchases the cloud service on the cloud service platform, the cloud environment uses the cloud service to provide users with cloud services for training neural networks. The user can upload the target neural network to be trained (and further upload the original training set) to the cloud environment through the application program interface (application program interface, API) or the web interface provided by the cloud service platform. The training device receives the target neural network to be trained and the original training set, and generates a strategy. The strategy is used to perform data enhancement on the original training set, and the enhanced data set is used to train the target neural network to be trained. A strategy is then generated based on the feedback information after training. The above steps are repeated until the training conditions are met. Finally, the trained target neural network is returned by the training device to the edge device where the user is located.

[0114] When the training device is a software device, the training device can also be deployed separately on a computing device in any environment, for example, separately on a computing device or separately on a computing device in a data center. Figure 4 As shown, computing device 400 includes a bus 401 , a processor 402 , a communication interface 403 , and a memory 404 .

[0115] The processor 402, the memory 404 and the communication interface 403 communicate with each other through the bus 401. Among them, the processor 402 can be a central processing unit (CPU). The memory 404 can include a volatile memory (volatile memory), such as a random access memory (random access memory, RAM). The memory 704 can also include a non-volatile memory (2non-volatile memory, 2NVM), such as a read-only memory (2read-onlymemory, 2ROM), a flash memory, a hard disk drive (hard disk drive, HDD) or a solid state disk (solidstate disk, SSD). The memory 404 stores the executable code included in the training device, and the processor 402 reads the executable code in the memory 404 to execute the training method. The memory 404 can also include software modules required for other running processes such as an operating system. The operating system can be LINUX TM , UNIX TM , WINDOWS TM wait.

[0116] For example, the communication interface 403 receives the original training set and the target neural network, the memory 404 stores executable codes for implementing the functions of each module in the training device 200, and the processor 402 reads these executable codes to implement the functions of the modules and ultimately achieve the training of the target neural network.

[0117] Figure 5 5 is a schematic structural diagram of a data processing device 500 according to an embodiment of the present application. The data processing device 500 may include an acquisition module 510 and a calculation module 520.

[0118] The acquisition module 510 is used to execute Fig.11 S1110 in the embodiment can realize the corresponding functions. The calculation module 520 is used to execute Fig.11 S1120 in the method shown is used to implement the corresponding function.

[0119] When the data processing device 500 is a software device, the data processing device 500 can be deployed separately on a computing device in any environment, for example, separately on a computing device or separately on a computing device in a data center. An exemplary structure of the computing device is as follows: Figure 4 As shown, the communication interface 403 receives the original training set and the target neural network, the memory 404 stores executable codes for implementing the functions of each module in the data processing device 500, and the processor 402 reads these executable codes to implement the functions of the various modules and finally implement the functions of the target neural network.

[0120] The data processing device of the embodiment of the present application can process data according to the target neural network trained by the training device 200, thereby improving the processing performance. For example, when the target neural network is an image classification network, since the target neural network trained by the training device 200 has higher performance, the result of image classification performed by the execution device according to the target neural network is more accurate.

[0121] Figure 6 FIG. 1 is a schematic flow chart of a method for training a neural network according to an embodiment of the present application. The method includes S610 to S630.

[0122] S610, generating the i-th batch of strategies according to the i-1th group of loss values, wherein the i-1th group of loss values ​​are the values ​​output by the loss function of the target neural network after training with the i-1th batch of enhanced training sets, and i is sequentially taken from 2 to N, where N is a preset value.

[0123] Among them, the i-1th group of loss values ​​includes one or more loss values, and the i-th batch of strategies includes one or more strategies. Usually, the number of the i-1th group of loss values ​​is the same as the number of the i-1th batch of enhanced training sets, and the loss values ​​in the i-1th group of loss values ​​correspond one-to-one to the incremental training sets in the i-1th batch of enhanced training sets, that is, the jth loss value in the i-1th group of loss values ​​is the loss function value output by the target neural network after training with the corresponding enhanced training set in the i-1th batch of enhanced training sets, j is a positive integer less than or equal to M, and M is the number of the i-1th group of loss values. The number of the i-1th batch of enhanced training sets is usually the same as the number of the i-1th batch of strategies, and the enhanced training sets in the i-1th group of enhanced training sets correspond one-to-one to the strategies in the i-1th batch of strategies, that is, the jth enhanced training set in the i-1th group of enhanced training sets is the training set obtained by enhancing the original training set with the corresponding strategy in the i-1th batch of strategies.

[0124] Normally, the i-th batch strategy needs to satisfy the following requirement: after the i-th batch of enhanced training sets obtained by enhancing the original training sets with the i-th batch strategy are input into the target neural network, the loss function value of the target neural network's inference output on the i-th batch of enhanced training sets should be greater than the loss function value of the target neural network's inference output on the i-1-th batch of enhanced training sets after the i-1-th batch of enhanced training sets are input into the target neural network.

[0125] The target neural network may also be referred to as a business implementation neural network, that is, a neural network that is actually used to implement the corresponding business after the training is completed. An example of a target neural network is a convolutional neural network. For example, when the target neural network is an image classification network, it is trained by this method and used for image classification on an edge device. For another example, when the target neural network is a data processing network for a sensor, it is trained by this method and used for human, building, road or vehicle recognition on an edge device.

[0126] In some possible implementations, the first batch of strategies can be randomly initialized to generate the first batch of strategies, the original training sets can be data enhanced according to the first batch of strategies to obtain the first batch of enhanced training sets, and the target neural network can be trained according to the first batch of enhanced training sets to obtain the first group of loss values; in other possible implementations, the original training sets can be first input into the target neural network for training, and the first group of loss values ​​can be generated based on the training.

[0127] S620, performing data enhancement on the original training set of the target neural network according to the i-th batch strategy to obtain the i-th batch of enhanced training sets.

[0128] It can be understood that the original training set described here refers to the enhanced training set, that is, the original training set refers to a data set that has not been enhanced by a strategy.

[0129] For example, when a strategy includes 5 sub-strategies, the data enhancement module 220 can be used to randomly select a sub-strategy from the five sub-strategies included in this strategy, and enhance the data in the original training set according to information such as the operation type, probability and strength value in the sub-strategy to obtain an enhanced training set.

[0130] For example, when the training set includes multiple images, the data enhancement module 220 can be used to: for each image in each batch of data in the training set, randomly select a sub-strategy from the five sub-strategies, and perform data enhancement based on information such as the operation type, probability and intensity value in the sub-strategy to obtain an enhanced training set, which includes the enhanced image.

[0131] S630, training the target neural network according to the i-th batch of enhanced training sets to obtain an i-th group of loss values.

[0132] The implementation method of using the enhanced training set to train the target neural network can refer to the implementation method of using the training set to train the neural network in the prior art.

[0133] The loss value outputted by S630 is used as the loss value in S610, and S610 to S630 are repeatedly executed until the termination condition is satisfied, and the neural network obtained by training the target neural network according to the Nth batch of enhanced training sets is outputted. An exemplary termination condition is that the number of training times of the target neural network reaches a preset maximum value, such as the above-mentioned N; another exemplary termination condition is that at least X different strategies in the search space have been used to perform data enhancement on the original training set. It is understandable that the termination condition is not limited to the above-mentioned example, and X is a positive integer.

[0134] The method of the embodiment of the present application alternately trains the target neural network and the search strategy so that the generated strategy can change with the change of the state of the target neural network, so that the enhanced training set obtained according to the strategy can be more consistent with the training process of the target neural network, thereby significantly improving the performance of the target neural network. In addition, the training device can improve the generation efficiency of the strategy, thereby improving the training efficiency of the target neural network.

[0135] The method of the embodiment of the present application trains the target neural network in an adversarial manner, so that the weaknesses of the target neural network can be continuously discovered, and a higher quality strategy is generated based on the weaknesses, and data enhancement is performed based on the strategy to obtain higher quality data, based on which a higher quality target neural network can be trained.

[0136] Combine the following Figure 7 More detailed introduction Figure 6An implementation of the method for training a neural network in .

[0137] S710, initially randomly generate the first batch of strategies, and initialize i=0.

[0138] S720, take i=i+1.

[0139] S730, performing data enhancement on the original training set of the target neural network according to the i-th batch strategy to obtain the i-th batch of enhanced training sets.

[0140] S740, training the target neural network according to the i-th batch of enhanced training sets to obtain an i-th group of loss values.

[0141] S750, generating the (i+1)th batch of strategies according to the i-th group of loss values.

[0142] S760, determine whether i is less than N, where N is the preset number of training times. In other words, determine whether the termination condition is met. If yes, execute S770, otherwise execute S720 again.

[0143] S770, output the target neural network.

[0144] In some designs, generating a strategy based on a loss value may include: generating a strategy based on an enhanced strategy network and the loss value. In this design, the loss value output by the target neural network, after being input into the enhanced strategy neural network, can guide the enhanced strategy neural network to update parameters, so that after the enhanced training set enhanced by the strategy generated by the enhanced strategy neural network under the updated parameter state is input into the target neural network, the inference loss value of the target neural network increases. The enhanced strategy neural network can use an existing method based on a reinforcement learning algorithm to update parameters according to the feedback information output by the target neural network. Among them, the inference loss value of the target neural network refers to the loss function value obtained by the target neural network when reasoning about the enhanced training set.

[0145] An example of the reinforcement strategy neural network is a recurrent neural network. Figure 8 FIG. 1 is a schematic structural diagram of the enhanced strategy neural network of the embodiment of the present application. Figure 8 As shown, the enhanced strategy neural network includes a long short-term memory (LSTM) unit 801, a normalization module 802, and a sampling module 803. Each column represents the execution process of a time step, different columns represent different time steps, and the columns from left to right are the operations in the time step arranged in chronological order.

[0146] The LSTM unit can also be called an LSTM layer, the normalization module can also be called a normalization (softmax) layer, and the sampling module can also be called a sampling (sample) layer.

[0147] When the enhanced strategy neural network is started, at the first time step, the LSTM unit 801 performs feature mapping according to the randomly initialized initial state 1 to obtain an M-dimensional feature vector, where M is the length of the information set to which the operation information to be output by the sampling module 803 at the current time step belongs. For example, when the sampling module 803 outputs the type of operation at the first time step, if the operation type set includes 16 types of "operations", the LSTM unit 801 maps the initialized initial state into a 16-dimensional feature vector; the normalization module 802 generates the probability distribution of M operation information in the above information set according to the M-dimensional feature vector output by the LSTM unit 801. For example, when the above information set includes 16 types of "operations", the normalization module 802 outputs the probability distribution of these 16 types of "operations" (P1, P2, ..., P16); the sampling module 803 performs sampling according to the probability distribution output by the normalization module 802 to sample one operation information in the above information set, for example, sampling one of the "operations" according to the probability distribution of these 16 types of "operations".

[0148] In the second time step, the LSTM unit 801 maps the operation information output by the sampling module 803 in the previous time step into an M-dimensional vector. At this time, M is the length of the information set to which the operation information to be output by the sampling module 803 in the second time step belongs. For example, the operation type output by the sampling module 803 in the first time step is "rotation", and when the sampling module 803 outputs the probability of the operation in the second time step, if the operation probability set includes 11 kinds of "probabilities", the LSTM unit 801 obtains an 11-dimensional feature vector according to the "rotation" mapping; after the normalization module 802 inputs the 11-dimensional feature vector, it generates a probability distribution of the probability value of the "operation" according to the 11-dimensional feature vector; the sampling module 803 samples according to the probability distribution, obtains one of the probability values ​​and outputs the value.

[0149] In the third time step, the LSTM unit 801 maps the operation information output by the sampling module 803 in the second time step into an M-dimensional vector. At this time, M is the length of the information set to which the operation information output by the sampling module 803 in the third time step belongs. For example, the operation probability output by the sampling module 803 in the second time step is "0.9", and when the sampling module 803 outputs the amplitude of the operation in the third time step, if the operation amplitude set includes 10 kinds of "amplitudes", the LSTM unit 801 maps "0.9" to obtain a 10-dimensional feature vector; after the normalization module 802 inputs the 10-dimensional feature vector, it generates a probability distribution of the amplitude value of the "operation" according to the high-dimensional feature vector; the sampling module 803 performs sampling according to the probability distribution, obtains an amplitude value and outputs the value. In this implementation, since the steps in the subsequent time step refer to the operation information output in the previous time step, the performance of the generated strategy can be improved.

[0150] The three outputs of the sampling unit 803 in these three time steps constitute an “operation”. The enhanced strategy neural network continues to cycle the steps in the above time steps, and an “operation” can be obtained every three time steps. Multiple operations constitute a sub-strategy, and multiple sub-strategies constitute a strategy.

[0151] It is understandable that the above time sequence of sampling “operation”, “probability” and “amplitude” is only an example, and other time sequences may be used to sample an operation type, the probability and amplitude of the operation type in a sub-strategy.

[0152] Optionally, the enhanced strategy neural network can output multiple strategies, which are called a batch of strategies. In this case, the original training set is data enhanced according to this batch of strategies to obtain multiple enhanced training sets, which correspond one-to-one to the multiple strategies, and each enhanced training set is obtained by performing data enhancement on the original training set by the corresponding strategy. In addition, by training the target neural network with these multiple enhanced training sets, multiple loss values ​​can be obtained, which are called a group of loss values. These multiple loss values ​​correspond one-to-one to the multiple enhanced training sets, and each loss value is obtained by training the target neural network with the corresponding enhanced training set. These multiple loss values ​​are synchronously input into the enhanced strategy neural network to guide the enhanced strategy neural network to update parameters, and the enhanced strategy neural network after updating the parameters begins to generate strategies. In this way, since multiple loss values ​​can be synchronously input into the enhanced strategy neural network, the efficiency of the enhanced strategy network in generating more difficult strategies can be improved, thereby improving the efficiency of training to obtain a target neural network with better performance.

[0153] If the sample output of each time step is a one-hot vector, then Fig.15As shown, the enhanced strategy neural network may also include a word vector embedding module 804, which is used to map the one-bit effective encoding vector of the operation information output by the sampling module 803 in the previous time step to a vector in the real number field. In this implementation, the long short-term memory unit is specifically used to obtain the M-dimensional vector according to the vector mapping output by the word vector embedding module 804. The word vector embedding module may also be called an embedding layer.

[0154] For example, in the first time step, the sampling module 803 outputs the third operation type "rotation" in the operation type set, and an example of a one-bit effective encoding vector of this operation type is [0010000000000000], then in the second time step, the word vector embedding module 804 can convert the 16-dimensional one-bit effective encoding vector into a 3-dimensional real number domain vector [0.2, 0.9, 0.5], and the long short-term memory unit 801 maps the real number domain vector to obtain an 11-dimensional probability distribution of the operation probability; In the second time step, the sampling module 803 outputs the second probability "0.8" in the operation probability set, and the example of the one-bit effective coding vector of the operation probability is [01000000000], then in the third time step, the word vector embedding module 804 can convert the 11-dimensional one-bit effective coding vector into a 4-dimensional real field vector [0.22, 0.54, 0.42, 0.91], and the long short-term memory unit 801 maps the real field vector to obtain a 10-dimensional probability distribution of the operation amplitude. This method can reduce the amount of calculation and increase the correlation between the outputs between two time steps.

[0155] In some designs, such as Fig. 9 As shown, the training method of the embodiment of the present application may further include S910, and correspondingly, S610 includes S920.

[0156] S910, using the target neural network trained with the i-1th batch of enhanced training sets, inferring the original training set to obtain the i-th batch of features of the data in the original training set in the target neural network.

[0157] For example, when the target neural network is an image classification network, the target neural network performs inference and outputs feature maps extracted by one or more layers.

[0158] It can be understood that the target neural network performs inference on the original training set means that after the data in the original training set is input into the target neural network, the target neural network outputs the loss function value, features and other information without updating the parameters in the target neural network.

[0159] Among them, when i is 1, the first batch of features are the features obtained by inputting the original training set into the target neural network for inference.

[0160] S920, generating an i-th batch of strategies according to the i-1-th group of loss values ​​and the i-th batch of features.

[0161] For example, the i-th batch of strategies is generated according to the i-1th group of loss values, the i-th batch of features and the enhanced strategy neural network. After the i-1th group of loss values ​​is input into the enhanced strategy neural network, the enhanced strategy neural network is guided to update parameters, and after the enhanced training set corresponding to the strategy generated by the enhanced strategy neural network after the parameter update is used to infer the target neural network, the loss value of the target neural network should be greater than the previous loss value.

[0162] against Fig. 9 The training method shown in FIG. 1 is a schematic flow chart of a more detailed training method of an embodiment of the present application. Fig.10 shown.

[0163] S1010, initially randomly generate the first batch of strategies, and initialize i=0.

[0164] S1020, take i=i+1.

[0165] S1030, inferring the original training set according to the target neural network to obtain the i-th batch of features.

[0166] S1040, performing data enhancement on the original training set of the target neural network according to the i-th batch strategy to obtain the i-th batch of enhanced training sets.

[0167] S1050, training the target neural network according to the i-th batch of enhanced training sets to obtain an i-th group of loss values.

[0168] S1060, generating the (i+1)th batch of strategies according to the i-th group of loss values.

[0169] S1070, determine whether i is less than N, where N is the preset number of training times. In other words, determine whether the termination condition is met. If yes, execute S1080, otherwise execute S1020 again.

[0170] S1080, output the target neural network.

[0171] against Fig. 9 or Fig.10 The training method shown in the figure, the schematic structure diagram of the enhancement strategy neural network of one embodiment of the present application is as follows Fig.11 As shown. Fig.11 As shown, the enhanced strategy neural network includes an LSTM unit 1101, a normalization module 1102, a sampling module 1103, and a concatenation module 1105. The concatenation module can also be called a concatenation layer.

[0172] Fig.11 The reinforcement strategy neural network shown is similar to Figure 8 The execution process of the enhanced strategy neural network shown is similar, except that the splicing module is used to splice the features obtained by reasoning the original training set and the operation information output by the sampling module 1103 in the previous time into a vector. In addition, at each time step, the LSTM unit 1101 is used to obtain an M-dimensional vector according to the vector mapping output by the splicing module, where M is the length of the information set to which the operation information to be output by the sampling module 1103 at the current time step belongs. This implementation method generates strategies with reference to the current state of the target neural network, which allows the enhanced strategy neural network to generate more difficult strategies, thereby improving the quality of the target neural network.

[0173] against Fig. 9 or Fig.10 The training method shown in the figure, the schematic structure diagram of the enhancement strategy neural network of one embodiment of the present application is as follows Fig.12 shown.

[0174] like Fig.12 As shown, the enhanced strategy neural network includes an LSTM unit 1201, a normalization module 1202, a sampling module 1203, a word vector embedding module 1204 and a splicing module 1205.

[0175] Fig.12 The reinforcement strategy neural network shown is similar to Fig.11 The execution process of the enhanced strategy neural network shown is similar, wherein the function of the word vector embedding module 1204 can refer to the word vector embedding module 804.

[0176] Understandably, Figure 8 , Fig.11 or Fig.12 The enhanced strategy neural network shown is only an example. The enhanced strategy neural network in the technical solution of the present application may also include more functional modules or units, wherein a unit or a module may also be referred to as a layer. For example, in some possible implementations, in the enhanced strategy neural network, a hyperbolic tangent function may also be included between the LSTM unit and the normalization module to perform data range compression on the feature vector mapped by the LSTM to prevent the enhanced strategy neural network from overfitting too quickly.

[0177] In the training method of the present application, optionally, strategies can also be generated based on other information. For example. The i-th batch of strategies can be generated based on the i-1th group of loss values ​​and the i-1th group of test accuracy values, and the i-1th group of test accuracy values ​​are the accuracy values ​​obtained by testing the target neural network after training with the i-1th batch of enhanced training sets. Among them, the role of the i-1th group of test accuracy values ​​is the same as that of the i-1th group of loss values, which is used to guide the enhanced strategy neural network to update parameters.

[0178] In the training method of the present application, optionally, the enhanced strategy neural network can be guided to update parameters based on the similarity between two adjacent batches of strategies in the previous two times, or the enhanced strategy neural network can be guided to update parameters based on the similarity between the strategies generated in the previous time step.

[0179] Fig.13 13 is a schematic flow chart of a data processing method according to an embodiment of the present application. The method may include S1310 and S1320.

[0180] S1310, obtaining data to be processed, for example, obtaining an image to be processed, further obtaining an image to be classified or obtaining an image to be identified.

[0181] S1320, processing the data to be processed according to a target neural network, the target neural network is obtained through N trainings, in the i-th training among the N trainings, the target neural network is trained by the i-th batch of enhanced training sets, the i-th batch of enhanced training sets is a training set obtained by enhancing the original training set with the i-th batch of strategies, the i-th batch of strategies is a strategy generated according to the i-1th group of loss values, the i-1th group of loss values ​​is the value output by the loss function of the target neural network when the target neural network is trained according to the i-1th batch of enhanced training sets.

[0182] The method of the embodiment of the present application can be Figure 6 The target neural network trained by the method shown in the figure is used to process data, thereby improving the processing performance. For example, when the target neural network is an image classification network, due to Figure 6 The target neural network trained by the method shown has higher performance, and therefore, the result of image classification based on the target neural network is more accurate.

[0183] Optionally, the i-th batch strategy is a strategy generated based on the i-1th group of loss values ​​and the i-th batch of features. Fig. 9 The target neural network trained by the method shown in the figure is used to process data, thereby improving the processing performance. For example, when the target neural network is an image classification network, due to Fig. 9The target neural network trained by the method shown has higher performance, and therefore, the result of image classification based on the target neural network is more accurate.

[0184] The present application also provides a Fig.14 The device 1400 shown includes a processor 1402, a communication interface 1403, and a memory 1404. An example chip of the device 1400. Another example of the device 1400 is a computing device.

[0185] The processor 1402, the memory 1404 and the communication interface 1403 communicate with each other via a bus. The processor 1402 may be a CPU. The memory 1404 may include a volatile memory, such as a RAM. The memory 1404 may also include a 2NVM, such as a 2ROM, a flash memory, a HDD or a SSD. The memory 1404 stores executable code, and the processor 1402 reads the executable code in the memory 1404 to execute the corresponding method. The memory 1404 may also include an operating system and other software modules required for running processes. The operating system may be LINUX. TM , UNIX TM , WINDOWS TM wait.

[0186] For example, the executable code in the memory 1404 is used to implement Figure 6 or Fig. 9 The method shown in the figure, the processor 1402 reads the executable code in the memory 1404 to execute Figure 6 or Fig. 9 As another example, the executable code in the memory 1404 is used to implement Fig.13 The method shown in the figure, the processor 1402 reads the executable code in the memory 1404 to execute Fig.13 The method shown.

[0187] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

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

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

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

[0191] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0192] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.

[0193] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A neural network training method, characterized in that: include: Generate the i-th batch of strategies according to the i-1th group of loss values, where the i-1th group of loss values ​​is the value output by the loss function of the target neural network after training with the i-1th batch of enhanced training sets, where i is taken from 2 to N in sequence, and N is a preset positive integer; Performing data enhancement on the original training set of the target neural network according to the i-th batch strategy to obtain an i-th batch of enhanced training sets, wherein the original training set includes training images; Training the target neural network according to the i-th batch of enhanced training sets to obtain an i-th group of loss values; Outputting a neural network for image processing obtained by training the target neural network according to the Nth batch of enhanced training sets; The i-th batch of strategies includes Q strategies, the i-th batch of enhanced training sets includes Q enhanced training sets, the j-th enhanced training set in the i-th batch of enhanced training sets is a training set obtained by enhancing the original training set with the j-th strategy in the i-th batch of strategies, Q> 1, and j is a positive integer less than or equal to Q; Among them, the i-th group of loss values ​​includes Q loss values, and the j-th loss value in the i-th group of loss values ​​is the loss function value output by the target neural network after training with the j-th enhanced training set in the i-th batch of enhanced training sets.

2. The method according to claim 1, characterized in that The step of generating the i-th batch of strategies according to the i-1-th group of loss values ​​comprises: The i-th batch of strategies is generated according to the enhanced strategy neural network and the i-1-th group of loss values, wherein the i-1-th group of loss values ​​is used to guide the enhanced strategy neural network to update parameters based on a machine learning method, and the enhanced strategy neural network includes a long-short time memory unit, a normalization module and a sampling module, and the long-short time memory unit is used to: map the operation information output by the sampling module in the previous time step to obtain an M-dimensional vector, where M is the length of the information set to which the operation information to be output by the sampling module in the current time step belongs, and the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long-short time memory unit, and the information set is an operation type set, an operation probability set or an operation amplitude set, and the sampling module is used to sample and output one of the M operation information according to the probability distribution.

3. The method according to claim 2, characterized in that The sampling module outputs a single-bit effective encoding of the operation information at the previous time step; The enhanced strategy neural network further includes a word vector embedding module, which is used to: map a one-bit effective encoding vector of the operation information output by the sampling module in the previous time step into a vector in the real number field; The long short-term memory unit is specifically used to obtain the M-dimensional vector according to the vector mapping output by the word vector embedding module.

4. The method according to claim 1, characterized in that The method further comprises: Using the target neural network trained by the i-1th batch of enhanced training sets, the original training set is inferred to obtain the i-th batch of features of the data in the original training set in the target neural network; The step of generating the i-th batch of strategies according to the i-1-th group of loss values ​​includes: The i-th batch of strategies is generated according to the i-1-th group of loss values ​​and the i-th batch of features.

5. The method according to claim 4, characterized in that The generating the i-th batch of strategies according to the i-1-th group of loss values ​​and the i-th batch of features comprises: The i-th batch of strategies is generated according to the enhanced strategy neural network, the i-th batch of features and the i-1th group of loss values, wherein the i-1th group of loss values ​​and the i-th batch of features are used to guide the enhanced strategy neural network to update parameters based on a machine learning method, the enhanced strategy neural network includes a long-short time memory unit, a normalization module, a sampling module and a splicing module, the splicing module is used to splice the i-th batch of features and the operation information output by the sampling module in the previous time into a vector, the long-short time memory unit is used to obtain an M-dimensional vector according to the vector mapping output by the splicing module, M is the length of the information set to which the operation information to be output by the sampling module at the current time step belongs, the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long-short time memory unit, the information set is an operation type set, an operation probability set or an operation amplitude set, and the sampling module is used to sample and output one of the M operation information according to the probability distribution.

6. The method according to claim 5, characterized in that The sampling module outputs a single-bit effective encoding of the operation information in the previous time step; The enhanced strategy neural network further includes a word vector embedding module, which is used to map a one-bit effective encoding vector of the operation information output by the sampling module in the previous time step into a vector in the real number field; The long short-term memory unit is specifically used to map the vector output by the word vector embedding module into the M-dimensional vector.

7. A data processing method, characterized in that: include: Acquiring data to be processed, wherein the data to be processed includes an image; The data to be processed is processed according to the target neural network, the target neural network is obtained through N trainings, in the i-th training among the N trainings, the target neural network is trained by the i-th batch of enhanced training sets, the i-th batch of enhanced training sets is the training sets obtained by enhancing the original training sets through the i-th batch of strategies, the i-th batch of strategies is the strategy generated according to the i-1-th group of loss values, the i-1-th group of loss values ​​is the value output by the loss function of the target neural network when the target neural network is trained according to the i-1-th batch of enhanced training sets, i is taken from 2 to N in sequence, N is a preset positive integer, the i-th batch of strategies includes Q strategies, the i-th batch of enhanced training sets includes Q enhanced training sets, the j-th enhanced training set in the i-th batch of enhanced training sets is the training set obtained by enhancing the original training set through the j-th strategy in the i-th batch of strategies, Q> 1, j is a positive integer less than or equal to Q, the i-th group of loss values ​​includes Q loss values, and the j-th loss value in the i-th group of loss values ​​is the loss function value output by the target neural network after training with the j-th enhanced training set in the i-th batch of enhanced training sets.

8. The method according to claim 7, characterized in that The i-th batch of strategies is generated based on the enhanced strategy neural network and the i-1th group of loss values, the i-1th group of loss values ​​is used to guide the enhanced strategy neural network to update parameters based on a machine learning method, the enhanced strategy neural network includes a long-short time memory unit, a normalization module and a sampling module, the long-short time memory unit is used to: map the operation information output by the sampling module in the previous time step into an M-dimensional vector, M is the length of the information set to which the operation information to be output by the sampling module in the current time step belongs, the normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long-short time memory unit, the information set is an operation type set, an operation probability set or an operation amplitude set, and the sampling module is used to sample and output one of the M operation information according to the probability distribution.

9. The method according to claim 8, characterized in that The sampling module outputs a single-bit effective encoding of the operation information at the previous time step; The enhanced strategy neural network further includes a word vector embedding module, which is used to: map a one-bit effective encoding vector of the operation information output by the sampling module in the previous time step into a vector in the real number field; Among them, the long short-term memory unit is specifically used to: map the vector output by the word vector embedding module into the M-dimensional vector.

10. The method according to claim 7, characterized in that The i-th batch of strategies is generated based on the i-1th group of loss values ​​and the i-th batch of features, and the i-th batch of features is obtained by inferring the original training set using the target neural network trained with the i-1th batch of enhanced training set.

11. The method according to claim 10, characterized in that The i-th batch of strategies is generated according to the enhanced strategy neural network, the i-th batch of features and the i-1th group of loss values, wherein the i-1th group of loss values ​​and the i-th batch of features are used to guide the enhanced strategy neural network to update parameters based on a machine learning method. The enhanced strategy neural network includes a long-short time memory unit, a normalization module, a sampling module and a splicing module. The splicing module is used to splice the i-th batch of features and the operation information output by the sampling module in the previous time into a vector. The long-short time memory unit is used to obtain an M-dimensional vector according to the vector mapping output by the splicing module, where M is the length of the information set to which the operation information to be output by the sampling module at the current time step belongs. The normalization module is used to generate a probability distribution of M operation information in the information set according to the M-dimensional vector output by the long-short time memory unit, and the information set is an operation type set, an operation probability set or an operation amplitude set. The sampling module is used to sample and output one of the M operation information according to the probability distribution.

12. The method according to claim 11, characterized in that The sampling module outputs a single-bit effective encoding of the operation information in the previous time step; The enhanced strategy neural network further includes a word vector embedding module and a splicing module, wherein the word vector embedding module is used to map a one-bit effective encoding vector of the operation information output by the sampling module in the previous time step into a vector in the real number field; The long short-term memory unit is specifically used to: map the vector output by the word vector embedding module into the M-dimensional vector.

13. A neural network training device, characterized in that: include: Memory, used to store programs; A processor, configured to execute the program stored in the memory; when the program stored in the memory is executed, the processor is configured to execute the method according to any one of claims 1 to 6.

14. A data processing device, characterized in that: include: Memory, used to store programs; A processor, configured to execute the program stored in the memory; when the program stored in the memory is executed, the processor is configured to execute the method as described in any one of claims 7 to 12.

15. A computer-readable storage medium, characterized in that: The computer-readable medium stores instructions for execution by a computing device, the instructions being used to implement the method according to any one of claims 1 to 6.

16. A computer-readable storage medium, characterized in that: The computer-readable medium stores instructions for execution by a computing device, the instructions being used to implement the method according to any one of claims 7 to 12.