Neural Network Architecture Search Method, Apparatus, Device, and Storage Medium

By sampling hyperparameters and adjusting the model structure of deep learning codecs, the target model is trained and searched, solving the problem of large computational scale and storage space consumption of deep learning codecs and achieving efficient model deployment.

CN115272825BActive Publication Date: 2026-05-26BEIJING SENSETIME TECH DEV CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING SENSETIME TECH DEV CO LTD
Filing Date
2022-07-29
Publication Date
2026-05-26

Smart Images

  • Figure CN115272825B_ABST
    Figure CN115272825B_ABST
Patent Text Reader

Abstract

Embodiments of this application disclose a neural network structure search method, device, equipment, and storage medium. Among them, the method includes: sampling hyperparameters of a preset network model to obtain at least two sets of sample hyperparameters; generating network parameters of the preset network model based on each set of sample hyperparameters in the at least two sets of sample hyperparameters and preset candidate parameters; adjusting the model structure of the preset network model based on each set of sample hyperparameters to obtain a to-be-searched model corresponding to each set of sample hyperparameters; training the to-be-searched model based on preset optimization conditions, training data, and the network parameters to obtain a trained to-be-searched model corresponding to each set of sample hyperparameters; performing structure search on at least two trained to-be-searched models corresponding to the at least two sets of sample hyperparameters according to a preset metric to obtain a target model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of computer vision technology, and in particular to a method, apparatus, device, and storage medium for searching neural network structures. Background Technology

[0002] Deep learning-based image semantic codecs can effectively eliminate redundant semantic information in images, achieving significant advantages in image quality and bitrate compared to traditional codecs in specific scenarios. However, among related technologies, deep learning codecs consume a large amount of computational and storage space, which limits their application. Summary of the Invention

[0003] In view of this, embodiments of this application provide at least one method, apparatus, device, and storage medium for searching neural network structures.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] On one hand, embodiments of this application provide a neural network structure search method, the method comprising:

[0006] The hyperparameters of the preset network model are sampled to obtain at least two sets of sample hyperparameters;

[0007] Based on each of the at least two sets of sample hyperparameters and the preset candidate parameters, the network parameters of the preset network model are generated.

[0008] Based on the hyperparameters of each set of samples, the model structure of the preset network model is adjusted to obtain the search model corresponding to each set of sample hyperparameters.

[0009] Based on preset optimization conditions, training data, and the network parameters, the model to be searched is trained to obtain the trained model to be searched corresponding to each set of sample hyperparameters.

[0010] According to preset indicators, perform structure search on at least two trained models to be searched corresponding to the hyperparameters of at least two sets of samples to obtain the target model.

[0011] On the other hand, embodiments of this application provide a neural network structure search device, the device comprising:

[0012] The first sampling module is used to sample the hyperparameters of the preset network model to obtain at least two sets of sample hyperparameters.

[0013] The first generation module is used to generate network parameters of the preset network model based on each of the at least two sets of sample hyperparameters and preset candidate parameters;

[0014] The first adjustment module is used to adjust the model structure of the preset network model based on the hyperparameters of each set of samples, so as to obtain the search model corresponding to the hyperparameters of each set of samples.

[0015] The first training module is used to train the model to be searched based on preset optimization conditions, training data and the network parameters, so as to obtain the trained model to be searched corresponding to each set of sample hyperparameters.

[0016] The first search module is used to perform a structure search on at least two trained models corresponding to the hyperparameters of the at least two sets of samples according to preset indicators, so as to obtain the target model.

[0017] In another aspect, embodiments of this application provide a computer device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the program to implement some or all of the steps in the above-described method.

[0018] In another aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements some or all of the steps in the above-described method.

[0019] In another aspect, embodiments of this application provide a computer program including computer-readable code, wherein when the computer-readable code is run in a computer device, a processor in the computer device performs some or all of the steps for implementing the above-described method.

[0020] In another aspect, embodiments of this application provide a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method.

[0021] In this embodiment, firstly, multiple sets of hyperparameters are sampled to obtain multiple sets of sample hyperparameters, and preset candidate parameters are introduced. The network parameters of the model to be searched are generated by combining the sample hyperparameters, which can assist in the subsequent parameter training of the model to be searched. Then, in the preset network model, the structure of the preset network model is pruned using each set of sample hyperparameters to obtain the model to be searched corresponding to that set of sample hyperparameters, making the size of the obtained model to be searched smaller. Then, according to preset optimization conditions, the model to be searched is trained using the training parameters and the generated network parameters to obtain a trained model to be searched. After the model to be searched is trained, a structure search is performed on at least two trained models to be searched according to preset metrics, and the target model is deployed based on the searched models. In this way, by performing a structure search on multiple trained models to be searched according to preset metrics, the obtained target model is applicable to noise-sensitive networks, and the deployed target model can be obtained without retraining, improving the deployment efficiency of the network model with lower computational cost.

[0022] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure. Attached Figure Description

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0024] Figure 1 A schematic diagram illustrating the implementation process of a neural network structure search method provided in this application embodiment;

[0025] Figure 2 This is a schematic diagram illustrating another implementation flow of a neural network structure search method provided in an embodiment of this application;

[0026] Figure 3 This is a schematic diagram illustrating another implementation process of a neural network structure search method provided in an embodiment of this application;

[0027] Figure 4 A schematic diagram of the network architecture for implementing the neural network structure search method provided in this application embodiment;

[0028] Figure 5 A schematic diagram of another network architecture for the neural network structure search method provided in this application embodiment;

[0029] Figure 6 This is a schematic diagram of the composition structure of a neural network structure search provided in an embodiment of this application;

[0030] Figure 7This is a schematic diagram of the hardware entity of a computer device provided in an embodiment of this application. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0032] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. The terminology used herein is for descriptive purposes only and is not intended to be limiting of this application.

[0034] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0035] 1) Computer vision refers to machine vision that uses cameras and computers to replace human eyes to identify, track and measure targets, and further performs graphic processing to make the computer-processed images more suitable for human observation or transmission to instruments for detection.

[0036] 2) The Multi-Layer Perceptron (MLP) is the fundamental algorithm of Deep Neural Networks (DNN), so it can be said that DNN refers to the Multi-Layer Perceptron; the role of the Multi-Layer Perceptron is to approximate the target function.

[0037] To better understand the neural network structure search method provided in the embodiments of this application, the neural network structure search schemes used in related technologies will be described below.

[0038] Among related technologies, deep learning-based image semantic codecs can effectively eliminate redundant semantic information in images; compared with encoders and decoders in related technologies, they can achieve significant advantages in image quality and bitrate in specific scenarios. However, compared with encoding and decoding models in related technologies, deep learning codecs consume more computational and storage space, requiring effective methods to reduce model size to improve usability in practical deployments.

[0039] Neural Architecture Search (NAS) is a crucial technique for improving the deployment performance of neural network models. It has wide applications in computer vision and machine learning, primarily addressing the problem of finding an optimal set of hyperparameters within a neural network to achieve optimal deployment efficiency and performance under constraints. NAS methods mainly include multi-round training search methods based on reinforcement learning and one-shot NAS search methods based on constructing differentiable networks and parameter-sharing networks. Reinforcement learning-based methods suffer from excessive computational cost during the search process, lacking significant cost advantages for model search in specific scenarios. One-shot NAS significantly reduces the computational cost of architecture search by constructing hypernets, making the computational cost of the search process similar to that of training the corresponding deep model individually. However, because the process of extracting semantic information by the deep learning encoder-decoder model is significantly disturbed during hypernet training, this method suffers performance degradation when applied to encoder-decoder models.

[0040] Based on this, embodiments of this application provide a neural network architecture search method, which can be executed by a processor of a computer device. The computer device refers to a device with data processing capabilities, such as a server, laptop, tablet, desktop computer, smart TV, set-top box, or mobile device (e.g., mobile phone, portable video player, personal digital assistant, dedicated messaging device, portable gaming device). Figure 1 This is a schematic diagram illustrating the implementation process of a neural network structure search method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method includes the following steps S101 to S104:

[0041] Step S101: Sample the hyperparameters of the preset network model to obtain at least two sets of sample hyperparameters.

[0042] In some embodiments, the preset network model is a custom network model whose structure and network parameters can vary within the framework of neural network architecture search. The preset network model can belong to any type of neural network. The preset network model can be obtained by any combination of modules from any type of neural network. In some possible implementations, the preset network model can be customized according to the type of network model to be defined within the framework of neural network architecture search. For example, the preset network model can be a custom deep learning image semantic encoding / decoding model, obtained by combining multiple modules included in the encoding / decoding model. Alternatively, the preset network model can be a custom convolutional neural network, obtained by combining the modules of the convolutional neural network.

[0043] In some embodiments, the hyperparameters of the preset network model are related to the type of the preset network model and may be one or more of the following hyperparameters: learning rate, regularization parameter, number of layers in the neural network, number of neurons in each hidden layer, number of training epochs, size of mini-batch data, encoding method of output neurons, choice of cost function, method of weight initialization, type of neuron activation function, scale of data used to train the model, etc. For example, taking a convolutional neural network as an example, the hyperparameters of a convolutional neural network include: number of layers in the network, size of convolutional kernels in the convolutional layers, number of channels in the convolutional layers, etc. Taking a deep learning image semantic encoding and decoding model as an example, the hyperparameters of a deep learning image semantic encoding and decoding model include: number of convolutional kernel channels, convolutional kernel size, number of convolutional kernels, activation function type, different loss function hyperparameters, etc.

[0044] In some possible implementations, within the range of hyperparameters of a preset network model, multiple sets of sample hyperparameters can be obtained by sampling the hyperparameters of the preset network model according to a set sampling combination. This sampling combination can be set based on the search space of the preset network model's hyperparameters; for example, according to the boundary values ​​of the search space, the sampling combination can include a maximum value, a minimum value, and a random value. Thus, when sampling according to this sampling combination, each set of sample hyperparameters conforms to that sampling combination.

[0045] Step S102: Based on each of the at least two sets of sample hyperparameters and the preset candidate parameters, generate the network parameters of the preset network model.

[0046] In some embodiments, for each set of sample hyperparameters, training is performed once using that set of sample hyperparameters. Feature extraction is performed on each set of sample hyperparameters, and the extracted features are multiplied by preset candidate parameters. The result of this inner product is used as the generated network parameters. Thus, a set of sample hyperparameters and preset candidate parameters generate the network parameters of the preset network model corresponding to that set of sample hyperparameters. Different families of sample hyperparameters generate different network parameters; therefore, at least two sets of network parameters can be generated using at least two sets of sample hyperparameters and preset candidate parameters. The preset candidate parameters can be multiple predefined network parameters, and can be set based on the range of hyperparameters in the preset network model. The preset candidate parameters can be parameters of multiple preset network sub-models, and their initialization method can be set to be consistent with the initialization method of the preset network model. Furthermore, the size of the preset candidate parameters is not less than the maximum possible size of the network parameters. For example, the values ​​of some preset candidate parameters can be set to be greater than or equal to the maximum value of the hyperparameters in the preset network model, so that the values ​​of the preset candidate parameters can cover the values ​​of the hyperparameters in the preset network model.

[0047] The preset network parameters of the network model include the weights of the convolutional kernels and the coefficients of the normalization layers. These network parameters can be used in the subsequent training process of the model to be searched, thus assisting in the training of the model to be searched.

[0048] Step S103: Based on the hyperparameters of each set of samples, adjust the model structure of the preset network model to obtain the search model corresponding to each set of sample hyperparameters.

[0049] In some embodiments, by analyzing a set of sample hyperparameters and according to the specifications of the model structure provided by the sample hyperparameters (i.e., the values ​​representing each model structure in the sample hyperparameters, such as kernel size, number of input and output channels, etc.), the model structure of the preset network model is pruned to obtain a sub-model. This sub-model is the search model corresponding to each set of sample hyperparameters. In this way, at least two sets of sample hyperparameters correspond to at least two search models.

[0050] In some possible implementations, a pre-defined network model is used as the encoding / decoding model. Within this model, the parameters of the convolutional kernels are pruned based on the kernel size and the number of input / output channels from a set of sample hyperparameters. Similarly, for the normalization layer, the normalization coefficients are pruned based on the number of input channels, resulting in a pruned pre-defined network model, i.e., the model to be searched. Thus, by pruning the pre-defined network model using multiple sets of sample hyperparameters, multiple different models to be searched can be obtained. Therefore, by pruning the model structure of the pre-defined network model using a set of sample hyperparameters, a model to be searched that is equivalent to the unstructured search framework can be obtained.

[0051] Step S104: Based on preset optimization conditions, training data, and the network parameters, train the model to be searched to obtain the trained model to be searched corresponding to each set of sample hyperparameters.

[0052] In some embodiments, during a single training process, the model to be searched is trained once based on the preset optimization conditions, the network parameters, and the training data, thereby obtaining a trained model to be searched. The preset optimization conditions can be a set model optimization function used for training the model; that is, the model to be searched is trained once with the goal of minimizing this optimization function. The training data can be selected based on the type of the preset network model and the requirements of the model to be searched. Thus, different types of preset network models or different requirements of the model to be searched will result in different training data. For example, if the type of the preset network model is a convolutional neural network and the requirement of the model to be searched is to achieve object detection, then the selected training data is sample images of the region where the labeled sample objects are located; if the type of the preset network model is a convolutional neural network and the requirement of the model to be searched is face recognition, then the selected training data is sample face images labeled with facial identity information. In the next training process, steps S102 to S104 are repeated, that is, the network parameters under the next set of sample hyperparameters are generated using the next set of sample hyperparameters and the preset candidate parameters; then, the model structure of the preset network model is adjusted using the next set of sample hyperparameters to obtain another model to be searched; finally, the next model to be searched is trained according to the network parameters under the next set of sample hyperparameters, the next set of sample hyperparameters, and the training data to obtain the next trained model to be searched that meets the preset optimization conditions; in this way, multiple trained models to be searched can be trained using multiple sets of sample hyperparameters.

[0053] In some possible implementations, if the optimization function is to calculate a local minimum of the model loss, then firstly, the network parameters are assigned to the model to be searched, and the loss of the assigned network parameters is determined using training data; secondly, the gradient of the optimization function in this loss is determined; finally, with the objective of determining a local minimum of the model loss, the model to be searched is trained once using this gradient. In this way, the trained model to be searched can satisfy the optimization function, that is, satisfy the preset optimization conditions.

[0054] Step S105: According to preset indicators, perform structure search on at least two trained models to be searched corresponding to the hyperparameters of the at least two sets of samples to obtain the target model.

[0055] In some embodiments, the preset metrics represent the requirements for deploying the target model. These can be performance requirements, such as model compression rate and distortion rate; or performance requirements of the device running the model, such as device storage capacity and computational load. Performing a structure search on at least two trained models according to the preset metrics can be understood as searching for the optimal trained model among multiple trained models according to the preset metrics. Then, the network parameters are generated using the hyperparameters of the optimal trained model; assigning these network parameters to the optimal trained model yields the target model.

[0056] In this embodiment, firstly, multiple sets of hyperparameters are sampled to obtain multiple sets of sample hyperparameters, and preset candidate parameters are introduced. These sample hyperparameters are then combined to generate network parameters for the model to be searched, which assists in the subsequent parameter training of the model to be searched. Next, within the preset network model, the structure of the preset network model is pruned using a set of sample hyperparameters to obtain the model to be searched corresponding to that set of sample hyperparameters, resulting in a smaller model to be searched. Then, according to preset optimization conditions, the model to be searched is trained using training parameters and the generated network parameters to obtain a trained model to be searched. After the model to be searched is trained, a structure search is performed on at least two trained models to be searched according to preset metrics, and the target model is deployed based on the searched models. Thus, by performing a structure search on multiple trained models to be searched according to preset metrics, the target model obtained is applicable to noise-sensitive networks, and the deployed target model can be obtained without retraining, improving the deployment efficiency of the network model with lower computational cost.

[0057] In this embodiment of the application, the neural network structure search method is technically related to the internal structure of a computer system. By performing structure search according to preset indicators related to the hardware within the computer system, a target model is obtained, which enables the target model to meet the storage requirements of the computer system and improve the hardware processing speed within the computer system, thereby achieving the technical effect of improving the internal performance of the computer system in accordance with natural laws.

[0058] In some embodiments, a parameter generation model is constructed to generate network parameters of a preset network model to assist in the subsequent training of the model to be searched. That is, step S102 above can be achieved through the following steps S121 and S122 (not shown in the figure):

[0059] Step S121: Determine the parameter generation model corresponding to this training.

[0060] In some embodiments, the parameter generation model includes either a trained parameter generation model or an untrained parameter generation model. If this is the first training iteration, the parameter generation model is an untrained parameter generation module; if this is not the first training iteration, the parameter generation model is a trained parameter generation module obtained from the previous training iteration. The parameter generation model is used to fuse a set of sample hyperparameters and preset candidate parameters to generate network parameters, thereby assisting in the training of the model to be searched.

[0061] Step S122: Input the hyperparameters of each set of samples and the preset candidate parameters into the parameter generation model corresponding to this training to generate the network parameters.

[0062] In some embodiments, during a training process, if this training is the first training, then for a set of sample hyperparameters, both the set of sample hyperparameters and the preset candidate parameters are used as input data and input into the untrained parameter generation model; in the untrained parameter generation model, features are extracted from the set of sample hyperparameters, and the extracted features are fused with the preset candidate parameters to obtain the network parameters.

[0063] If this training is not the first training, then for a set of sample hyperparameters, both the set of sample hyperparameters and the preset candidate parameters are used as input data and input into the parameter generation model obtained after the previous training. In the trained parameter generation model, features of the set of sample hyperparameters are extracted, and the extracted features are fused with the preset candidate parameters to obtain the network parameters.

[0064] In steps S121 and S122 above, the parameter generation model corresponding to this training is obtained, and a set of sample hyperparameters and preset candidate parameters are used as inputs to the parameter generation model to generate network parameters. In this way, by introducing a parameter generation model shared in multiple training sessions, network parameters can be generated, which can not only assist the subsequent training process, but also make the subsequent training process faster.

[0065] In some embodiments, a parameter generation model is used to extract features from a set of sample hyperparameters, and the extracted features are fused with preset candidate parameters to generate network parameters. That is, step S122 above can be achieved through the following steps:

[0066] The first step is to use the parameter generation model corresponding to this training to extract features from the hyperparameters of each group of samples to obtain parameter features.

[0067] Here, the parameter generation model corresponding to this training includes a feature extraction module, which extracts features from the input data. For example, this module can be implemented using an MLP (Multi-Level Processing), where an MLP is used to extract features from the set of sample hyperparameters. In some possible implementations, the input set of sample hyperparameters is first encoded to obtain a vector; then, this module extracts features from the vector to obtain the parameter features. This module can also be implemented using other deep learning models, such as a graph neural network (Graph Neural Network) model.

[0068] The second step is to fuse the parameter features and the preset candidate parameters to obtain the network parameters.

[0069] Here, the parameter generation model corresponding to this training also includes a fusion module. The parameter features and preset candidate parameters are input into the fusion module to perform an inner product, and the inner product result is the network parameter.

[0070] In some possible implementations, taking the feature extraction module as an MLP and the candidate sample hyperparameters as N as an example, the encoded sample hyperparameters are input into the MLP, and the output is M groups of C-dimensional vectors. Then, the inner product of each of the M groups of C preset candidate parameters with the corresponding vector is performed to obtain a set of network parameters. After combining this set of network parameters, the final network parameters are obtained.

[0071] In the first and second steps described above, the hyperparameters of the input samples are extracted using a parameter generation model. Then, the extracted parameter features are multiplied by the preset candidate parameters, and the result of the multiplication is used as the network parameters. In this way, when the input hyperparameters are updated, the generated network parameters will also be updated accordingly. By sampling different hyperparameters, multiple network parameters can be updated, which in turn can assist in the training of the model to be searched.

[0072] In some embodiments, the model structure of a preset network model is pruned using a set of sample hyperparameters to obtain the model to be searched under this set of sample hyperparameters. That is, step S103 above can be achieved through the following steps S131 and S132 (not shown in the figure):

[0073] Step S131: In the preset network model, determine the candidate model structure that matches the type of hyperparameters of each group of samples.

[0074] In some embodiments, the type of each set of sample hyperparameters refers to the types of hyperparameters included in that set. For example, the types of the sample hyperparameters include: kernel height, kernel width, number of output channels of the kernel, and number of kernels. The candidate model structure is the model structure indicated by each hyperparameter in the set of sample hyperparameters. Thus, in the preset network model, the structure corresponding to the kernel, the number of input / output channels, and the normalization coefficients is determined (for example, the kernel and the number of input / output channels correspond to the structure of a convolution operator in the preset network model; the normalization system corresponds to the structure of a normalization layer in the preset network model).

[0075] Step S132: Adjust the candidate model structure based on the values ​​of the hyperparameters of each set of samples to obtain the search model corresponding to the hyperparameters of each set of samples.

[0076] In some embodiments, since the network architecture of the preset network model is relatively large, the candidate model structure in the preset network model is pruned according to the value of the hyperparameters of each set of samples to obtain a sub-model, i.e., the model to be searched.

[0077] In some possible implementations, if the hyperparameters of the sample set include kernel height, kernel width, number of output channels, and number of kernels; and the candidate model structure includes convolution operators, then by adjusting these parameters in the candidate model structure according to the values ​​of these sample hyperparameters—that is, according to the kernel size, number of input / output channels, and number of kernels—the adjusted candidate model structure can be obtained. The model composed of this adjusted candidate model structure is then used as the model to be searched. In this way, the kernel parameters of the convolution operators in the preset network model are pruned according to the kernel size and the number of input / output channels to obtain the model to be searched.

[0078] In this embodiment, by determining the candidate model structure in the preset network model according to the type of hyperparameters of each group of samples, the parameter values ​​of the same type in the candidate model structure can be adjusted according to the value of the hyperparameters of each group of samples, thereby achieving the pruning of the preset network model. In this way, the obtained model structure matches the search model of the hyperparameters of that group of samples and makes the size of the search model smaller.

[0079] In some embodiments, after obtaining the model to be searched, the model is trained once to reduce the computational load; that is, step S104 above can be performed by... Figure 2 The steps shown are to be implemented as follows:

[0080] Step S201: Assign the network parameters to the model to be searched.

[0081] In some embodiments, a set of sample hyperparameters is input into a parameter generation model to generate network parameters. These network parameters are then assigned to the corresponding network parameters in the model to be searched. For example, network parameters include convolutional kernel weights and normalization layer coefficients. The generated convolutional kernel weights are assigned to the convolutional kernel weights of the model to be searched, and the normalization layer coefficients are assigned to the normalization layer of the model to be searched. In this way, all network parameters in the model to be searched are given initial values, enabling the model to proceed to the next training step.

[0082] Step S202: Based on the training data, determine the loss of the model to be searched.

[0083] In some embodiments, during a training process, the structure of a pre-defined network model is pruned using a set of sample hyperparameters to obtain a model to be searched. The generated network parameters are then assigned to this model, and training data is input into it. Gradient descent training is then performed on the model according to pre-defined optimization conditions (e.g., an optimization function). In some possible implementations, the pre-defined optimization conditions are used as the target to be achieved by the finally trained model. Training data is input into the model, and the loss is determined based on the difference between the output structure and the ground truth values ​​labeled in the training data.

[0084] Step S203: Determine the gradient of the model to be searched based on the loss and the preset optimization function.

[0085] In some embodiments, the gradients of each network parameter in the model to be searched are determined by using the loss of the model to be searched, with a preset optimization condition as the objective. For example, if the preset optimization condition is a function used to minimize the loss, then with this function as the objective, each parameter of the model to be searched is input into the loss to obtain the gradient of each parameter in the loss.

[0086] Step S204: Based on the gradient, perform a single training on the network parameters in the model to be searched to obtain the trained model to be searched corresponding to each set of sample hyperparameters.

[0087] In some embodiments, the network parameters in the model to be searched are trained once according to the gradient of each parameter, and the model to be searched after the single training is used as the trained model to be searched. This can improve the performance of the model to be searched, reduce the number of training times, and increase the training rate.

[0088] Steps S201 to S204 above involve inputting training data into the model to be searched to determine the loss of the model; further determining the gradient of each network parameter in the model to be searched according to the loss and the preset optimization conditions, and using the gradient to perform a single training of the model to be searched; thus, by using the preset optimization conditions as the training objective and using gradient descent to perform a single training of the model to be searched, the network performance of the model to be searched can be improved while reducing the amount of computation.

[0089] In some embodiments, during each training iteration, while the model to be searched is trained once, the parameter generation model is trained according to the gradient of the model to be searched, thereby improving the performance of the model to be searched and the parameter generation model simultaneously. That is, after step S203 above, while executing step S204, the following steps are also included:

[0090] The first step is to train the parameter generation model that generates the network parameters based on the gradient, thereby obtaining the trained parameter generation model.

[0091] In some embodiments, after generating the gradients of each network parameter, if the network parameter was generated by a parameter generation model, the gradient of that network parameter is backpropagated to the parameter generation model. The network parameters of the parameter generation model itself are adjusted using the backpropagated gradient, thereby obtaining a trained parameter generation model. In some possible implementations, the network parameters of the parameter generation model are trained once using the backpropagated gradient to obtain a trained parameter generation model. If the network parameter corresponding to this gradient was not generated by the parameter generation model, then the gradient is not backpropagated to the parameter generation model, but is instead used to train the model to be searched once using the gradient.

[0092] The second step is to use the trained parameter generation model as the parameter generation model for the next training iteration.

[0093] In some embodiments, during a training process, i.e. the training of a model to be searched, the trained parameter generation model obtained by backpropagating gradients is used as the parameter generation model for the next training of another model to be searched.

[0094] In some possible implementations, during a training process, a pre-defined network model structure is pruned using a sample set of hyperparameters to obtain a model to be searched. The sampled hyperparameters are then input into a parameter generation model to generate network parameters, which are then assigned to the model to be searched. Subsequently, based on pre-defined optimization conditions and the input training data, the loss of the model to be searched with the assigned network parameters is determined, and the gradient of each network parameter is determined according to the loss of the model to be searched. A single gradient descent training iteration is then performed on the model to be searched, resulting in a trained model to be searched. Simultaneously, the gradients corresponding to the network parameters generated by the parameter generation model are fed back into the parameter generation model to perform a single training iteration on the parameter generation model, resulting in a trained parameter generation model. This completes this training iteration.

[0095] In the next training process, another set of sample hyperparameters is used to obtain another model to be searched, and the other set of sample hyperparameters is input into the previously trained parameter generation model to generate network parameters, thereby obtaining the loss and gradient of the other model to be searched. In this way, both the other model to be searched and the previously trained parameter generation model can be trained in a single run.

[0096] In the first and second steps described above, training data is fed into the model to be searched. After determining the gradient of each network parameter through the loss function, the gradient is synchronously fed back into the parameter generation model corresponding to this training. The model to be searched and the parameter generation model are trained synchronously, so that the performance of the trained model to be searched and the trained parameter generation model can influence each other and improve synchronously. Moreover, the parameter generation model is shared among multiple models to be searched. In this way, the training speed can be accelerated each time a model to be searched is trained, without the need to reset the network parameters.

[0097] In some embodiments, a target search model is found among multiple trained search models using preset metrics, and the target model is deployed using the hyperparameters of the target search model. That is, step S105 above can be achieved through... Figure 3 The steps shown are to be implemented as follows:

[0098] Step S301: Among the at least two trained search models, determine the target search model that meets the preset index.

[0099] In some embodiments, multiple sets of sample hyperparameters are obtained through sampling, thereby training multiple trained search models. The performance metrics of each trained search model are then analyzed, and the trained search model whose performance metrics meet preset metrics is selected as the target search model. For example, the preset metrics might be the bit error rate (BER) and device storage requirements. In this case, the target search model is selected from the multiple trained search models if its BER meets the preset BER and its storage requirements are less than or equal to the preset device storage requirements.

[0100] Step S302: Deploy the target model based on the target hyperparameters of the target model to be searched.

[0101] In some embodiments, the hyperparameters in the target search model are used as the target hyperparameters. The hyperparameters in the target search model can be a set of sample hyperparameters used when training the model. This set of sample hyperparameters is used as the target hyperparameters. Then, the model to be deployed, i.e., the target model, is generated using these target hyperparameters.

[0102] In this embodiment, the optimal target model is searched among multiple trained search models according to a preset metric, and the network performance of the target model that meets the preset metric is deployed using the hyperparameters of the target model. In this way, the target model is deployed using the target hyperparameters, eliminating the need to retrain the deployed model using hyperparameters, thus improving the efficiency of model deployment.

[0103] In some embodiments, by inputting the target hyperparameters into the target trained parameter generation model obtained in the last training iteration, network parameters to be deployed are generated, and these network parameters to be deployed are fixed in the target search model to obtain the target model. That is, the above step S302 can be achieved by the following steps S321 to S223 (not shown in the figure):

[0104] Step S321: Determine the target trained parameter generation model obtained from the last training.

[0105] In some embodiments, the trained parameter generation model obtained from the last training iteration is obtained, i.e., the target trained parameter generation model. For example, 20 sets of sample hyperparameters are sampled, and a search model is trained using the hyperparameters of each set of samples. The parameter generation model trained on the 20th iteration is used as the target trained parameter generation model.

[0106] Step S322: Input the target hyperparameters and the preset candidate parameters into the target trained parameter generation model to generate network parameters to be deployed.

[0107] In some embodiments, the target hyperparameter and a set of preset candidate parameters are used as input to the target trained parameter generation model to generate network parameters, i.e., network parameters to be deployed.

[0108] Step S323: Assign the network parameters to be deployed to the target search model to obtain the target model, and deploy the target model.

[0109] In some embodiments, the network parameters to be deployed are assigned as the optimal network parameters to the target search model to obtain the target model. Thus, after finding the optimal target search model among multiple trained search models, the target trained parameter generation model obtained from the last training is combined with the target hyperparameters to generate the network parameters to be deployed. By fixing and storing these network parameters in the target search model, a target model that meets preset metrics is obtained. This significantly reduces the production cost of the encoding / decoding model by eliminating the need to retrain the target model using hyperparameters, and the target model meeting the preset metrics improves the overall deployment performance in data centers and terminal devices.

[0110] In some embodiments, for any trained model to be searched, the network performance of the trained model to be searched is obtained by analyzing the cost function of a set of hyperparameters in the model, and then it is determined whether the trained model to be searched is the target model to be searched. That is, the above step S301 can be implemented by the following steps S311 to S313 (not shown in the figure):

[0111] Step S311: Determine the cost function of a set of sample hyperparameters corresponding to each trained model to be searched.

[0112] In some embodiments, before determining the cost function, the trained search model is preprocessed according to the method for training the search model; then, in the preprocessed trained search model, the cost function of a set of sample hyperparameters corresponding to the trained search model is determined; thus, preprocessing the trained search model enables the cost function of the trained search model to effectively characterize the performance results of the model.

[0113] In some possible implementations, the cost function for a set of sample hyperparameters in the trained model to be searched can be obtained by considering the type combination of hyperparameters in a set of sample hyperparameters and the loss of the trained model to be searched. For example, the cost function can be obtained by determining the loss of each sample hyperparameter in the trained model to be searched and using the average of the losses corresponding to this set of sample hyperparameters.

[0114] Step S312: Based on the cost function of each trained search model and the preset validation dataset, determine the network performance of each trained search model.

[0115] Here, before step S312, a preset verification dataset is first obtained. This dataset can be a preset verification dataset sent by other devices or a preset verification dataset stored in the system's own repository. After determining the cost function, some network metrics of the trained search model can be characterized by the cost function, such as the distortion rate of the trained search model. By inputting the preset verification dataset into the trained search model, the performance of the trained search model under these preset verification datasets can be obtained, such as accuracy and bitrate. The time consumption of each module in the trained search model can also be obtained. These performance metrics and the time consumption of each module are used to evaluate the network performance of the trained search model. In this way, the network performance of multiple trained search models can be obtained.

[0116] Step S313: The trained search model whose network performance meets the preset index is determined as the target search model.

[0117] Here, among multiple trained search models, we find the trained search model whose network performance meets the preset indicators. For example, the preset indicators include preset distortion rate and preset time consumption. Then, the trained search model whose network performance meets the preset distortion rate and preset time consumption is selected as the target search model.

[0118] In this embodiment, the cost function of the hyperparameters of the trained search model can accurately characterize the performance of the model and the time consumption of each module. Combined with the performance of the preset validation dataset, the network performance of each trained search model can be accurately evaluated, thereby enabling the accurate search for the target search model with the best network performance from multiple trained search models.

[0119] In some embodiments, sampling combinations are set according to the size of the hyperparameter search space, thereby performing multiple sets of sampling to obtain at least two sets of sample hyperparameters. That is, the above step S101 can be achieved by the following steps S111 to S113 (not shown in the figure):

[0120] Step S111: Determine the search space of the hyperparameters of the preset network model.

[0121] In some possible implementations, taking a pre-defined network model as a convolutional neural network as an example, the hyperparameters of this convolutional neural network include: convolutional kernel, number of channels, number of convolutional layers, etc. Thus, the search space for setting these hyperparameters according to empirical values ​​includes: the range of convolutional kernels is 3 to 5, the range of the number of channels is 8 to 256, and the range of the number of layers is 2 to 5, etc.

[0122] Step S112: Determine the sampling combination based on the boundary information of the search space.

[0123] In some possible implementations, the boundary information of the search space includes the boundary values ​​of each hyperparameter within that search space. For a given hyperparameter, the sampling method is set according to its boundary values ​​in the search space. For example, the hyperparameter can be sampled in the search space based on its maximum, minimum, and random values. Thus, by sampling various types of hyperparameters according to these combinations of maximum, minimum, and random values, a set of sample hyperparameters is obtained for each type of hyperparameter under these combinations.

[0124] Step S113: Based on the sampling combination, perform at least two sets of sampling in the search space to obtain the at least two sets of sample hyperparameters.

[0125] Here, hyperparameters are sampled according to their range to ensure that the sampled hyperparameters cover a wide range, thus enabling different network structures within the search space to be trained. For example, hyperparameters can be sampled using the maximum and minimum values ​​of the hyperparameters of at least two models to be searched, and simultaneously sampled using random values ​​of the hyperparameters of at least two models to be searched, resulting in sampled hyperparameters with a large coverage range.

[0126] In this embodiment, by setting a search space for the hyperparameters of a preset network model, and according to the boundary information of the search space, a sampling combination is set so that the set sampling combination can better cover the search space. Then, at least two sets of sampling are performed according to the sampling combination to obtain at least two sets of sample hyperparameters. The obtained at least two sets of sample hyperparameters can be used to train different network structures in the subsequent training process, thereby improving the effectiveness of training.

[0127] The following describes the application of the neural network structure search method provided in this application embodiment in a real-world scenario, taking the structure search for a deep learning encoding / decoding model as an example.

[0128] This application provides a neural network architecture search method. During the neural network architecture search process, a novel structural feature-assisted training method is introduced, which solves the problem of noise introduced during architecture search training, leading to a decrease in the performance of the encoding / decoding model. Based on this method, a deployable model can be obtained directly after a single training iteration, achieving a significant performance improvement in the same task compared to neural network architecture search algorithms in related technologies.

[0129] The neural network structure search method provided in this application can be implemented through the following steps:

[0130] The first step is to construct a parameter generation model for generating neural network parameters.

[0131] Here, during the training process of the model to be searched, hyperparameter encoding of the model is introduced; and the network parameters of the model are generated by combining the model hyperparameter encoding with a set of candidate parameters. For example... Figure 4 As shown, Figure 4 This is a schematic diagram of the network architecture for the neural network structure search method provided in this application embodiment. Taking the search space as the length and width of the convolutional kernel K and the number of output channels C, and generating a single convolutional kernel as an example, the input 401 of this network architecture includes: the hyperparameter-encoded vector [K::C], the number of channels, and the size of the convolutional kernel. The input 401 is input into MLP 402. MLP 402 extracts features from the input content to obtain the features corresponding to the current module, and calculates the inner product with a set of candidate parameters 41 to 4n to obtain the corresponding network parameters (i.e., kernel 403). The generation process of the convolutional kernel parameter W in the network parameters can be expressed as W = MLP([K::C]·[W1::W2::...::W N ]).

[0132] exist Figure 4 In this context, the multilayer perceptron model can be replaced with other deep learning models, such as graph machine learning models, to enhance representation capabilities. For generating convolutional kernel parameters, a set of candidate parameters can be constructed channel-by-channel, with each set corresponding to different features output by the perceptron. These generated parameters are then combined to obtain the convolutional kernel weights, i.e., the network parameters.

[0133] The second step is to conduct the training and hyperparameter search process.

[0134] Here, the models to be trained include at least: the model to be searched and the parameter generation model. A suitable hyperparameter search space needs to be set before training. In the encoding / decoding model, the configurable search space includes the number of convolutional kernel channels, the convolutional kernel size, different sub-models, and different loss function hyperparameters. In some embodiments, better training results can be obtained when the difference in floating-point operations between the models in the search space is within three times.

[0135] During training, at each step, hyperparameters are sampled according to the largest network model, two random network models, and the smallest network model in the search space. After each sampling, the sampled hyperparameters are first encoded and fed into the parameter generation model to generate network parameters; then, the model structure is adjusted based on the hyperparameters using the method in parameter-shared structure search; finally, data samples are fed into the adjusted model, and gradient descent training is performed according to the model optimization objective.

[0136] After training, constraints on model computational complexity, bitrate, and distortion rate are set according to preset metrics, and optimization algorithms such as genetic algorithms are used to search for optimal hyperparameters. The cost function for determining a set of hyperparameters is performed using the method employed during training (i.e., according to...). Figure 5 The network is preprocessed in the manner shown, and the network performance corresponding to the verification dataset and the time consumption of each module of the encoding and decoding model of a specific device are used as the evaluation results. Figure 5 This is a schematic diagram of another implementation network architecture of the neural network structure search method provided in the embodiments of this application, wherein kernels 1 to 4 share MLP 501, indicating that the four models to be searched corresponding to kernels 1 to 4 share MLP 501; as shown Figure 5 As shown, the four search models are connected in the same supernet. During training, firstly, a set of sample hyperparameters 51 is input into MLP 501 to generate network parameters. Then, data sample 502 and the network parameters output by MLP 501 are input into the search model corresponding to kernel 1 to perform a single training of the search model corresponding to kernel 1, and MLP 501 is trained based on the gradient of this model to obtain the first trained MLP 501, and feature 1 is output. Secondly, data sample 502 and the network parameters output by the first trained MLP 501 are input into the search model corresponding to kernel 2 to perform a single training of the search model corresponding to kernel 2, and MLP 501 is trained based on the gradient of this model to obtain the second trained MLP 501, and feature 2 is output. Thirdly, data sample 502 and the network parameters output by the second trained MLP 501 are input into the search model corresponding to kernel 2 to perform a single training of the search model corresponding to kernel 2, and MLP 501 is trained based on the gradient of this model to obtain the second trained MLP 501, and feature 2 is output. The network parameters output by kernel 501 are input into the search model corresponding to kernel 3 to perform a single training of the search model corresponding to kernel 3. Based on the gradient of this model, a second training of MLP 501 is performed to obtain a third training of MLP 501, and feature 3 is output. Finally, the data sample 502 and the network parameters output by the third training of MLP 501 are input into the search model corresponding to kernel 4 to perform a single training of the search model corresponding to kernel 4. Based on the gradient of this model, a third training of MLP 501 is performed to obtain the final trained MLP 501 and the final output result 503.

[0137] The third step is to generate a deployment model according to the preset indicators.

[0138] Here, the parameters of the parameter generation model are fixed and stored. The network parameters obtained based on the target hyperparameters are then assigned to the target model to be searched, and the deployment model is obtained without the need to retrain using hyperparameters.

[0139] In this embodiment, the network parameters are used to assist in network parameter training, completing a single-shot training structure search for the deep learning encoder-decoder model. This introduces structural features as auxiliary information during training, significantly improving the overall performance of the model obtained through structure search compared to directly using the One-Shot structure search method in related techniques. Simultaneous training of the hypernetic parameter generation model and the model to be searched yields deployable target models under different constraints, eliminating the need for retraining using hyperparameters. This approach is applicable to noise-sensitive networks such as generative models, avoids introducing additional training processes, and maintains high computational efficiency.

[0140] The embodiments of this application can be used in the production process of encoding and decoding models running on data centers and mobile terminals. These scenarios require processing large-scale image data, or the computing performance of the devices is limited, necessitating the training of targeted encoding and decoding models. The neural network search method provided in these embodiments can significantly reduce the production cost of encoding and decoding models while improving the overall deployment performance on data centers and terminal devices.

[0141] Based on the foregoing embodiments, this application provides a neural network structure search device. The device includes various units and modules included in each unit, which can be implemented by a processor in a computer device; of course, it can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a graphics processing unit (GPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0142] Figure 6 This is a schematic diagram of the composition structure of a neural network structure search device provided in an embodiment of this application, as shown below. Figure 6As shown, the neural network structure search device 600 includes: a first sampling module 601, used to sample the hyperparameters of a preset network model to obtain at least two sets of sample hyperparameters; a first generation module 602, used to generate network parameters of the preset network model based on each set of sample hyperparameters and preset candidate parameters; a first adjustment module 603, used to adjust the model structure of the preset network model based on each set of sample hyperparameters to obtain a search model corresponding to each set of sample hyperparameters; a first training module 604, used to train the search model based on preset optimization conditions, training data, and the network parameters to obtain a trained search model corresponding to each set of sample hyperparameters; and a first search module 605, used to perform structure search on at least two trained search models corresponding to the at least two sets of sample hyperparameters according to preset indicators to obtain a target model.

[0143] In some embodiments, the first generation module 602 includes: a first determining submodule, configured to determine the parameter generation model corresponding to the current training; wherein the parameter generation model includes: a trained parameter generation model or an untrained parameter generation model; the first generation submodule is configured to input the hyperparameters of each set of samples and the preset candidate parameters into the parameter generation model corresponding to the current training to generate the network parameters.

[0144] In some embodiments, the first generation submodule includes: a first extraction unit, configured to extract features from the hyperparameters of each group of samples using the parameter generation model corresponding to the current training, to obtain parameter features; and a first fusion unit, configured to fuse the parameter features and the preset candidate parameters to obtain the network parameters.

[0145] In some embodiments, the first adjustment module 603 includes: a second determining submodule, configured to determine a candidate model structure that matches the type of each set of sample hyperparameters in the preset network model; and a first adjustment submodule, configured to adjust the candidate model structure based on the value of each set of sample hyperparameters in the preset network model to obtain the search model corresponding to each set of sample hyperparameters.

[0146] In some embodiments, when the preset optimization conditions include a preset optimization function, the first training module 604 includes: a first assignment submodule, configured to assign the network parameters to the model to be searched; a third determination submodule, configured to determine the loss of the model to be searched based on the training data; a fourth determination submodule, configured to determine the gradient of the model to be searched based on the loss and the preset optimization function; and a second adjustment submodule, configured to perform a single training on the network parameters in the model to be searched based on the gradient, to obtain the trained model to be searched corresponding to each set of sample hyperparameters.

[0147] In some embodiments, the apparatus further includes: a second training module, configured to train a parameter generation model for generating network parameters based on the gradient to obtain a trained parameter generation model; and a first determining module, configured to use the trained parameter generation model as the parameter generation model for the next training iteration.

[0148] In some embodiments, the first search module 605 includes: a fifth determining submodule, configured to determine a target search model that satisfies the preset index among the at least two trained search models; and a first deployment submodule, configured to deploy the target model based on the target hyperparameters of the target search model.

[0149] In some embodiments, the apparatus further includes: a first acquisition module, configured to acquire a preset verification dataset; the fifth determination submodule includes: a first determination unit, configured to determine the cost function of a set of sample hyperparameters corresponding to each trained search model; a second determination unit, configured to determine the network performance of each trained search model based on the cost function of each trained search model and the preset verification dataset; and a third determination unit, configured to determine the trained search model whose network performance meets the preset index as the target search model.

[0150] In some embodiments, the first deployment submodule includes: a fourth determining unit, configured to determine the target trained parameter generation model obtained in the last training; a first generating unit, configured to input the target hyperparameters and the preset candidate parameters into the target trained parameter generation model to generate network parameters to be deployed; and a first assigning unit, configured to assign the network parameters to be deployed to the target search model to obtain the target model and deploy the target model.

[0151] In some embodiments, the first sampling module 601 includes: a sixth determining submodule, configured to determine the search space of the hyperparameters of the preset network model; a seventh determining submodule, configured to determine a sampling combination based on the boundary information of the search space; and a first sampling submodule, configured to perform at least two sets of sampling in the search space based on the sampling combination to obtain the at least two sets of sample hyperparameters.

[0152] The descriptions of the apparatus embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. In some embodiments, the functions or modules included in the apparatus provided in this application can be used to perform the methods described in the method embodiments above. For technical details not disclosed in the apparatus embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0153] It should be noted that, in the embodiments of this application, if the above-described neural network structure search method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0154] This application provides a computer device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.

[0155] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium can be transient or non-transient.

[0156] This application provides a computer program including computer-readable code, wherein when the computer-readable code is executed in a computer device, a processor in the computer device performs some or all of the steps in the above-described method.

[0157] This application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.

[0158] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0159] It should be noted that, Figure 7 This is a schematic diagram of a hardware entity of a computer device in an embodiment of this application, such as... Figure 7 As shown, the hardware entity of the computer device 700 includes: a processor 701, a communication interface 702, and a memory 703, wherein:

[0160] Processor 701 typically controls the overall operation of computer device 700.

[0161] Communication interface 702 enables computer devices to communicate with other terminals or servers over a network.

[0162] The memory 703 is configured to store instructions and applications executable by the processor 701, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data, and video communication data) in the processor 701 and various modules in the computer device 700. It can be implemented using flash memory or random access memory (RAM). Data transfer between the processor 701, the communication interface 702, and the memory 703 can be performed via bus 704.

[0163] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above embodiments of this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0164] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0165] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0166] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0167] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0168] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0169] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.

[0170] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for searching neural network structures, characterized in that, The method includes: The hyperparameters of a preset network model are sampled to obtain at least two sets of sample hyperparameters; the type of the preset network model is a convolutional neural network. Based on each of the at least two sets of sample hyperparameters and the preset candidate parameters, the network parameters of the preset network model are generated. Based on the hyperparameters of each set of samples, the model structure of the preset network model is adjusted to obtain the search model corresponding to each set of sample hyperparameters; the requirement of the search model is to achieve object detection or face recognition. Based on preset optimization conditions, training data, and the network parameters, the model to be searched is trained to obtain the trained model to be searched corresponding to each set of sample hyperparameters; the training data includes: sample images of the region where the sample object is labeled or sample face images labeled with face identity information. According to preset indicators, perform structure search on at least two trained models to be searched corresponding to the hyperparameters of at least two sets of samples to obtain the target model; When the preset optimization conditions include a preset optimization function, the step of training the model to be searched based on the preset optimization conditions, training data, and the network parameters to obtain the trained model to be searched corresponding to each set of sample hyperparameters includes: Assign the network parameters to the model to be searched; Based on the training data, determine the loss of the model to be searched; Based on the loss and the preset optimization function, the gradient of the model to be searched is determined; Based on the gradient, the network parameters in the model to be searched are trained once to obtain the trained model to be searched corresponding to each set of sample hyperparameters. After determining the gradient of the model to be searched based on the loss and the preset optimization function, the method further includes: Based on the gradient, the parameter generation model that generates the network parameters is trained to obtain the trained parameter generation model; the trained parameter generation model is then used as the parameter generation model for the next training iteration.

2. The method according to claim 1, characterized in that, The process of generating network parameters for the preset network model based on each of the at least two sets of sample hyperparameters and preset candidate parameters includes: Determine the parameter generation model corresponding to this training; wherein, the parameter generation model includes: a trained parameter generation model or an untrained parameter generation model; The hyperparameters of each set of samples and the preset candidate parameters are input into the parameter generation model corresponding to this training to generate the network parameters.

3. The method according to claim 2, characterized in that, The step of inputting the hyperparameters of each set of samples and the preset candidate parameters into the parameter generation model corresponding to this training to generate the network parameters includes: The parameter generation model corresponding to this training is used to extract features from the hyperparameters of each group of samples to obtain parameter features; The network parameters are obtained by fusing the parameter features and the preset candidate parameters.

4. The method according to any one of claims 1 to 3, characterized in that, The step of adjusting the model structure of the preset network model based on the hyperparameters of each set of samples to obtain the search model corresponding to each set of sample hyperparameters includes: In the preset network model, a candidate model structure that matches the type of hyperparameters of each group of samples is determined; In the preset network model, the candidate model structure is adjusted based on the values ​​of the hyperparameters of each set of samples to obtain the search model corresponding to each set of sample hyperparameters.

5. The method according to any one of claims 1 to 3, characterized in that, The step of performing a structure search on at least two trained models corresponding to the hyperparameters of at least two sets of samples according to preset indicators to obtain the target model includes: Among the at least two trained search models, a target search model that meets the preset criteria is determined; Based on the target hyperparameters of the target model to be searched, the target model is deployed.

6. The method according to claim 5, characterized in that, Before determining the target search model that meets the preset metric among the at least two trained search models, the method further includes: Obtain the preset verification dataset; The step of determining the target search model that meets the preset index among the at least two trained search models includes: Determine the cost function for a set of sample hyperparameters corresponding to each trained model to be searched; Based on the cost function of each trained search model and the preset validation dataset, the network performance of each trained search model is determined. The trained search model whose network performance meets the preset index is identified as the target search model.

7. The method according to claim 5, characterized in that, Deploying the target model based on the target hyperparameters of the target model to be searched includes: Determine the target parameters obtained from the last training iteration to generate the model; The target hyperparameters and the preset candidate parameters are input into the target trained parameter generation model to generate network parameters to be deployed; The network parameters to be deployed are assigned to the target search model to obtain the target model, and then the target model is deployed.

8. The method according to any one of claims 1 to 3, characterized in that, The process of sampling the hyperparameters of the preset network model yields at least two sets of sample hyperparameters, including: Determine the search space for the hyperparameters of the preset network model; Based on the boundary information of the search space, the sampling combination is determined; Based on the sampling combination, at least two sets of samples are performed in the search space to obtain the at least two sets of sample hyperparameters.

9. A neural network structure search device, characterized in that, include: The first sampling module is used to sample the hyperparameters of the preset network model to obtain at least two sets of sample hyperparameters; the type of the preset network model is a convolutional neural network. The first generation module is used to generate network parameters of the preset network model based on each of the at least two sets of sample hyperparameters and preset candidate parameters; The first adjustment module is used to adjust the model structure of the preset network model based on the hyperparameters of each set of samples to obtain the search model corresponding to each set of sample hyperparameters; the requirement of the search model is to realize object detection or face recognition. The first training module is used to train the model to be searched based on preset optimization conditions, training data and the network parameters, so as to obtain the trained model to be searched corresponding to each set of sample hyperparameters; the training data includes: sample images of the region where the sample object is labeled or sample face images labeled with face identity information. The first search module is used to perform a structure search on at least two trained models to be searched corresponding to the hyperparameters of the at least two sets of samples according to preset indicators, so as to obtain the target model. When the preset optimization conditions include a preset optimization function, the first training module is further configured to assign the network parameters to the model to be searched; determine the loss of the model to be searched based on the training data; determine the gradient of the model to be searched based on the loss and the preset optimization function; and perform a single training on the network parameters in the model to be searched based on the gradient to obtain the trained model to be searched corresponding to each set of sample hyperparameters. The second training module is used to train the parameter generation model that generates the network parameters based on the gradient, so as to obtain the trained parameter generation model. The first determining module is used to use the trained parameter generation model as the parameter generation model for the next training.

10. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 8.