A neural network architecture selection method, device and electronic device
By establishing a latent feature space and performing sampling decoding in its high-precision area, the problems of architecture search complexity and high resource consumption in the NAS method are solved, and a more efficient neural network architecture selection is achieved.
Patent Information
- Application Number
- CN202110307991.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-23
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-03-23
AI Technical Summary
The neural network architecture search process in existing NAS methods is complex, consumes a lot of time and computing resources, and makes it difficult to find the target structure efficiently.
By obtaining the initial architecture in the architecture pool, establishing a latent feature space, sampling in the high-precision latent feature space area, and decoding to obtain a new architecture with higher precision, thereby selecting the target architecture.
It simplifies the neural network architecture search process, improves efficiency, reduces the consumption of computing resources, and achieves faster target architecture selection.
Smart Images

Figure CN112990436B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a neural network architecture selection method, device and electronic device. Background Art
[0002] Deep learning technology has achieved unprecedented success in tasks such as image classification and detection, speech recognition, and natural language processing. In recent years, it has been widely used in many fields such as security, medical care, advertising and media. NAS (Neural Architecture Search) methods have begun to show great potential in various fields.
[0003] However, the design of the search space in the NAS method is relatively complex. The NAS algorithm needs to randomly sample millions or tens of millions of candidate architectures to find the target structure to achieve high performance, which results in a huge consumption of time and computing resources. Summary of the invention
[0004] In view of this, the present application provides a neural network architecture selection method to solve the problem that the process of finding the target structure in the NAS method in the prior art is complicated and consumes a lot of time and computing resources.
[0005] To achieve the above objectives, this application provides the following technical solutions:
[0006] A neural network architecture selection method, comprising:
[0007] Obtain a first architecture in an architecture pool, wherein the architecture pool includes at least two first architectures;
[0008] Establishing a latent feature space based on the at least two first frameworks;
[0009] Sampling is performed in a first interval of the latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space;
[0010] Decoding the latent features in the sampling result to obtain at least two second architectures;
[0011] An architecture that meets a predetermined condition is selected from the at least two second architectures as a target architecture.
[0012] Optionally, in the above method, the step of sampling in the first interval of the latent feature space to obtain a sampling result includes:
[0013] Sampling is performed in the first interval with a first sampling probability, and sampling is performed in the latent feature space with a second sampling probability to obtain a sampling result, where the sum of the first sampling probability and the second sampling probability is 1.
[0014] Optionally, in the above method, establishing a latent feature space according to the at least two first architectures includes:
[0015] Training preset parameters of the controller according to the at least two first architectures to obtain a controller that meets preset training requirements;
[0016] Encoding the at least two first architectures based on the trained controller to obtain latent features;
[0017] A latent feature space is established based on the latent features.
[0018] Optionally, the above method, before decoding the latent features in the sampling result to obtain at least two second architectures, further includes:
[0019] Optimization is performed based on the sampling result, and the latent feature accuracy after optimization is higher than the latent feature accuracy before optimization.
[0020] Optionally, in the above method, the step of training preset parameters of the controller according to the at least two first architectures to obtain a controller that meets preset training requirements includes:
[0021] Based on the controller evaluating the at least two first architectures, generating a correspondence between at least two architectures and precision;
[0022] Based on the correspondence between the at least two architectures and the precision, the preset parameters of the controller are trained to obtain a controller that meets the preset training requirements.
[0023] Optionally, in the above method, the step of establishing a latent feature space based on the latent features includes:
[0024] Based on the correspondence between at least two architectures and precision, obtaining the precision corresponding to the latent feature of any first architecture, and obtaining the correspondence between the precision and the latent feature;
[0025] A latent feature space is established based on the correspondence between the precision and the latent feature, wherein the latent feature space includes a first interval and a second interval, and the precision of the latent feature in the first interval is higher than the precision of the latent feature in the second interval.
[0026] Optionally, the above method, after decoding the latent features in the sampling result to obtain at least two second architectures, further includes:
[0027] Determine whether the number of times the latent feature is decoded meets the preset number, and obtain a determination result;
[0028] Based on the judgment result indicating that the number of times the latent feature is decoded meets the preset number, the step of selecting an architecture that meets the predetermined condition from the at least two second architectures as the target architecture is performed;
[0029] Based on the judgment result indicating that the number of times the latent feature is decoded does not meet the preset number, the at least two second architectures are put into the architecture pool as the first architecture; and the subsequent step of obtaining the first architecture in the architecture pool is executed in a loop.
[0030] A neural network architecture selection device, comprising:
[0031] An acquisition module, configured to acquire a first architecture from an architecture pool, wherein the architecture pool includes at least two first architectures;
[0032] A building module, used for building a latent feature space according to the at least two first frameworks;
[0033] A sampling module, configured to perform sampling in a first interval of a latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space;
[0034] A processing module, configured to decode latent features in the sampling result to obtain at least two second architectures;
[0035] The selection module is used to select an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0036] Optionally, the sampling module of the above device is specifically used for:
[0037] Sampling is performed in the first interval with a first sampling probability, and sampling is performed in the latent feature space with a second sampling probability to obtain a sampling result, where the sum of the first sampling probability and the second sampling probability is 1.
[0038] An electronic device, comprising: a memory and a processor;
[0039] Wherein, the memory stores a processing program;
[0040] The processor is used to load and execute the processing program stored in the memory to implement each step of the neural network architecture selection method as described in any one of the above items.
[0041] Through the above technical scheme, it can be known that compared with the prior art, the present application provides a neural network architecture selection method, including: obtaining a first architecture in an architecture pool, the architecture pool includes at least two first architectures; establishing a latent feature space based on the at least two first architectures; sampling in the first interval of the latent feature space to obtain a sampling result, the sampling result includes at least two latent features, the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space; decoding the latent features in the sampling result to obtain at least two second architectures; selecting an architecture that meets the predetermined conditions from the at least two second architectures as the target structure. In this scheme, a latent feature space is established based on the architecture in the architecture pool, sampling is performed in the first area with high accuracy in the latent feature space respectively, sampling results are obtained, and the latent features in the sampling results are decoded to obtain a new architecture, and the architecture with the highest accuracy is selected as the target structure, by sampling the latent features in the first interval with high accuracy in the latent feature space, and obtaining a new architecture with higher accuracy based on the latent feature decoding, so as to realize the selection of the target structure based on accuracy, compared with the prior art in which the target structure can only be found by randomly selecting in a large number of architectures in the candidate architecture, the processing process is faster. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0043] Figure 1 A flowchart of a neural network architecture selection method embodiment 1 provided in the present application;
[0044] Figure 2 A schematic diagram of a latent feature space in Embodiment 1 of a neural network architecture selection method provided in this application;
[0045] Figure 3 A flowchart of Embodiment 2 of a neural network architecture selection method provided in this application;
[0046] Figure 4 A flowchart of Embodiment 3 of a neural network architecture selection method provided in this application;
[0047] Figure 5 A flowchart of a neural network architecture selection method embodiment 4 provided in the present application;
[0048] Figure 6A flowchart of Embodiment 5 of a neural network architecture selection method provided in this application;
[0049] Figure 7 A schematic diagram of a processing flow of a controller in a neural network architecture selection method provided in this application;
[0050] Figure 8 A schematic diagram of the structure of an embodiment of a neural network architecture selection device provided by the present application;
[0051] Fig. 9 A schematic diagram of the structure of an electronic device embodiment provided in the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] Neural network is a model in machine learning. It is an algorithmic mathematical model that imitates the behavioral characteristics of animal neural networks and performs distributed parallel information processing. This network relies on the complexity of the system and adjusts the interconnected relationships between a large number of internal nodes to achieve the purpose of processing information.
[0054] The neural network architecture refers to the structure of the neural network. The neural network includes: input layer, convolution layer, fully connected layer, ..., output layer, etc. Among them, the differences in various factors such as the size of the convolution kernel in the convolution layer and / or the number of convolution layers, the number of fully connected layers, etc., make the neural network have various architectures.
[0055] In order to select the neural network architecture with the best performance, the existing technology lists a large number of architectures, randomly selects one from them for evaluation, and determines the one with the highest accuracy (best performance) as the optimal architecture. In this process, a large number of selections may need to be made, resulting in a huge consumption of time and computing resources.
[0056] Therefore, in the neural network architecture selection method disclosed in the present application, a latent feature space is constructed based on a finite number of first architectures, and sampling is performed from a first region in the latent feature space where latent features have high accuracy to obtain latent features with high accuracy, and then the latent features are decoded to obtain a second architecture with high accuracy. Theoretically speaking, since the first region is a continuous region, the latent features obtained by sampling from the first region are different from the latent features of the first architecture and have higher accuracy, that is, the multiple second architectures are architectures that are at least partially different from the multiple first architectures, and have higher accuracy than the first architectures. Therefore, the architecture with the best performance selected from the second architecture is the architecture with the best performance, which simplifies the processing process.
[0057] like Figure 1 The figure is a flowchart of a neural network architecture selection method embodiment 1 provided by the present application. The method is applied to an electronic device, and the method includes the following steps:
[0058] Step S101: obtaining a first architecture in an architecture pool;
[0059] Wherein, the architecture pool includes at least two first architectures;
[0060] Among them, the at least two first architectures are different and have different performances. When the same input content is processed by the at least two first architectures, the output results are different. This is due to different accuracies (i.e., different performances). Moreover, the accuracies of the first architectures may be relatively low.
[0061] In a specific implementation, the number of first architectures in the architecture pool is limited, such as dozens or even hundreds, which is very small compared to the millions or tens of millions of candidate architectures in the prior art.
[0062] Step S102: establishing a latent feature space according to the at least two first frameworks;
[0063] A latent feature space is established based on the multiple first architectures, and the latent feature space includes the latent features of the multiple first architectures.
[0064] Specifically, the controller encodes the multiple first architectures respectively to obtain multiple latent features, and then establishes a latent feature space based on the multiple latent features.
[0065] It should be noted that the controller encodes the first architecture, which maps the architecture to high-level features (i.e., latent feature space), and the high-level feature space contains semantic information. By sampling from the high-level feature space, we can intuitively understand which type of architectural representation is easy to achieve good performance and enhance interpretability.
[0066] The specific process of establishing the latent feature space will be described in detail in the subsequent embodiments, and will not be described in detail in this embodiment.
[0067] Step S103: sampling in the first interval of the latent feature space to obtain a sampling result;
[0068] Wherein, the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space;
[0069] The number of latent features in the sampling result is the same as the number of the first architecture for establishing the latent feature space.
[0070] Among them, the latent feature accuracy of the first interval of the latent feature space is higher than the latent feature accuracy of other areas. Therefore, the accuracy of the latent features obtained by sampling from the first interval is relatively high.
[0071] as follows Figure 2 What is shown is a schematic diagram of the latent feature space. The gray area represents the first interval, where the horizontal axis represents the value of the latent feature and the vertical axis represents the accuracy of the latent feature.
[0072] Combined with Figure 2 As shown, the left figure shows z 24 The distribution of hidden features, hidden features z 24 The value of is about 0.3 to 0.4, which is the densely distributed area (i.e., the first area); the right figure shows the distribution of the hidden features of z7. 24 The value of is approximately -0.30 to -0.25, which is a densely distributed area (i.e., the first area).
[0073] The first interval is a continuous interval, and latent features obtained by sampling in the continuous interval are completely different from or not completely the same as the latent features of the first architecture.
[0074] Specifically, the sampling is random sampling, and the latent features obtained by the sampling are less likely to be the same latent features as the latent features obtained by encoding the first architecture, but are highly likely not to be the same latent features.
[0075] It should be noted that the latent feature includes several dimensions, and the latent features obtained by the multiple first architectures correspond to the several dimensions respectively.
[0076] Specifically, the latent feature space is a latent feature space containing several dimensions, as mentioned above Figure 2 The following is a case of two dimensions of the latent feature space, where Figure 2 The left figure in the figure shows the distribution of latent features in a certain dimension, and the right figure shows the distribution of latent features in another dimension.
[0077] Specifically, step S103 includes:
[0078] Sampling is performed in the first interval with a first sampling probability, and sampling is performed in the latent feature space with a second sampling probability to obtain a sampling result, where the sum of the first sampling probability and the second sampling probability is 1.
[0079] Specifically, in order to avoid missing some unique and excellent architectures, random sampling is also performed on the entire latent feature space, that is, sampling is performed on the first interval and the entire latent feature space respectively to obtain sampling results.
[0080] The sampling formula is as follows:
[0081]
[0082] Among them, R s represents the latent features of the sample, whole space represents the entire latent feature space, z i represents the latent features of the i-th dimension, I k represents the set of TOP k (k with the highest accuracy) architectures, and σ represents the value of the region range.
[0083] Among them, k points with the highest accuracy (such as 3 or 5, etc.) are first selected, and the spatial range of the left and right values σ is used as the first interval.
[0084] For example, the values of the three highest accuracy architectures of the latent feature i dimension are 0.3, 0.4, and 0.35 respectively, and σ is ±0.02, then the range of 0.3±0.02 can be selected as the first interval.
[0085] Specifically, ε e Sampling is performed in the first interval, with a value of 1-ε e Sampling is performed as a whole in the latent feature space.
[0086] Step S104: decoding the latent features in the sampling result to obtain at least two second architectures;
[0087] The latent features obtained by sampling are decoded to obtain the second architecture.
[0088] Since each latent feature obtained by sampling includes a number of dimensions (such as i), correspondingly, the decoding is to decode the latent features including the several dimensions to obtain the second architecture.
[0089] Among them, the sampling result is to sample the latent features with high precision. Therefore, the accuracy of the second architecture obtained by decoding the latent features with high precision is also high.
[0090] Step S105: selecting an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0091] A specific architecture is selected as the target architecture from the at least two second architectures with higher accuracy.
[0092] Specifically, the predetermined condition may be the highest accuracy / best performance, that is, in the present application, the architecture with the highest accuracy is selected as the target architecture, or the optimal architecture.
[0093] Specifically, the second architecture is encoded and decoded to obtain its accuracy, and the accuracy is sorted from high to low, and the architecture with the highest accuracy is determined as the target architecture.
[0094] In summary, the present embodiment provides a neural network architecture selection method, including: obtaining a first architecture in an architecture pool, wherein the architecture pool includes at least two first architectures; establishing a latent feature space based on the at least two first architectures; sampling in a first interval of the latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature precision in the first interval of the latent feature space is higher than the latent feature precision outside the first interval of the latent feature space; decoding the latent features in the sampling result to obtain at least two second architectures; and selecting an architecture that meets the predetermined conditions from the at least two second architectures as a target structure. In this solution, a latent feature space is established based on the architecture in the architecture pool, and sampling is performed in a first area with high precision in the latent feature space to obtain sampling results, and the latent features in the sampling results are decoded to obtain a new architecture, and the architecture with the highest precision is selected from them as the target structure, and the latent features in the first interval with high precision in the latent feature space are sampled, and a new architecture with higher precision is obtained based on the latent feature decoding, so as to realize the selection of the target structure based on precision, and the processing process is faster than that in the prior art, in which the target structure can only be found by randomly selecting from a large number of architectures in the candidate architecture.
[0095] like Figure 3 The figure is a flowchart of Embodiment 2 of a neural network architecture selection method provided by the present application. The method is applied to an electronic device and includes the following steps:
[0096] Step S301: obtaining the first architecture in the architecture pool;
[0097] Among them, step S301 is consistent with step S101 in embodiment 1, and is not described in detail in this embodiment.
[0098] Step S302: training preset parameters of the controller according to the at least two first architectures to obtain a controller that meets preset training requirements;
[0099] In this embodiment, the preset parameters (such as defined as θ) of the controller are trained to achieve encoding and decoding and performance prediction of the training controller.
[0100] Among them, the controller includes the following components: an encoder, a decoder and a predictor. The encoder specifically maps the architecture to a high-level continuous latent feature space through encoding. The high-level continuous latent feature space contains semantic information and can establish the relationship between high-level latent features and performance. The decoder is used to decode the latent features of the latent feature space to obtain the corresponding architecture, and the predictor predicts the accuracy of the latent features and analyzes the latent features that may produce high-precision architectures, thereby determining the distribution of the first interval in the latent feature space.
[0101] Therefore, the controller performs training of preset parameters so that it can more accurately predict the distribution area of the first interval, so that the second architecture obtained through subsequent sampling and decoding has higher accuracy and higher stability.
[0102] Step S303: encoding the at least two first architectures based on the trained controller to obtain latent features;
[0103] After training, the controller encodes the first architecture of the input to obtain the corresponding latent features.
[0104] It should be noted that the latent features obtained by encoding a first architecture include several dimensions. The specific dimension settings can be set according to actual conditions. This application does not limit the number and specific content of the dimensions.
[0105] Step S304: establishing a latent feature space based on the latent features;
[0106] Specifically, a latent feature space is established based on the multi-dimensional latent features, and the latent feature space contains information of several dimensions.
[0107] Step S305: sampling in the first interval of the latent feature space to obtain a sampling result;
[0108] Step S306: decoding the latent features in the sampling result to obtain at least two second architectures;
[0109] Step S307: selecting an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0110] Among them, steps S305-307 are consistent with steps S103-105 in Example 1 and are not described in detail in this embodiment.
[0111] In summary, in a neural network architecture selection method provided in this embodiment, the latent feature space is established based on the at least two first architectures, including: training the preset parameters of the controller based on the at least two first architectures to obtain a controller that meets the preset training requirements; encoding the at least two first architectures based on the trained controller to obtain latent features; and establishing a latent feature space based on the latent features. In this solution, the preset parameters of the controller are trained so that the first architecture is encoded based on the trained controller to obtain latent features, and the latent feature space is established based on the latent features. The controller is trained with preset parameters, so that it can more accurately predict the distribution area of the first interval, so that the second architecture obtained through subsequent sampling and decoding has higher accuracy and higher stability.
[0112] like Figure 4 The flowchart shown is a third embodiment of a neural network architecture selection method provided by the present application. The method is applied to an electronic device and includes the following steps:
[0113] Step S401: obtaining the first architecture in the architecture pool;
[0114] Step S402: training preset parameters of the controller according to the at least two first architectures to obtain a controller that meets preset training requirements;
[0115] Step S403: encoding the at least two first architectures based on the trained controller to obtain latent features;
[0116] Step S404: establishing a latent feature space based on the latent features;
[0117] Step S405: sampling in the first interval of the latent feature space to obtain a sampling result;
[0118] Among them, steps S401-405 are consistent with steps S301-305 in Example 2, and are not described in detail in this embodiment.
[0119] Step S406: Optimizing based on the sampling result, the latent feature accuracy after optimization is higher than the latent feature accuracy before optimization;
[0120] Among them, optimization processing is performed based on the sampling results, that is, optimization processing is performed on the latent features of the sampling.
[0121] It should be noted that, when the controller is trained in step S402, the predictor training can make the prediction accuracy of the predictor higher in the process of optimizing the latent features.
[0122] In this step, the process of optimizing the sampling results is implemented by the predictor.
[0123] Among them, a gradient optimization method, such as a gradient ascent method, can be used to optimize the direction of the latent feature network with high accuracy in the sampling results.
[0124] Step S407: decoding the latent features in the sampling result to obtain at least two second architectures;
[0125] Step S408: Selecting an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0126] Among them, steps S407-408 are consistent with steps S306-307 in Example 2, and are not described in detail in this embodiment.
[0127] In summary, the neural network architecture selection method provided in this embodiment also includes: optimizing based on the sampling results, and the latent features after optimization have a higher accuracy than the latent features before optimization. In this solution, the sampled latent features are optimized to obtain higher accuracy latent features, so that the accuracy of the second architecture obtained by subsequent decoding is higher, and the accuracy of the target architecture finally selected is higher.
[0128] like Figure 5 The figure is a flowchart of a neural network architecture selection method embodiment 4 provided by the present application. The method is applied to an electronic device and includes the following steps:
[0129] Step S501: obtaining the first architecture in the architecture pool;
[0130] Among them, step S501 is consistent with step S301 in embodiment 2, and is not described in detail in this embodiment.
[0131] Step S502: evaluating the at least two first architectures based on the controller to generate a correspondence relationship between at least two architectures and precision;
[0132] The process of evaluating the first architecture by the controller is that the controller encodes and decodes the first architecture, compares the output result with the input architecture, and obtains the corresponding relationship between the corresponding architecture and the accuracy.
[0133] Specifically, in this step, each first architecture is evaluated to obtain a corresponding relationship between each first architecture and its accuracy.
[0134] Step S503: Based on the correspondence between the at least two architectures and the precision, the preset parameters of the controller are trained to obtain a controller that meets the preset training requirements;
[0135] Specifically, the controller includes three components: an encoder, a decoder and a predictor, wherein the encoder is used to encode (evaluate) the input architecture, the decoder is used to decode the latent features to obtain the architecture, and the predictor is used to predict the accuracy corresponding to the architecture of the input controller.
[0136] Among them, the architecture is input to the encoder to implement the evaluation and obtain the correspondence between the architecture and the accuracy. The predictor predicts the accuracy corresponding to the architecture. The predicted accuracy and the evaluated accuracy are processed by the loss function of the square difference to obtain the loss function result. Based on the loss function result, the preset parameter θ of the predictor is updated by gradient backpropagation.
[0137] Moreover, in the process from architecture input to encoding to decoding, the decoded architecture is subjected to the cross entropy loss function (loss) processing with the initially input architecture to obtain the loss function result, and the preset parameters θ of the encoder and decoder are updated based on the loss function result by gradient backpropagation.
[0138] Step S504: encoding the at least two first architectures based on the trained controller to obtain latent features;
[0139] Among them, step S504 is consistent with step S303 in embodiment 2, and is not described in detail in this embodiment.
[0140] Step S505: establishing a latent feature space based on the latent features;
[0141] Specifically, step S505 includes:
[0142] Step S5051: based on the correspondence between at least two architectures and precision, obtaining the precision corresponding to the latent feature of any first architecture, and obtaining the correspondence between the precision and the latent feature;
[0143] Specifically, the latent features of the first architecture include several dimensions, and the corresponding accuracy is determined for each dimension of the latent features.
[0144] Step S5052: establishing a latent feature space based on the correspondence between the precision and the latent feature, wherein the latent feature space includes a first interval and a second interval, and the precision of the latent feature in the first interval is higher than the precision of the latent feature in the second interval.
[0145] Among them, according to the corresponding relationship between each latent feature and its accuracy, a two-dimensional graph of the latent feature distribution of the corresponding latent feature is established according to the dimension of each latent feature, and several two-dimensional graphs constitute the latent feature space.
[0146] Among them, the two-dimensional graph corresponding to the latent features and their precision in each dimension includes a first interval and a second interval, wherein the latent feature precision of the first interval is high, and the latent feature precision of the second interval is low.
[0147] When sampling is performed in the subsequent step S506, high-precision latent feature samples of the corresponding dimension are collected in the two-dimensional graph of each latent feature dimension. Therefore, the sampling results of the several dimensions are finally combined to obtain latent features containing the several dimensions.
[0148] Step S506: sampling in the first interval of the latent feature space to obtain a sampling result;
[0149] Step S507: decoding the latent features in the sampling result to obtain at least two second architectures;
[0150] Step S508: Selecting an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0151] Among them, steps S506-508 are consistent with steps S305-307 in Example 2, and are not repeated in this embodiment.
[0152] In a specific implementation, in order to improve the accuracy of the selection and prevent missed selection, the accuracy of the second architecture and the first architecture can be sorted, and the architecture with the highest accuracy can be determined as the target architecture.
[0153] Since the accuracy of the first architecture is known during the training of the controller, in a specific implementation, the accuracy of the first architecture can be directly obtained, the accuracy of the second architecture can be evaluated to obtain the accuracy, and then the accuracies of the first architecture and the second architecture can be sorted to obtain the target structure.
[0154] In summary, in a neural network architecture selection method provided in this embodiment, the latent feature space is established based on the latent feature, including: based on the correspondence between at least two architectures and precision, obtaining the precision corresponding to the latent feature of any first architecture, and obtaining the correspondence between precision and latent feature; based on the correspondence between precision and latent feature, the latent feature space is established, and the latent feature space includes a first interval and a second interval, and the precision of the latent feature in the first interval is higher than the precision of the latent feature in the second interval. In this scheme, the latent feature space is established based on the correspondence between the first architecture and its precision, and the latent feature space contains the precision distribution of multiple dimensions of the latent feature. Then, each dimension of the latent feature space involves a latent feature dimension with high precision. Subsequently, the latent features with high precision can be sampled from each dimension, and the latent features with high precision in each dimension are combined to obtain the latent features in the sampling result. The latent features are latent features with high precision in each dimension. Therefore, the precision of the second architecture obtained by decoding is high, and the accuracy of the target architecture finally selected is high.
[0155] like Figure 6The flowchart shown is a neural network architecture selection method embodiment 5 provided by the present application, and the method comprises the following steps:
[0156] Step S601: Obtain the first architecture in the architecture pool;
[0157] Step S602: evaluating the at least two first architectures based on the controller to generate a correspondence relationship between at least two architectures and precision;
[0158] Step S603: Based on the correspondence between the at least two architectures and the precision, the preset parameters of the controller are trained to obtain a controller that meets the preset training requirements;
[0159] Step S604: encoding the at least two first architectures based on the trained controller to obtain latent features;
[0160] Step S605: establishing a latent feature space based on the latent features;
[0161] Step S606: sampling in the first interval of the latent feature space to obtain a sampling result;
[0162] Step S607: decoding the latent features in the sampling result to obtain at least two second architectures;
[0163] Among them, steps S601-607 are consistent with steps S501-507 in Example 4 and are not described in detail in this embodiment.
[0164] Step S608: Determine whether the number of times the latent feature is decoded meets the preset number, and obtain a determination result;
[0165] Based on the judgment result indicating that the number of times the latent feature is decoded meets the preset number, executing step 610;
[0166] Step S609: based on the judgment result indicating that the number of times the latent feature is decoded does not meet the preset number, the at least two second architectures are put into the architecture pool as the first architecture; and step S601 is executed in a loop.
[0167] In order to improve the accuracy of the final target architecture, the above training and sampling process can be performed multiple times, and the number of executions can be preset, such as 3 times, 5 times, etc.
[0168] Among them, after the second architecture is obtained by decoding, the number of decodings is recorded, and when it is judged that the number of decodings meets the preset number, it indicates that sufficient training sampling has been performed and the accuracy of the second architecture obtained is high enough, then the target architecture is selected from the second architecture, and step S610 is executed; when the number of decodings does not meet the preset number, it indicates that insufficient training sampling has been performed and the accuracy of the second architecture obtained may not be high enough, then the second architecture is put into the architecture pool as the first architecture, and steps S601-607 are repeated.
[0169] In a specific implementation, the optimization step before decoding in Embodiment 4 may also be used as the content of the loop.
[0170] Step S610: Selecting an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0171] Among them, step S610 is consistent with step S508 in embodiment 4 and is not described in detail in this embodiment.
[0172] In summary, the neural network architecture selection method provided by this embodiment also includes: judging whether the number of times the latent features are decoded meets the preset number of times, and obtaining a judgment result; based on the judgment result indicating that the number of times the latent features are decoded meets the preset number of times, executing the step of selecting an architecture that meets the predetermined conditions from the at least two second architectures as the target architecture; based on the judgment result indicating that the number of times the latent features are decoded does not meet the preset number of times, placing the at least two second architectures as the first architecture into the architecture pool; and cyclically executing the subsequent step of obtaining the first architecture in the architecture pool. In this solution, through the process of training the controller and sampling in multiple cycles, after sufficient training and sampling, the second architecture obtained has high accuracy, and the target architecture selected from the second architecture has high accuracy.
[0173] Corresponding to the above-mentioned embodiment of a neural network architecture selection method provided by the present application, the present application also provides an application scenario for applying the neural network architecture selection method.
[0174] like Figure 7 Shown is a schematic diagram of a processing flow of a controller, the controller including an encoder, a decoder and a predictor;
[0175] The input of the encoder includes the architecture in the architecture pool (including the original architecture and the sampled architecture). The encoder encodes the input architecture to obtain the latent feature (also called potential representation) Z, and performs first interval sampling in the latent feature space to obtain the sampling result. The sampling result is optimized by the predictor using the gradient ascent method for prediction accuracy, and then decoded by the decoder to obtain the optimized architecture. The optimized architecture has higher accuracy than the input architecture.
[0176] Corresponding to the above-mentioned neural network architecture selection method embodiment provided by the present application, the present application also provides an apparatus embodiment for applying the neural network architecture selection method.
[0177] like Figure 8 , which is a schematic diagram of a structure of an embodiment of a neural network architecture selection device provided by the present application, the device includes the following components: an acquisition module 801, an establishment module 802, a sampling module 803, a processing module 804 and a selection module 805;
[0178] An acquisition module 801 is used to acquire a first architecture in an architecture pool, where the architecture pool includes at least two first architectures;
[0179] An establishing module 802, configured to establish a latent feature space according to the at least two first frameworks;
[0180] A sampling module 803 is used to perform sampling in a first interval of the latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space;
[0181] A processing module 804 is used to decode the latent features in the sampling result to obtain at least two second architectures;
[0182] The selection module 805 is configured to select an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
[0183] Optionally, the sampling module is specifically used to:
[0184] Sampling is performed in the first interval with a first sampling probability, and sampling is performed in the latent feature space with a second sampling probability to obtain a sampling result, where the sum of the first sampling probability and the second sampling probability is 1.
[0185] Optionally, the establishing module includes:
[0186] Training preset parameters of the controller according to the at least two first architectures to obtain a controller that meets preset training requirements;
[0187] Encoding the at least two first architectures based on the trained controller to obtain latent features;
[0188] A latent feature space is established based on the latent features.
[0189] Optionally, also include:
[0190] The optimization module is used to perform optimization based on the sampling result, and the latent feature accuracy after optimization is higher than the latent feature accuracy before optimization.
[0191] Optionally, the establishing module is specifically used for:
[0192] Based on the controller evaluating the at least two first architectures, generating a correspondence between at least two architectures and precision;
[0193] Based on the correspondence between the at least two architectures and the precision, the preset parameters of the controller are trained to obtain a controller that meets the preset training requirements.
[0194] Optionally, the establishing module is specifically used for:
[0195] Based on the correspondence between at least two architectures and precision, obtaining the precision corresponding to the latent feature of any first architecture, and obtaining the correspondence between the precision and the latent feature;
[0196] A latent feature space is established based on the correspondence between the precision and the latent feature, wherein the latent feature space includes a first interval and a second interval, and the precision of the latent feature in the first interval is higher than the precision of the latent feature in the second interval.
[0197] Optionally, also include:
[0198] A judgment module is used to judge whether the number of times of decoding the latent feature meets the preset number and obtain a judgment result;
[0199] The selection module is triggered based on the judgment result indicating that the number of times the latent feature is decoded meets the preset number;
[0200] Based on the judgment result indicating that the number of times the latent feature is decoded does not meet the preset number, the at least two second architectures are put into the architecture pool as the first architecture; and the acquisition module is triggered.
[0201] In summary, the present embodiment provides a neural network architecture selection device, comprising: an acquisition module, used to acquire a first architecture in an architecture pool, wherein the architecture pool includes at least two first architectures; an establishment module, used to establish a latent feature space based on the at least two first architectures; a sampling module, used to sample in a first interval of the latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space; a processing module, used to decode the latent features in the sampling result to obtain at least two second architectures; and a selection module, used to select an architecture that meets predetermined conditions from the at least two second architectures as a target architecture. In this solution, a latent feature space is established based on the architecture in the architecture pool, and sampling is performed in the first area with high precision in the latent feature space to obtain sampling results. The latent features in the sampling results are decoded to obtain a new architecture, and the architecture with the highest accuracy is selected as the target structure. By sampling the latent features in the first interval with high precision in the latent feature space, and obtaining a new architecture with higher accuracy based on the latent feature decoding, the target structure can be selected based on accuracy. Compared with the prior art in which the target structure can only be found by randomly selecting from a large number of architectures among the candidate architectures, the processing process is faster.
[0202] Corresponding to the above-mentioned neural network architecture selection method embodiment provided by the present application, the present application also provides an electronic device embodiment applying the neural network architecture selection method.
[0203] like Fig. 9 The figure is a schematic diagram of the structure of an electronic device embodiment provided by the present application, and the electronic device includes the following structures: a memory 901 and a processor 902;
[0204] Wherein, the memory stores a processing program;
[0205] The processor is used to load and execute the processing program stored in the memory to implement each step of the neural network architecture selection method as described in any one of the above items.
[0206] Specifically, the memory may be ROM (read-only memory), RAM (random read-write memory), Flash Memory (flash memory), etc. The present application does not limit the specific structure of the memory.
[0207] Specifically, the processor may be a component with information processing capability, such as a CPU (central processing unit) or an EC (Embedded Controller).
[0208] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device provided in the embodiment, since it corresponds to the method provided in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0209] The above description of the embodiments provided enables professionals and technicians in the field to implement or use the present application. Various modifications to these embodiments will be apparent to professionals and technicians in the field, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features provided herein.
Claims
1. A method for selecting a neural network architecture for image classification and detection, speech recognition, or natural language processing. include: Obtain a first architecture in an architecture pool, wherein the architecture pool includes at least two first architectures; Establishing a latent feature space based on the at least two first frameworks; Sampling is performed in a first interval of the latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space; Decoding the latent features in the sampling result to obtain at least two second architectures; An architecture that meets a predetermined condition is selected from the at least two second architectures as a target architecture.
2. According to the method of claim 1, sampling is performed in the first interval of the latent feature space to obtain a sampling result, include: Sampling is performed in the first interval with a first sampling probability, and sampling is performed in the latent feature space with a second sampling probability to obtain a sampling result, where the sum of the first sampling probability and the second sampling probability is 1.
3. The method according to claim 1, wherein the latent feature space is established based on the at least two first frameworks. include: Training preset parameters of the controller according to the at least two first architectures to obtain a controller that meets preset training requirements; Encoding the at least two first architectures based on the trained controller to obtain latent features; A latent feature space is established based on the latent features.
4. The method according to claim 3, before decoding the latent features in the sampling result to obtain at least two second architectures, further comprising: include: Optimization is performed based on the sampling result, and the latent feature accuracy after optimization is higher than the latent feature accuracy before optimization.
5. The method according to claim 3, wherein the preset parameters of the controller are trained according to the at least two first architectures to obtain a controller that meets the preset training requirements, include: Based on the controller evaluating the at least two first architectures, generating a correspondence between at least two architectures and precision; Based on the correspondence between the at least two architectures and the precision, the preset parameters of the controller are trained to obtain a controller that meets the preset training requirements.
6. The method according to claim 5, wherein the latent feature space is established based on the latent feature. include: Based on the correspondence between at least two architectures and precision, obtaining the precision corresponding to the latent feature of any first architecture, and obtaining the correspondence between the precision and the latent feature; A latent feature space is established based on the correspondence between the precision and the latent feature, wherein the latent feature space includes a first interval and a second interval, and the precision of the latent feature in the first interval is higher than the precision of the latent feature in the second interval.
7. The method according to claim 5, further comprising: decoding the latent features in the sampling result to obtain at least two second architectures; include: Determine whether the number of times the latent feature is decoded meets the preset number, and obtain a determination result; Based on the judgment result indicating that the number of times the latent feature is decoded meets the preset number, the step of selecting an architecture that meets the predetermined condition from the at least two second architectures as the target architecture is performed; Based on the judgment result indicating that the number of times the latent feature is decoded does not meet the preset number, the at least two second architectures are put into the architecture pool as the first architecture; The subsequent step of acquiring the first architecture in the architecture pool is executed in a loop.
8. A neural network architecture selection device, used in image classification and detection, speech recognition or natural language processing, include: An acquisition module, configured to acquire a first architecture from an architecture pool, wherein the architecture pool includes at least two first architectures; A building module, used for building a latent feature space according to the at least two first frameworks; A sampling module, configured to perform sampling in a first interval of a latent feature space to obtain a sampling result, wherein the sampling result includes at least two latent features, and the latent feature accuracy in the first interval of the latent feature space is higher than the latent feature accuracy outside the first interval of the latent feature space; A processing module, configured to decode latent features in the sampling result to obtain at least two second architectures; The selection module is used to select an architecture that meets a predetermined condition from the at least two second architectures as a target architecture.
9. The device according to claim 8, wherein the sampling module is specifically used for: Sampling is performed in the first interval with a first sampling probability, and sampling is performed in the latent feature space with a second sampling probability to obtain a sampling result, where the sum of the first sampling probability and the second sampling probability is 1.
10. An electronic device, include: Memory, processor; Wherein, the memory stores a processing program; The processor is used to load and execute the processing program stored in the memory to implement each step of the neural network architecture selection method described in any one of 1-7 above.
