Network structure searching method, device, equipment and storage medium

文档序号:8694 发布日期:2021-09-17 浏览:37次 中文

1. A method for searching a network structure, the method comprising:

acquiring a first network structure according to a preset search strategy;

determining the target network performance of the first network structure through a preset performance prediction model;

and updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

2. The method according to claim 1, wherein the determining the target network performance of the first network structure through a preset performance prediction model comprises:

determining a first network performance of the first network structure through the performance prediction model, and obtaining a second network performance of the first network structure, wherein the first network performance refers to the network performance of the first network structure predicted based on the performance prediction model, and the second network performance refers to the network performance of the first network structure determined based on a first training data set and a verification data set;

determining a target network performance of the first network fabric based on the first network performance and the second network performance.

3. The method of claim 2, wherein the obtaining the second network performance of the first network structure comprises:

acquiring a first training data set and a verification data set;

training the first network structure according to the first training data set to obtain a trained network structure;

and acquiring the network performance of the trained network structure according to the verification data set to serve as the second network performance of the first network structure.

4. The method for searching a network structure according to claim 1, wherein the method further comprises:

acquiring an excitation value of a historical network structure, wherein the historical network structure refers to each network structure which is searched currently when a preset search stopping condition is met;

determining an objective function value of the historical network structure according to the excitation value and a preset objective function;

and acquiring a target network structure from the historical network structure, wherein the target network structure is a network structure corresponding to the maximum value of the objective function value.

5. The method for searching network structure according to claim 4, wherein the obtaining the incentive value of the historical network structure comprises:

acquiring preset demand performance;

and determining an incentive value of the historical network structure according to the demand performance and the network performance of the historical network structure.

6. The method according to claim 5, wherein the obtaining the preset demand performance comprises:

obtaining model precision performance and model speed performance, wherein the model precision performance refers to a preset precision requirement value of a network structure on a verification data set, and the model speed performance refers to a preset requirement value of the network structure on a prediction speed;

and determining the demand performance according to the model precision performance and the model speed performance.

7. The method for searching a network structure according to any one of claims 1 to 6, wherein the performance prediction model is obtained by:

obtaining a second training data set, the second training data set comprising a sample model and network performance of the sample model;

training an initial model according to the second training data set;

and determining the trained model as a performance prediction model.

8. A network structured search apparatus, characterized in that the network structured search apparatus comprises:

the device comprises an acquisition unit, a search unit and a processing unit, wherein the acquisition unit is used for acquiring a first network structure according to a preset search strategy;

the processing unit is used for determining the target network performance of the first network structure acquired by the acquisition unit through a preset performance prediction model; and updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

9. A network structure search device comprising a processor and a memory, the memory having stored therein a computer program, the processor executing the network structure search method according to any one of claims 1 to 7 when calling the computer program in the memory.

10. A computer-readable storage medium, having stored thereon a computer program which is loaded by a processor to execute the steps in the network structure searching method according to any one of claims 1 to 7.

Background

With the rapid development of deep learning techniques, deep learning techniques have been widely applied, such as image recognition, speech recognition, and the like.

However, it is very difficult to design a neural network manually and have excellent performance, for example, the structural design, training strategy, parameter adjusting means and the like of the neural network often require researchers to expend a lot of manpower and material resources for experimental exploration.

At present, a neural network architecture search algorithm is proposed in the prior art, aiming at automatically completing the search of the neural network architecture so as to solve the problems existing in the manual design of the neural network. However, the existing neural network architecture search algorithm has the problem of long search time.

Disclosure of Invention

Embodiments of the present application provide a method, an apparatus, a device, and a storage medium for searching a network structure, which can reduce an instance training time of the network structure, and further reduce a search time of the network structure.

In one aspect, an embodiment of the present application provides a method for searching a network structure, where the method includes:

acquiring a first network structure according to a preset search strategy;

determining the target network performance of the first network structure through a preset performance prediction model;

and updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

In some embodiments of the present application, the determining, by a preset performance prediction model, a target network performance of the first network structure includes:

determining a first network performance of the first network structure through the performance prediction model, and obtaining a second network performance of the first network structure, wherein the first network performance refers to the network performance of the first network structure predicted based on the performance prediction model, and the second network performance refers to the network performance of the first network structure determined based on a first training data set and a verification data set;

determining a target network performance of the first network fabric based on the first network performance and the second network performance.

In some embodiments of the present application, the obtaining the second network performance of the first network structure includes:

acquiring a first training data set and a verification data set;

training the first network structure according to the first training data set to obtain a trained network structure;

and acquiring the network performance of the trained network structure according to the verification data set to serve as the second network performance of the first network structure.

In some embodiments of the present application, the method further comprises:

acquiring an excitation value of a historical network structure, wherein the historical network structure refers to each network structure which is searched currently when a preset search stopping condition is met;

determining an objective function value of the historical network structure according to the excitation value and a preset objective function;

and acquiring a target network structure from the historical network structure, wherein the target network structure is a network structure corresponding to the maximum value of the objective function value.

In some embodiments of the present application, the obtaining the incentive value of the historical network structure includes:

acquiring preset demand performance;

and determining an incentive value of the historical network structure according to the demand performance and the network performance of the historical network structure.

In some embodiments of the present application, the obtaining of the preset demand performance includes:

obtaining model precision performance and model speed performance, wherein the model precision performance refers to a preset precision requirement value of a network structure on a verification data set, and the model speed performance refers to a preset requirement value of the network structure on a prediction speed;

and determining the demand performance according to the model precision performance and the model speed performance.

In some embodiments of the present application, the performance prediction model is obtained by:

obtaining a second training data set, the second training data set comprising a sample model and network performance of the sample model;

training an initial model according to the second training data set;

and determining the trained model as a performance prediction model.

In another aspect, an embodiment of the present application provides a network structure search apparatus, where the network structure search apparatus includes:

the device comprises an acquisition unit, a search unit and a processing unit, wherein the acquisition unit is used for acquiring a first network structure according to a preset search strategy;

the processing unit is used for determining the target network performance of the first network structure acquired by the acquisition unit through a preset performance prediction model; and updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

In some embodiments of the present application, the processing unit is further specifically configured to:

determining a first network performance of the first network structure through the performance prediction model, and obtaining a second network performance of the first network structure, wherein the first network performance refers to the network performance of the first network structure predicted based on the performance prediction model, and the second network performance refers to the network performance of the first network structure determined based on a first training data set and a verification data set;

determining a target network performance of the first network fabric based on the first network performance and the second network performance.

In some embodiments of the present application, the processing unit is further specifically configured to:

acquiring a first training data set and a verification data set;

training the first network structure according to the first training data set to obtain a trained network structure;

and acquiring the network performance of the trained network structure according to the verification data set to serve as the second network performance of the first network structure.

In some embodiments of the present application, the search apparatus of the network structure further includes a determining unit, where the determining unit is specifically configured to:

acquiring an excitation value of a historical network structure, wherein the historical network structure refers to each network structure which is searched currently when a preset search stopping condition is met;

determining an objective function value of the historical network structure according to the excitation value and a preset objective function;

and acquiring a target network structure from the historical network structure, wherein the target network structure is a network structure corresponding to the maximum value of the objective function value.

In some embodiments of the present application, the determining unit is further specifically configured to:

acquiring preset demand performance;

and determining an incentive value of the historical network structure according to the demand performance and the network performance of the historical network structure.

In some embodiments of the present application, the determining unit is further specifically configured to:

obtaining model precision performance and model speed performance, wherein the model precision performance refers to a preset precision requirement value of a network structure on a verification data set, and the model speed performance refers to a preset requirement value of the network structure on a prediction speed;

and determining the demand performance according to the model precision performance and the model speed performance.

In some embodiments of the present application, the processing unit is further specifically configured to:

obtaining a second training data set, the second training data set comprising a sample model and network performance of the sample model;

training an initial model according to the second training data set;

and determining the trained model as a performance prediction model.

On the other hand, an embodiment of the present application further provides a network structure search device, where the network structure search device includes a processor and a memory, where the memory stores a computer program, and the processor executes, when calling the computer program in the memory, any one of the steps in the network structure search method provided in the embodiment of the present application.

On the other hand, the embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is loaded by a processor to execute the steps in the network structure searching method.

According to the method and the device, after the first network structure is searched, the target network performance of the first network structure is determined through the preset performance prediction model, on one hand, the searching device can continuously optimize the searching strategy according to the determined target network performance of the first network structure, and then the optimal network structure can be searched. On the other hand, the network performance of the first network structure can be predicted through the preset performance prediction model, and the network performance of the first network structure can be determined without training the first network structure through a large amount of training data, so that the training time of the network structure is shortened, and the searching time of the network structure is shortened.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

Fig. 1 is a flowchart illustrating an embodiment of a method for searching a network structure provided in an embodiment of the present application;

FIG. 2 is a schematic flow chart of a step S20 refinement in the embodiment of the present application;

fig. 3 is a schematic flowchart of a method for searching a network structure according to an embodiment of the present application;

fig. 4 is a schematic structural diagram of an embodiment of a network structure search device provided in the embodiment of the present application;

fig. 5 is a schematic structural diagram of an embodiment of a search device of a network structure provided in the embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

In the description of the embodiments of the present application, it should be understood that the terms "first", "second", and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present application, "a plurality" means two or more unless specifically defined otherwise.

The following description is presented to enable any person skilled in the art to make and use the application. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present application may be practiced without these specific details. In other instances, well-known processes have not been described in detail so as not to obscure the description of the embodiments of the present application with unnecessary detail. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed in the embodiments herein.

First, before describing the embodiments of the present application, the related contents of the embodiments of the present application with respect to the application context will be described.

The deep learning technology achieves excellent generalization performance on various visual tasks (such as a target classification task, a target detection task, a target segmentation task and the like) in the field of machine learning. After an optimization target is given, the process of feature learning is automatically processed by deep learning, but researchers are required to consume a large amount of manpower and material resources to conduct experimental exploration in the aspects of structural design, training strategies, parameter adjusting means and the like of a deep model. In recent years, automatic learning methods, such as neural network architecture search, provide the possibility of automation for several steps that require manual design.

However, in the existing neural network architecture search method, after the network structure is searched, training needs to be performed on the searched network structure to check the performance of the searched network structure, and then the search strategy is updated according to the performance of the searched network structure to search out the optimal network structure. However, training the network structure takes a lot of time, which results in a long overall time for searching the network structure; moreover, training the network structure requires a large amount of hardware resources.

Because the model can show the network performance close to the real network performance when the model is trained to be converged, in order to accurately detect the network performance of the model when the network performance of the model is detected, the prior art generally considers that the model is trained to be converged first and then the model is detected by adopting a verification data set. Due to such limitation, after a network structure is searched, it is easy for those skilled in the art to train the searched network structure to converge (the time required for training the network structure is long), and then to detect the network performance of the network structure, thereby resulting in a long search time of the network structure.

Based on the above defects in the related art, the embodiment of the present application provides a network structure searching method, and after a network structure is searched, the network performance of the searched network structure can be predicted through a preset performance prediction model, so that the training time of the network structure is reduced, the searching time of the network structure is further shortened, and the defects in the related art are overcome at least to a certain extent.

The embodiment of the application provides a network structure searching method, and in the embodiment of the application, the network structure is searched based on reinforcement learning. The network structure refers to a Convolutional Neural Network (CNN).

Reinforcement learning is to obtain learning information and update model parameters by receiving environmental rewards (feedback) for actions. Specifically, in reinforcement learning, an agent (also called a controller) acts as a learning system, acquires current state information s of an external environment, takes a tentative action u on the environment, and acquires an evaluation r of the action fed back by the environment and a new environment state. If an action u of the agent results in a positive reward of the environment, then the tendency of the agent to generate this action at a later time is enhanced; conversely, the tendency of the agent to generate this action will be diminished. In the repeated interaction of the control behavior of the learning system and the state and evaluation of the environmental feedback, the mapping strategy from the state to the action is continuously modified in a learning mode so as to achieve the aim of optimizing the system performance.

In the embodiment of the application, an agent (hereinafter referred to as a controller) is used to search a network structure (i.e. an action in reinforcement learning), and first, according to the network performance of the network structure searched by the controller, an excitation value (i.e. an evaluation r of the action in reinforcement learning) obtained by the controller searching the network structure is determined; updating decision parameters of the controller according to the excitation value obtained by searching the network structure by the controller; then, after the decision parameters of the controller are updated, the controller continues to search the network structure until the condition of stopping searching is met.

The main execution body of the method for searching a network structure in the embodiment of the present application may be a search apparatus of a network structure provided in the embodiment of the present application, or a server device, a physical host, or a User Equipment (UE) that integrates the search apparatus of the network structure, where the search apparatus of the network structure may be implemented in a hardware or software manner, and the UE may specifically be a terminal device such as a smart phone, a tablet computer, a laptop computer, a palmtop computer, a desktop computer, or a Personal Digital Assistant (PDA).

The searching device of the network structure can adopt a working mode of independent operation or a working mode of a device cluster, and by applying the searching method of the network structure provided by the embodiment of the application, the training time of the network structure can be reduced, and the searching time of the network structure is further shortened.

In the following, a method for searching for a network structure provided in an embodiment of the present application is described, where a search device of a network structure is used as an execution subject, and for simplicity and convenience of description, the execution subject will be omitted in subsequent embodiments of the method, or the search device of a network structure is directly referred to as a search device for short, and the method for searching for a network structure includes: acquiring a first network structure according to a preset search strategy; determining the target network performance of the first network structure through a preset performance prediction model; and updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

Referring to fig. 1, fig. 1 is a schematic flowchart of a method for searching a network structure according to an embodiment of the present application. It should be noted that, although a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different than that shown or described herein. The searching method of the network structure includes steps S10-S30, wherein:

and S10, acquiring a first network structure according to a preset search strategy.

First, a search space of a network structure is constructed. Specifically, a search space of a network structure can be constructed through a Long Short-Term Memory network (LSTM); the search space of the network structure defines variables of the optimization problem (including the number of convolution kernels, the size of the convolution kernels, the existence of residual operation, the step length of the convolution operation, the number of network layers and the like).

Then, a first network configuration is obtained based on the controller. Specifically, the controller determines specific values of variables for constructing the first network structure according to the initial decision parameters and the search space of the network structure, and the search device constructs the CNN network according to the specific values of the variables, thereby completing the search of the network structure. The first network structure is a CNN network constructed according to specific values of the variables.

The preset search strategy may have various embodiments, for example, a network structure with a structure conforming to a specific rule (e.g., a network structure with 8 layers including 5 convolutional layers and 3 fully-connected layers, or a network structure with 6 layers including 4 convolutional layers and 2 fully-connected layers) is searched out. For another example, in the embodiments of the present application: the search device generates a CNN network based on reinforcement learning, specifically, the controller determines specific values of variables for constructing the CNN network according to initial decision parameters and a search space of a network structure, and the search device constructs the CNN network according to the specific values of the variables; i.e. the network structure is searched out based on reinforcement learning.

To facilitate understanding of how the network structure is searched in detail, a specific embodiment is described below. For example, the controller determines, according to the initial decision parameter and the search space of the network structure, that the variables for constructing the first network structure are: and if the number of convolution kernels is 3, the size of the convolution kernels is 5 multiplied by 5 and the convolution operation step length is 1, the search equipment constructs and forms a CNN network according to each variable, and the constructed CNN network is the searched network structure.

And S20, determining the target network performance of the first network structure through a preset performance prediction model.

The network performance refers to an index for measuring the performance level of the network structure, and the level of the network performance is related to the prediction precision, the prediction speed and the like of the network structure; for example, the higher the prediction accuracy of the network structure, the higher the network performance of the network structure; the faster the prediction speed of the network structure, the higher the network performance of the network structure.

Since different performance metrics represent different units, in order to measure the performance of the network structure, in the embodiment of the present application, a score is used to represent the network performance. For example, the prediction accuracies are represented by 8 points, 9 points, and 10 points for 80%, 90%, and 100%, respectively; the prediction speeds are slow, medium and fast, and are respectively expressed by 2 min, 4 min and 6 min. For the network structure with the prediction accuracy of 80% and the prediction speed of medium speed, the network performance is determined as follows: 8+4 is 12 points; for a network structure with the prediction accuracy of 90% and the prediction speed of "fast", the network performance is determined as follows: and 8+4 is 12 points.

For example, if only the prediction accuracy of the network structure is used to measure the network performance of the network structure, the specific network performance value may be determined directly according to the prediction accuracy value of the network structure. If the network performance of the network structure is to be measured according to the prediction accuracy and the prediction speed of the network structure, the specific network performance value can be determined according to the prediction accuracy and the prediction speed of the network structure, and the specific network performance value can be set according to the actual requirement.

The target network performance refers to a network performance of the first network fabric. The preset performance prediction model refers to a model obtained by pre-training and used for predicting the network performance of the network structure, and the specific determination manner of the preset performance prediction model may refer to the following steps a1 to a 3.

One embodiment of "determining the target network performance of the first network structure through a preset performance prediction model" is as follows: inputting the network configuration code of the first network structure into the preset performance prediction model, so that the preset performance prediction model predicts the network performance of the first network structure according to the network configuration code of the first network structure and the prediction function in the step a3, and taking the predicted network performance of the first network structure as the target network performance of the first network structure.

One embodiment of "determining the target network performance of the first network structure through a preset performance prediction model" is as follows: in one aspect, the network configuration code of the first network structure is input to the preset performance prediction model, so that the preset performance prediction model predicts the network performance of the first network structure according to the network configuration code of the first network structure and the prediction function in step a 3. In another aspect, the first network structure is trained with a training data set, and the network performance of the trained first network structure is detected with a validation data set. Finally, the target network performance of the first network structure is determined according to the network performance of the first network structure predicted by the performance prediction model and the network performance of the first network structure (referred to as the trained first network structure) detected by the verification data set (for example, the average value of the network performance predicted by the performance prediction model and the network performance detected by the verification data set is used as the target network performance of the first network structure).

In order to improve the accuracy of the network performance predicted by the performance prediction model and further provide a data basis with higher accuracy for the subsequent updating of the search strategy according to the network performance, in some embodiments of the present application, the performance prediction model is obtained through the following steps a1 to a 3:

a1, acquiring a second training data set.

Wherein the second training data set comprises the sample model and the network performance of the sample model.

Specifically, one embodiment of "acquiring the second training data set" is: first, a plurality of existing (published or open source) artificially designed deep network models are collected as sample models. The network performance of these existing artificially designed deep network models is then collected as the network performance of the sample model. Finally, the collected sample models and the network performance of the sample models are used as a second training data set.

Another embodiment of "acquiring the second training data set" is: first, a plurality of existing (published or open source) artificially designed deep network models are collected as sample models. Then, performing multiple rounds of training on the existing artificially designed deep network model to obtain a plurality of trained deep network models, taking the plurality of trained deep network models as sample models, and determining the network performance of all the sample models (specifically, the network performance of the sample models can be detected by verifying a data set). Finally, the collected sample models and the network performance of the sample models are used as a second training data set.

a2, training the initial model according to the second training data set.

Specifically, one embodiment of "training the initial model according to the second training data set" is: and characterizing the network configuration code and the network performance of each sample model into vector data, and inputting the vector data into the initial model so that the initial model learns according to the vector data to determine a prediction function of the model performance.

Since the network performance of the model may be different after the same model is trained under different training data, in order to consider the influence of different training data on the network performance of the model, in some embodiments of the present application, another implementation of "training the initial model according to the second training data set" is: the number of samples in a training data set, the sample category distribution condition, the mean value and the variance of the signal-to-noise ratio of the disturbed samples, the average input of the samples and the like, as well as the network configuration code and the network performance of each sample model are characterized into vector data, and the vector data are input into an initial model, so that the initial model learns according to the vector data to determine a prediction function of the model performance.

and a3, determining the trained model as a performance prediction model.

When the network performance output by the trained initial model can meet the loss function or other target conditions, the training of the model is completed, and the model can be used as a performance prediction model for predicting the network performance of the network structure.

To facilitate understanding of how the initial model is collected and trained based on the second training data set to obtain the performance prediction model, a specific embodiment is described below.

For example, collect the network configuration code A of the existing artificial design network model (published or open source), the training round number I of the artificial design network model, and the performance f of the artificial design network model on the classification taskpAnd a description vector D of the training data set as a second training data set. Inputting a second training data set to the initial modelAnd learning the initial model according to the second training data set, determining a prediction function of the network performance, and further obtaining a performance prediction model. The prediction function of the network performance is as follows:

fpf (D, A, I) formula (1)

The method comprises the steps that D represents a description vector obtained by describing a training data set of a manual design network model (namely a sample model) by combining the number of samples, the sample category distribution condition, the mean value and the variance of the signal-to-noise ratio of the disturbed samples, the mean value and the variance of the samples, the mean value and the variance of an evaluation value under a blind image quality evaluation system and the like, A represents a network configuration code of the manual design network model (namely the sample model), and I represents the number of training rounds of the manual design network model.

The purpose of increasing the number of training rounds I as training data here is to: the model of the same network structure can be used as different sample models after being trained in different rounds, so that the diversity of training data is enhanced.

In the embodiment of the application, the model is trained by obtaining the second training data set to obtain the performance prediction model for predicting the network performance of the network structure, and the accuracy of the network performance predicted by the performance prediction model is improved due to the training of the training data set, so that a data basis with higher accuracy is provided for the follow-up updating of the search strategy according to the network performance.

And S30, updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

The preset search stopping condition may be various, for example, when the search duration of the search device is longer than a certain duration, the network structure is stopped to be searched; for another example, when the variation of the objective function value corresponding to the searched network structure (the objective function value corresponding to the network structure may be determined with reference to the objective function in step S50 below) is smaller than the preset threshold, the search for the network structure is stopped.

Specifically, in order to make the network performance of the searched network structure as high as possible, in the embodiment of the present application, when performing a search based on reinforcement learning, a reward function is constructed according to a requirement value of the model performance and the network performance of the searched network structure, and a decision parameter of the controller is updated according to the constructed incentive function, in consideration of a requirement on performance of an algorithm model in practical applications (for example, a requirement on accuracy of classification of the algorithm model of a classification task, a requirement on accuracy of detection of a target of the algorithm model of a target detection task, and a requirement on time for the algorithm model to infer and output a result).

In some embodiments of the present application, the excitation function is as follows:

r ═ P-K formula (2)

Wherein, R represents the excitation value of the searched network structure, P represents the network performance of the searched network structure, and K represents the performance requirement value of the preset algorithm model.

In some embodiments of the present application, the excitation function is as follows:

wherein R represents an excitation value for searching the network structure, PeRepresenting the network performance, P, predicted by a performance predictor of the searched network structurelAnd K represents the performance requirement value of a preset algorithm model.

The "updating the search policy according to the target network performance, and obtaining the second network structure according to the updated search policy until a preset search stopping condition is met" specifically includes:

(1) after determining the target network performance of the first network structure, first, according to the target network performance of the first network structure and the performance requirement value of the preset algorithm model, determining an excitation value corresponding to the first network structure according to the above formula (2), and updating the decision parameter of the controller according to the excitation value corresponding to the first network structure.

(2) Then, a second network configuration is obtained based on the controller. Specifically, the controller determines specific values of variables for constructing the second network structure according to the updated decision parameters and the search space of the network structure, and the search device constructs the CNN network according to the specific values of the variables, so that the network structure is searched once again. And the second network structure is a CNN network constructed according to the specific values of the variables.

(3) And (3) iterating and circulating the steps (1) and (2) until a preset search stopping condition is met.

In the embodiment of the application, after the first network structure is searched, the target network performance of the first network structure is determined through the preset performance prediction model, on one hand, the searching equipment can continuously optimize the searching strategy according to the determined target network performance of the first network structure, and further, the optimal network structure can be searched.

On the other hand, the network performance of the first network structure can be predicted through the preset performance prediction model, and the network performance of the first network structure can be determined without training the first network structure through a large amount of training data, so that the training time of the network structure is shortened, and the searching time of the network structure is shortened.

In order to improve the accuracy of the determined target network performance of the first network structure, referring to fig. 2, fig. 2 is a flowchart of a step S20 in the embodiment of the present application. In some embodiments of the present application, step S20 may specifically include the following steps 21 to 22, where:

21. determining a first network performance of the first network structure through the performance prediction model, and obtaining a second network performance of the first network structure.

The first network performance refers to the network performance of the first network structure predicted based on the performance prediction model. The second network performance refers to a network performance of the first network structure determined based on the first training data set and the verification data set (specifically, the first network structure is trained by the training data set, and the network performance of the trained first network structure is detected by the verification data set as the second network performance of the first network structure).

In some embodiments of the present application, the step of obtaining the second network performance of the first network structure may specifically include the following steps b1 to b3, where:

b1, acquiring a first training data set and a verification data set.

Specifically, a plurality of sample data are obtained according to a specific model task, and are labeled; and dividing the marked sample data into a first training data set and a verification data set for training the first network structure according to the first training data set and detecting the network performance of the trained first network structure according to the verification data set.

For example, for a classification task, a plurality of sample images are obtained first, then the class of each sample image is labeled, and then one part of the labeled sample images is used as a first training data set, and the other part is used as a verification data set. For the segmentation task, firstly, a plurality of sample images are obtained, then segmentation data of each sample image are labeled, and then one part of the labeled sample images is used as a first training data set, and the other part of the labeled sample images is used as a verification data set.

b2, training the first network structure according to the first training data set to obtain a trained network structure.

To facilitate understanding how the first network structure is trained according to the first training data set, a trained network structure is obtained, and the following description is provided by a specific embodiment.

For example, for a classification task, each sample image labeled in the first training data set is input into the initial model, so that the initial model performs forward propagation according to the sample images, performs backward propagation according to a loss function configured for the initial model, and iteratively updates the model parameters of the initial model with the output classification result as a target. And finishing the training of the model until the classification result output by the initial model can meet a loss function or other target conditions, and taking the model as a trained network structure.

For another example: for the segmentation task, each sample image labeled in the first training data set is input into the initial model, so that the initial model performs forward propagation according to the sample images, performs backward propagation according to a loss function configured for the initial model, and iteratively updates model parameters of the initial model (namely a prediction function of the iteratively updated model) by taking an output segmentation result as a target. And finishing the training of the model until the segmentation result output by the initial model can meet a loss function or other target conditions, and taking the model as a trained network structure.

b3, acquiring the network performance of the trained network structure according to the verification data set to be used as the second network performance of the first network structure.

Specifically, first, each sample data in the validation dataset is input into the trained network structure, so that the trained network structure determines and outputs a prediction result according to each sample data and a prediction function of the trained network structure. Then, according to the error between the prediction result and the labeled data, determining the network performance of the trained network structure to be used as the second network performance of the first network structure; wherein the larger the error between the prediction result and the annotation data, the lower the network performance of the trained network structure (i.e., the lower the second network performance of the first network structure).

For example, for the classification task, the verification data set includes a sample picture 1, a sample picture 2, and a sample picture 3, and it can be known from the labeling data that objects respectively corresponding to the sample picture 1, the sample picture 2, and the sample picture 3 are: tables, chairs, and wardrobes. The classification results of the trained network structure predicted respectively based on the sample picture 1, the sample picture 2 and the sample picture 3 are as follows: for a chair, a chair and a wardrobe, the classification result of the trained network structure for the prediction of the sample picture 1 is wrong, and the classification results of the sample picture 2 and the sample picture 3 are all correct, so that the prediction precision of the trained network structure can be determined as follows: 2/3 ≈ 67%, the network performance of the trained network structure may be determined (refer to the example in step S20 above).

In the embodiment of the application, the first network structure is trained by adopting the first training data set, and the network performance of the trained first network structure is detected by adopting the verification data set, so that the network performance (namely, the second network performance) of the first network structure on the verification set is detected, and an accurate data basis is provided for subsequently determining the target network performance according to the second network performance.

22. Determining a target network performance of the first network fabric based on the first network performance and the second network performance.

One embodiment for determining the performance of the target network is as follows: the average of the first network performance and the second network performance is taken as the target network performance of the first network structure. Specifically, the target network performance of the first network structure is calculated by the following formula (4):

wherein P represents a target network performance of the first network structure, PeRepresenting the network performance predicted by the performance predictor for the first network structure (i.e., the first network performance), PlRepresenting the network performance (i.e., the second network performance) detected on the validation set after the first network structure is trained by the training data set.

Another embodiment for determining the target network performance is: first, a weighting factor of the first network performance and a weighting factor of the second network performance are determined, respectively. Then, the target network performance of the first network structure is determined according to the weighting coefficient of the first network performance, the weighting coefficient of the second network performance, the first network performance and the second network performance. Therefore, the influence of the first network performance and the second network performance on the target network performance is balanced through the weight coefficient.

In the embodiment of the present application, on one hand, the target network performance of the first network structure is determined by combining the network performance detected by the verification data set, so that the determined target network performance is closer to the actual network performance of the first network structure; on the other hand, the target network performance of the first network structure is determined by combining the grid performance roughly predicted by the performance predictor, and the network performance of the first network structure can be detected without training the network structure for a long time, so that the training time of the network structure can be shortened, and the searching time of the network structure can be shortened.

Therefore, the grid performance roughly predicted by the performance predictor is combined with the network performance determined based on the first training data set and the verification data set to comprehensively determine the target network performance of the first network structure, so that the accuracy of network performance detection of the network structure can be ensured, and the search time of the network structure is shortened.

Referring to fig. 3, fig. 3 is a schematic flowchart of a network structure searching method according to an embodiment of the present application. In some embodiments of the present application, the method for searching a network structure further includes the following steps S40 to S50, wherein:

and S40, acquiring the incentive value of the historical network structure.

After performing the above steps S10 to S30, the search apparatus may search for a plurality of network structures based on the controller.

The historical network structure refers to each network structure which is searched currently when a preset search stopping condition is met. For example, the preset search stopping condition is that the search duration is greater than or equal to a preset threshold (e.g., 2 days), and the network structure 1 is obtained according to a preset search strategy (e.g., strategy 1); updating the strategy 1 according to the network performance of the network structure 1 to obtain a strategy 2, and searching the network structure 2 according to the strategy 2; updating the strategy 2 according to the network performance of the network structure 2 to obtain a strategy 3, and searching the network structure 3 according to the strategy 3; and repeating the steps until the searching time is equal to 2 days, and searching five network structures including the network structure 1, the network structure 2, the network structure 3, the network structure 4 and the network structure 5, wherein the historical network structure refers to each of the network structures 1, 2, 3, 4 and 5.

The excitation value of the historical network structure is the excitation value obtained by determining the historical network structure searched by the controller according to the network performance of the historical network structure searched by the controller; the excitation value of the historical network structure may be specifically determined with reference to formula (2) or formula (3) in step S30 above. Specifically, the method comprises the following steps: first, the network performance of the history network structure is acquired with reference to the above step S20 (or with reference to the above steps 21 to 22); then, acquiring a performance requirement value of a preset algorithm model; finally, the difference between the network performance of the historical network structure acquired with reference to the above step S20 (or with reference to the above steps 21 to 22) and the performance requirement value of the preset algorithm model is taken as the excitation value of the historical network structure.

In some embodiments of the present application, the step of obtaining the incentive value of the historical network structure specifically includes the following steps c1 and c 2:

c1, acquiring preset required performance;

in practical applications, there are performance requirements on the model performance, for example, there are requirements on the accuracy of classification for the algorithm model of the classification task, the accuracy of target detection for the algorithm model of the target detection task, or there is a requirement on the time required for model inference in a hardware environment in practical applications.

The preset demand performance is an index for measuring the height of target performance (the target performance is performance required by the network structure), and the height of the preset demand performance is related to the requirements on the prediction precision, the prediction speed and the like of the network structure; for example, the higher the prediction accuracy requirement on the network structure, the higher the preset demand performance; the faster the prediction speed of the network structure is required, the higher the preset demand performance is. The specific value of the preset demand performance is related to at least one of the prediction precision requirement and the prediction speed requirement of the network structure, for example, if only the prediction precision of the network structure is required, the specific demand performance value can be directly determined according to the prediction precision requirement value of the network structure; if the requirement is simultaneously provided for the prediction precision and the prediction speed of the network structure, the specific network performance value can be determined according to the requirement value of the prediction precision and the requirement value of the prediction speed of the network structure, and the specific network performance value can be set according to the actual requirement.

In some embodiments of the present application, a prediction accuracy requirement value for a network structure is obtained as a preset requirement performance. For example, if the score corresponding to the prediction accuracy requirement value of the network structure is 9 points, the preset requirement performance is 9 points.

In order to balance the prediction accuracy and the prediction speed of the obtained network structure at the same time, in some embodiments of the present application, the step of obtaining the preset demand performance specifically includes the following steps (c11) and (c 12):

(c11) and obtaining the model precision performance and the model speed performance.

The model precision performance refers to a preset precision requirement value of the network structure on the verification data set, and the model speed performance refers to a preset requirement value of the network structure on the prediction speed.

For example, if the preset precision requirement value of the network structure on the verification data set is 80%, and the score corresponding to the precision of 80% is 8 points, the model precision performance is 8 points. If the preset required value of the network structure on the prediction speed is 'fast', the corresponding score of the speed 'fast' is 6 scores, and the model speed performance is 6 scores.

(c12) And determining the demand performance according to the model precision performance and the model speed performance.

Specifically, the demand performance is calculated by the following formula:

k ═ precision- μ latency equation (5)

Wherein, K represents a preset demand performance, precision represents a preset precision requirement value (namely model precision performance) on the verification data set of the network structure, latency represents a preset requirement value (namely model speed performance) on the prediction speed of the network structure, and μ represents a balance factor.

In the embodiment of the application, the requirement performance is determined according to the precision requirement value of the network structure on the verification data set and the requirement value of the network structure on the prediction speed. The incentive value is directly related to the demand performance, and the incentive value influences the updating of the search strategy, so that the network structure can be searched by balancing the prediction accuracy and the prediction speed.

c2, determining the incentive value of the historical network structure according to the demand performance and the network performance of the historical network structure.

In some embodiments of the present application, the difference between the network performance of the historical network structure obtained in the above step S20 and the demand performance determined in the above steps (c11) and (c12) (or the preset demand performance obtained in the above step c 1) will be referred to as an incentive value of the historical network structure.

In some embodiments of the present application, the difference between the network performance of the historical network structure obtained in the above steps 21 to 22 and the demand performance determined in the above steps (c11) and (c12) (or the preset demand performance obtained in the above step c 1) is referred to as an incentive value of the historical network structure.

The excitation value of the historical network structure refers to an excitation value obtained when the controller searches the historical network structure.

In the embodiment of the application, the excitation value of the historical network structure is determined according to the performance requirement (namely the required performance) of the network structure and the network performance of the historical network, so that on one hand, accurate data basis is provided for subsequently determining the objective function value of the historical network structure according to the excitation value of the historical network structure. On the other hand, the incentive value is directly related to the demand performance, and the incentive value influences the updating of the search strategy, so that the network performance of the subsequently searched network structure is closer to the actual demand.

And S50, determining an objective function value of the historical network structure according to the excitation value and a preset objective function.

After the excitation values of the historical network structures are determined, determining an objective function value of each historical network structure according to a preset objective function, wherein the preset objective function is as follows:

where L is the objective function value of the network structure, m is the number of network structures searched by the controller, T is the total number of hyper-parameters predicted by the controller, atIs the output at a time step t in a given network structure, RkIs the excitation value obtained after the kth network structure test, P represents the probability of generating the network structure, thetacIs a decision parameter of the controller.

60. And acquiring a target network structure from the historical network structure.

The target network structure refers to a network structure corresponding to the maximum value of the objective function value in the historical network structure.

To facilitate an understanding of the manner in which the target network structure is determined, a specific embodiment will be described. For example, the historical network structure includes a network structure a, a network structure B, and a network structure C, where the objective function values of the network structure a, the network structure B, and the network structure C are 10, 20, and 30, respectively, then the network structure corresponding to the maximum value of the objective function value is the network structure C, and the network structure C is obtained as the target network structure and is used as the output result of the network search.

In the embodiment of the application, the network structure corresponding to the maximum value of the objective function value is obtained as the target network structure in the searched historical network structure according to the preset objective function and the excitation value of the historical network structure, so that the optimal network structure is searched.

In order to better implement the searching method of the network structure in the embodiment of the present application, on the basis of the searching method of the network structure, an embodiment of the present application further provides a searching apparatus of the network structure, as shown in fig. 4, which is a schematic structural diagram of an embodiment of the searching apparatus of the network structure in the embodiment of the present application, and the searching apparatus 400 of the network structure includes:

an obtaining unit 401, configured to obtain a first network structure according to a preset search policy;

a processing unit 402, configured to determine, through a preset performance prediction model, a target network performance of the first network structure acquired by the acquiring unit 401; and updating the search strategy according to the target network performance, and acquiring a second network structure according to the updated search strategy until a preset search stopping condition is met.

In some embodiments of the present application, the processing unit 402 is further specifically configured to:

determining a first network performance of the first network structure through the performance prediction model, and obtaining a second network performance of the first network structure, wherein the first network performance refers to the network performance of the first network structure predicted based on the performance prediction model, and the second network performance refers to the network performance of the first network structure determined based on a first training data set and a verification data set;

determining a target network performance of the first network fabric based on the first network performance and the second network performance.

In some embodiments of the present application, the processing unit 402 is further specifically configured to:

acquiring a first training data set and a verification data set;

training the first network structure according to the first training data set to obtain a trained network structure;

and acquiring the network performance of the trained network structure according to the verification data set to serve as the second network performance of the first network structure.

In some embodiments of the present application, the search apparatus of the network structure further includes a determining unit (not shown in the figure), where the determining unit is specifically configured to:

acquiring an excitation value of a historical network structure, wherein the historical network structure refers to each network structure which is searched currently when a preset search stopping condition is met;

determining an objective function value of the historical network structure according to the excitation value and a preset objective function;

and acquiring a target network structure from the historical network structure, wherein the target network structure is a network structure corresponding to the maximum value of the objective function value.

In some embodiments of the present application, the determining unit is further specifically configured to:

acquiring preset demand performance;

and determining an incentive value of the historical network structure according to the demand performance and the network performance of the historical network structure.

In some embodiments of the present application, the determining unit is further specifically configured to:

obtaining model precision performance and model speed performance, wherein the model precision performance refers to a preset precision requirement value of a network structure on a verification data set, and the model speed performance refers to a preset requirement value of the network structure on a prediction speed;

and determining the demand performance according to the model precision performance and the model speed performance.

In some embodiments of the present application, the processing unit 402 is further specifically configured to:

obtaining a second training data set, the second training data set comprising a sample model and network performance of the sample model;

training an initial model according to the second training data set;

and determining the trained model as a performance prediction model.

In addition, in order to better implement the search method of the network structure in the embodiment of the present application, based on the search method of the network structure, the embodiment of the present application further provides a search device of the network structure, referring to fig. 5, fig. 5 shows a schematic structural diagram of the search device of the network structure in the embodiment of the present application, specifically, the search device of the network structure provided in the embodiment of the present application includes a processor 501, and when the processor 501 is used for executing the computer program stored in the memory 502, each step of the search method of the network structure in any embodiment corresponding to fig. 1 to fig. 3 is implemented; alternatively, the processor 501 is configured to implement the functions of the units in the corresponding embodiment of fig. 4 when executing the computer program stored in the memory 502.

Illustratively, a computer program may be partitioned into one or more modules/units, which are stored in the memory 502 and executed by the processor 501 to implement embodiments of the present application. One or more modules/units may be a series of computer program instruction segments capable of performing certain functions, the instruction segments being used to describe the execution of a computer program in a computer device.

The network fabric search device may include, but is not limited to, a processor 501, a memory 502. It will be understood by those skilled in the art that the illustration is merely an example of a search device of a network architecture, and does not constitute a limitation of the search device of a network architecture, and may include more or less components than those illustrated, or combine some components, or different components, for example, the search device of a network architecture may further include an input-output device, a network access device, a bus, etc., and the processor 501, the memory 502, the input-output device, and the network access device, etc., are connected via the bus.

The Processor 501 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor being the control center for the searching device of the network architecture, various interfaces and lines connecting the various parts of the searching device of the overall network architecture.

The memory 502 may be used to store computer programs and/or modules, and the processor 501 may implement various functions of the computer device by running or executing the computer programs and/or modules stored in the memory 502, as well as invoking data stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the search apparatus of the network structure, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.

It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described network structure searching apparatus, device and corresponding units thereof may refer to the descriptions of the network structure searching method in any embodiment corresponding to fig. 1 to fig. 3, and are not described herein again in detail.

It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.

For this reason, an embodiment of the present application provides a computer-readable storage medium, where a plurality of instructions are stored, where the instructions can be loaded by a processor to execute steps in the method for searching a network structure in any embodiment of the present application, as shown in fig. 1 to fig. 3, and specific operations may refer to descriptions of the method for searching a network structure in any embodiment of fig. 1 to fig. 3, which are not described herein again.

Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.

Since the instructions stored in the computer-readable storage medium can execute the steps in the method for searching a network structure in any embodiment of the present application corresponding to fig. 1 to 3, the beneficial effects that can be achieved by the method for searching a network structure in any embodiment of the present application corresponding to fig. 1 to 3 can be achieved, which are described in detail in the foregoing description and will not be repeated herein.

The method, apparatus, device and storage medium for searching a network structure provided in the embodiments of the present application are described in detail above, and a specific example is applied in the present application to explain the principle and implementation manner of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:识别图像的方法和设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!