WO2021036397A1 - Method and apparatus for generating target neural network model - Google Patents

Method and apparatus for generating target neural network model Download PDF

Info

Publication number
WO2021036397A1
WO2021036397A1 PCT/CN2020/094837 CN2020094837W WO2021036397A1 WO 2021036397 A1 WO2021036397 A1 WO 2021036397A1 CN 2020094837 W CN2020094837 W CN 2020094837W WO 2021036397 A1 WO2021036397 A1 WO 2021036397A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
network model
candidate
operator
differentiable
Prior art date
Application number
PCT/CN2020/094837
Other languages
French (fr)
Chinese (zh)
Inventor
方慕园
钟钊
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021036397A1 publication Critical patent/WO2021036397A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • This application relates to the field of artificial intelligence, and in particular to a method and device for generating a target neural network model.
  • Artificial Intelligence is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, and basic AI theories.
  • AutoMachine Learning is a method of automatically designing convolutional neural networks.
  • the target data set and evaluation criteria are input to the Automl system, and the Automl system will output the target neural network.
  • the Automl system needs to generate different neural network models, and separately train each neural network model to obtain the accuracy and delay of each neural network model, and use the accuracy and delay as
  • the feedback information is used to update the parameters and generation rules of the neural network model according to the feedback information to determine the target neural network.
  • the above method of determining the target neural network requires sampling to obtain a large number of neural network models for training, which consumes more computing resources and time.
  • the present application provides a method and device for generating a target neural network model to improve the efficiency of generating a target neural network model and reduce the consumption of computing resources and time.
  • an embodiment of the present application provides a method for generating a target neural network model.
  • the method may include: obtaining score weights of a plurality of candidate operators and a plurality of neural network models; The scoring weight, the accuracy rate of each neural network model, and the delay of each neural network model determine the differentiable relationship information of the loss function with respect to the scoring variable, and the loss function is a joint function of the accuracy rate and the delay; Differentiable relationship information updates the score weights of the multiple candidate operators; generates a target neural network model according to the updated score weights; sends target model configuration information, the target model configuration information is used to configure the target neural network model.
  • the target neural network model can be generated based on the scoring weight of the candidate operator. Efficiency, reducing the consumption of computing resources and time.
  • each neural network model of the plurality of neural network models is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block
  • the differentiable relationship information of the loss function with respect to the scoring variable includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block; the update of the differentiable relationship information is based on the differentiable relationship information.
  • the scoring weights of multiple candidate operators include: updating the scoring weights of the candidate operators corresponding to each differentiable relationship information according to the L*N differentiable relationship information; where L and N are any positive Integer.
  • the generation of the target neural network model can be improved. Efficiency, reducing the consumption of computing resources and time.
  • the method further includes: acquiring a target data set and a delay adjustment parameter; determining the loss function according to the delay adjustment parameter; updating the candidate operator's value according to the target data set Internal parameters; the multiple neural network models are determined according to the updated internal parameters and the score weights of the multiple candidate operators.
  • the target data set and time delay adjustment parameters are obtained, so that the generated target neural network model meets the corresponding functional requirements, the internal parameters of the candidate operators are updated according to the target data set, and the internal parameters of the candidate operators are updated according to the updated internal parameters. And the scoring weights of the candidate operations to determine multiple neural network models.
  • the scoring weights of the candidate operators the accuracy and delay of each neural network model, the differentiable relationship information of the loss function on the scoring variables is determined, and according to the differentiable Relational information optimizes the scoring weights of the candidate operators, thereby optimizing the internal parameters and scoring weights of the candidate operators, which can improve the efficiency of generating the target neural network model based on the scoring weights of the candidate operators, and reduce the consumption of computing resources and time .
  • the accuracy of each neural network model and the delay of each neural network model are used to determine the feasibility of the loss function with respect to the scoring variable according to the scoring weights of the multiple candidate operators.
  • the micro-relation information includes: determining the m-th accuracy differentiable relation information of the l-th selection block according to the score weights of the N candidate operators of each selection block and the accuracy of each neural network model.
  • each neural network model is determined based on the target data set; the sampling probability of each selection block of each neural network model is determined according to the score weights of the N candidate operators of each selection block and The sampling probability of each candidate operator of each selection block is related to the differentiable relationship information of the scoring variable; according to the sampling probability of the operator of the L-1 selection block of each neural network model, the m-th selection block of the l.
  • the differentiable relationship information of the sampling probabilities of the candidate operators with respect to the scoring variable and the delay of each neural network model determine the m-th delay differentiable relationship information of the l-th selection block, the L-1 Selection blocks include selection blocks other than the lth selection block among the L selection blocks; according to the mth accuracy rate of the lth selection block, the differentiable relationship information and the value of the lth selection block
  • the m-th time delay differentiable relationship information determines the m-th differentiable relationship information of the l-th selection block.
  • the value of l is a positive integer
  • the optimized scoring weight minimizes the accuracy rate error and the average network delay at the same time, thereby improving the accuracy of the target neural network model constructed based on the candidate model and reducing the network delay.
  • the updating the score weights of the candidate operators corresponding to each differentiable relationship information according to the L*N differentiable relationship information includes: separately updating the L*N differentiable relationship information Differentiable relationship information and the score weight of each candidate operator are input to the stochastic gradient descent algorithm, and the updated score weight of each candidate operator in each selection block is output.
  • the updating the internal parameters of the candidate operator according to the target data set includes: using the target data set to train a first neural network model, and the first neural network model is determined by L The number of candidate operators is determined, and each candidate operator is one of the N candidate operators of the corresponding selection block; the internal parameters of the L candidate operators are updated according to the training result; where L is any positive integer.
  • the method further includes: determining whether there is a first operator according to the updated scoring weight and a preset condition, and the first operator is a candidate operation for L selection blocks One or more of the operators; if there is a first operator, remove the first operator from the candidate operators of the selection block corresponding to the first operator.
  • the computing resources and time spent in obtaining the target neural model can be reduced.
  • the method further includes: judging whether a cut-off condition is satisfied, and if the cut-off condition is not satisfied, Then execute the step of training the first neural network model using the target data set; if the cut-off condition is met, execute the step of generating the target neural network model according to the updated scoring weight.
  • each candidate operator of each selection block has an equal probability of being selected as an operator of the first neural network model.
  • the method further includes: acquiring identification information of the speed measuring device; sending neural network model configuration information to the speed measuring device according to the identification information, and the neural network model configuration information is used to configure the speed measuring device.
  • the multiple neural network models receiving the time delay of each neural network model sent by the speed measuring device.
  • the target neural network can be generated The model meets the actual needs of use.
  • the neural network model configuration information includes multiple network structure coding information, and each network structure coding information is used to configure a neural network model of various operators and the connection relationship of the operators.
  • the generating the target neural network model according to the updated scoring weight includes: selecting, in each selection block, the candidate operator with the largest score in the selection block as the target neural network model.
  • An operator of the network model, the internal parameter of the operator is the updated internal parameter.
  • the obtaining the target data set and the time delay adjustment parameter includes: receiving the target data set and the time delay adjustment parameter input by the user; or, receiving the data set selection information and the time delay adjustment parameter input by the user.
  • the delay adjustment parameter determines the target data set according to the data set selection information; or, receives data set selection information and expected complexity information input by a user, and determines the target data set according to the data set selection information , Determining the delay adjustment parameter according to the expected complexity information.
  • an embodiment of the present application provides a device for generating a target neural network model.
  • the device for generating a target neural network model is used to execute the target neural network in the first aspect or any possible implementation of the first aspect.
  • the device for generating the target neural network model may include a module for executing the method for generating the target neural network model in the first aspect or any possible implementation of the first aspect.
  • an embodiment of the present application provides a terminal device.
  • the terminal device includes a memory and a processor.
  • the memory is used to store instructions.
  • the execution of the instructions stored in the processor enables the processor to execute the method for generating the target neural network model in the first aspect or any possible implementation of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the program is executed by a processor, the first aspect or any one of the possible implementation manners of the first aspect is implemented. method.
  • the present application provides a computer program product.
  • the computer program product includes instructions that, when run on a computer, cause the computer to execute the method described in any one of the above-mentioned first aspects.
  • the present application provides a chip including a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the above-mentioned first aspect The method of any one of.
  • the method and device for generating a target neural network model of the present application obtain the scoring weights of multiple candidate operators and multiple neural network models, according to the scoring weights of the multiple candidate operators and the accuracy of each neural network model.
  • the rate and the delay of each neural network model determine the differentiable relationship information of the loss function on the score variable.
  • the loss function is a joint function of accuracy and delay.
  • the scores of the multiple candidate operators are updated according to the differentiable relationship information
  • the weight value is to generate the target neural network model according to the updated scoring weight value, and send the target model configuration information.
  • the target model configuration information is used to configure the target neural network model.
  • the differentiable relationship information about the scoring variable is determined by the loss function Optimize the scoring weight of the operator according to the differentiable relationship information, which can improve the efficiency of generating the target neural network model and reduce the consumption of computing resources and time.
  • FIG. 1 is a schematic diagram of an artificial intelligence main body framework provided by an embodiment of this application.
  • FIG. 2A is a schematic diagram of an application environment provided by an embodiment of the application.
  • FIG. 2B is a schematic diagram of an application environment provided by an embodiment of this application.
  • FIG. 3 is a schematic diagram of a candidate model provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of a convolutional neural network structure provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of a convolutional neural network structure provided by an embodiment of this application.
  • Fig. 6 is a method for generating a target neural network model according to an embodiment of the application.
  • FIG. 7 is another method for generating a target neural network model according to an embodiment of the application.
  • FIG. 8 is another method for generating a target neural network model according to an embodiment of the application.
  • FIG. 9 is a schematic diagram of a candidate model provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of a neural network model provided by an embodiment of this application.
  • FIG. 11A is a schematic diagram of a method for generating a target neural network model provided by an embodiment of this application.
  • FIG. 11B is a schematic diagram of updating the score weight of each candidate operator in the selection block 1 according to an embodiment of the application;
  • FIG. 12 is a flowchart of another method for generating a target neural network model according to an embodiment of the application.
  • FIG. 13 is a schematic structural diagram of a chip provided by an embodiment of the application.
  • FIG. 14 is a schematic diagram of a system architecture 300 provided by an embodiment of this application.
  • 15 is a schematic block diagram of a device 1600 for generating a target neural network model provided by an embodiment of the application;
  • FIG. 16 is a schematic block diagram of an electronic device 1700 provided by this application.
  • Figure 1 shows a schematic diagram of an artificial intelligence main framework, which describes the overall workflow of the artificial intelligence system and is suitable for general artificial intelligence field requirements.
  • Intelligent Information Chain reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has gone through the condensing process of "data-information-knowledge-wisdom".
  • the "IT value chain” is the industrial ecological process from the underlying infrastructure and information (providing and processing technology realization) of human intelligence to the system, reflecting the value that artificial intelligence brings to the information technology industry.
  • the infrastructure provides computing power support for the artificial intelligence system, realizes communication with the outside world, and realizes support through the basic platform.
  • smart chips hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA
  • basic platforms include distributed computing frameworks and network related platform guarantees and support, which can include cloud storage and Computing, interconnection network, etc.
  • sensors communicate with the outside to obtain data, and these data are provided to the smart chip in the distributed computing system provided by the basic platform for calculation.
  • the data in the upper layer of the infrastructure is used to represent the data source in the field of artificial intelligence.
  • the data involves graphics, images, voice, and text, as well as the Internet of Things data of traditional devices, including business data of existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
  • machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, training, etc.
  • Reasoning refers to the process of simulating human intelligent reasoning in a computer or intelligent system, using formal information to conduct machine thinking and solving problems based on reasoning control strategies.
  • the typical function is search and matching.
  • Decision-making refers to the process of making decisions based on intelligent information after reasoning, and usually provides functions such as classification, sorting, and prediction.
  • some general capabilities can be formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image Recognition and so on.
  • Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. It is an encapsulation of the overall solution of artificial intelligence, productizing intelligent information decision-making and realizing landing applications. Its application fields mainly include: intelligent manufacturing, intelligent transportation, Smart home, smart medical, smart security, autonomous driving, safe city, smart terminal, etc.
  • an embodiment of the present application provides a system architecture 200.
  • the data collection device 260 is used to collect target data and store it in the database 230, and the training device 220 generates a target model/rule 201 based on the target data maintained in the database 230.
  • the following will describe in detail how the training device 220 obtains the target model/rule 201 based on the target data.
  • the target model/rule 201 can be applied to image classification, speech recognition, and the like.
  • a deep neural network can include multiple layers, and each layer can be set with the same or different operators.
  • the operator can be a convolution operator, a pooling operator, a fully connected operator, etc.
  • the convolution operator may be a 3*3 convolution operator, a 5*5 convolution operator, or the like.
  • the operators of each layer in the deep neural network can be expressed in mathematical expressions To describe: From the physical level, the operators of each layer in the deep neural network can be understood as five operations on the input space (the set of input vectors) to complete the transformation from the input space to the output space (that is, the row space of the matrix to Column space), these five operations include: 1. Dimension Up/Down; 2. Enlarge/Reduce; 3. Rotate; 4. Translation; 5. "Bend”. The operations of 1, 2, and 3 are determined by Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a(). The reason why the word "space” is used here is because the object to be classified is not a single thing, but a class of things. Space refers to the collection of all individuals of this kind of thing.
  • W is a weight vector, and each value in the vector represents the weight value of a neuron in the layer of neural network.
  • This vector W determines the spatial transformation from the input space to the output space described above, that is, the weight W of each layer controls how the space is transformed.
  • the purpose of training a deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vector W of many layers). Therefore, the training process of the neural network is essentially the way of learning to control the spatial transformation, and more specifically the learning of the weight matrix.
  • the weight vector of the network (of course, there is usually an initialization process before the first update, which is to pre-configure parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it The prediction is lower and keep adjusting until the neural network can predict the target value you really want. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value".
  • This is the loss function or objective function, which is used to measure the difference between the predicted value and the target value. Important equation. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, then the training of the deep neural network becomes a process of reducing this loss as much as possible.
  • the training device 220 can determine the operators of each layer of the deep neural network and the internal parameters of the operators of each layer according to the target data set according to the method for generating the target neural network model of the embodiment of the present application, for example, the weights described above vector.
  • the candidate model of the deep neural network includes L layers (also called selection blocks), and each layer includes N candidate operations.
  • the scoring weight ( ⁇ ) between each candidate operator and the previous layer can be the same or different.
  • the input data is x 0
  • the output data of the first layer is x 1
  • the output data of the second layer is x 2
  • the output data of the Lth layer is x L
  • the first layer The scoring weight between the first candidate operator and the input data x 0 is ⁇ 1,1
  • the scoring weight between the second candidate operator of the first layer and the input data x 0 is ⁇ 1,2
  • the scoring weight between the Nth candidate operator of the first layer and the input data x 0 is ⁇ 1,N .
  • one operator can be determined to form the target neural network model among the N candidate operators in each layer.
  • the target neural network model can also be called target model/rule.
  • L and N are arbitrary positive integers.
  • Any candidate operator can be a convolution operator, a pooling operator, or a fully connected operation, etc.
  • L selection blocks are connected in series as a possible implementation method. L selection blocks can also be connected in parallel, or a combination of series and parallel.
  • a directed acyclic graph the directed acyclic graph can be used as a candidate model, and the embodiment of the present application uses the candidate model as shown in FIG. 3 as an example, which is not limited thereto.
  • the target model/rule obtained by the training device 220 can be applied to different systems or devices.
  • the execution device 210 is configured with an I/O interface 212 to perform data interaction with external devices, and the "user" can input data to the I/O interface 212 through the client device 240.
  • the execution device 210 can call data, codes, etc. in the data storage system 250, and can also store data, instructions, etc. in the data storage system 250.
  • the calculation module 211 uses the target model/rule 201 to process the input data, and returns the processing result to the client device 240 through the I/O interface 212, and provides it to the user.
  • the training device 220 can generate corresponding target models/rules 201 based on different data for different targets, so as to provide users with better results.
  • the user can manually specify the input data in the execution device 210, for example, to operate in the interface provided by the I/O interface 212.
  • the client device 240 can automatically input data to the I/O interface 212 and obtain the result. If the client device 240 automatically inputs data and needs the user's authorization, the user can set the corresponding authority in the client device 240.
  • the user can view the result output by the execution device 210 on the client device 240, and the specific presentation form may be a specific manner such as display, sound, and action.
  • the client device 240 may also serve as a data collection terminal to store the collected target data in the database 230.
  • FIG. 2A is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 may also be placed in the execution device 210.
  • an embodiment of the present application provides another system architecture 400.
  • the system architecture 400 may include a client device 410 and a server 420.
  • the client device 410 may establish a connection with the server 420, and the server 420 may use this
  • the method for generating a target neural network model of the application embodiment generates a target model/rule, and provides the target model/rule to the client device 410.
  • the client device 410 may configure the target model/rule on the corresponding execution device, for example, an embedded neural network processor (Neural-network Processing Unit, NPU).
  • NPU embedded neural network processor
  • the method for generating the target neural network model of the embodiment of the present application may generate a convolutional neural network (CNN, Convolutional Neuron Network) as shown in FIG. 4 based on the candidate model shown in FIG. 3 (where L is 9).
  • CNN is a deep neural network with a convolutional structure. It is a deep learning architecture.
  • the deep learning architecture refers to the use of machine learning algorithms to perform multiple levels of learning at different abstract levels.
  • CNN is a feed-forward artificial neural network. Each neuron in the feed-forward artificial neural network responds to overlapping regions in the input image.
  • a convolutional neural network may include an input layer, intermediate layers 121-127, and an output layer 130.
  • the input layer 110 may be a candidate operator in the first selection block shown in FIG. 3, and the middle layer 121-127 may be a candidate in the second to eighth selection blocks shown in FIG. 3 Operator, the output layer 130 may be a candidate operator in the 9th selection block as shown in FIG. 3.
  • the middle layer 121-177 can be pooling, convolution or fully connected operation.
  • the middle layer for pooling operation is the pooling layer
  • the middle layer for convolution operation is the convolutional layer
  • the middle layer for full connection operation is Fully connected layer.
  • layer 121 is a convolutional layer
  • layer 122 is a pooling layer
  • layer 123 is a convolutional layer
  • layer 124 is a pooling layer
  • 125 is a convolutional layer
  • 126 is a pooling layer
  • 121 and 122 are convolutional layers
  • 123 is a pooling layer
  • 124 and 125 are convolutional layers
  • 126 is a pooling layer. That is, the output of the convolutional layer can be used as the input of the subsequent pooling layer, or as the input of another convolutional layer to continue the convolution operation.
  • the convolutional neural network shown in Figure 4 is only used as an example of a convolutional neural network.
  • the convolutional neural network can also exist in the form of other network models, and this application can be used
  • the method for generating the target neural network model of the embodiment (using 15 candidate models of selection blocks, the candidate models using a combination of series and parallel) generates, for example, a convolutional neural network as shown in FIG. 5, that is, multiple intermediate layers are parallel, The respectively extracted features are input to the middle layer 127 for processing.
  • the target neural network model can be obtained by the method for generating the target neural network model as described below, and the target neural network model can be applied to face recognition, image classification, image super-resolution, and obstacle detection of the preceding vehicle.
  • the target neural network model of the embodiment of the present application can process the input face image and output a vector for similarity matching.
  • image classification the target neural network model of the embodiment of the present application can process the input image to be classified and output a tensor (Tensor), which is used to determine the classification result.
  • a tensor Transducsor
  • the target neural network model of the embodiment of the present application can process the input sensor raw image and output a high-resolution image.
  • FIG. 6 is a flowchart of a method for generating a target neural network model according to an embodiment of this application. As shown in FIG. 6, the method of this embodiment may be executed by the training device 220 or the processor of the training device 220 as shown in FIG. 2A. Executed, or may be executed by the server 420 or the processor of the server 420 as shown in FIG. 2B, and the method in this embodiment may include:
  • Step 101 Obtain score weights of multiple candidate operators and multiple neural network models.
  • step 101 can obtain the score weight of each candidate operator in the candidate model, for example, ⁇ 1,1 , ⁇ 1,2, etc.
  • the scoring weights of the multiple candidate operators may be the scoring weights after the initialization operation, or the preset scoring weights, or they may be the last time the method for generating the target neural network model of the embodiment of this application is executed.
  • the scoring weight in the candidate model Based on each candidate operator in the candidate model, multiple neural network models can be determined. For example, a neural network model is the first candidate operator in the first selection block and the second candidate operation in the second selection block.
  • the multiple neural network models may be neural network models obtained by sampling the candidate models as shown in FIG. 3.
  • Step 102 Determine the differentiable relationship information of the loss function with respect to the scoring variable according to the scoring weights of the multiple candidate operators, the accuracy rate of each neural network model, and the time delay of each neural network model, and the loss function is the accuracy rate And the joint function of the delay.
  • the accuracy rate of each neural network model may be the accuracy rate of each neural network model in the above-mentioned multiple neural network models, and the accuracy rate of each neural network model may be the output and target of each neural network model.
  • the delay of each neural network model can be the time required for each neural network model to propagate forward.
  • the delay can be the delay of the neural network model measured on a real device.
  • the real device can be as shown in Figure 2A. Execution equipment shown. According to the scoring weights of the multiple candidate operators and the accuracy of each neural network model, the differentiable relationship information of the accuracy function L acc with respect to the scoring variable ⁇ can be determined.
  • the delay of a neural network model can determine the differentiable relationship information of the delay function T( ⁇ ) with respect to the scoring variable ⁇ , and then the differentiable relationship information of the scoring variable ⁇ according to the accuracy function L acc and the delay function T( ⁇ )
  • the differentiable relationship information about the scoring variable ⁇ determines the differentiable relationship information of the loss function about the scoring variable ⁇ .
  • Step 103 Update the score weights of the multiple candidate operators according to the differentiable relationship information.
  • the differentiable relationship information of the loss function on the score variable ⁇ can be obtained, and then the score weights of multiple candidate operators can be updated according to the differentiable relationship information to optimize the score weights of the candidate operators based on the loss function .
  • each neural network model in the plurality of neural network models is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block, and the loss function
  • the differentiable relationship information about the scoring variable includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block.
  • One possible implementation of the above step 103 is: according to the L*N differentiable relationship information, respectively update the score weight of the candidate operator corresponding to each differentiable relationship information; where L and N are any positive integers.
  • Step 104 Generate a target neural network model according to the updated scoring weight.
  • the score weights of the candidate operators in the candidate model can be updated, and then the operators can be selected in the updated candidate model to form the target.
  • Neural network model
  • Step 105 Send target model configuration information, where the target model configuration information is used to configure the target neural network model.
  • the training device 220 may send target model configuration information to the execution device 210, and the execution device 210 establishes a corresponding target neural network model according to the target model configuration information to use the target neural network model Realize corresponding data processing functions, such as face recognition.
  • the server 420 may send target model configuration information to the client device 410, and the client device 420 may establish a corresponding target neural network model according to the target model configuration information to use the target neural network model Realize corresponding data processing functions, such as face recognition.
  • the client device 420 may configure the target neural network model on a corresponding execution device, such as an NPU.
  • the target model configuration information is used to configure each operator of the target neural network model and the connection relationship between the operators. You can also configure the internal parameters of each operator.
  • the accuracy rate of each neural network model, and the time of each neural network model Determine the differentiable relationship information of the loss function on the scoring variable.
  • the loss function is a joint function of accuracy and delay.
  • the score weights of the multiple candidate operators are updated according to the differentiable relationship information, and the score weights are updated according to the updated scoring weights.
  • the value generates the target neural network model, and sends the target model configuration information.
  • the target model configuration information is used to configure the target neural network model.
  • This embodiment determines the differentiable relationship information of the loss function with respect to the scoring variable, and optimizes the operation according to the differentiable relationship information
  • the score weight of the symbol can improve the efficiency of generating the target neural network model and reduce the consumption of computing resources and time.
  • FIG. 7 is a flowchart of a method for generating a target neural network model according to an embodiment of this application. As shown in FIG. 7, the method of this embodiment can be executed by the training device 220 or the processor of the training device 220 as shown in FIG. 2A. Executed, or may be executed by the server 420 or the processor of the server 420 as shown in FIG. 2B, and the method in this embodiment may include:
  • Step 201 Obtain score weights, target data sets, and time delay adjustment parameters of multiple candidate operators.
  • the training device 220 may obtain the target data set and the delay adjustment parameters when receiving the model generation instruction.
  • the model generation instruction may be sent by a terminal device, and the terminal device may be a client device as shown in FIG. 2A.
  • the target data set may include a plurality of training data, and the training data may include input data and corresponding target values.
  • the target data set may be preset or input by the user.
  • the training device 220 receives the target data set sent by the terminal device.
  • the delay adjustment parameter may be preset or input by the user.
  • the training device 220 receives the delay adjustment parameter sent by the terminal device.
  • an achievable way is to receive the target data set and the delay adjustment parameter input by the user.
  • the user may provide the target data set to the training device 220, so that the training device 220 obtains the target neural network model through the method of the embodiment of the present application.
  • a neural network model for face recognition For example, a neural network model for face recognition.
  • Another achievable way is to receive the data set selection information and time delay adjustment parameters input by the user, and determine the target data set according to the data set selection information. For example, there are multiple data sets in the database 230 as shown in FIG. 2A, and the training device 220 may use the data set corresponding to the data set selection information as the target data set according to the data set selection information input by the user.
  • Another achievable manner is to receive data set selection information and expected complexity information input by a user, determine the target data set according to the data set selection information, and determine the delay adjustment parameter according to the expected complexity information.
  • the expected complexity information can be in multiple levels such as high, medium, and low, and each level corresponds to a delay adjustment parameter.
  • the training device 220 can determine the desired complexity information corresponding to the expected complexity information according to the expected complexity information input by the user. Delay adjustment parameters. For example, the higher the level, the smaller the value of the corresponding delay adjustment parameter.
  • Step 202 Determine a loss function according to the delay adjustment parameter, where the loss function is a joint function of accuracy and delay.
  • the joint function of the accuracy and the delay can be the sum of the accuracy function and the delay function, or the weighted sum of the accuracy function and the delay function.
  • the loss function is represented by L
  • the accuracy function is represented by L Acc is denoted
  • the time delay function is denoted by T
  • the time delay adjustment parameter is denoted by ⁇
  • the loss function can be as the following formula (1).
  • the loss function of the embodiment of the present application is differentiable with regard to the scoring weight variable.
  • the specific form of the accuracy function L acc can be flexibly set according to requirements, for example, it can be the Euclidean distance between the output of the neural network model and the target value.
  • Step 203 Update the internal parameters of the candidate operator according to the target data set.
  • the training device 220 is provided with a candidate model as shown in FIG. 3.
  • the internal parameters of each candidate operator in the candidate model can be initialized, and the training device 220 can select candidate operators in each layer to form a neural network model, and use the target data set to train the neural network model to update the internal parameters of each candidate operator constituting the neural network model .
  • Step 204 Determine multiple neural network models according to the updated internal parameters and the score weights of multiple candidate operators.
  • each candidate operator has a scoring weight.
  • the training device 220 can be based on the candidate operators of each layer. For scoring weights, a plurality of candidate operators are selected from the candidate model to form a neural network model, and the internal parameters selected as the candidate operators of the neural network model may be the internal parameters updated through the above step 203.
  • the training device 220 constructs multiple neural network models in the same manner.
  • Step 205 Determine the differentiable relationship information of the loss function with respect to the score variable according to the score weights of the multiple candidate operators, the accuracy rate of each neural network model, and the time delay of each neural network model.
  • the differentiable relationship information may be a derivative value.
  • the delay function of the embodiment of this application can be as the following formula (2)
  • ⁇ k represents a neural network model
  • S is the traversal space formed by the multiple neural network models in step 104
  • l takes 1 to L
  • t( ⁇ k ) represents the time delay of the neural network model ⁇ k.
  • the candidate model includes L selection blocks, each selection block includes N candidate operators, and the differentiable relationship information of the loss function on the score variable ⁇ includes L*N differentiable relationship information
  • the value of l is a positive integer greater than or equal to 1 and less than or equal to L
  • the value of m is a positive integer greater than or equal to 1 and less than or equal to N
  • each differentiable relation information corresponds to a selection block and a candidate operator.
  • An implementation of the above step 205 is to determine the m-th accuracy differentiable relationship information of the l-th selection block according to the score weights of the N candidate operators of each selection block and the accuracy of each neural network model , The accuracy of each neural network model is determined according to the target data set.
  • the sampling probability of the candidate operators of each selection block of each neural network model is determined (
  • the value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N) and the sampling probability of each candidate operator of each selection block is differentiable with respect to the score variable Relationship information
  • the sampling probability of the candidate operator of the L-1 selection block of each neural network model the sampling probability of the m-th candidate operator of the l selection block, the differentiable relationship information about the scoring variable and each neural network model
  • the delay determines the m-th delay differentiable relationship information of the l-th selection block, and the L-1 selection blocks include the selection blocks other than the l-th selection block among the L selection blocks.
  • the value of l is a positive integer greater than or equal to 1 and less than or equal to L.
  • Candidate operators selected for the lth layer of the neural network model ⁇ k The sampling probability.
  • x l represents the output of the selection block l (that is, the lth layer)
  • p l,m represents the probability of selecting the m-th candidate operator in the l-th selection block.
  • Step 206 Update the score weights of multiple candidate operators according to the differentiable relationship information of the loss function on the score variable.
  • the differentiable relationship information of the loss function on the score variable can be obtained, and then the score weights of multiple candidate operators can be updated according to the differentiable relationship information, so as to optimize the score weights of the candidate operators based on the loss function.
  • Step 207 Generate a target neural network model according to the updated scoring weight and the updated internal parameters.
  • the internal parameters of the candidate operator in the candidate model and the score weight of the candidate operator can be updated through the above steps, and then the training device 220 can update In the latter candidate model, candidate operators are selected to form the target neural network model.
  • Step 208 Send target model configuration information, where the target model configuration information is used to configure the target neural network model.
  • step 208 refers to step 105 of the embodiment shown in FIG. 6, which will not be repeated here.
  • the loss function is determined according to the delay adjustment parameters.
  • the loss function is a joint function of accuracy and delay.
  • the data set updates the internal parameters of the candidate operators, determines multiple neural network models according to the updated internal parameters and the score weights of multiple candidate operators, and determines each neural network model according to the score weights of the multiple candidate operators.
  • the accuracy rate and the delay of each neural network model determine the differentiable relationship information of the loss function on the scoring variable, and update the score weights of multiple candidate operators according to the differentiable relationship information of the loss function on the scoring variable.
  • the latter scoring weights and the updated internal parameters generate the target neural network model.
  • the differentiable relationship information of the loss function on the scoring variables is determined, and the scoring weights of the candidate operators are optimized according to the differentiable relationship information, which can improve
  • the efficiency of generating the target neural network model reduces the consumption of computing resources and time.
  • FIG. 8 is a flowchart of another method for generating a target neural network model according to an embodiment of the application.
  • the method of this embodiment can be processed by the training device 220 or the training device 220 shown in FIG. 2A It may be executed by the server 420 or the processor of the server 420 as shown in FIG. 2B.
  • the method in this embodiment may include:
  • Step 301 Obtain score weights, target data sets, and time delay adjustment parameters of multiple candidate operators.
  • Step 302 Determine a loss function according to the delay adjustment parameter, where the loss function is a joint function of accuracy and delay.
  • Step 303 Use the target data set to train the first neural network model, and update the internal parameters of the L candidate operators according to the training result.
  • the first neural network model is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block.
  • each candidate operator in the candidate operator of each selection block has an equal probability of being selected as a candidate operator of the first neural network model.
  • Step 304 Determine multiple neural network models according to the updated internal parameters and the score weights of multiple candidate operators.
  • Step 305 Determine the differentiable relationship information of the loss function with respect to the scoring variable according to the scoring weight of the multiple candidate operators, the accuracy rate of each neural network model, and the time delay of each neural network model.
  • Step 306 Update the score weights of multiple candidate operators according to the differentiable relationship information.
  • Step 307 Determine whether the first operator exists according to the updated scoring weight and the preset condition, if it exists, execute step 308, and if it does not exist, execute step 309.
  • the first operator is one or more of the candidate operators of the L selection blocks.
  • the preset condition may be that the scoring weight is less than the preset threshold.
  • the candidate operator corresponding to the updated scoring weight is a first operator.
  • Step 308 Eliminate the first operator from the candidate operators of the selection block corresponding to the first operator.
  • the method of excluding the first operator may be to clear the internal parameters and the score weight of the first operator.
  • Step 309 It is judged whether the cut-off condition is met, if yes, step 310 is executed, and if not, step 303 is executed.
  • step 303 when the cut-off condition is not met and step 303 is executed, the L candidate operators constituting the first neural network model come from the remaining candidate operators after excluding the first operator.
  • Step 310 Generate a target neural network model according to the updated scoring weight and the updated internal parameters.
  • the candidate operator with the largest scoring weight in the selection block is selected as a candidate operator of the target neural network model.
  • the efficiency of generating the target neural network model can be improved, and the consumption of computing resources and time can be reduced.
  • the computational resources and time spent in obtaining the target neural model can be reduced.
  • the candidate model can be as shown in Fig. 9, input x i , pass selection block 1, output x j , pass selection block 2, output x k .
  • One optimization process for updating the internal parameters of candidate operators can be to randomly select a candidate operator from two selection blocks to form a neural network model, so as to select candidate operator 3 in selection block 1, and select in selection block 2.
  • Candidate operator 2 is taken as an example to illustrate.
  • the composed neural network model can be as shown in Figure 10, and the neural network model shown in Figure 10 can be trained using the target data set to update the candidate operator 3 of selection block 1. And select the internal parameters in the candidate operator 2 of block 2.
  • the scoring weights ( ⁇ 1,1 , ⁇ 1,2) of each candidate operator in the selection block 1 and the selection block 2 , ⁇ 1,3 and ⁇ 1,4 , ⁇ 2,1 , ⁇ 2,2 , ⁇ 2,3 and ⁇ 2,4 ) are updated for illustration, as shown in Figure 11A and Figure 11B, the target neural network
  • the model generation device can include an internal parameter optimization module, a differentiable relationship determination module, and a dynamic path decision module.
  • the internal parameter optimization module can update the candidate operators of the selection block 1 and the candidate operators of the selection block 2 in the manner described above.
  • the differentiable relationship determination module sends the neural network model configuration information to the speed measuring device, so that the speed measuring device restores the corresponding neural network model ⁇ k , and the speed measuring device measures the time delay t( ⁇ k ) of the neural network model ⁇ k, The time delay t( ⁇ k ) is fed back to the differentiable relationship determination module.
  • the differentiable relationship determination module is based on the time delay t( ⁇ k ) of each neural network model, the accuracy of each neural network model, and each neural network model.
  • the scoring weights of the candidate operators and the scoring weights of each candidate operator use formula (3) to formula (5) to obtain the delay function about ⁇ 1,1 , ⁇ 1,2 , ⁇ 1,3 , ⁇ 1, 4.
  • Derivative values of ⁇ 2,1 , ⁇ 2,2 , ⁇ 2,3 and ⁇ 2,4 use formula (6) to obtain the accuracy function with respect to ⁇ 1,1 , ⁇ 1,2 , ⁇ 1,3 .
  • Derivative values of ⁇ 1,4 , ⁇ 2,1 , ⁇ 2,2 , ⁇ 2,3 and ⁇ 2,4 according to formula (1), the loss function is obtained according to ⁇ 1,1 , ⁇ 1,2 , ⁇ 1 ,3 , ⁇ 1,4 , ⁇ 2,1 , ⁇ 2,2 , ⁇ 2,3 and ⁇ 2,4 are the derivative values, and the loss function is related to ⁇ 1,1 , ⁇ 1,2 , ⁇ 1,3
  • the derivative values of, ⁇ 1,4 , ⁇ 2,1 , ⁇ 2,2 , ⁇ 2,3 and ⁇ 2,4 are provided to the dynamic path decision module, and the dynamic path decision module converts ⁇ 1,1 , ⁇ 1,2 , ⁇ 1,3 , ⁇ 1,4 , ⁇
  • the optimized score weights are ⁇ ′ 1,1 , ⁇ ′ 1,2 , ⁇ ′ 1,3 , ⁇ ′ 1,4 , ⁇ ′ 2,1 , ⁇ ′ 2,2 , ⁇ ′ 2,3 And ⁇ ′ 2,4 .
  • the device for generating the target neural network model may be the training device 220 or the processor of the training device 220 as shown in FIG. 2A, or the server 420 or the processor of the server 420 as shown in FIG. 2B.
  • the scoring weight of each candidate operator in the selection block 1 and the selection block 2 is optimized, and the optimized scoring weight is minimized at the same time.
  • the accuracy error and the average network delay are reduced, thereby improving the accuracy of the target neural network model constructed based on the candidate model and reducing the network delay.
  • FIG. 12 is a flowchart of another method for generating a target neural network model according to an embodiment of the application.
  • the embodiment of the application relates to a device for generating a target neural network model and a speed measuring device.
  • the device for generating the target neural network model may be the processor of the training device 220 or the training device 220 as shown in FIG. 2A, or the server 420 or the processor of the server 420 as shown in FIG. 2B.
  • the speed measurement device may be a server or an internal chip of a server, or a terminal device or an internal chip of a terminal device.
  • the terminal device may be a wireless communication device or an Internet of Things (IoT) device. , Wearable devices or vehicle-mounted devices, mobile terminals, Customer Premise Equipment (CPE), etc.
  • the method for generating the target neural network model of the embodiment of the present application may further include:
  • Step 401 The generating device of the target neural network model obtains the identification information of the speed measuring device.
  • the identification information is used to identify the speed measurement device, and the identification information may be input by the user.
  • the user provides the identification information to the generating device of the target neural network model through the client device 240.
  • the identification information may also be determined by the device for generating the target neural network model according to the target training set. For example, if the target training set is a training set for vehicle detection based on machine vision, the device for generating the target neural network model may be determined according to the target training set. In the application scenario, it is determined that the identification information of the speed measuring device is the identification information of the vehicle-mounted equipment.
  • the identification information of the speed measurement device can be the host name (Hostname), Media Access Control (MAC) address, IP address (Internet Protocol Address), user agent (user agent) information, domain name system (Domain Name System, DNS) ) Any one or a combination of information, International Mobile Subscriber Identity (IMSI).
  • Hostname host name
  • MAC Media Access Control
  • IP address Internet Protocol Address
  • user agent user agent
  • domain name system Domain Name System, DNS
  • Step 402 The device for generating the target neural network model sends the neural network model configuration information to the speed measuring device according to the identification information.
  • the neural network model configuration information is used to configure multiple neural network models.
  • the neural network model configuration information is used to configure multiple neural network models in step 101 of the embodiment shown in FIG. 6.
  • the neural network model configuration information may include a plurality of network structure coding information, and each network structure coding information is used to configure a connection relationship between various operators and operators of a neural network model.
  • the network structure coding information of the neural network model shown in Fig. 10 can be 013 122, where 013 indicates that the operator between input x i (node 0) to x j (node 1) is candidate operator 3. 122 indicates that the operator between x j (node 1) and output x k (node 2) is candidate operator 2.
  • the network structure coding information of the neural network model shown in Figure 10 can be 0010 0100, where 0010 corresponds to each candidate operator in selection block 1, 0 means not selected, 1 means selected, and 0100 corresponds to selection For each candidate operator in block 2, 0 means not selected, and 1 means selected.
  • the delay of the neural network model is usually related to the structure of the neural network model, that is, it is related to the connection relationship between the various operators of the neural network model and the operators.
  • random initialization parameters can be used for the internal parameters of each operator.
  • Preset parameters can also be used, which can be flexibly set according to requirements.
  • Step 403 The speed measuring device restores multiple target neural network models according to the neural network model configuration information, and measures the time delay of each target neural network model.
  • the speed measuring device can restore multiple neural network models in step 101 of the embodiment shown in FIG. 6 according to the neural network model configuration information. And measure the time delay of each target neural network model.
  • Step 404 The speed measuring device sends the time delay of each neural network model to the generating device of the target neural network model.
  • the target neural network model generating device receives the time delay of each neural network model sent by the speed measuring device.
  • the time delay of each neural network model may include model identification information and time delay t( ⁇ k ), and the model identification information is used to represent the neural network model ⁇ k .
  • the target neural network model generation device can determine the differentiable relationship information of the loss function with respect to the scoring variable through the above step 102, and then use the differentiable relationship information to optimize the score weight of each candidate operator to generate the target based on the optimized score weight.
  • Neural network model can determine the differentiable relationship information of the loss function with respect to the scoring variable through the above step 102, and then use the differentiable relationship information to optimize the score weight of each candidate operator to generate the target based on the optimized score weight.
  • Step 404' the speed measuring device determines the differentiable relationship information of the delay function on the score variable according to the score weights of the multiple candidate operators of each neural network model and the delay of each neural network model, and the speed measuring device sends the target neural network to the target neural network.
  • the model generating device sends the differentiable relationship information of the delay function on the scoring variable.
  • the target neural network model generating device receives the differentiable relationship information of the time delay function on the scoring variable sent by the speed measuring device, and the target neural network model generating device determines the loss function according to the differentiable relationship information of the delay function on the scoring variable The differentiable relationship information of the scoring variable is then used to optimize the scoring weight of each candidate operator to generate a target neural network model based on the optimized scoring weight.
  • step 404 or step 404' can be executed after step 403.
  • the differentiable relationship information of the loss function with respect to the scoring variable is determined based on the measurement result of the speed measuring device, and then the differentiable relationship information is used to optimize each candidate operation
  • the efficiency of generating the target neural network model can be improved, and the consumption of computing resources and time can be reduced.
  • FIG. 13 is a diagram of a chip hardware structure provided by an embodiment of the application.
  • the algorithm based on the target neural network model of the embodiment of the present application can be implemented in the NPU chip shown in FIG. 13, and the target neural network model can be the target neural network model obtained by the above method embodiment.
  • Neural Network Processor NPU 50 NPU is mounted on the main CPU (Host CPU) as a coprocessor, and the Host CPU distributes tasks.
  • the core part of the NPU is the arithmetic circuit 50.
  • the arithmetic circuit 503 is controlled by the controller 504 to extract matrix data from the memory and perform multiplication operations.
  • the arithmetic circuit 503 includes multiple processing units (Process Engine, PE). In some implementations, the arithmetic circuit 503 is a two-dimensional systolic array. The arithmetic circuit 503 may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 503 is a general-purpose matrix processor.
  • the arithmetic circuit fetches the corresponding data of matrix B from the weight memory 502 and caches it on each PE in the arithmetic circuit.
  • the arithmetic circuit takes the matrix A data and matrix B from the input memory 501 to perform matrix operations, and the partial or final result of the obtained matrix is stored in the accumulator 508.
  • the unified memory 506 is used to store input data and output data.
  • the weight data directly passes through the storage unit to access the controller 505 Direct Memory Access Controller, and the DMAC is transferred to the weight memory 502.
  • the input data is also transferred to the unified memory 506 through the DMAC.
  • the BIU is the Bus Interface Unit, that is, the bus interface unit 510, which is used for the interaction between the AXI bus and the DMAC and the instruction fetch buffer 509.
  • the bus interface unit 510 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 509 to obtain instructions from an external memory, and is also used for the storage unit access controller 505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • BIU Bus Interface Unit
  • the DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 506 or to transfer the weight data to the weight memory 502 or to transfer the input data to the input memory 501.
  • the vector calculation unit 507 has multiple arithmetic processing units, if necessary, further processing the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison and so on.
  • the vector calculation unit 507 can store the processed output vector in the unified buffer 506.
  • the vector calculation unit 507 may apply a nonlinear function to the output of the arithmetic circuit 503, such as a vector of accumulated value, to generate an activation value.
  • the vector calculation unit 507 generates a normalized value, a combined value, or both.
  • the processed output vector can be used as an activation input to the arithmetic circuit 503, for example for use in a subsequent layer in a neural network.
  • the instruction fetch buffer 509 connected to the controller 504 is used to store instructions used by the controller 504;
  • the unified memory 506, the input memory 501, the weight memory 502, and the instruction fetch memory 509 are all On-Chip memories.
  • the external memory is private to the NPU hardware architecture.
  • the calculation of each layer in the target neural network model can be executed by the vector calculation unit 507.
  • the target neural network model obtained in the foregoing embodiment of the present application can be applied to a server, a wearable device, a vehicle, or an automatic driving system, etc., to process input data and output a result based on the target neural network model.
  • an embodiment of the present application provides a system architecture 300.
  • the execution device 210 is implemented by one or more servers, and optionally, it cooperates with other computing devices, such as data storage, routers, load balancers and other devices; the execution device 210 can be arranged on one physical site or distributed in multiple On the physical site.
  • the execution device 210 can use the data in the data storage system 250, or call the program code in the data storage system 250 to implement the processing method based on the above-mentioned target neural network model, and provide services for users.
  • Each local device can represent any computing device, such as personal computers, computer workstations, smart phones, tablets, smart cameras, smart cars or other types of cellular phones, media consumption devices, wearable devices, set-top boxes, game consoles, etc.
  • the local device of each user can interact with the execution device 210 through a communication network of any communication mechanism/communication standard.
  • the communication network can be a wide area network, a local area network, a point-to-point connection, etc., or any combination thereof.
  • one or more aspects of the execution device 210 may be implemented by each local device.
  • the local device 301 may provide the execution device 210 with local data or feed back calculation results.
  • the execution device 210 can also be implemented by a local device.
  • the local device 301 implements the functions of the device 210 and provides services for its own users, or provides services for users of the local device 302.
  • FIG. 15 is a schematic block diagram of a device 1600 for generating a target neural network model provided by this application.
  • the generating device 1600 of the communication target neural network model includes an acquisition module 1601, a model generation module 1602, and a transceiver module 1602.
  • the device 1600 for generating a target neural network model has the function of a training device or a server in the method embodiment.
  • the device 1600 for generating a target neural network model may execute the method of any one of the embodiments in FIGS. 6 to 8, or execute the method executed by the device for generating a target neural network model in the embodiment of FIG. 12.
  • the units of the communication device 500 are respectively used to perform the following operations and/or processing.
  • the obtaining module 1601 is used to obtain the scoring weights of multiple candidate operators and multiple neural network models.
  • the model generation module 1602 is used to determine the differentiable relationship information of the loss function with respect to the scoring variables according to the scoring weights of the multiple candidate operators, the accuracy of each neural network model, and the time delay of each neural network model.
  • the loss function is a joint function of accuracy and time delay.
  • the model generation module 1602 is further configured to update the score weights of the multiple candidate operators according to the differentiable relationship information.
  • the model generation module 1602 is also used to generate a target neural network model according to the updated scoring weight.
  • the transceiver module 1603 is configured to send target model configuration information, where the target model configuration information is used to configure the target neural network model
  • each neural network model of the plurality of neural network models is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block, and
  • the differentiable relationship information of the loss function on the scoring variable includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block;
  • the model generation module 1602 is used to: according to the L* N differentiable relation information, respectively update the score weight of the candidate operator corresponding to each differentiable relation information; where L and N are any positive integers.
  • the acquisition module 1601 is further configured to: acquire a target data set and a delay adjustment parameter; determine the loss function according to the delay adjustment parameter; update the candidate operator according to the target data set
  • the internal parameters of; the multiple neural network models are determined according to the updated internal parameters and the score weights of the multiple candidate operators.
  • the model generation module 1602 is configured to determine the mth accuracy of the lth selection block according to the score weights of the N candidate operators of each selection block and the accuracy rate of each neural network model. Rate differentiable relationship information, the accuracy rate of each neural network model is determined according to the target data set; each neural network model is determined according to the score weight of the N candidate operators of each selection block The sampling probability of the operator of the selection block and the sampling probability of each candidate operator of each selection block.
  • the L-1 selection blocks include selection blocks other than the l-th selection block among the L selection blocks; and the m-th accuracy rate of the l-th selection block may be differentiable relation information And the m-th time delay differentiable relationship information of the l-th selection block to determine the m-th differentiable relationship information of the l-th selection block.
  • the value of l is a positive integer greater than or equal to 1 and less than or equal to L
  • the value of m is a positive integer greater than or equal to 1 and less than or equal to N.
  • the model generation module 1602 is configured to: respectively input the L*N differentiable relationship information and the score weight of each candidate operator into the stochastic gradient descent algorithm, and output each updated The scoring weight of each candidate operator in the selection block.
  • the acquisition module 1601 is configured to: use the target data set to train a first neural network model, the first neural network model is determined by L candidate operators, and each candidate operator is a corresponding Select one of the N candidate operators of the block; update the internal parameters of the L candidate operators according to the training result; where L is any positive integer.
  • the model generation module 1602 is further configured to determine whether there is a first operator based on the updated scoring weight and a preset condition, and the first operator is the value of the L selection blocks. One or more of the candidate operators; if there is a first operator, remove the first operator from the candidate operators of the selection block corresponding to the first operator.
  • the model generation module 1602 is further configured to determine whether a cut-off condition is satisfied after the score weights of the multiple candidate operators are updated according to the differentiable relationship information, if the cut-off condition is not satisfied , Then execute the step of training the first neural network model using the target data set; if the cut-off condition is met, execute the step of generating the target neural network model according to the updated scoring weight.
  • each candidate operator of each selection block has an equal probability of being selected as an operator of the first neural network model.
  • the acquisition module 1601 is further configured to: acquire identification information of the speed measurement device; according to the identification information, send neural network model configuration information to the speed measurement device through the transceiver module 1603, and the neural network
  • the model configuration information is used to configure the multiple neural network models; the transceiver module 1603 is also used to receive the time delay of each neural network model sent by the speed measurement device.
  • the neural network model configuration information includes a plurality of network structure coding information, and each network structure coding information is used to configure a connection relationship between various operators of a neural network model and the operators.
  • the model generation module 1602 is configured to select, in each selection block, the candidate operator with the largest score in the selection block as an operator of the target neural network model, and the operation The internal parameters of the symbol are the updated internal parameters.
  • the acquiring module 1601 is configured to: receive the target data set and the delay adjustment parameter input by the user through the transceiver module 1603; or, receive the data input by the user through the transceiver module 1603
  • the target data set is determined according to the data set selection information based on the set selection information and the delay adjustment parameters; or, the data set selection information and the expected complexity information input by the user are received through the transceiver module 1603, and the The data set selection information determines the target data set, and the delay adjustment parameter is determined according to the expected complexity information.
  • the device 1600 for generating the target neural network model may also have other functions in the method embodiment at the same time.
  • the acquisition module 1601 and the model generation model 1602 may be a processor
  • the transceiver module 1603 may be a transceiver.
  • the transceiver includes a receiver and a transmitter, and has both sending and receiving functions.
  • the acquisition module 1601 and the model generation model 1602 may be a processing device, and the functions of the processing device may be partially or fully implemented by software.
  • the functions of the processing device may be partially or fully implemented by software.
  • the processing device may include a memory and a processor.
  • the memory is used to store a computer program, and the processor reads and executes the computer program stored in the memory to execute the steps in each method embodiment.
  • the processing device includes a processor.
  • the memory for storing the computer program is located outside the processing device, and the processor is connected to the memory through a circuit/wire to read and execute the computer program stored in the memory.
  • the functions of the processing device may all be implemented by hardware.
  • the processing device may include an input interface circuit, a logic circuit, and an output interface circuit.
  • the input interface circuit is used to obtain the score weights of multiple candidate operators and multiple neural network models;
  • the logic circuit is used to obtain the score weights of the multiple candidate operators and the accuracy of each neural network model.
  • the rate and the delay of each neural network model determine the differentiable relationship information of the loss function with respect to the scoring variable, and the loss function is a joint function of the accuracy rate and the delay; the multiple candidate operations are updated according to the differentiable relationship information
  • the target neural network model is generated according to the updated score weight; the output interface circuit is used to send target model configuration information, and the target model configuration information is used to configure the target neural network model.
  • the device 1600 for generating the target neural network model may be a chip.
  • the transceiver module 1601 may specifically be a communication interface or a transceiver circuit.
  • FIG. 16 is a schematic structural diagram of an electronic device 1700 provided by this application.
  • the electronic device 1700 includes a processor 1701 and a transceiver 1702.
  • the electronic device 1700 further includes a memory 1703.
  • the processor 1701, the transceiver 1702, and the memory 1703 can communicate with each other through an internal connection path to transfer control signals and/or data signals.
  • the memory 1703 is used to store computer programs.
  • the processor 1701 is configured to execute the computer program stored in the memory 1703, so as to realize the functions of the device 1600 for generating the target neural network model in the foregoing device embodiment.
  • the processor 1701 may be used to perform the operations and/or processing performed by the acquisition module 1601 and the model generation model 1602 described in the apparatus embodiment (for example, FIG. 16), and the transceiver 1702 is used to perform the operations and/or processing performed by the transceiver module 1603. Perform operations and/or processing.
  • the memory 1703 may also be integrated in the processor 1701 or independent of the processor 1701.
  • the electronic device of this embodiment can execute the method for generating the target neural network model of the foregoing method embodiment, and its technical principles and technical effects can be referred to the explanation of the foregoing embodiment, which will not be repeated here.
  • the present application also provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium.
  • the computer program When the computer program is executed by a computer, the computer executes the steps and/or processing in any of the above-mentioned method embodiments. .
  • the computer program product includes computer program code.
  • the computer program code runs on a computer, the computer executes the steps and/or processing in any of the foregoing method embodiments.
  • the application also provides a chip including a processor.
  • the memory for storing the computer program is provided independently of the chip, and the processor is used to execute the computer program stored in the memory to execute the steps and/or processing in any method embodiment.
  • the chip may also include a memory and a communication interface.
  • the communication interface may be an input/output interface, a pin, an input/output circuit, or the like.
  • the processor mentioned in the above embodiments may be an integrated circuit chip with signal processing capability.
  • the steps of the foregoing method embodiments can be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
  • the processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP digital signal processor
  • ASIC application-specific integrated circuit
  • FPGA field programmable gate array
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware encoding processor, or executed and completed by a combination of hardware and software modules in the encoding processor.
  • the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
  • the memory mentioned in the above embodiments may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • dynamic RAM dynamic RAM
  • DRAM dynamic random access memory
  • synchronous dynamic random access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous connection dynamic random access memory serial DRAM, SLDRAM
  • direct rambus RAM direct rambus RAM
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disks or optical disks and other media that can store program codes. .

Abstract

A method and apparatus for generating a target neural network model in the field of artificial intelligence. The method comprises: acquiring scoring weight values of a plurality of candidate operators and a plurality of neural network models; according to the scoring weight values of the plurality of candidate operators, the precision rate of each neural network model, and the delay of each neural network model, determining differentiable relationship information of a loss function with respect to scoring variables, the loss function being a joint function of the precision rates and the delays; updating the scoring weight values of the plurality of candidate operators according to the differentiable relationship information; generating a target neural network model according to the updated scoring weight values; and sending target model configuration information, the target model configuration information being used to configure the target neural network model. The described method may improve the efficiency of generating a target neural network model and reduce the consumption of computing resources and time.

Description

目标神经网络模型的生成方法和装置Method and device for generating target neural network model
本申请要求于2019年8月30日提交中国专利局、申请号为201910814558.6、申请名称为“目标神经网络模型的生成方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201910814558.6, and the application name is "Method and Apparatus for Generating Target Neural Network Model" on August 30, 2019, the entire content of which is incorporated herein by reference. Applying.
技术领域Technical field
本申请涉及人工智能领域,特别涉及一种目标神经网络模型的生成方法和装置。This application relates to the field of artificial intelligence, and in particular to a method and device for generating a target neural network model.
背景技术Background technique
人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能领域的研究包括机器人,自然语言处理,计算机视觉,决策与推理,人机交互,推荐与搜索,AI基础理论等。Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, and basic AI theories.
自动化机器学习(Auto Machine Learning,Automl)是一类自动化设计卷积神经网络的方法,向Automl系统输入目标数据集和评价标准,Automl系统会输出目标神经网络。AutoMachine Learning (Automl) is a method of automatically designing convolutional neural networks. The target data set and evaluation criteria are input to the Automl system, and the Automl system will output the target neural network.
Automl系统在确定目标神经网络过程中,需要生成不同的神经网络模型,并对每个神经网络模型进行单独训练,得到每个神经网络模型的准确率和时延,将该准确率和时延作为反馈信息,根据反馈信息更新神经网络模型的参数和生成规则,以确定目标神经网络。In the process of determining the target neural network, the Automl system needs to generate different neural network models, and separately train each neural network model to obtain the accuracy and delay of each neural network model, and use the accuracy and delay as The feedback information is used to update the parameters and generation rules of the neural network model according to the feedback information to determine the target neural network.
上述确定目标神经网络的方式,需要采样得到大量神经网络模型进行训练,所消耗的计算资源和时间较多。The above method of determining the target neural network requires sampling to obtain a large number of neural network models for training, which consumes more computing resources and time.
发明内容Summary of the invention
本申请提供一种目标神经网络模型的生成方法和装置,以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。The present application provides a method and device for generating a target neural network model to improve the efficiency of generating a target neural network model and reduce the consumption of computing resources and time.
第一方面,本申请实施例提供一种目标神经网络模型的生成方法,该方法可以包括:获取多个候选操作符的评分权值和多个神经网络模型;根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,所述损失函数为准确率和时延的联合函数;根据所述可微关系信息更新所述多个候选操作符的评分权值;根据更新后的评分权值生成目标神经网络模型;发送目标模型配置信息,所述目标模型配置信息用于配置所述目标神经网络模型。In the first aspect, an embodiment of the present application provides a method for generating a target neural network model. The method may include: obtaining score weights of a plurality of candidate operators and a plurality of neural network models; The scoring weight, the accuracy rate of each neural network model, and the delay of each neural network model determine the differentiable relationship information of the loss function with respect to the scoring variable, and the loss function is a joint function of the accuracy rate and the delay; Differentiable relationship information updates the score weights of the multiple candidate operators; generates a target neural network model according to the updated score weights; sends target model configuration information, the target model configuration information is used to configure the target neural network model.
在本申请的方案中,通过确定损失函数关于评分变量的可微关系信息,根据该可微关系信息优化候选操作符的评分权值,可以提升基于候选操作符的评分权值生成目标神经网络模型的效率,减少计算资源和时间的消耗。In the solution of the present application, by determining the differentiable relationship information of the loss function on the scoring variable, and optimizing the scoring weight of the candidate operator based on the differentiable relationship information, the target neural network model can be generated based on the scoring weight of the candidate operator. Efficiency, reducing the consumption of computing resources and time.
在一种可能的设计中,所述多个神经网络模型中的每个神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个,所述损失函数关于评分变量的可微关系信息包括L*N个可微关系信息,每个可微关系信息对应一个选择块的一个候选操作符;所述根据所述可微关系信息更新所述多个候选操作符的评分权值,包括:根据所述L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值;其中,L和N为任意正整数。In a possible design, each neural network model of the plurality of neural network models is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block, The differentiable relationship information of the loss function with respect to the scoring variable includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block; the update of the differentiable relationship information is based on the differentiable relationship information. The scoring weights of multiple candidate operators include: updating the scoring weights of the candidate operators corresponding to each differentiable relationship information according to the L*N differentiable relationship information; where L and N are any positive Integer.
在本申请的方案中,通过确定每一个选择块的每一个候选操作对应的可微关系信息,根据该可微关系信息优化每一个候选操作符的评分权值,可以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。In the solution of this application, by determining the differentiable relationship information corresponding to each candidate operation of each selection block, and optimizing the scoring weight of each candidate operator according to the differentiable relationship information, the generation of the target neural network model can be improved. Efficiency, reducing the consumption of computing resources and time.
在一种可能的设计中,所述方法还包括:获取目标数据集和时延调节参数;根据所述时延调节参数确定所述损失函数;根据所述目标数据集更新所述候选操作符的内部参数;根据更新后的内部参数和所述多个候选操作符的评分权值确定所述多个神经网络模型。In a possible design, the method further includes: acquiring a target data set and a delay adjustment parameter; determining the loss function according to the delay adjustment parameter; updating the candidate operator's value according to the target data set Internal parameters; the multiple neural network models are determined according to the updated internal parameters and the score weights of the multiple candidate operators.
在本申请的方案中,通过获取目标数据集和时延调节参数,以使得生成的目标神经网络模型满足相应的功能需求,根据目标数据集更新候选操作符的内部参数,根据更新后的内部参数和候选操作的评分权值确定多个神经网络模型,根据候选操作符的评分权值、每个神经网络模型的准确率和时延确定损失函数关于评分变量的可微关系信息,根据该可微关系信息优化候选操作符的评分权值,从而实现优化候选操作符的内部参数和评分权值,可以提升基于候选操作符的评分权值生成目标神经网络模型的效率,减少计算资源和时间的消耗。In the solution of this application, the target data set and time delay adjustment parameters are obtained, so that the generated target neural network model meets the corresponding functional requirements, the internal parameters of the candidate operators are updated according to the target data set, and the internal parameters of the candidate operators are updated according to the updated internal parameters. And the scoring weights of the candidate operations to determine multiple neural network models. According to the scoring weights of the candidate operators, the accuracy and delay of each neural network model, the differentiable relationship information of the loss function on the scoring variables is determined, and according to the differentiable Relational information optimizes the scoring weights of the candidate operators, thereby optimizing the internal parameters and scoring weights of the candidate operators, which can improve the efficiency of generating the target neural network model based on the scoring weights of the candidate operators, and reduce the consumption of computing resources and time .
在一种可能的设计中,所述根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定所述损失函数关于评分变量的可微关系信息,包括:根据每个选择块的N个候选操作符的评分权值和每个神经网络模型的准确率确定第l个选择块的第m个准确率可微关系信息,所述每个神经网络模型的准确率为根据所述目标数据集确定的;根据每个选择块的N个候选操作符的评分权值确定每个神经网络模型的每个选择块的操作符的采样概率和每个选择块的每个候选操作符的采样概率关于评分变量的可微关系信息;根据每个神经网络模型的L-1个选择块的操作符的采样概率、第l个选择块的第m个候选操作符的采样概率关于评分变量的可微关系信息和所述每个神经网络模型的时延确定所述第l个选择块的第m个时延可微关系信息,所述L-1个选择块包括L个选择块中除所述第l个选择块之外的选择块;根据所述第l个选择块的第m个准确率可微关系信息和所述第l个选择块的第m个时延可微关系信息,确定所述第l个选择块的第m个可微关系信息。其中,l取值为大于等于1且小于等于L的正整数,m取值为大于等于1且小于等于N的正整数。In a possible design, the accuracy of each neural network model and the delay of each neural network model are used to determine the feasibility of the loss function with respect to the scoring variable according to the scoring weights of the multiple candidate operators. The micro-relation information includes: determining the m-th accuracy differentiable relation information of the l-th selection block according to the score weights of the N candidate operators of each selection block and the accuracy of each neural network model. The accuracy of each neural network model is determined based on the target data set; the sampling probability of each selection block of each neural network model is determined according to the score weights of the N candidate operators of each selection block and The sampling probability of each candidate operator of each selection block is related to the differentiable relationship information of the scoring variable; according to the sampling probability of the operator of the L-1 selection block of each neural network model, the m-th selection block of the l The differentiable relationship information of the sampling probabilities of the candidate operators with respect to the scoring variable and the delay of each neural network model determine the m-th delay differentiable relationship information of the l-th selection block, the L-1 Selection blocks include selection blocks other than the lth selection block among the L selection blocks; according to the mth accuracy rate of the lth selection block, the differentiable relationship information and the value of the lth selection block The m-th time delay differentiable relationship information determines the m-th differentiable relationship information of the l-th selection block. Among them, the value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N.
在本申请的方案中,优化后的评分权值使得同时最小化准确率误差和平均网络时延,进而提升基于候选模型所构建的目标神经网络模型的准确率并且减少网络时延。In the solution of the present application, the optimized scoring weight minimizes the accuracy rate error and the average network delay at the same time, thereby improving the accuracy of the target neural network model constructed based on the candidate model and reducing the network delay.
在一种可能的设计中,所述根据所述L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值,包括:分别将所述L*N个可微关系信息和每个候选操作符的评分权值输入至随机梯度下降算法,输出更新后的每个选择块中每个候选操作符的评分权值。In a possible design, the updating the score weights of the candidate operators corresponding to each differentiable relationship information according to the L*N differentiable relationship information includes: separately updating the L*N differentiable relationship information Differentiable relationship information and the score weight of each candidate operator are input to the stochastic gradient descent algorithm, and the updated score weight of each candidate operator in each selection block is output.
在一种可能的设计中,所述根据所述目标数据集更新所述候选操作符的内部参数,包 括:使用所述目标数据集训练第一神经网络模型,所述第一神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个;根据训练结果,更新所述L个候选操作符的内部参数;其中,L为任意正整数。In a possible design, the updating the internal parameters of the candidate operator according to the target data set includes: using the target data set to train a first neural network model, and the first neural network model is determined by L The number of candidate operators is determined, and each candidate operator is one of the N candidate operators of the corresponding selection block; the internal parameters of the L candidate operators are updated according to the training result; where L is any positive integer.
在一种可能的设计中,所述方法还包括:根据所述更新后的评分权值和预设条件,确定是否存在第一操作符,所述第一操作符为L个选择块的候选操作符中的一个或多个;若存在第一操作符,则在第一操作符对应的选择块的候选操作符中剔除所述第一操作符。In a possible design, the method further includes: determining whether there is a first operator according to the updated scoring weight and a preset condition, and the first operator is a candidate operation for L selection blocks One or more of the operators; if there is a first operator, remove the first operator from the candidate operators of the selection block corresponding to the first operator.
在本申请的方案中,通过在候选操作符中剔除评分权值较小的候选操作符,可以减少得到目标神经模型所耗费的计算资源和时间。In the solution of the present application, by excluding candidate operators with a smaller score weight from the candidate operators, the computing resources and time spent in obtaining the target neural model can be reduced.
在一种可能的设计中,在所述根据所述可微关系信息更新所述多个候选操作符的评分权值之后,所述方法还包括:判断是否满足截止条件,若不满足截止条件,则执行使用所述目标数据集训练第一神经网络模型的步骤;若满足截止条件,则执行根据更新后的评分权值生成目标神经网络模型的步骤。In a possible design, after the update of the score weights of the multiple candidate operators according to the differentiable relationship information, the method further includes: judging whether a cut-off condition is satisfied, and if the cut-off condition is not satisfied, Then execute the step of training the first neural network model using the target data set; if the cut-off condition is met, execute the step of generating the target neural network model according to the updated scoring weight.
在一种可能的设计中,每个选择块的每个候选操作符被选取作为所述第一神经网络模型的一个操作符的概率相等。In a possible design, each candidate operator of each selection block has an equal probability of being selected as an operator of the first neural network model.
在本申请的方案中,通过将每个选择块的每个候选操作符被选取作为所述第一神经网络模型的一个操作符的概率设置为相等的,可以提升更新各个候选操作符的内部参数的均匀性。In the solution of this application, by setting the probability that each candidate operator of each selection block is selected as an operator of the first neural network model to be equal, the internal parameters of each candidate operator can be upgraded and updated The uniformity.
在一种可能的设计中,所述方法还包括:获取测速装置的标识信息;根据所述标识信息,向所述测速装置发送神经网络模型配置信息,所述神经网络模型配置信息用于配置所述多个神经网络模型;接收所述测速装置发送的每个神经网络模型的时延。In a possible design, the method further includes: acquiring identification information of the speed measuring device; sending neural network model configuration information to the speed measuring device according to the identification information, and the neural network model configuration information is used to configure the speed measuring device. The multiple neural network models; receiving the time delay of each neural network model sent by the speed measuring device.
在本申请的方案中,通过获取测速装置的标识信息,在相应的测速装置上测量每个神经网络模型的时延,基于此优化各个候选操作符的评分权值,可以使得生成的目标神经网络模型满足实际使用需求。In the solution of this application, by acquiring the identification information of the speed measuring device, measuring the time delay of each neural network model on the corresponding speed measuring device, and optimizing the score weight of each candidate operator based on this, the target neural network can be generated The model meets the actual needs of use.
在一种可能的设计中,所述神经网络模型配置信息包括多个网络结构编码信息,每个网络结构编码信息用于配置一个神经网络模型的各个操作符和操作符的连接关系。In a possible design, the neural network model configuration information includes multiple network structure coding information, and each network structure coding information is used to configure a neural network model of various operators and the connection relationship of the operators.
在一种可能的设计中,所述根据更新后的评分权值生成目标神经网络模型,包括:在每个选择块中选取所述选择块中评分权值最大的候选操作符作为所述目标神经网络模型的一个操作符,所述操作符的内部参数为更新后的内部参数。In a possible design, the generating the target neural network model according to the updated scoring weight includes: selecting, in each selection block, the candidate operator with the largest score in the selection block as the target neural network model. An operator of the network model, the internal parameter of the operator is the updated internal parameter.
在一种可能的设计中,所述获取目标数据集和时延调节参数,包括:接收用户输入的所述目标数据集和所述时延调节参数;或者,接收用户输入的数据集选择信息和所述时延调节参数,根据所述数据集选择信息确定所述目标数据集;或者,接收用户输入的数据集选择信息和期望复杂度信息,根据所述数据集选择信息确定所述目标数据集,根据所述期望复杂度信息确定所述时延调节参数。In a possible design, the obtaining the target data set and the time delay adjustment parameter includes: receiving the target data set and the time delay adjustment parameter input by the user; or, receiving the data set selection information and the time delay adjustment parameter input by the user. The delay adjustment parameter determines the target data set according to the data set selection information; or, receives data set selection information and expected complexity information input by a user, and determines the target data set according to the data set selection information , Determining the delay adjustment parameter according to the expected complexity information.
第二方面,本申请实施例提供一种目标神经网络模型的生成装置,所述目标神经网络模型的生成装置用于执行上述第一方面或第一方面的任一可能的实现方式中的目标神经网络模型的生成方法。具体地,所述目标神经网络模型的生成装置可以包括用于执行第一方面或第一方面的任一可能的实现方式中的目标神经网络模型的生成方法的模块。In a second aspect, an embodiment of the present application provides a device for generating a target neural network model. The device for generating a target neural network model is used to execute the target neural network in the first aspect or any possible implementation of the first aspect. The generation method of the network model. Specifically, the device for generating the target neural network model may include a module for executing the method for generating the target neural network model in the first aspect or any possible implementation of the first aspect.
第三方面,本申请实施例提供一种终端设备,所述终端设备包括存储器和处理器,所述存储器用于存储指令,所述处理器用于执行所述存储器存储的指令,并且对所述存储器 中存储的指令的执行使得所述处理器执行上述第一方面或第一方面的任一可能的实现方式中的目标神经网络模型的生成方法。In a third aspect, an embodiment of the present application provides a terminal device. The terminal device includes a memory and a processor. The memory is used to store instructions. The execution of the instructions stored in the processor enables the processor to execute the method for generating the target neural network model in the first aspect or any possible implementation of the first aspect.
第四方面面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现第一方面或第一方面的任一可能的实现方式中的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the first aspect or any one of the possible implementation manners of the first aspect is implemented. method.
第五方面,本申请提供一种计算机程序产品,该计算机程序产品包括指令,在计算机上运行时,使得计算机执行上述第一方面中任一项所述的方法。In a fifth aspect, the present application provides a computer program product. The computer program product includes instructions that, when run on a computer, cause the computer to execute the method described in any one of the above-mentioned first aspects.
第六方面,本申请提供一种芯片,包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于调用并运行所述存储器中存储的计算机程序,以执行如上述第一方面中任一项所述的方法。In a sixth aspect, the present application provides a chip including a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the above-mentioned first aspect The method of any one of.
本申请的目标神经网络模型的生成方法和装置,通过获取多个候选操作符的评分权值和多个神经网络模型,根据该多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,该损失函数为准确率和时延的联合函数,根据该可微关系信息更新该多个候选操作符的评分权值,根据更新后的评分权值生成目标神经网络模型,发送目标模型配置信息,该目标模型配置信息用于配置目标神经网络模型,本实施例通过确定损失函数关于评分变量的可微关系信息,根据该可微关系信息优化操作符的评分权值,可以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。The method and device for generating a target neural network model of the present application obtain the scoring weights of multiple candidate operators and multiple neural network models, according to the scoring weights of the multiple candidate operators and the accuracy of each neural network model. The rate and the delay of each neural network model determine the differentiable relationship information of the loss function on the score variable. The loss function is a joint function of accuracy and delay. The scores of the multiple candidate operators are updated according to the differentiable relationship information The weight value is to generate the target neural network model according to the updated scoring weight value, and send the target model configuration information. The target model configuration information is used to configure the target neural network model. In this embodiment, the differentiable relationship information about the scoring variable is determined by the loss function Optimize the scoring weight of the operator according to the differentiable relationship information, which can improve the efficiency of generating the target neural network model and reduce the consumption of computing resources and time.
附图说明Description of the drawings
图1为本申请实施例提供的一种人工智能主体框架示意图;FIG. 1 is a schematic diagram of an artificial intelligence main body framework provided by an embodiment of this application;
图2A为本申请实施例提供的一种应用环境示意图;2A is a schematic diagram of an application environment provided by an embodiment of the application;
图2B为本申请实施例提供的一种应用环境示意图;2B is a schematic diagram of an application environment provided by an embodiment of this application;
图3为本申请实施例提供的一种候选模型示意图;FIG. 3 is a schematic diagram of a candidate model provided by an embodiment of the application;
图4为本申请实施例提供的一种卷积神经网络结构示意图;4 is a schematic diagram of a convolutional neural network structure provided by an embodiment of the application;
图5为本申请实施例提供的一种卷积神经网络结构示意图;FIG. 5 is a schematic diagram of a convolutional neural network structure provided by an embodiment of this application;
图6为本申请实施例的一种目标神经网络模型的生成方法;Fig. 6 is a method for generating a target neural network model according to an embodiment of the application;
图7为本申请实施例的另一种目标神经网络模型的生成方法;FIG. 7 is another method for generating a target neural network model according to an embodiment of the application;
图8为本申请实施例的另一种目标神经网络模型的生成方法;FIG. 8 is another method for generating a target neural network model according to an embodiment of the application;
图9为本申请实施例提供的一种候选模型示意图;FIG. 9 is a schematic diagram of a candidate model provided by an embodiment of the application;
图10为本申请实施例提供的一种神经网络模型示意图;FIG. 10 is a schematic diagram of a neural network model provided by an embodiment of this application;
图11A为本申请实施例提供的一种目标神经网络模型的生成方法的示意图;FIG. 11A is a schematic diagram of a method for generating a target neural network model provided by an embodiment of this application;
图11B为本申请实施例提供的一种更新选择块1中的各个候选操作符的评分权值的示意图;FIG. 11B is a schematic diagram of updating the score weight of each candidate operator in the selection block 1 according to an embodiment of the application;
图12为本申请实施例的另一种目标神经网络模型的生成方法的流程图;FIG. 12 is a flowchart of another method for generating a target neural network model according to an embodiment of the application;
图13为本申请实施例提供的一种芯片的结构示意图;FIG. 13 is a schematic structural diagram of a chip provided by an embodiment of the application;
图14为本申请实施例提供的一种系统架构300的示意图;FIG. 14 is a schematic diagram of a system architecture 300 provided by an embodiment of this application;
图15为本申请实施例提供的目标神经网络模型的生成装置1600的示意性框图;15 is a schematic block diagram of a device 1600 for generating a target neural network model provided by an embodiment of the application;
图16为本申请提供的电子设备1700的示意性框图。FIG. 16 is a schematic block diagram of an electronic device 1700 provided by this application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following describes the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
图1示出一种人工智能主体框架示意图,该主体框架描述了人工智能系统总体工作流程,适用于通用的人工智能领域需求。Figure 1 shows a schematic diagram of an artificial intelligence main framework, which describes the overall workflow of the artificial intelligence system and is suitable for general artificial intelligence field requirements.
下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。The following describes the above-mentioned artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis).
“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。"Intelligent Information Chain" reflects a series of processes from data acquisition to processing. For example, it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has gone through the condensing process of "data-information-knowledge-wisdom".
“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。The "IT value chain" is the industrial ecological process from the underlying infrastructure and information (providing and processing technology realization) of human intelligence to the system, reflecting the value that artificial intelligence brings to the information technology industry.
(1)基础设施:(1) Infrastructure:
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。The infrastructure provides computing power support for the artificial intelligence system, realizes communication with the outside world, and realizes support through the basic platform. Communicate with the outside through sensors; computing capabilities are provided by smart chips (hardware acceleration chips such as CPU, NPU, GPU, ASIC, FPGA); basic platforms include distributed computing frameworks and network related platform guarantees and support, which can include cloud storage and Computing, interconnection network, etc. For example, sensors communicate with the outside to obtain data, and these data are provided to the smart chip in the distributed computing system provided by the basic platform for calculation.
(2)数据(2) Data
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。The data in the upper layer of the infrastructure is used to represent the data source in the field of artificial intelligence. The data involves graphics, images, voice, and text, as well as the Internet of Things data of traditional devices, including business data of existing systems and sensory data such as force, displacement, liquid level, temperature, and humidity.
(3)数据处理(3) Data processing
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, training, etc.
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。Reasoning refers to the process of simulating human intelligent reasoning in a computer or intelligent system, using formal information to conduct machine thinking and solving problems based on reasoning control strategies. The typical function is search and matching.
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。Decision-making refers to the process of making decisions based on intelligent information after reasoning, and usually provides functions such as classification, sorting, and prediction.
(4)通用能力(4) General ability
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。After the above-mentioned data processing is performed on the data, some general capabilities can be formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image Recognition and so on.
(5)智能产品及行业应用(5) Smart products and industry applications
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能制造、智能交通、智能家居、智能医疗、智能安防、自动驾驶,平安城市,智能终端等。Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. It is an encapsulation of the overall solution of artificial intelligence, productizing intelligent information decision-making and realizing landing applications. Its application fields mainly include: intelligent manufacturing, intelligent transportation, Smart home, smart medical, smart security, autonomous driving, safe city, smart terminal, etc.
参见附图2A,本申请实施例提供了一种系统架构200。数据采集设备260用于采集目标数据并存入数据库230,训练设备220基于数据库230中维护的目标数据生成目标模型/规则201。下面将详细地描述训练设备220如何基于目标数据得到目标模型/规则201,目标模型/规则201能够应用于图像分类、语音识别等。Referring to FIG. 2A, an embodiment of the present application provides a system architecture 200. The data collection device 260 is used to collect target data and store it in the database 230, and the training device 220 generates a target model/rule 201 based on the target data maintained in the database 230. The following will describe in detail how the training device 220 obtains the target model/rule 201 based on the target data. The target model/rule 201 can be applied to image classification, speech recognition, and the like.
深度神经网络可以包括多个层,每个层可以设置相同或不同的操作符。该操作符可以是卷积操作符、池化操作符、全连接操作符等。示例性的,该卷积操作符可以是3*3的卷积操作符、或5*5的卷积操作符等。A deep neural network can include multiple layers, and each layer can be set with the same or different operators. The operator can be a convolution operator, a pooling operator, a fully connected operator, etc. Exemplarily, the convolution operator may be a 3*3 convolution operator, a 5*5 convolution operator, or the like.
深度神经网络中的每一层的操作符可以用数学表达式
Figure PCTCN2020094837-appb-000001
来描述:从物理层面深度神经网络中的每一层的操作符可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由
Figure PCTCN2020094837-appb-000002
完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练深度神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
The operators of each layer in the deep neural network can be expressed in mathematical expressions
Figure PCTCN2020094837-appb-000001
To describe: From the physical level, the operators of each layer in the deep neural network can be understood as five operations on the input space (the set of input vectors) to complete the transformation from the input space to the output space (that is, the row space of the matrix to Column space), these five operations include: 1. Dimension Up/Down; 2. Enlarge/Reduce; 3. Rotate; 4. Translation; 5. "Bend". The operations of 1, 2, and 3 are determined by
Figure PCTCN2020094837-appb-000002
Complete, the operation of 4 is completed by +b, and the operation of 5 is realized by a(). The reason why the word "space" is used here is because the object to be classified is not a single thing, but a class of things. Space refers to the collection of all individuals of this kind of thing. Among them, W is a weight vector, and each value in the vector represents the weight value of a neuron in the layer of neural network. This vector W determines the spatial transformation from the input space to the output space described above, that is, the weight W of each layer controls how the space is transformed. The purpose of training a deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vector W of many layers). Therefore, the training process of the neural network is essentially the way of learning to control the spatial transformation, and more specifically the learning of the weight matrix.
上述五种操作的不同的组合方式可以实现池化操作、卷积操作、全连接操作等。Different combinations of the above five operations can implement pooling operations, convolution operations, and fully connected operations.
因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。Because it is hoped that the output of the deep neural network is as close as possible to the value that you really want to predict, you can compare the current network's predicted value with the really desired target value, and then update each layer of neural network according to the difference between the two. The weight vector of the network (of course, there is usually an initialization process before the first update, which is to pre-configure parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it The prediction is lower and keep adjusting until the neural network can predict the target value you really want. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value". This is the loss function or objective function, which is used to measure the difference between the predicted value and the target value. Important equation. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, then the training of the deep neural network becomes a process of reducing this loss as much as possible.
训练设备220通过本申请实施例的目标神经网络模型的生成方法可以根据目标数据集确定深度神经网络中每一层的操作符,以及每一层操作符的内部参数,例如,如上所述的权重向量。The training device 220 can determine the operators of each layer of the deep neural network and the internal parameters of the operators of each layer according to the target data set according to the method for generating the target neural network model of the embodiment of the present application, for example, the weights described above vector.
以所需要得到的深度神经网络包括L个层为例,如图3所示,该深度神经网络的候选模型包括L个层(也可以称之为选择块),每个层包括N个候选操作符,每个候选操作符与其上一层之间的评分权值(α)可以相同也可以不同。例如,如图3所示,输入数据为x 0,第一层的输出数据为x 1,第二层的输出数据为x 2,……,第L层的输出数据为x L,第一层的第一个候选操作符与输入数据x 0之间的评分权值为α 1,1,第一层的第二个候选操作符与输入数据x 0之间的评分权值为α 1,2,……,第一层的第N个候选操作符与输入数据x 0之间的评分权值为α 1,N。通过本申请实施例的目标神经网络模型的生成方法可以在每个层 的N个候选操作符中确定一个操作符组成目标神经网络模型。该目标神经网络模型也可以称之为目标模型/规则。其中,L和N为任意正整数。任意一个候选操作符可以是卷积操作符、池化操作符、或全连接操作等。 Take the required deep neural network including L layers as an example. As shown in Figure 3, the candidate model of the deep neural network includes L layers (also called selection blocks), and each layer includes N candidate operations. The scoring weight (α) between each candidate operator and the previous layer can be the same or different. For example, as shown in Figure 3, the input data is x 0 , the output data of the first layer is x 1 , the output data of the second layer is x 2 ,..., the output data of the Lth layer is x L , the first layer The scoring weight between the first candidate operator and the input data x 0 is α 1,1 , and the scoring weight between the second candidate operator of the first layer and the input data x 0 is α 1,2 ,..., the scoring weight between the Nth candidate operator of the first layer and the input data x 0 is α 1,N . Through the method for generating the target neural network model of the embodiment of the present application, one operator can be determined to form the target neural network model among the N candidate operators in each layer. The target neural network model can also be called target model/rule. Among them, L and N are arbitrary positive integers. Any candidate operator can be a convolution operator, a pooling operator, or a fully connected operation, etc.
需要说明的是,图3所示的候选模型中L个选择块采用串联的方式为一种可能的实现方式,L个选择块还可以采用并联的方式、或串联和并联组合的方式组成一个有向无环图,该有向无环图可以作为候选模型,本申请实施例以如图3所示的候选模型做举例说明,其并不以此作为限制。It should be noted that in the candidate model shown in Fig. 3, L selection blocks are connected in series as a possible implementation method. L selection blocks can also be connected in parallel, or a combination of series and parallel. A directed acyclic graph, the directed acyclic graph can be used as a candidate model, and the embodiment of the present application uses the candidate model as shown in FIG. 3 as an example, which is not limited thereto.
训练设备220得到的目标模型/规则可以应用不同的系统或设备中。在附图2A中,执行设备210配置有I/O接口212,与外部设备进行数据交互,“用户”可以通过客户设备240向I/O接口212输入数据。The target model/rule obtained by the training device 220 can be applied to different systems or devices. In FIG. 2A, the execution device 210 is configured with an I/O interface 212 to perform data interaction with external devices, and the "user" can input data to the I/O interface 212 through the client device 240.
执行设备210可以调用数据存储系统250中的数据、代码等,也可以将数据、指令等存入数据存储系统250中。The execution device 210 can call data, codes, etc. in the data storage system 250, and can also store data, instructions, etc. in the data storage system 250.
计算模块211使用目标模型/规则201对输入的数据进行处理,通过I/O接口212将处理结果返回给客户设备240,提供给用户。The calculation module 211 uses the target model/rule 201 to process the input data, and returns the processing result to the client device 240 through the I/O interface 212, and provides it to the user.
更深层地,训练设备220可以针对不同的目标,基于不同的数据生成相应的目标模型/规则201,以给用户提供更佳的结果。At a deeper level, the training device 220 can generate corresponding target models/rules 201 based on different data for different targets, so as to provide users with better results.
在附图2A中所示情况下,用户可以手动指定输入执行设备210中的数据,例如,在I/O接口212提供的界面中操作。另一种情况下,客户设备240可以自动地向I/O接口212输入数据并获得结果,如果客户设备240自动输入数据需要获得用户的授权,用户可以在客户设备240中设置相应权限。用户可以在客户设备240查看执行设备210输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备240也可以作为数据采集端将采集到目标数据存入数据库230。In the case shown in FIG. 2A, the user can manually specify the input data in the execution device 210, for example, to operate in the interface provided by the I/O interface 212. In another case, the client device 240 can automatically input data to the I/O interface 212 and obtain the result. If the client device 240 automatically inputs data and needs the user's authorization, the user can set the corresponding authority in the client device 240. The user can view the result output by the execution device 210 on the client device 240, and the specific presentation form may be a specific manner such as display, sound, and action. The client device 240 may also serve as a data collection terminal to store the collected target data in the database 230.
值得注意的,附图2A仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在附图2A中,数据存储系统250相对执行设备210是外部存储器,在其它情况下,也可以将数据存储系统250置于执行设备210中。It is worth noting that FIG. 2A is only a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation. For example, in FIG. 2A, The data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 may also be placed in the execution device 210.
再例如,参见附图2B,本申请实施例提供了另一种系统架构400,该系统架构400可以包括客户设备410和服务器420,该客户设备410可以与服务器420建立连接,服务器420可以通过本申请实施例的目标神经网络模型的生成方法生成目标模型/规则,将目标模型/规则提供给客户设备410。在一些实施例中,可以由客户设备410将目标模型/规则配置到相应的执行设备上,例如,嵌入式神经网络处理器(Neural-network Processing Unit,NPU)。For another example, referring to FIG. 2B, an embodiment of the present application provides another system architecture 400. The system architecture 400 may include a client device 410 and a server 420. The client device 410 may establish a connection with the server 420, and the server 420 may use this The method for generating a target neural network model of the application embodiment generates a target model/rule, and provides the target model/rule to the client device 410. In some embodiments, the client device 410 may configure the target model/rule on the corresponding execution device, for example, an embedded neural network processor (Neural-network Processing Unit, NPU).
本申请实施例的目标神经网络模型的生成方法可以基于图3所示的候选模型(其中,L取9)生成一个如图4所示的卷积神经网络(CNN,Convolutional neuron network)。CNN是一种带有卷积结构的深度神经网络,是一种深度学习(deep learning)架构,深度学习架构是指通过机器学习的算法,在不同的抽象层级上进行多个层次的学习。作为一种深度学习架构,CNN是一种前馈(feed-forward)人工神经网络,该前馈人工神经网络中的各个神经元对输入其中的图像中的重叠区域作出响应。The method for generating the target neural network model of the embodiment of the present application may generate a convolutional neural network (CNN, Convolutional Neuron Network) as shown in FIG. 4 based on the candidate model shown in FIG. 3 (where L is 9). CNN is a deep neural network with a convolutional structure. It is a deep learning architecture. The deep learning architecture refers to the use of machine learning algorithms to perform multiple levels of learning at different abstract levels. As a deep learning architecture, CNN is a feed-forward artificial neural network. Each neuron in the feed-forward artificial neural network responds to overlapping regions in the input image.
如图4所示,卷积神经网络(CNN)可以包括输入层,中间层121-127,以及输出层130。其中,输入层110可以是图3所示的第一个选择块中的一个候选操作符,中间层121-127可以是如图3所示的第2个至第8个选择块中的一个候选操作符,输出层130可以是如图3所示的第9个选择块中的一个候选操作符。As shown in FIG. 4, a convolutional neural network (CNN) may include an input layer, intermediate layers 121-127, and an output layer 130. The input layer 110 may be a candidate operator in the first selection block shown in FIG. 3, and the middle layer 121-127 may be a candidate in the second to eighth selection blocks shown in FIG. 3 Operator, the output layer 130 may be a candidate operator in the 9th selection block as shown in FIG. 3.
中间层121-177,可以是池化、卷积或全连接操作,进行池化操作的中间层为池化层,进行卷积操作的中间层为卷积层,进行全连接操作的中间层为全连接层。The middle layer 121-177 can be pooling, convolution or fully connected operation. The middle layer for pooling operation is the pooling layer, the middle layer for convolution operation is the convolutional layer, and the middle layer for full connection operation is Fully connected layer.
在一种实现中,121层为卷积层,122层为池化层,123层为卷积层,124层为池化层,125为卷积层,126为池化层;在另一种实现方式中,121、122为卷积层,123为池化层,124、125为卷积层,126为池化层。即卷积层的输出可以作为随后的池化层的输入,也可以作为另一个卷积层的输入以继续进行卷积操作。In one implementation, layer 121 is a convolutional layer, layer 122 is a pooling layer, layer 123 is a convolutional layer, layer 124 is a pooling layer, 125 is a convolutional layer, and 126 is a pooling layer; in another In the implementation manner, 121 and 122 are convolutional layers, 123 is a pooling layer, 124 and 125 are convolutional layers, and 126 is a pooling layer. That is, the output of the convolutional layer can be used as the input of the subsequent pooling layer, or as the input of another convolutional layer to continue the convolution operation.
需要说明的是,如图4所示的卷积神经网络仅作为一种卷积神经网络的示例,在具体的应用中,卷积神经网络还可以以其他网络模型的形式存在,可以利用本申请实施例的目标神经网络模型的生成方法(采用15个选择块的候选模型,候选模型采用串联和并联组合的方式)生成例如如图5所示的卷积神经网络,即多个中间层并行,将分别提取的特征均输入给中间层127进行处理。It should be noted that the convolutional neural network shown in Figure 4 is only used as an example of a convolutional neural network. In specific applications, the convolutional neural network can also exist in the form of other network models, and this application can be used The method for generating the target neural network model of the embodiment (using 15 candidate models of selection blocks, the candidate models using a combination of series and parallel) generates, for example, a convolutional neural network as shown in FIG. 5, that is, multiple intermediate layers are parallel, The respectively extracted features are input to the middle layer 127 for processing.
本申请可以通过如下所述的目标神经网络模型的生成方法得到目标神经网络模型,该目标神经网络模型可以应用于人脸识别、图像分类、图像超分辨率、前车障碍物检测等。例如,应用于人脸识别中,本申请实施例的目标神经网络模型可以对输入的人脸图像进行处理,输出用于相似度匹配的向量。应用于图像分类中,本申请实施例的目标神经网络模型可以对输入的待分类图像进行处理,输出张量(Tensor),该Tensor用于分类结果的确定。应用于图像超分辨率中,本申请实施例的目标神经网络模型可以对输入的传感器原始图像进行处理,输出高分辨率图像。本申请实施例的目标神经网络模型的生成方法的具体解释说明可以参见下述实施例。In the present application, the target neural network model can be obtained by the method for generating the target neural network model as described below, and the target neural network model can be applied to face recognition, image classification, image super-resolution, and obstacle detection of the preceding vehicle. For example, when applied to face recognition, the target neural network model of the embodiment of the present application can process the input face image and output a vector for similarity matching. Applied to image classification, the target neural network model of the embodiment of the present application can process the input image to be classified and output a tensor (Tensor), which is used to determine the classification result. Applied to image super-resolution, the target neural network model of the embodiment of the present application can process the input sensor raw image and output a high-resolution image. For specific explanations of the method for generating the target neural network model in the embodiments of the present application, refer to the following embodiments.
图6为本申请实施例的一种目标神经网络模型的生成方法的流程图,如图6所示,本实施例的方法可以由如图2A所示的训练设备220或训练设备220的处理器执行,或者,可以由如图2B所示的服务器420或服务器420的处理器执行,本实施例的方法可以包括:FIG. 6 is a flowchart of a method for generating a target neural network model according to an embodiment of this application. As shown in FIG. 6, the method of this embodiment may be executed by the training device 220 or the processor of the training device 220 as shown in FIG. 2A. Executed, or may be executed by the server 420 or the processor of the server 420 as shown in FIG. 2B, and the method in this embodiment may include:
步骤101、获取多个候选操作符的评分权值和多个神经网络模型。Step 101: Obtain score weights of multiple candidate operators and multiple neural network models.
以图3所示的候选模型为例进行举例说明,通过步骤101可以获取该候选模型中各个候选操作符的评分权值,例如,α 1,1、α 1,2等。该多个候选操作符的评分权值可以是初始化操作后的评分权值,也可以是预设的评分权值,也可以是上一次执行本申请实施例的目标神经网络模型的生成方法后该候选模型中的评分权值。基于该候选模型中的各个候选操作符可以确定多个神经网络模型,例如,一个神经网络模型为第一个选择块中的第一个候选操作符、第二个选择块的第二个候选操作符、……、第L个选择块的第二个候选操作符所组成的网络模型。换言之,该多个神经网络模型可以是对如图3所示的候选模型进行采样得到的神经网络模型。 Taking the candidate model shown in FIG. 3 as an example for illustration, step 101 can obtain the score weight of each candidate operator in the candidate model, for example, α 1,1 , α 1,2, etc. The scoring weights of the multiple candidate operators may be the scoring weights after the initialization operation, or the preset scoring weights, or they may be the last time the method for generating the target neural network model of the embodiment of this application is executed. The scoring weight in the candidate model. Based on each candidate operator in the candidate model, multiple neural network models can be determined. For example, a neural network model is the first candidate operator in the first selection block and the second candidate operation in the second selection block. The network model composed of the second candidate operator of the L-th selection block. In other words, the multiple neural network models may be neural network models obtained by sampling the candidate models as shown in FIG. 3.
步骤102、根据该多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,该损失函数为准确率和时 延的联合函数。Step 102: Determine the differentiable relationship information of the loss function with respect to the scoring variable according to the scoring weights of the multiple candidate operators, the accuracy rate of each neural network model, and the time delay of each neural network model, and the loss function is the accuracy rate And the joint function of the delay.
示例性的,每个神经网络模型的准确率可以是上述多个神经网络模型中的每个神经网络模型的准确率,每个神经网络模型的准确率可以是每个神经网络模型的输出与目标值的欧式距离。每个神经网络模型的时延可以是每个神经网络模型前向传播所需要的时间,该时延可以是在真实设备上测量的该神经网络模型的时延,该真实设备可以是如图2A所示的执行设备。根据该多个候选操作符的评分权值和每个神经网络模型的准确率可以确定准确率函数L acc关于评分变量α的可微关系信息,根据该多个候选操作符的评分权值和每个神经网络模型的时延可以确定时延函数T(α)关于评分变量α的可微关系信息,进而根据准确率函数L acc关于评分变量α的可微关系信息和时延函数T(α)关于评分变量α的可微关系信息确定损失函数关于评分变量α的可微关系信息。 Exemplarily, the accuracy rate of each neural network model may be the accuracy rate of each neural network model in the above-mentioned multiple neural network models, and the accuracy rate of each neural network model may be the output and target of each neural network model. The Euclidean distance of the value. The delay of each neural network model can be the time required for each neural network model to propagate forward. The delay can be the delay of the neural network model measured on a real device. The real device can be as shown in Figure 2A. Execution equipment shown. According to the scoring weights of the multiple candidate operators and the accuracy of each neural network model, the differentiable relationship information of the accuracy function L acc with respect to the scoring variable α can be determined. According to the scoring weights of the multiple candidate operators and the accuracy of each neural network model, The delay of a neural network model can determine the differentiable relationship information of the delay function T(α) with respect to the scoring variable α, and then the differentiable relationship information of the scoring variable α according to the accuracy function L acc and the delay function T(α) The differentiable relationship information about the scoring variable α determines the differentiable relationship information of the loss function about the scoring variable α.
步骤103、根据该可微关系信息更新该多个候选操作符的评分权值。Step 103: Update the score weights of the multiple candidate operators according to the differentiable relationship information.
通过上述步骤可以得到损失函数关于评分变量α的可微关系信息,则可以根据该可微关系信息对多个候选操作符的评分权值进行更新,以基于损失函数优化候选操作符的评分权值。Through the above steps, the differentiable relationship information of the loss function on the score variable α can be obtained, and then the score weights of multiple candidate operators can be updated according to the differentiable relationship information to optimize the score weights of the candidate operators based on the loss function .
在一些实施例中,该多个神经网络模型中的每个神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个,该损失函数关于评分变量的可微关系信息包括L*N个可微关系信息,每个可微关系信息对应一个选择块的一个候选操作符。上述步骤103的一种可实现方式为:根据该L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值;其中,L和N为任意正整数。In some embodiments, each neural network model in the plurality of neural network models is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block, and the loss function The differentiable relationship information about the scoring variable includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block. One possible implementation of the above step 103 is: according to the L*N differentiable relationship information, respectively update the score weight of the candidate operator corresponding to each differentiable relationship information; where L and N are any positive integers.
步骤104、根据更新后的评分权值生成目标神经网络模型。Step 104: Generate a target neural network model according to the updated scoring weight.
以上述图3所示的候选模型为例做进一步举例说明,通过上述步骤可以对该候选模型中的候选操作符的评分权值进行更新,之后可以在更新后的候选模型中选择操作符构成目标神经网络模型。Take the candidate model shown in Figure 3 as an example for further illustration. Through the above steps, the score weights of the candidate operators in the candidate model can be updated, and then the operators can be selected in the updated candidate model to form the target. Neural network model.
步骤105、发送目标模型配置信息,该目标模型配置信息用于配置目标神经网络模型。Step 105: Send target model configuration information, where the target model configuration information is used to configure the target neural network model.
以图2A所示的应用场景进行举例说明,训练设备220可以向执行设备210发送目标模型配置信息,执行设备210根据该目标模型配置信息建立对应的目标神经网络模型,以使用该目标神经网络模型实现相应数据处理功能,例如,人脸识别等。Taking the application scenario shown in FIG. 2A as an example, the training device 220 may send target model configuration information to the execution device 210, and the execution device 210 establishes a corresponding target neural network model according to the target model configuration information to use the target neural network model Realize corresponding data processing functions, such as face recognition.
以图2B所示的应用场景进行举例说明,服务器420可以向客户设备410发送目标模型配置信息,客户设备420可以根据该目标模型配置信息建立对应的目标神经网络模型,以使用该目标神经网络模型实现相应数据处理功能,例如,人脸识别等。或者,客户设备420可以将该目标神经网络模型配置到相应的执行设备上,例如,NPU等。Taking the application scenario shown in FIG. 2B as an example, the server 420 may send target model configuration information to the client device 410, and the client device 420 may establish a corresponding target neural network model according to the target model configuration information to use the target neural network model Realize corresponding data processing functions, such as face recognition. Alternatively, the client device 420 may configure the target neural network model on a corresponding execution device, such as an NPU.
该目标模型配置信息用于配置该目标神经网络模型的各个操作符和操作符的连接关系。还可以配置各个操作符的内部参数等。The target model configuration information is used to configure each operator of the target neural network model and the connection relationship between the operators. You can also configure the internal parameters of each operator.
本实施例,通过获取多个候选操作符的评分权值和多个神经网络模型,根据该多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,该损失函数为准确率和时延的联合函数,根据该可微关系信息更新该多个候选操作符的评分权值,根据更新后的评分权值生成目标神经网络模型,发送目标模型配置信息,该目标模型配置信息用于配置目标神经网络模型,本实施例通过确定损失函数关于评分变量的可微关系信息,根据该可微关系信息优化操作符的评分权值, 可以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。In this embodiment, by obtaining the scoring weights of multiple candidate operators and multiple neural network models, according to the scoring weights of the multiple candidate operators, the accuracy rate of each neural network model, and the time of each neural network model Determine the differentiable relationship information of the loss function on the scoring variable. The loss function is a joint function of accuracy and delay. The score weights of the multiple candidate operators are updated according to the differentiable relationship information, and the score weights are updated according to the updated scoring weights. The value generates the target neural network model, and sends the target model configuration information. The target model configuration information is used to configure the target neural network model. This embodiment determines the differentiable relationship information of the loss function with respect to the scoring variable, and optimizes the operation according to the differentiable relationship information The score weight of the symbol can improve the efficiency of generating the target neural network model and reduce the consumption of computing resources and time.
图7为本申请实施例的一种目标神经网络模型的生成方法的流程图,如图7所示,本实施例的方法可以由如图2A所示的训练设备220或训练设备220的处理器执行,或者,可以由如图2B所示的服务器420或服务器420的处理器执行,本实施例的方法可以包括:FIG. 7 is a flowchart of a method for generating a target neural network model according to an embodiment of this application. As shown in FIG. 7, the method of this embodiment can be executed by the training device 220 or the processor of the training device 220 as shown in FIG. 2A. Executed, or may be executed by the server 420 or the processor of the server 420 as shown in FIG. 2B, and the method in this embodiment may include:
步骤201、获取多个候选操作符的评分权值、目标数据集和时延调节参数。Step 201: Obtain score weights, target data sets, and time delay adjustment parameters of multiple candidate operators.
其中,获取多个候选操作符的评分权值的解释说明可以参见图6所示实施例的步骤101,此处不再赘述。For the explanation of obtaining the score weights of multiple candidate operators, refer to step 101 of the embodiment shown in FIG. 6, which will not be repeated here.
例如,训练设备220可以在接收到模型生成指令时,获取目标数据集和时延调节参数。该模型生成指令可以是终端设备发送的,该终端设备可以是如图2A所示的客户设备。For example, the training device 220 may obtain the target data set and the delay adjustment parameters when receiving the model generation instruction. The model generation instruction may be sent by a terminal device, and the terminal device may be a client device as shown in FIG. 2A.
该目标数据集可以包括多个训练数据,该训练数据可以包括输入数据和对应的目标值。该目标数据集可以是预设的,也可以是用户输入的,例如,该训练设备220接收终端设备发送的该目标数据集。该时延调节参数可以是预设的,也可以是用户输入的,例如,该训练设备220接收终端设备发送的该时延调节参数。The target data set may include a plurality of training data, and the training data may include input data and corresponding target values. The target data set may be preset or input by the user. For example, the training device 220 receives the target data set sent by the terminal device. The delay adjustment parameter may be preset or input by the user. For example, the training device 220 receives the delay adjustment parameter sent by the terminal device.
例如,一种可实现方式,接收用户输入的该目标数据集和该时延调节参数。举例而言,如图2A所示的数据库230中没有满足用户需求的目标数据时,用户可以向训练设备220提供目标数据集,以使得训练设备220通过本申请实施例的方法得到目标神经网络模型,例如,用于人脸识别的神经网络模型。For example, an achievable way is to receive the target data set and the delay adjustment parameter input by the user. For example, when there is no target data that meets the needs of the user in the database 230 as shown in FIG. 2A, the user may provide the target data set to the training device 220, so that the training device 220 obtains the target neural network model through the method of the embodiment of the present application. , For example, a neural network model for face recognition.
另一种可实现方式,接收用户输入的数据集选择信息和时延调节参数,根据该数据集选择信息确定目标数据集。举例而言,如图2A所示的数据库230中存在多个数据集,训练设备220可以根据用户输入的数据集选择信息,将该数据集选择信息对应的数据集作为目标数据集。Another achievable way is to receive the data set selection information and time delay adjustment parameters input by the user, and determine the target data set according to the data set selection information. For example, there are multiple data sets in the database 230 as shown in FIG. 2A, and the training device 220 may use the data set corresponding to the data set selection information as the target data set according to the data set selection information input by the user.
另一种可实现方式,接收用户输入的数据集选择信息和期望复杂度信息,根据数据集选择信息确定该目标数据集,根据该期望复杂度信息确定该时延调节参数。例如,该期望复杂度信息可以是高、中、低等多个级别,每个级别对应一个时延调节参数,训练设备220可以根据用户输入的期望复杂度信息确定与该期望复杂度信息对应的时延调节参数。例如,级别越高,其对应的时延调节参数的取值越小。Another achievable manner is to receive data set selection information and expected complexity information input by a user, determine the target data set according to the data set selection information, and determine the delay adjustment parameter according to the expected complexity information. For example, the expected complexity information can be in multiple levels such as high, medium, and low, and each level corresponds to a delay adjustment parameter. The training device 220 can determine the desired complexity information corresponding to the expected complexity information according to the expected complexity information input by the user. Delay adjustment parameters. For example, the higher the level, the smaller the value of the corresponding delay adjustment parameter.
步骤202、根据时延调节参数确定损失函数,该损失函数为准确率和时延的联合函数。Step 202: Determine a loss function according to the delay adjustment parameter, where the loss function is a joint function of accuracy and delay.
该准确率和时延的联合函数可以是准确率函数和时延函数之和,也可以是准确率函数和时延函数的加权之和,例如,该损失函数用L表示,准确率函数用L acc表示,时延函数用T表示,时延调节参数用β表示,该损失函数可以如下述公式(1)。 The joint function of the accuracy and the delay can be the sum of the accuracy function and the delay function, or the weighted sum of the accuracy function and the delay function. For example, the loss function is represented by L, and the accuracy function is represented by L Acc is denoted, the time delay function is denoted by T, and the time delay adjustment parameter is denoted by β, and the loss function can be as the following formula (1).
L=L acc+βT              (1) L=L acc +βT (1)
需要说明的是,本申请实施例的损失函数关于评分权值变量可微。准确率函数L acc的具体形式可以根据需求进行灵活设置,例如,可以是神经网络模型的输出与目标值的欧式距离。 It should be noted that the loss function of the embodiment of the present application is differentiable with regard to the scoring weight variable. The specific form of the accuracy function L acc can be flexibly set according to requirements, for example, it can be the Euclidean distance between the output of the neural network model and the target value.
步骤203、根据该目标数据集更新候选操作符的内部参数。Step 203: Update the internal parameters of the candidate operator according to the target data set.
例如,训练设备220设置有如图3所示的候选模型,在执行本申请实施例的目标神经网络模型的生成方法之前,可以对该候选模型中的各个候选操作符的内部参数进行初始化,训练设备220可以在每个层中选取候选操作符,进而构成一个神经网络模型,可以使用该 目标数据集对该神经网络模型进行训练,以对构成该神经网络模型的各个候选操作符的内部参数进行更新。For example, the training device 220 is provided with a candidate model as shown in FIG. 3. Before executing the method for generating the target neural network model in the embodiment of the present application, the internal parameters of each candidate operator in the candidate model can be initialized, and the training device 220 can select candidate operators in each layer to form a neural network model, and use the target data set to train the neural network model to update the internal parameters of each candidate operator constituting the neural network model .
步骤204、根据更新后的内部参数和多个候选操作符的评分权值确定多个神经网络模型。Step 204: Determine multiple neural network models according to the updated internal parameters and the score weights of multiple candidate operators.
以上述图3所示的候选模型为例做进一步举例说明,每个层中的N个候选操作符,每个候选操作符有评分权值,训练设备220可以根据每一层的候选操作符的评分权值,在候选模型中选取多个候选操作符构成一个神经网络模型,被选取作为该神经网络模型的候选操作符的内部参数可以是通过上述步骤203更新后的内部参数。训练设备220采用相同的方式构建多个神经网络模型。Taking the candidate model shown in Figure 3 as an example for further illustration, there are N candidate operators in each layer, and each candidate operator has a scoring weight. The training device 220 can be based on the candidate operators of each layer. For scoring weights, a plurality of candidate operators are selected from the candidate model to form a neural network model, and the internal parameters selected as the candidate operators of the neural network model may be the internal parameters updated through the above step 203. The training device 220 constructs multiple neural network models in the same manner.
步骤205、根据多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定该损失函数关于评分变量的可微关系信息。Step 205: Determine the differentiable relationship information of the loss function with respect to the score variable according to the score weights of the multiple candidate operators, the accuracy rate of each neural network model, and the time delay of each neural network model.
该可微关系信息可以是导数值。The differentiable relationship information may be a derivative value.
本申请实施例的时延函数可以如下述公式(2)The delay function of the embodiment of this application can be as the following formula (2)
Figure PCTCN2020094837-appb-000003
Figure PCTCN2020094837-appb-000003
其中,θ k表示一个神经网络模型,S为由上述步骤104的多个神经网络模型所构成的遍历空间,
Figure PCTCN2020094837-appb-000004
表示神经网络模型θ k的第l层所选取的候选操作符,l取1至L,t(θ k)表示神经网络模型θ k的时延。
Among them, θ k represents a neural network model, and S is the traversal space formed by the multiple neural network models in step 104,
Figure PCTCN2020094837-appb-000004
Represents the candidate operator selected by the lth layer of the neural network model θ k , l takes 1 to L, and t(θ k ) represents the time delay of the neural network model θ k.
根据多个候选操作符的评分权值和每个神经网络模型的时延确定该时延函数T(α)关于评分变量α的可微关系信息和准确率函数L acc关于评分变量α的可微关系信息,进而根据公式(1)可以确定损失函数关于评分变量α的可微关系信息。 According to the score weights of multiple candidate operators and the delay of each neural network model, determine the differentiable relationship information of the delay function T(α) on the score variable α and the differentiability of the accuracy function L acc on the score variable α Relationship information, and then according to formula (1), the differentiable relationship information of the loss function with respect to the score variable α can be determined.
一种可实现方式,候选模型包括L个选择块,每个选择块包括N个候选操作符,损失函数关于评分变量α的可微关系信息包括L*N个可微关系信息
Figure PCTCN2020094837-appb-000005
l取值为大于等于1且小于等于L的正整数,m取值为大于等于1且小于等于N的正整数),每个可微关系信息对应一个选择块一个候选操作符。上述步骤205的一种可实现方式,根据每个选择块的N个候选操作符的评分权值和每个神经网络模型的准确率确定第l个选择块的第m个准确率可微关系信息,该每个神经网络模型的准确率为根据所述目标数据集确定的。根据每个选择块的N个候选操作符的评分权值确定每个神经网络模型的每个选择块的候选操作符的采样概率(
Figure PCTCN2020094837-appb-000006
l取值为大于等于1且小于等于L的正整数,m取值为大于等于1且小于等于N的正整数)和每个选择块的每个候选操作符的采样概率关于评分变量的可微关系信息
Figure PCTCN2020094837-appb-000007
根据每个神经网络模型的L-1个选择块的候选操作符的采样概率、第l个选择块的第m个候选操作符的采样概率关于评分变量的可微关系信息和每个神经网络模型的时延确定第l个选择块的第m个时延可微关系信息,该L-1个选择块包括L个选择块中除第l个选择块之外的选择块。根据第l个选择块的第m个准确率可微关系信息和第l个选择块的第m个时延可微关系信息,确定所述第l个选择块的第m个可微关系信息。其中,l取值为大于等于1且小于等于L的正整数。
An implementable way, the candidate model includes L selection blocks, each selection block includes N candidate operators, and the differentiable relationship information of the loss function on the score variable α includes L*N differentiable relationship information
Figure PCTCN2020094837-appb-000005
The value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N), and each differentiable relation information corresponds to a selection block and a candidate operator. An implementation of the above step 205 is to determine the m-th accuracy differentiable relationship information of the l-th selection block according to the score weights of the N candidate operators of each selection block and the accuracy of each neural network model , The accuracy of each neural network model is determined according to the target data set. According to the scoring weights of the N candidate operators of each selection block, the sampling probability of the candidate operators of each selection block of each neural network model is determined (
Figure PCTCN2020094837-appb-000006
The value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N) and the sampling probability of each candidate operator of each selection block is differentiable with respect to the score variable Relationship information
Figure PCTCN2020094837-appb-000007
According to the sampling probability of the candidate operator of the L-1 selection block of each neural network model, the sampling probability of the m-th candidate operator of the l selection block, the differentiable relationship information about the scoring variable and each neural network model The delay determines the m-th delay differentiable relationship information of the l-th selection block, and the L-1 selection blocks include the selection blocks other than the l-th selection block among the L selection blocks. Determine the m-th differentiable relation information of the l-th selection block according to the m-th differentiable relation information of the accuracy rate of the l-th selection block and the m-th delay differentiable relation information of the l-th selection block. Among them, the value of l is a positive integer greater than or equal to 1 and less than or equal to L.
上述P(θ k|α)可以表示为如下公式(3)。 The above P(θ k |α) can be expressed as the following formula (3).
Figure PCTCN2020094837-appb-000008
Figure PCTCN2020094837-appb-000008
Figure PCTCN2020094837-appb-000009
Figure PCTCN2020094837-appb-000009
根据公式(2)以及上述公式(3)和公式(4),该时延函数关于评分变量α l,m的导数关系如下公式(5)。需要说明的是,上述公式(4)是确定p l,m的一种可实现方式,其还可以 是其他方式,本申请实施例不以此作为限制。 According to formula (2) and the above formula (3) and formula (4), the derivative relationship of the delay function with respect to the scoring variable α l, m is as follows: formula (5). It should be noted that the above formula (4) is an achievable way to determine p l, m , and it may also be in other ways, and the embodiment of the present application is not limited thereto.
Figure PCTCN2020094837-appb-000010
Figure PCTCN2020094837-appb-000010
其中,
Figure PCTCN2020094837-appb-000011
为神经网络模型θ k的第l层所选取的候选操作符
Figure PCTCN2020094837-appb-000012
的采样概率。
among them,
Figure PCTCN2020094837-appb-000011
Candidate operators selected for the lth layer of the neural network model θ k
Figure PCTCN2020094837-appb-000012
The sampling probability.
本申请实施例的准确率函数关于评分变量α l,m的导数关系可以如下述公式(6)。 The derivative relation of the accuracy rate function of the embodiment of the present application with respect to the scoring variable α l, m can be as the following formula (6).
Figure PCTCN2020094837-appb-000013
Figure PCTCN2020094837-appb-000013
Figure PCTCN2020094837-appb-000014
Figure PCTCN2020094837-appb-000014
Figure PCTCN2020094837-appb-000015
Figure PCTCN2020094837-appb-000015
其中,x l表示选择块l(即第l层)的输出,
Figure PCTCN2020094837-appb-000016
p l,m表示在第l个选择块中选取第m个候选操作符的概率。
Among them, x l represents the output of the selection block l (that is, the lth layer),
Figure PCTCN2020094837-appb-000016
p l,m represents the probability of selecting the m-th candidate operator in the l-th selection block.
步骤206、根据该损失函数关于评分变量的可微关系信息更新多个候选操作符的评分权值。Step 206: Update the score weights of multiple candidate operators according to the differentiable relationship information of the loss function on the score variable.
通过上述步骤可以得到损失函数关于评分变量的可微关系信息,则可以根据该可微关系信息对多个候选操作符的评分权值进行更新,以基于损失函数优化候选操作符的评分权值。Through the above steps, the differentiable relationship information of the loss function on the score variable can be obtained, and then the score weights of multiple candidate operators can be updated according to the differentiable relationship information, so as to optimize the score weights of the candidate operators based on the loss function.
步骤207、根据更新后的评分权值和更新后的内部参数生成目标神经网络模型。Step 207: Generate a target neural network model according to the updated scoring weight and the updated internal parameters.
以上述图3所示的候选模型为例做进一步举例说明,通过上述步骤可以对该候选模型中的候选操作符的内部参数、候选操作符的评分权值进行更新,之后训练设备220可以在更新后的候选模型中选择候选操作符构成目标神经网络模型。Taking the candidate model shown in FIG. 3 as an example for further illustration, the internal parameters of the candidate operator in the candidate model and the score weight of the candidate operator can be updated through the above steps, and then the training device 220 can update In the latter candidate model, candidate operators are selected to form the target neural network model.
步骤208、发送目标模型配置信息,该目标模型配置信息用于配置目标神经网络模型。Step 208: Send target model configuration information, where the target model configuration information is used to configure the target neural network model.
其中,步骤208的解释说明可以参见图6所示实施例的步骤105,此处不再赘述。For the explanation of step 208, refer to step 105 of the embodiment shown in FIG. 6, which will not be repeated here.
本实施例,通过获取多个候选操作符的评分权值、目标数据集和时延调节参数,根据时延调节参数确定损失函数,该损失函数为准确率和时延的联合函数,根据该目标数据集更新候选操作符的内部参数,根据更新后的内部参数和多个候选操作符的评分权值确定多个神经网络模型,根据该多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定该损失函数关于评分变量的可微关系信息,根据该损失函数关于评分变量的可微关系信息更新多个候选操作符的评分权值,根据更新后的评分权值和更新后的内部参数生成目标神经网络模型,本实施例通过确定损失函数关于评分变量的可微关系信息,根据该可微关系信息优化候选操作符的评分权值,可以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。In this embodiment, by obtaining the scoring weights, target data sets, and delay adjustment parameters of multiple candidate operators, the loss function is determined according to the delay adjustment parameters. The loss function is a joint function of accuracy and delay. The data set updates the internal parameters of the candidate operators, determines multiple neural network models according to the updated internal parameters and the score weights of multiple candidate operators, and determines each neural network model according to the score weights of the multiple candidate operators The accuracy rate and the delay of each neural network model determine the differentiable relationship information of the loss function on the scoring variable, and update the score weights of multiple candidate operators according to the differentiable relationship information of the loss function on the scoring variable. The latter scoring weights and the updated internal parameters generate the target neural network model. In this embodiment, the differentiable relationship information of the loss function on the scoring variables is determined, and the scoring weights of the candidate operators are optimized according to the differentiable relationship information, which can improve The efficiency of generating the target neural network model reduces the consumption of computing resources and time.
图8为本申请实施例的另一种目标神经网络模型的生成方法的流程图,如图8所示,本实施例的方法可以由如图2A所示的训练设备220或训练设备220的处理器执行,或者, 可以由如图2B所示的服务器420或服务器420的处理器执行,本实施例的方法可以包括:FIG. 8 is a flowchart of another method for generating a target neural network model according to an embodiment of the application. As shown in FIG. 8, the method of this embodiment can be processed by the training device 220 or the training device 220 shown in FIG. 2A It may be executed by the server 420 or the processor of the server 420 as shown in FIG. 2B. The method in this embodiment may include:
步骤301、获取多个候选操作符的评分权值、目标数据集和时延调节参数。Step 301: Obtain score weights, target data sets, and time delay adjustment parameters of multiple candidate operators.
步骤302、根据时延调节参数确定损失函数,该损失函数为准确率和时延的联合函数。Step 302: Determine a loss function according to the delay adjustment parameter, where the loss function is a joint function of accuracy and delay.
其中,上述步骤301至步骤302的解释说明可以参见上述实施例的步骤201和步骤202,此处不再赘述。Wherein, the explanation of the above steps 301 to 302 can refer to step 201 and step 202 of the above embodiment, which will not be repeated here.
步骤303、使用目标数据集训练第一神经网络模型,根据训练结果,更新L个候选操作符的内部参数。Step 303: Use the target data set to train the first neural network model, and update the internal parameters of the L candidate operators according to the training result.
该第一神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个。The first neural network model is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block.
在一些实施例中,每个选择块的候选操作符中的每个候选操作符被选取作为该第一神经网络模型的一个候选操作符的概率相等。In some embodiments, each candidate operator in the candidate operator of each selection block has an equal probability of being selected as a candidate operator of the first neural network model.
步骤304、根据更新后的内部参数和多个候选操作符的评分权值确定多个神经网络模型。Step 304: Determine multiple neural network models according to the updated internal parameters and the score weights of multiple candidate operators.
步骤305、根据该多个候选操作符的评分权、每个神经网络模型的准确率和每个神经网络模型的时延确定该损失函数关于评分变量的可微关系信息。Step 305: Determine the differentiable relationship information of the loss function with respect to the scoring variable according to the scoring weight of the multiple candidate operators, the accuracy rate of each neural network model, and the time delay of each neural network model.
步骤306、根据该可微关系信息更新多个候选操作符的评分权值。Step 306: Update the score weights of multiple candidate operators according to the differentiable relationship information.
其中,上述步骤304至步骤306的解释说明可以参见上述实施例的步骤204至步骤206,此处不再赘述。Wherein, the explanations of the above steps 304 to 306 can refer to the steps 204 to 206 of the above embodiment, which will not be repeated here.
步骤307、根据更新后的评分权值和预设条件,确定是否存在第一操作符,若存在,则执行步骤308,若不存在,则执行步骤309。Step 307: Determine whether the first operator exists according to the updated scoring weight and the preset condition, if it exists, execute step 308, and if it does not exist, execute step 309.
该第一操作符为L个选择块的候选操作符中的一个或多个。该预设条件可以是评分权值小于预设阈值,当更新后的评分权值小于预设阈值时,则该更新后的评分权值对应的候选操作符为一个第一操作符。The first operator is one or more of the candidate operators of the L selection blocks. The preset condition may be that the scoring weight is less than the preset threshold. When the updated scoring weight is less than the preset threshold, the candidate operator corresponding to the updated scoring weight is a first operator.
步骤308、在第一操作符对应的选择块的候选操作符中剔除该第一操作符。Step 308: Eliminate the first operator from the candidate operators of the selection block corresponding to the first operator.
剔除该第一操作符的方式可以为清除该第一操作符的内部参数和评分权值。The method of excluding the first operator may be to clear the internal parameters and the score weight of the first operator.
步骤309、判断是否满足截止条件,若是,则执行步骤310,若否,则执行步骤303。Step 309: It is judged whether the cut-off condition is met, if yes, step 310 is executed, and if not, step 303 is executed.
需要说明的是,在不满足截止条件,执行步骤303时,构成该第一神经网络模型的L个候选操作符来自于剔除第一操作符之后的剩余候选操作符。It should be noted that when the cut-off condition is not met and step 303 is executed, the L candidate operators constituting the first neural network model come from the remaining candidate operators after excluding the first operator.
步骤310、根据更新后的评分权值和更新后的内部参数生成目标神经网络模型。Step 310: Generate a target neural network model according to the updated scoring weight and the updated internal parameters.
例如,在每个选择块中选取选择块中评分权值最大的候选操作符作为目标神经网络模型的一个候选操作符。For example, in each selection block, the candidate operator with the largest scoring weight in the selection block is selected as a candidate operator of the target neural network model.
本实施例,通过确定损失函数关于评分变量的可微关系信息,根据该可微关系信息优化候选操作符的评分权值,可以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。并且,通过在候选操作符中剔除评分权值较小的候选操作符,可以减少得到目标神经模型所耗费的计算资源和时间。In this embodiment, by determining the differentiable relationship information of the loss function on the scoring variable, and optimizing the scoring weights of the candidate operators according to the differentiable relationship information, the efficiency of generating the target neural network model can be improved, and the consumption of computing resources and time can be reduced. In addition, by excluding candidate operators with smaller score weights from the candidate operators, the computational resources and time spent in obtaining the target neural model can be reduced.
以L=2,N=4为例,对更新候选操作符的内部参数和更新候选操作符的评分权值进行举例说明。Taking L=2 and N=4 as an example, the internal parameters of the update candidate operator and the scoring weight of the update candidate operator are exemplified.
候选模型可以如图9所示,输入x i,经过选择块1,输出x j,经过选择块2,输出x k。 选择块1和选择块2中分别有4个候选操作符,分别为候选操作符1、候选操作符2、候选操作符3以及候选操作符4。 The candidate model can be as shown in Fig. 9, input x i , pass selection block 1, output x j , pass selection block 2, output x k . There are 4 candidate operators in selection block 1 and selection block 2, respectively, candidate operator 1, candidate operator 2, candidate operator 3, and candidate operator 4.
更新候选操作符的内部参数的一次优化过程可以为,随机在两个选择块中选择一个候选操作符组成一个神经网络模型,以在选择块1中选取候选操作符3,在选择块2中选取候选操作符2为例进行举例说明,所组成的神经网络模型可以如图10所示,可以使用目标数据集对图10所示的神经网络模型进行训练,以更新选择块1的候选操作符3和选择块2的候选操作符2中的内部参数。One optimization process for updating the internal parameters of candidate operators can be to randomly select a candidate operator from two selection blocks to form a neural network model, so as to select candidate operator 3 in selection block 1, and select in selection block 2. Candidate operator 2 is taken as an example to illustrate. The composed neural network model can be as shown in Figure 10, and the neural network model shown in Figure 10 can be trained using the target data set to update the candidate operator 3 of selection block 1. And select the internal parameters in the candidate operator 2 of block 2.
以训练设备包括内部参数优化模块、可微关系确定模块和动态路径决策模块为例,对选择块1和选择块2中的各个候选操作符的评分权值(α 1,1、α 1,2、α 1,3和α 1,4,α 2,1、α 2,2、α 2,3和α 2,4)进行更新进行举例说明,如图11A和图11B所示,该目标神经网络模型的生成装置可以包括内部参数优化模块、可微关系确定模块和动态路径决策模块,内部参数优化模块可以采用如上所述的方式更新选择块1的候选操作符和选择块2的候选操作符中的内部参数,可微关系确定模块向测速装置发送神经网络模型配置信息,以使得测速装置还原出相应的神经网络模型θ k,测速装置测量神经网络模型θ k的时延t(θ k),并将时延t(θ k)反馈给可微关系确定模块,可微关系确定模块根据各个神经网络模型的时延t(θ k)、各个神经网络模型的准确率、各个神经网络模型的各个候选操作符的评分权值以及各个候选操作符的评分权值,使用公式(3)至公式(5)得到时延函数关于α 1,1、α 1,2、α 1,3、α 1,4、α 2,1、α 2,2、α 2,3和α 2,4的导数值,使用公式(6)得到准确率函数关于α 1,1、α 1,2、α 1,3、α 1,4、α 2,1、α 2,2、α 2,3和α 2,4的导数值,根据公式(1)得到损失函数关于根据α 1,1、α 1,2、α 1,3、α 1,4、α 2,1、α 2,2、α 2,3和α 2,4的导数值,将损失函数关于根据α 1,1、α 1,2、α 1,3、α 1,4、α 2,1、α 2,2、α 2,3和α 2,4的导数值提供给动态路径决策模块,动态路径决策模块将α 1,1、α 1,2、α 1,3、α 1,4、α 2,1、α 2,2、α 2,3和α 2,4、以及损失函数关于α 1,1、α 1,2、α 1,3、α 1,4、α 2,1、α 2,2、α 2,3和α 2,4的导数值输入至随机梯度下降算法中,优化各个候选操作符的评分权值。例如,优化后的评分权值为α′ 1,1、α′ 1,2、α′ 1,3、α′ 1,4、α′ 2,1、α′ 2,2、α′ 2,3和α′ 2,4。需要说明的是该目标神经网络模型的生成装置可以是如图2A所示的训练设备220或训练设备220的处理器,或者如图2B所示的服务器420或服务器420的处理器。 Taking the training device including an internal parameter optimization module, a differentiable relationship determination module, and a dynamic path decision module as an example, the scoring weights (α 1,1 , α 1,2) of each candidate operator in the selection block 1 and the selection block 2 , Α 1,3 and α 1,4 , α 2,1 , α 2,2 , α 2,3 and α 2,4 ) are updated for illustration, as shown in Figure 11A and Figure 11B, the target neural network The model generation device can include an internal parameter optimization module, a differentiable relationship determination module, and a dynamic path decision module. The internal parameter optimization module can update the candidate operators of the selection block 1 and the candidate operators of the selection block 2 in the manner described above. The differentiable relationship determination module sends the neural network model configuration information to the speed measuring device, so that the speed measuring device restores the corresponding neural network model θ k , and the speed measuring device measures the time delay t(θ k ) of the neural network model θ k, The time delay t(θ k ) is fed back to the differentiable relationship determination module. The differentiable relationship determination module is based on the time delay t(θ k ) of each neural network model, the accuracy of each neural network model, and each neural network model. The scoring weights of the candidate operators and the scoring weights of each candidate operator, use formula (3) to formula (5) to obtain the delay function about α 1,1 , α 1,2 , α 1,3 , α 1, 4. Derivative values of α 2,1 , α 2,2 , α 2,3 and α 2,4 , use formula (6) to obtain the accuracy function with respect to α 1,1 , α 1,2 , α 1,3 , Derivative values of α 1,4 , α 2,1 , α 2,2 , α 2,3 and α 2,4 , according to formula (1), the loss function is obtained according to α 1,1 , α 1,2 , α 1 ,3 , α 1,4 , α 2,1 , α 2,2 , α 2,3 and α 2,4 are the derivative values, and the loss function is related to α 1,1 , α 1,2 , α 1,3 The derivative values of, α 1,4 , α 2,1 , α 2,2 , α 2,3 and α 2,4 are provided to the dynamic path decision module, and the dynamic path decision module converts α 1,1 , α 1,2 , α 1,3 , α 1,4 , α 2,1 , α 2,2 , α 2,3 and α 2,4 , and the loss function about α 1,1 , α 1,2 , α 1,3 , α The derivative values of 1,4 , α 2,1 , α 2,2 , α 2,3, and α 2,4 are input into the stochastic gradient descent algorithm to optimize the scoring weight of each candidate operator. For example, the optimized score weights are α′ 1,1 , α′ 1,2 , α′ 1,3 , α′ 1,4 , α′ 2,1 , α′ 2,2 , α′ 2,3 And α′ 2,4 . It should be noted that the device for generating the target neural network model may be the training device 220 or the processor of the training device 220 as shown in FIG. 2A, or the server 420 or the processor of the server 420 as shown in FIG. 2B.
本实施例,通过确定损失函数关于各个候选操作符的评分变量的导数值,对选择块1和选择块2中的各个候选操作符的评分权值进行优化,优化后的评分权值使得同时最小化准确率误差和平均网络时延,进而提升基于候选模型所构建的目标神经网络模型的准确率并且减少网络时延。In this embodiment, by determining the derivative value of the scoring variable of each candidate operator of the loss function, the scoring weight of each candidate operator in the selection block 1 and the selection block 2 is optimized, and the optimized scoring weight is minimized at the same time The accuracy error and the average network delay are reduced, thereby improving the accuracy of the target neural network model constructed based on the candidate model and reducing the network delay.
图12为本申请实施例的另一种目标神经网络模型的生成方法的流程图,如图12所示,本申请实施例涉及目标神经网络模型的生成装置和测速装置。该目标神经网络模型的生成装置可以是由如图2A所示的训练设备220或训练设备220的处理器,或者如图2B所示的服务器420或服务器420的处理器。如图11A所示该测速装置可以是服务器或服务器的内部芯片、也可以是终端设备或终端设备的内部芯片,例如,该终端设备可以是无线通信设备、物联网(Internet of Things,IoT)设备、可穿戴设备或车载设备、移动终端、客户终端设备(Customer Premise Equipment,CPE)等。在上述任一实施例的基础上,本申请实施例的目标神经网络模型的生成方法还可以包括:FIG. 12 is a flowchart of another method for generating a target neural network model according to an embodiment of the application. As shown in FIG. 12, the embodiment of the application relates to a device for generating a target neural network model and a speed measuring device. The device for generating the target neural network model may be the processor of the training device 220 or the training device 220 as shown in FIG. 2A, or the server 420 or the processor of the server 420 as shown in FIG. 2B. As shown in FIG. 11A, the speed measurement device may be a server or an internal chip of a server, or a terminal device or an internal chip of a terminal device. For example, the terminal device may be a wireless communication device or an Internet of Things (IoT) device. , Wearable devices or vehicle-mounted devices, mobile terminals, Customer Premise Equipment (CPE), etc. On the basis of any of the foregoing embodiments, the method for generating the target neural network model of the embodiment of the present application may further include:
步骤401、目标神经网络模型的生成装置获取测速装置的标识信息。Step 401: The generating device of the target neural network model obtains the identification information of the speed measuring device.
该标识信息用于标识该测速装置,该标识信息可以是用户输入的,例如,用户通过客户设备240向目标神经网络模型的生成装置提供该标识信息。该标识信息也可以是目标神经网络模型的生成装置根据目标训练集确定的,例如,目标训练集为基于机器视觉的车辆检测的训练集,则目标神经网络模型的生成装置可以根据该目标训练集的应用场景确定测速装置的标识信息为车载设备的标识信息。The identification information is used to identify the speed measurement device, and the identification information may be input by the user. For example, the user provides the identification information to the generating device of the target neural network model through the client device 240. The identification information may also be determined by the device for generating the target neural network model according to the target training set. For example, if the target training set is a training set for vehicle detection based on machine vision, the device for generating the target neural network model may be determined according to the target training set. In the application scenario, it is determined that the identification information of the speed measuring device is the identification information of the vehicle-mounted equipment.
该测速装置的标识信息可以是主机名(Hostname)、介质访问控制(Media Access Control,MAC)地址,IP地址(Internet Protocol Address)、用户代理(user agent)信息,域名系统(Domain Name System,DNS)信息、国际移动用户识别码(International Mobile Subscriber Identity,IMSI)中任意一项或多项组合。The identification information of the speed measurement device can be the host name (Hostname), Media Access Control (MAC) address, IP address (Internet Protocol Address), user agent (user agent) information, domain name system (Domain Name System, DNS) ) Any one or a combination of information, International Mobile Subscriber Identity (IMSI).
步骤402、目标神经网络模型的生成装置根据该标识信息,向该测速装置发送神经网络模型配置信息。Step 402: The device for generating the target neural network model sends the neural network model configuration information to the speed measuring device according to the identification information.
该神经网络模型配置信息用于配置多个神经网络模型。例如,该神经网络模型配置信息用于配置如图6所示实施例的步骤101的多个神经网络模型。The neural network model configuration information is used to configure multiple neural network models. For example, the neural network model configuration information is used to configure multiple neural network models in step 101 of the embodiment shown in FIG. 6.
示例性的,该神经网络模型配置信息可以包括多个网络结构编码信息,每个网络结构编码信息用于配置一个神经网络模型的各个操作符和操作符的连接关系。例如,如图10所示的神经网络模型的网络结构编码信息可以是013 122,其中,013表示输入x i(节点0)至x j(节点1)之间的操作符为候选操作符3,122表示x j(节点1)至输出x k(节点2)之间的操作符为候选操作符2。再例如,如图10所示的神经网络模型的网络结构编码信息可以是0010 0100,其中,0010对应选择块1中的各个候选操作符,0表示未被选中,1表示被选中,0100对应选择块2中的各个候选操作符,0表示未被选中,1表示被选中。 Exemplarily, the neural network model configuration information may include a plurality of network structure coding information, and each network structure coding information is used to configure a connection relationship between various operators and operators of a neural network model. For example, the network structure coding information of the neural network model shown in Fig. 10 can be 013 122, where 013 indicates that the operator between input x i (node 0) to x j (node 1) is candidate operator 3. 122 indicates that the operator between x j (node 1) and output x k (node 2) is candidate operator 2. For another example, the network structure coding information of the neural network model shown in Figure 10 can be 0010 0100, where 0010 corresponds to each candidate operator in selection block 1, 0 means not selected, 1 means selected, and 0100 corresponds to selection For each candidate operator in block 2, 0 means not selected, and 1 means selected.
需要说明的是,神经网络模型的时延通常与神经网络模型的结构有关,即与神经网络模型的各个操作符和操作符的连接关系有关,对于各个操作符的内部参数可以采用随机初始化参数,也可以采用预设的参数,其可以根据需求进行灵活设置。It should be noted that the delay of the neural network model is usually related to the structure of the neural network model, that is, it is related to the connection relationship between the various operators of the neural network model and the operators. For the internal parameters of each operator, random initialization parameters can be used. Preset parameters can also be used, which can be flexibly set according to requirements.
步骤403、测速装置根据该神经网络模型配置信息还原多个目标神经网络模型,并测量每个目标神经网络模型的时延。Step 403: The speed measuring device restores multiple target neural network models according to the neural network model configuration information, and measures the time delay of each target neural network model.
例如,测速装置可以根据该神经网络模型配置信息还原出如图6所示实施例的步骤101的多个神经网络模型。并测量每个目标神经网络模型的时延。For example, the speed measuring device can restore multiple neural network models in step 101 of the embodiment shown in FIG. 6 according to the neural network model configuration information. And measure the time delay of each target neural network model.
步骤404、测速装置向目标神经网络模型的生成装置发送每个神经网络模型的时延。Step 404: The speed measuring device sends the time delay of each neural network model to the generating device of the target neural network model.
相应的,目标神经网络模型的生成装置接收测速装置发送的每个神经网络模型的时延。每个神经网络模型的时延可以包括模型标识信息和时延t(θ k),该模型标识信息用于表示神经网络模型θ kCorrespondingly, the target neural network model generating device receives the time delay of each neural network model sent by the speed measuring device. The time delay of each neural network model may include model identification information and time delay t(θ k ), and the model identification information is used to represent the neural network model θ k .
目标神经网络模型的生成装置可以通过上述步骤102确定损失函数关于评分变量的可微关系信息,进而使用该可微关系信息优化各个候选操作符的评分权值,以基于优化后评分权值生成目标神经网络模型。The target neural network model generation device can determine the differentiable relationship information of the loss function with respect to the scoring variable through the above step 102, and then use the differentiable relationship information to optimize the score weight of each candidate operator to generate the target based on the optimized score weight. Neural network model.
步骤404’、测速装置根据每个神经网络模型的多个候选操作符的评分权值和每个神经网络模型的时延确定时延函数关于评分变量的可微关系信息,测速装置向目标神经网络模型的生成装置发送时延函数关于评分变量的可微关系信息。Step 404', the speed measuring device determines the differentiable relationship information of the delay function on the score variable according to the score weights of the multiple candidate operators of each neural network model and the delay of each neural network model, and the speed measuring device sends the target neural network to the target neural network. The model generating device sends the differentiable relationship information of the delay function on the scoring variable.
相应的,目标神经网络模型的生成装置接收测速装置发送的时延函数关于评分变量的 可微关系信息,目标神经网络模型的生成装置根据时延函数关于评分变量的可微关系信息确定损失函数关于评分变量的可微关系信息,进而使用该可微关系信息优化各个候选操作符的评分权值,以基于优化后评分权值生成目标神经网络模型。Correspondingly, the target neural network model generating device receives the differentiable relationship information of the time delay function on the scoring variable sent by the speed measuring device, and the target neural network model generating device determines the loss function according to the differentiable relationship information of the delay function on the scoring variable The differentiable relationship information of the scoring variable is then used to optimize the scoring weight of each candidate operator to generate a target neural network model based on the optimized scoring weight.
其中,在步骤403之后可以执行步骤404或步骤404’。Wherein, step 404 or step 404' can be executed after step 403.
本实施例,通过在测速装置上对每个神经网络模型的时延进行测量,基于测速装置的测量结果确定损失函数关于评分变量的可微关系信息,进而使用该可微关系信息优化各个候选操作符的评分权值,以基于优化后评分权值生成目标神经网络模型,可以提升生成目标神经网络模型的效率,减少计算资源和时间的消耗。In this embodiment, by measuring the time delay of each neural network model on the speed measuring device, the differentiable relationship information of the loss function with respect to the scoring variable is determined based on the measurement result of the speed measuring device, and then the differentiable relationship information is used to optimize each candidate operation To generate the target neural network model based on the optimized scoring weight based on the score weight of the symbol, the efficiency of generating the target neural network model can be improved, and the consumption of computing resources and time can be reduced.
图13为本申请实施例提供的一种芯片硬件结构图。本申请实施例的基于目标神经网络模型的算法可以在图13所示的NPU芯片中实现,该目标神经网络模型可以是通过上述方法实施例所得到的目标神经网络模型。FIG. 13 is a diagram of a chip hardware structure provided by an embodiment of the application. The algorithm based on the target neural network model of the embodiment of the present application can be implemented in the NPU chip shown in FIG. 13, and the target neural network model can be the target neural network model obtained by the above method embodiment.
神经网络处理器NPU 50 NPU作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路50,通过控制器504控制运算电路503提取存储器中的矩阵数据并进行乘法运算。Neural Network Processor NPU 50 NPU is mounted on the main CPU (Host CPU) as a coprocessor, and the Host CPU distributes tasks. The core part of the NPU is the arithmetic circuit 50. The arithmetic circuit 503 is controlled by the controller 504 to extract matrix data from the memory and perform multiplication operations.
在一些实现中,运算电路503内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路503是二维脉动阵列。运算电路503还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路503是通用的矩阵处理器。In some implementations, the arithmetic circuit 503 includes multiple processing units (Process Engine, PE). In some implementations, the arithmetic circuit 503 is a two-dimensional systolic array. The arithmetic circuit 503 may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 503 is a general-purpose matrix processor.
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器502中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器501中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器508accumulator中。For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit fetches the corresponding data of matrix B from the weight memory 502 and caches it on each PE in the arithmetic circuit. The arithmetic circuit takes the matrix A data and matrix B from the input memory 501 to perform matrix operations, and the partial or final result of the obtained matrix is stored in the accumulator 508.
统一存储器506用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器505 Direct Memory Access Controller,DMAC被搬运到权重存储器502中。输入数据也通过DMAC被搬运到统一存储器506中。The unified memory 506 is used to store input data and output data. The weight data directly passes through the storage unit to access the controller 505 Direct Memory Access Controller, and the DMAC is transferred to the weight memory 502. The input data is also transferred to the unified memory 506 through the DMAC.
BIU为Bus Interface Unit即,总线接口单元510,用于AXI总线与DMAC和取指存储器509 Instruction Fetch Buffer的交互。The BIU is the Bus Interface Unit, that is, the bus interface unit 510, which is used for the interaction between the AXI bus and the DMAC and the instruction fetch buffer 509.
总线接口单元510(Bus Interface Unit,简称BIU),用于取指存储器509从外部存储器获取指令,还用于存储单元访问控制器505从外部存储器获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 510 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 509 to obtain instructions from an external memory, and is also used for the storage unit access controller 505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器506或将权重数据搬运到权重存储器502中或将输入数据数据搬运到输入存储器501中。The DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 506 or to transfer the weight data to the weight memory 502 or to transfer the input data to the input memory 501.
向量计算单元507多个运算处理单元,在需要的情况下,对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/FC层网络计算,如Pooling(池化),Batch Normalization(批归一化),Local Response Normalization(局部响应归一化)等。The vector calculation unit 507 has multiple arithmetic processing units, if necessary, further processing the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison and so on. Mainly used for non-convolution/FC layer network calculations in neural networks, such as Pooling, Batch Normalization, Local Response Normalization, etc.
在一些实现种,向量计算单元能507将经处理的输出的向量存储到统一缓存器506。例如,向量计算单元507可以将非线性函数应用到运算电路503的输出,例如累加值的向 量,用以生成激活值。在一些实现中,向量计算单元507生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路503的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector calculation unit 507 can store the processed output vector in the unified buffer 506. For example, the vector calculation unit 507 may apply a nonlinear function to the output of the arithmetic circuit 503, such as a vector of accumulated value, to generate an activation value. In some implementations, the vector calculation unit 507 generates a normalized value, a combined value, or both. In some implementations, the processed output vector can be used as an activation input to the arithmetic circuit 503, for example for use in a subsequent layer in a neural network.
控制器504连接的取指存储器(instruction fetch buffer)509,用于存储控制器504使用的指令;The instruction fetch buffer 509 connected to the controller 504 is used to store instructions used by the controller 504;
统一存储器506,输入存储器501,权重存储器502以及取指存储器509均为On-Chip存储器。外部存储器私有于该NPU硬件架构。The unified memory 506, the input memory 501, the weight memory 502, and the instruction fetch memory 509 are all On-Chip memories. The external memory is private to the NPU hardware architecture.
其中,目标神经网络模型中各层的运算可以由向量计算单元507执行。Among them, the calculation of each layer in the target neural network model can be executed by the vector calculation unit 507.
本申请上述实施例所得到的目标神经网络模型可以应用于服务器、可穿戴设备、车辆、或自动驾驶系统等,以基于该目标神经网络模型对输入数据进行处理,输出结果。The target neural network model obtained in the foregoing embodiment of the present application can be applied to a server, a wearable device, a vehicle, or an automatic driving system, etc., to process input data and output a result based on the target neural network model.
参见附图14,本申请实施例提供了一种系统架构300。执行设备210由一个或多个服务器实现,可选的,与其它计算设备配合,例如:数据存储、路由器、负载均衡器等设备;执行设备210可以布置在一个物理站点上,或者分布在多个物理站点上。执行设备210可以使用数据存储系统250中的数据,或者调用数据存储系统250中的程序代码实现基于上述目标神经网络模型的处理方法,为用户提供服务。Referring to FIG. 14, an embodiment of the present application provides a system architecture 300. The execution device 210 is implemented by one or more servers, and optionally, it cooperates with other computing devices, such as data storage, routers, load balancers and other devices; the execution device 210 can be arranged on one physical site or distributed in multiple On the physical site. The execution device 210 can use the data in the data storage system 250, or call the program code in the data storage system 250 to implement the processing method based on the above-mentioned target neural network model, and provide services for users.
用户可以操作各自的用户设备(例如本地设备301和本地设备302)与执行设备210进行交互。每个本地设备可以表示任何计算设备,例如个人计算机、计算机工作站、智能手机、平板电脑、智能摄像头、智能汽车或其他类型蜂窝电话、媒体消费设备、可穿戴设备、机顶盒、游戏机等。The user can operate respective user devices (for example, the local device 301 and the local device 302) to interact with the execution device 210. Each local device can represent any computing device, such as personal computers, computer workstations, smart phones, tablets, smart cameras, smart cars or other types of cellular phones, media consumption devices, wearable devices, set-top boxes, game consoles, etc.
每个用户的本地设备可以通过任何通信机制/通信标准的通信网络与执行设备210进行交互,通信网络可以是广域网、局域网、点对点连接等方式,或它们的任意组合。The local device of each user can interact with the execution device 210 through a communication network of any communication mechanism/communication standard. The communication network can be a wide area network, a local area network, a point-to-point connection, etc., or any combination thereof.
在另一种实现中,执行设备210的一个方面或多个方面可以由每个本地设备实现,例如,本地设备301可以为执行设备210提供本地数据或反馈计算结果。In another implementation, one or more aspects of the execution device 210 may be implemented by each local device. For example, the local device 301 may provide the execution device 210 with local data or feed back calculation results.
需要注意的,执行设备210的所有功能也可以由本地设备实现。例如,本地设备301实现执行设备210的的功能并为自己的用户提供服务,或者为本地设备302的用户提供服务。It should be noted that all functions of the execution device 210 can also be implemented by a local device. For example, the local device 301 implements the functions of the device 210 and provides services for its own users, or provides services for users of the local device 302.
参见图15,图15为本申请提供的目标神经网络模型的生成装置1600的示意性框图。通目标神经网络模型的生成装置1600包括获取模块1601、模型生成模块1602和收发模块1602。Referring to FIG. 15, FIG. 15 is a schematic block diagram of a device 1600 for generating a target neural network model provided by this application. The generating device 1600 of the communication target neural network model includes an acquisition module 1601, a model generation module 1602, and a transceiver module 1602.
在一个实施例中,目标神经网络模型的生成装置1600具有方法实施例中训练设备或服务器的功能。例如,目标神经网络模型的生成装置1600可以执行如图6至8任一项实施例的方法,或者执行如图12实施例的目标神经网络模型的生成装置所执行的方法。此时,通信装置500的各单元分别用于执行如下操作和/或处理。In an embodiment, the device 1600 for generating a target neural network model has the function of a training device or a server in the method embodiment. For example, the device 1600 for generating a target neural network model may execute the method of any one of the embodiments in FIGS. 6 to 8, or execute the method executed by the device for generating a target neural network model in the embodiment of FIG. 12. At this time, the units of the communication device 500 are respectively used to perform the following operations and/or processing.
获取模块1601,用于获取多个候选操作符的评分权值和多个神经网络模型。The obtaining module 1601 is used to obtain the scoring weights of multiple candidate operators and multiple neural network models.
模型生成模块1602,用于根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,所述损失 函数为准确率和时延的联合函数。The model generation module 1602 is used to determine the differentiable relationship information of the loss function with respect to the scoring variables according to the scoring weights of the multiple candidate operators, the accuracy of each neural network model, and the time delay of each neural network model. The loss function is a joint function of accuracy and time delay.
所述模型生成模块1602,还用于根据所述可微关系信息更新所述多个候选操作符的评分权值。The model generation module 1602 is further configured to update the score weights of the multiple candidate operators according to the differentiable relationship information.
所述模型生成模块1602,还用于根据更新后的评分权值生成目标神经网络模型。The model generation module 1602 is also used to generate a target neural network model according to the updated scoring weight.
收发模块1603,用于发送目标模型配置信息,所述目标模型配置信息用于配置所述目标神经网络模型The transceiver module 1603 is configured to send target model configuration information, where the target model configuration information is used to configure the target neural network model
在一些实施例中,所述多个神经网络模型中的每个神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个,所述损失函数关于评分变量的可微关系信息包括L*N个可微关系信息,每个可微关系信息对应一个选择块的一个候选操作符;所述模型生成模块1602用于:根据所述L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值;其中,L和N为任意正整数。In some embodiments, each neural network model of the plurality of neural network models is determined by L candidate operators, and each candidate operator is one of the N candidate operators of the corresponding selection block, and The differentiable relationship information of the loss function on the scoring variable includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block; the model generation module 1602 is used to: according to the L* N differentiable relation information, respectively update the score weight of the candidate operator corresponding to each differentiable relation information; where L and N are any positive integers.
在一些实施例中,所述获取模块1601还用于:获取目标数据集和时延调节参数;根据所述时延调节参数确定所述损失函数;根据所述目标数据集更新所述候选操作符的内部参数;根据更新后的内部参数和所述多个候选操作符的评分权值确定所述多个神经网络模型。In some embodiments, the acquisition module 1601 is further configured to: acquire a target data set and a delay adjustment parameter; determine the loss function according to the delay adjustment parameter; update the candidate operator according to the target data set The internal parameters of; the multiple neural network models are determined according to the updated internal parameters and the score weights of the multiple candidate operators.
在一些实施例中,所述模型生成模块1602用于:根据每个选择块的N个候选操作符的评分权值和每个神经网络模型的准确率确定第l个选择块的第m个准确率可微关系信息,所述每个神经网络模型的准确率为根据所述目标数据集确定的;根据每个选择块的N个候选操作符的评分权值确定每个神经网络模型的每个选择块的操作符的采样概率和每个选择块的每个候选操作符的采样概率关于评分变量的可微关系信息;根据每个神经网络模型的L-1个选择块的操作符的采样概率、第l个选择块的第m个候选操作符的采样概率关于评分变量的可微关系信息和所述每个神经网络模型的时延确定所述第l个选择块的第m个时延可微关系信息,所述L-1个选择块包括L个选择块中除所述第l个选择块之外的选择块;根据所述第l个选择块的第m个准确率可微关系信息和所述第l个选择块的第m个时延可微关系信息,确定所述第l个选择块的第m个可微关系信息。其中,l取值为大于等于1且小于等于L的正整数,m取值为大于等于1且小于等于N的正整数。In some embodiments, the model generation module 1602 is configured to determine the mth accuracy of the lth selection block according to the score weights of the N candidate operators of each selection block and the accuracy rate of each neural network model. Rate differentiable relationship information, the accuracy rate of each neural network model is determined according to the target data set; each neural network model is determined according to the score weight of the N candidate operators of each selection block The sampling probability of the operator of the selection block and the sampling probability of each candidate operator of each selection block. Differentiable relationship information about the scoring variable; according to the sampling probability of the L-1 selection block operators of each neural network model , The sampling probability of the m-th candidate operator of the l-th selection block and the differentiable relationship information of the scoring variable and the delay of each neural network model determine the m-th delay of the l-th selection block Micro-relationship information, the L-1 selection blocks include selection blocks other than the l-th selection block among the L selection blocks; and the m-th accuracy rate of the l-th selection block may be differentiable relation information And the m-th time delay differentiable relationship information of the l-th selection block to determine the m-th differentiable relationship information of the l-th selection block. Among them, the value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N.
在一些实施例中,所述模型生成模块1602用于:分别将所述L*N个可微关系信息和每个候选操作符的评分权值输入至随机梯度下降算法,输出更新后的每个选择块中每个候选操作符的评分权值。In some embodiments, the model generation module 1602 is configured to: respectively input the L*N differentiable relationship information and the score weight of each candidate operator into the stochastic gradient descent algorithm, and output each updated The scoring weight of each candidate operator in the selection block.
在一些实施例中,所述获取模块1601用于:使用所述目标数据集训练第一神经网络模型,所述第一神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个;根据训练结果,更新所述L个候选操作符的内部参数;其中,L为任意正整数。In some embodiments, the acquisition module 1601 is configured to: use the target data set to train a first neural network model, the first neural network model is determined by L candidate operators, and each candidate operator is a corresponding Select one of the N candidate operators of the block; update the internal parameters of the L candidate operators according to the training result; where L is any positive integer.
在一些实施例中,所述模型生成模块1602还用于:根据所述更新后的评分权值和预设条件,确定是否存在第一操作符,所述第一操作符为L个选择块的候选操作符中的一个或多个;若存在第一操作符,则在第一操作符对应的选择块的候选操作符中剔除所述第一操作符。In some embodiments, the model generation module 1602 is further configured to determine whether there is a first operator based on the updated scoring weight and a preset condition, and the first operator is the value of the L selection blocks. One or more of the candidate operators; if there is a first operator, remove the first operator from the candidate operators of the selection block corresponding to the first operator.
在一些实施例中,所述模型生成模块1602还用于在所述根据所述可微关系信息更新所述多个候选操作符的评分权值之后,判断是否满足截止条件,若不满足截止条件,则执行使用所述目标数据集训练第一神经网络模型的步骤;若满足截止条件,则执行根据更新 后的评分权值生成目标神经网络模型的步骤。In some embodiments, the model generation module 1602 is further configured to determine whether a cut-off condition is satisfied after the score weights of the multiple candidate operators are updated according to the differentiable relationship information, if the cut-off condition is not satisfied , Then execute the step of training the first neural network model using the target data set; if the cut-off condition is met, execute the step of generating the target neural network model according to the updated scoring weight.
在一些实施例中,每个选择块的每个候选操作符被选取作为所述第一神经网络模型的一个操作符的概率相等。In some embodiments, each candidate operator of each selection block has an equal probability of being selected as an operator of the first neural network model.
在一些实施例中,所述获取模块1601还用于:获取测速装置的标识信息;根据所述标识信息,通过所述收发模块1603向所述测速装置发送神经网络模型配置信息,所述神经网络模型配置信息用于配置所述多个神经网络模型;所述收发模块1603还用于接收所述测速装置发送的每个神经网络模型的时延。In some embodiments, the acquisition module 1601 is further configured to: acquire identification information of the speed measurement device; according to the identification information, send neural network model configuration information to the speed measurement device through the transceiver module 1603, and the neural network The model configuration information is used to configure the multiple neural network models; the transceiver module 1603 is also used to receive the time delay of each neural network model sent by the speed measurement device.
在一些实施例中,所述神经网络模型配置信息包括多个网络结构编码信息,每个网络结构编码信息用于配置一个神经网络模型的各个操作符和操作符的连接关系。In some embodiments, the neural network model configuration information includes a plurality of network structure coding information, and each network structure coding information is used to configure a connection relationship between various operators of a neural network model and the operators.
在一些实施例中,所述模型生成模块1602用于:在每个选择块中选取所述选择块中评分权值最大的候选操作符作为所述目标神经网络模型的一个操作符,所述操作符的内部参数为更新后的内部参数。In some embodiments, the model generation module 1602 is configured to select, in each selection block, the candidate operator with the largest score in the selection block as an operator of the target neural network model, and the operation The internal parameters of the symbol are the updated internal parameters.
在一些实施例中,所述获取模块1601用于:通过所述收发模块1603接收用户输入的所述目标数据集和所述时延调节参数;或者,通过所述收发模块1603接收用户输入的数据集选择信息和所述时延调节参数,根据所述数据集选择信息确定所述目标数据集;或者,通过所述收发模块1603接收用户输入的数据集选择信息和期望复杂度信息,根据所述数据集选择信息确定所述目标数据集,根据所述期望复杂度信息确定所述时延调节参数。In some embodiments, the acquiring module 1601 is configured to: receive the target data set and the delay adjustment parameter input by the user through the transceiver module 1603; or, receive the data input by the user through the transceiver module 1603 The target data set is determined according to the data set selection information based on the set selection information and the delay adjustment parameters; or, the data set selection information and the expected complexity information input by the user are received through the transceiver module 1603, and the The data set selection information determines the target data set, and the delay adjustment parameter is determined according to the expected complexity information.
可选地,目标神经网络模型的生成装置1600也可以同时具有方法实施例中的其它功能。类似说明可以参考前述方法实施例的描述。为避免重复,这里不再赘述。Optionally, the device 1600 for generating the target neural network model may also have other functions in the method embodiment at the same time. For similar description, reference may be made to the description of the foregoing method embodiment. To avoid repetition, I won’t repeat them here.
可选地,获取模块1601和模型生成模型1602可以是处理器,收发模块1603可以是收发器。收发器包括接收器和发射器,同时具有发送和接收的功能。Optionally, the acquisition module 1601 and the model generation model 1602 may be a processor, and the transceiver module 1603 may be a transceiver. The transceiver includes a receiver and a transmitter, and has both sending and receiving functions.
可选地,获取模块1601和模型生成模型1602可以是一个处理装置,处理装置的功能可以部分或全部通过软件实现。Optionally, the acquisition module 1601 and the model generation model 1602 may be a processing device, and the functions of the processing device may be partially or fully implemented by software.
在一种可能的实现方式中,处理装置的功能可以部分或全部通过软件实现。此时,处理装置可以包括存储器和处理器。其中,存储器用于存储计算机程序,处理器读取并执行存储器中存储的计算机程序,以执行各方法实施例中的步骤。In a possible implementation manner, the functions of the processing device may be partially or fully implemented by software. At this time, the processing device may include a memory and a processor. The memory is used to store a computer program, and the processor reads and executes the computer program stored in the memory to execute the steps in each method embodiment.
可选地,在一种可能的实现方式中,处理装置包括处理器。用于存储计算机程序的存储器位于处理装置之外,处理器通过电路/电线与存储器连接,以读取并执行存储器中存储的计算机程序。Optionally, in a possible implementation manner, the processing device includes a processor. The memory for storing the computer program is located outside the processing device, and the processor is connected to the memory through a circuit/wire to read and execute the computer program stored in the memory.
在一种可能的实现方式中,处理装置的功能可以全部通过硬件实现。此时,处理装置可以包括输入接口电路、逻辑电路和输出接口电路。其中,输入接口电路,用于获取多个候选操作符的评分权值和多个神经网络模型;逻辑电路,用于根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,所述损失函数为准确率和时延的联合函数;根据所述可微关系信息更新所述多个候选操作符的评分权值;根据更新后的评分权值生成目标神经网络模型;输出接口电路用于发送目标模型配置信息,所述目标模型配置信息用于配置所述目标神经网络模型。In a possible implementation manner, the functions of the processing device may all be implemented by hardware. At this time, the processing device may include an input interface circuit, a logic circuit, and an output interface circuit. The input interface circuit is used to obtain the score weights of multiple candidate operators and multiple neural network models; the logic circuit is used to obtain the score weights of the multiple candidate operators and the accuracy of each neural network model. The rate and the delay of each neural network model determine the differentiable relationship information of the loss function with respect to the scoring variable, and the loss function is a joint function of the accuracy rate and the delay; the multiple candidate operations are updated according to the differentiable relationship information The target neural network model is generated according to the updated score weight; the output interface circuit is used to send target model configuration information, and the target model configuration information is used to configure the target neural network model.
在另一个实施例中,目标神经网络模型的生成装置1600可以为芯片。此时,收发模块1601具体可以为通信接口或者收发电路。In another embodiment, the device 1600 for generating the target neural network model may be a chip. At this time, the transceiver module 1601 may specifically be a communication interface or a transceiver circuit.
参见图16,图16为本申请提供的电子设备1700的示意性结构图。如图16所示,电子设备1700包括处理器1701和收发器1702。Refer to FIG. 16, which is a schematic structural diagram of an electronic device 1700 provided by this application. As shown in FIG. 16, the electronic device 1700 includes a processor 1701 and a transceiver 1702.
可选地,电子设备1700还包括存储器1703。其中,处理器1701、收发器1702和存储器1703之间可以通过内部连接通路互相通信,传递控制信号和/或数据信号。Optionally, the electronic device 1700 further includes a memory 1703. Among them, the processor 1701, the transceiver 1702, and the memory 1703 can communicate with each other through an internal connection path to transfer control signals and/or data signals.
其中,存储器1703用于存储计算机程序。处理器1701用于执行存储器1703中存储的计算机程序,从而实现上述装置实施例中目标神经网络模型的生成装置1600的各功能。Among them, the memory 1703 is used to store computer programs. The processor 1701 is configured to execute the computer program stored in the memory 1703, so as to realize the functions of the device 1600 for generating the target neural network model in the foregoing device embodiment.
具体地,处理器1701可以用于执行装置实施例(例如,图16)中描述的由获取模块1601和模型生成模型1602执行的操作和/或处理,而收发器1702用于执行由收发模块1603执行操作和/处理。Specifically, the processor 1701 may be used to perform the operations and/or processing performed by the acquisition module 1601 and the model generation model 1602 described in the apparatus embodiment (for example, FIG. 16), and the transceiver 1702 is used to perform the operations and/or processing performed by the transceiver module 1603. Perform operations and/or processing.
可选地,存储器1703也可以集成在处理器1701中,或者独立于处理器1701。Optionally, the memory 1703 may also be integrated in the processor 1701 or independent of the processor 1701.
本实施例的电子设备可以执行上述方法实施例的目标神经网络模型的生成方法,其技术原理和技术效果可以参见上述实施例的解释说明,此处不再赘述。The electronic device of this embodiment can execute the method for generating the target neural network model of the foregoing method embodiment, and its technical principles and technical effects can be referred to the explanation of the foregoing embodiment, which will not be repeated here.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被计算机执行时,使得计算机执行上述任一方法实施例中的步骤和/或处理。The present application also provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium. When the computer program is executed by a computer, the computer executes the steps and/or processing in any of the above-mentioned method embodiments. .
本申请还提供一种计算机程序产品,所述计算机程序产品包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行上述任一方法实施例中的步骤和/或处理。This application also provides a computer program product. The computer program product includes computer program code. When the computer program code runs on a computer, the computer executes the steps and/or processing in any of the foregoing method embodiments.
本申请还提供一种芯片,所述芯片包括处理器。用于存储计算机程序的存储器独立于芯片而设置,处理器用于执行存储器中存储的计算机程序,以执行任一方法实施例中的步骤和/或处理。The application also provides a chip including a processor. The memory for storing the computer program is provided independently of the chip, and the processor is used to execute the computer program stored in the memory to execute the steps and/or processing in any method embodiment.
进一步地,所述芯片还可以包括存储器和通信接口。所述通信接口可以是输入/输出接口、管脚或输入/输出电路等。Further, the chip may also include a memory and a communication interface. The communication interface may be an input/output interface, a pin, an input/output circuit, or the like.
以上各实施例中提及的处理器可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。处理器可以是通用处理器、数字信号处理器(digital signal processor,DSP)、特定应用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。本申请实施例公开的方法的步骤可以直接体现为硬件编码处理器执行完成,或者用编码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。The processor mentioned in the above embodiments may be an integrated circuit chip with signal processing capability. In the implementation process, the steps of the foregoing method embodiments can be completed by hardware integrated logic circuits in the processor or instructions in the form of software. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware encoding processor, or executed and completed by a combination of hardware and software modules in the encoding processor. The software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
上述各实施例中提及的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取 存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。The memory mentioned in the above embodiments may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), and synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM) ) And direct memory bus random access memory (direct rambus RAM, DR RAM). It should be noted that the memories of the systems and methods described herein are intended to include, but are not limited to, these and any other suitable types of memories.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disks or optical disks and other media that can store program codes. .

Claims (30)

  1. 一种目标神经网络模型的生成方法,其特征在于,包括:A method for generating a target neural network model, which is characterized in that it includes:
    获取多个候选操作符的评分权值和多个神经网络模型;Obtain score weights of multiple candidate operators and multiple neural network models;
    根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,所述损失函数为准确率和时延的联合函数;According to the scoring weights of the multiple candidate operators, the accuracy of each neural network model, and the time delay of each neural network model, the differentiable relationship information of the loss function with respect to the scoring variable is determined, and the loss function is the accuracy and Joint function of time delay;
    根据所述可微关系信息更新所述多个候选操作符的评分权值;Updating the score weights of the multiple candidate operators according to the differentiable relationship information;
    根据更新后的评分权值生成目标神经网络模型;Generate the target neural network model according to the updated scoring weight;
    发送目标模型配置信息,所述目标模型配置信息用于配置所述目标神经网络模型。Send target model configuration information, where the target model configuration information is used to configure the target neural network model.
  2. 根据权利要求1所述的方法,其特征在于,所述多个神经网络模型中的每个神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个,所述损失函数关于评分变量的可微关系信息包括L*N个可微关系信息,每个可微关系信息对应一个选择块的一个候选操作符;The method according to claim 1, wherein each neural network model in the plurality of neural network models is determined by L candidate operators, and each candidate operator is N candidate operations of the corresponding selection block One of the differentiable relationship information of the scoring variable of the loss function includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block;
    所述根据所述可微关系信息更新所述多个候选操作符的评分权值,包括:The updating the score weights of the multiple candidate operators according to the differentiable relationship information includes:
    根据所述L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值;According to the L*N differentiable relationship information, respectively update the score weight of the candidate operator corresponding to each differentiable relationship information;
    其中,L和N为任意正整数。Among them, L and N are arbitrary positive integers.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method according to claim 2, wherein the method further comprises:
    获取目标数据集和时延调节参数;Obtain target data set and time delay adjustment parameters;
    根据所述时延调节参数确定所述损失函数;Determine the loss function according to the delay adjustment parameter;
    根据所述目标数据集更新所述候选操作符的内部参数;Update the internal parameters of the candidate operator according to the target data set;
    根据更新后的内部参数和所述多个候选操作符的评分权值确定所述多个神经网络模型。The multiple neural network models are determined according to the updated internal parameters and the score weights of the multiple candidate operators.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定所述损失函数关于评分变量的可微关系信息,包括:The method according to claim 3, wherein the loss function is determined according to the scoring weights of the multiple candidate operators, the accuracy rate of each neural network model, and the delay of each neural network model Information about the differentiable relationship of scoring variables, including:
    根据每个选择块的N个候选操作符的评分权值和每个神经网络模型的准确率确定第l个选择块的第m个准确率可微关系信息,所述每个神经网络模型的准确率为根据所述目标数据集确定的;According to the scoring weights of the N candidate operators of each selection block and the accuracy of each neural network model, determine the m-th accuracy differentiable relationship information of the l selection block, and the accuracy of each neural network model The rate is determined according to the target data set;
    根据每个选择块的N个候选操作符的评分权值确定每个神经网络模型的每个选择块的操作符的采样概率和每个选择块的每个候选操作符的采样概率关于评分变量的可微关系信息;Determine the sampling probability of the operator of each selection block of each neural network model and the sampling probability of each candidate operator of each selection block with respect to the score variable according to the score weight of the N candidate operators of each selection block Differentiable relationship information;
    根据每个神经网络模型的L-1个选择块的操作符的采样概率、第l个选择块的第m个候选操作符的采样概率关于评分变量的可微关系信息和所述每个神经网络模型的时延确定所述第l个选择块的第m个时延可微关系信息,所述L-1个选择块包括L个选择块中除所述第l个选择块之外的选择块;According to the sampling probability of the operator of the L-1 selection block of each neural network model, the sampling probability of the m-th candidate operator of the l selection block, the differentiable relationship information about the scoring variable and each neural network The delay of the model determines the m-th delay differentiable relation information of the l-th selection block, and the L-1 selection blocks include the selection blocks of the L selection blocks other than the l-th selection block ;
    根据所述第l个选择块的第m个准确率可微关系信息和所述第l个选择块的第m个时延可微关系信息,确定所述第l个选择块的第m个可微关系信息;According to the m-th accuracy differentiable relation information of the l-th selection block and the m-th delay differentiable relation information of the l-th selection block, determine the m-th possibility of the l-th selection block Micro-relationship information;
    其中,l取值为大于等于1且小于等于L的正整数,m取值为大于等于1且小于等于 N的正整数。Among them, the value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值,包括:The method according to claim 4, wherein the updating the score weight of the candidate operator corresponding to each differentiable relationship information according to the L*N differentiable relationship information includes:
    分别将所述L*N个可微关系信息和每个候选操作符的评分权值输入至随机梯度下降算法,输出更新后的每个选择块中每个候选操作符的评分权值。The L*N differentiable relationship information and the scoring weight of each candidate operator are respectively input to the stochastic gradient descent algorithm, and the updated scoring weight of each candidate operator in each selection block is output.
  6. 根据权利要求3至5任一项所述的方法,其特征在于,所述根据所述目标数据集更新所述候选操作符的内部参数,包括:The method according to any one of claims 3 to 5, wherein the updating the internal parameters of the candidate operator according to the target data set comprises:
    使用所述目标数据集训练第一神经网络模型,所述第一神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个;Training a first neural network model using the target data set, the first neural network model being determined by L candidate operators, each candidate operator being one of the N candidate operators of the corresponding selection block;
    根据训练结果,更新所述L个候选操作符的内部参数;Update the internal parameters of the L candidate operators according to the training result;
    其中,L为任意正整数。Among them, L is any positive integer.
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method according to claim 6, wherein the method further comprises:
    根据所述更新后的评分权值和预设条件,确定是否存在第一操作符,所述第一操作符为L个选择块的候选操作符中的一个或多个;Determine whether there is a first operator according to the updated scoring weight and the preset condition, where the first operator is one or more of the candidate operators of the L selection blocks;
    若存在第一操作符,则在第一操作符对应的选择块的候选操作符中剔除所述第一操作符。If there is a first operator, remove the first operator from the candidate operators of the selection block corresponding to the first operator.
  8. 根据权利要求7所述的方法,其特征在于,在所述根据所述可微关系信息更新所述多个候选操作符的评分权值之后,所述方法还包括:8. The method according to claim 7, wherein after the updating the score weights of the multiple candidate operators according to the differentiable relationship information, the method further comprises:
    判断是否满足截止条件,若不满足截止条件,则执行使用所述目标数据集训练第一神经网络模型的步骤;Determine whether the cut-off condition is met, and if the cut-off condition is not met, execute the step of using the target data set to train the first neural network model;
    若满足截止条件,则执行根据更新后的评分权值生成目标神经网络模型的步骤。If the cut-off condition is met, the step of generating the target neural network model according to the updated scoring weight is executed.
  9. 根据权利要求6至8任一项所述的方法,其特征在于,每个选择块的每个候选操作符被选取作为所述第一神经网络模型的一个操作符的概率相等。The method according to any one of claims 6 to 8, wherein each candidate operator of each selection block has an equal probability of being selected as an operator of the first neural network model.
  10. 根据权利要求1至9任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 9, wherein the method further comprises:
    获取测速装置的标识信息;Obtain identification information of the speed measuring device;
    根据所述标识信息,向所述测速装置发送神经网络模型配置信息,所述神经网络模型配置信息用于配置所述多个神经网络模型;Sending neural network model configuration information to the speed measurement device according to the identification information, where the neural network model configuration information is used to configure the multiple neural network models;
    接收所述测速装置发送的每个神经网络模型的时延。The time delay of each neural network model sent by the speed measuring device is received.
  11. 根据权利要求10所述的方法,其特征在于,所述神经网络模型配置信息包括多个网络结构编码信息,每个网络结构编码信息用于配置一个神经网络模型的各个操作符和操作符的连接关系。The method according to claim 10, wherein the neural network model configuration information includes a plurality of network structure coding information, and each network structure coding information is used to configure each operator of a neural network model and the connection of the operators relationship.
  12. 根据权利要求3至11任一项所述的方法,其特征在于,所述根据更新后的评分权值生成目标神经网络模型,包括:The method according to any one of claims 3 to 11, wherein the generating a target neural network model according to the updated scoring weight value comprises:
    在每个选择块中选取所述选择块中评分权值最大的候选操作符作为所述目标神经网络模型的一个操作符,所述操作符的内部参数为更新后的内部参数。In each selection block, the candidate operator with the largest scoring weight in the selection block is selected as an operator of the target neural network model, and the internal parameter of the operator is the updated internal parameter.
  13. 根据权利要求3至12任一项所述的方法,其特征在于,所述获取目标数据集和时延调节参数,包括:The method according to any one of claims 3 to 12, wherein the obtaining the target data set and the delay adjustment parameter comprises:
    接收用户输入的所述目标数据集和所述时延调节参数;或者,Receiving the target data set and the delay adjustment parameter input by the user; or,
    接收用户输入的数据集选择信息和所述时延调节参数,根据所述数据集选择信息确定 所述目标数据集;或者,Receive the data set selection information and the time delay adjustment parameter input by the user, and determine the target data set according to the data set selection information; or,
    接收用户输入的数据集选择信息和期望复杂度信息,根据所述数据集选择信息确定所述目标数据集,根据所述期望复杂度信息确定所述时延调节参数。Receive data set selection information and expected complexity information input by a user, determine the target data set according to the data set selection information, and determine the delay adjustment parameter according to the expected complexity information.
  14. 一种目标神经网络模型的生成装置,其特征在于,包括:A device for generating a target neural network model is characterized in that it comprises:
    获取模块,用于获取多个候选操作符的评分权值和多个神经网络模型;The obtaining module is used to obtain the scoring weights of multiple candidate operators and multiple neural network models;
    模型生成模块,用于根据所述多个候选操作符的评分权值、每个神经网络模型的准确率和每个神经网络模型的时延确定损失函数关于评分变量的可微关系信息,所述损失函数为准确率和时延的联合函数;The model generation module is used to determine the differentiable relationship information of the loss function with respect to the scoring variable according to the scoring weights of the multiple candidate operators, the accuracy of each neural network model, and the time delay of each neural network model. The loss function is a joint function of accuracy and delay;
    所述模型生成模块,还用于根据所述可微关系信息更新所述多个候选操作符的评分权值;The model generation module is further configured to update the score weights of the multiple candidate operators according to the differentiable relationship information;
    所述模型生成模块,还用于根据更新后的评分权值生成目标神经网络模型;The model generation module is also used to generate a target neural network model according to the updated scoring weight;
    收发模块,用于发送目标模型配置信息,所述目标模型配置信息用于配置所述目标神经网络模型。The transceiver module is used to send target model configuration information, and the target model configuration information is used to configure the target neural network model.
  15. 根据权利要求14所述的装置,其特征在于,所述多个神经网络模型中的每个神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个,所述损失函数关于评分变量的可微关系信息包括L*N个可微关系信息,每个可微关系信息对应一个选择块的一个候选操作符;The device according to claim 14, wherein each neural network model in the plurality of neural network models is determined by L candidate operators, and each candidate operator is N candidate operations of the corresponding selection block One of the differentiable relationship information of the scoring variable of the loss function includes L*N differentiable relationship information, and each differentiable relationship information corresponds to a candidate operator of a selection block;
    所述模型生成模块用于:根据所述L*N个可微关系信息,分别更新每个可微关系信息对应的候选操作符的评分权值;其中,L和N为任意正整数。The model generation module is used to update the score weight of the candidate operator corresponding to each differentiable relationship information according to the L*N differentiable relationship information; where L and N are any positive integers.
  16. 根据权利要求15所述的装置,其特征在于,所述获取模块还用于:The device according to claim 15, wherein the acquisition module is further configured to:
    获取目标数据集和时延调节参数;Obtain target data set and time delay adjustment parameters;
    根据所述时延调节参数确定所述损失函数;Determine the loss function according to the delay adjustment parameter;
    根据所述目标数据集更新所述候选操作符的内部参数;Update the internal parameters of the candidate operator according to the target data set;
    根据更新后的内部参数和所述多个候选操作符的评分权值确定所述多个神经网络模型。The multiple neural network models are determined according to the updated internal parameters and the score weights of the multiple candidate operators.
  17. 根据权利要求16所述的装置,其特征在于,所述模型生成模块用于:The device according to claim 16, wherein the model generation module is used for:
    根据每个选择块的N个候选操作符的评分权值和每个神经网络模型的准确率确定第l个选择块的第m个准确率可微关系信息,所述每个神经网络模型的准确率为根据所述目标数据集确定的;According to the scoring weights of the N candidate operators of each selection block and the accuracy of each neural network model, determine the m-th accuracy differentiable relationship information of the l selection block, and the accuracy of each neural network model The rate is determined according to the target data set;
    根据每个选择块的N个候选操作符的评分权值确定每个神经网络模型的每个选择块的操作符的采样概率和每个选择块的每个候选操作符的采样概率关于评分变量的可微关系信息;Determine the sampling probability of the operator of each selection block of each neural network model and the sampling probability of each candidate operator of each selection block with respect to the score variable according to the score weight of the N candidate operators of each selection block Differentiable relationship information;
    根据每个神经网络模型的L-1个选择块的操作符的采样概率、第l个选择块的第m个候选操作符的采样概率关于评分变量的可微关系信息和所述每个神经网络模型的时延确定所述第l个选择块的第m个时延可微关系信息,所述L-1个选择块包括L个选择块中除所述第l个选择块之外的选择块;According to the sampling probability of the operator of the L-1 selection block of each neural network model, the sampling probability of the m-th candidate operator of the l selection block, the differentiable relationship information about the scoring variable and each neural network The delay of the model determines the m-th delay differentiable relation information of the l-th selection block, and the L-1 selection blocks include the selection blocks of the L selection blocks other than the l-th selection block ;
    根据所述第l个选择块的第m个准确率可微关系信息和所述第l个选择块的第m个时延可微关系信息,确定所述第l个选择块的第m个可微关系信息;According to the m-th accuracy differentiable relation information of the l-th selection block and the m-th delay differentiable relation information of the l-th selection block, determine the m-th possibility of the l-th selection block Micro-relationship information;
    其中,l取值为大于等于1且小于等于L的正整数,m取值为大于等于1且小于等于 N的正整数。Among them, the value of l is a positive integer greater than or equal to 1 and less than or equal to L, and the value of m is a positive integer greater than or equal to 1 and less than or equal to N.
  18. 根据权利要求17所述的装置,其特征在于,所述模型生成模块用于:The device according to claim 17, wherein the model generation module is used for:
    分别将所述L*N个可微关系信息和每个候选操作符的评分权值输入至随机梯度下降算法,输出更新后的每个选择块中每个候选操作符的评分权值。The L*N differentiable relationship information and the scoring weight of each candidate operator are respectively input to the stochastic gradient descent algorithm, and the updated scoring weight of each candidate operator in each selection block is output.
  19. 根据权利要求16至18任一项所述的装置,其特征在于,所述获取模块用于:使用所述目标数据集训练第一神经网络模型,所述第一神经网络模型由L个候选操作符确定,每个候选操作符为对应的选择块的N个候选操作符中的一个;根据训练结果,更新所述L个候选操作符的内部参数;其中,L为任意正整数。The device according to any one of claims 16 to 18, wherein the acquisition module is configured to: use the target data set to train a first neural network model, and the first neural network model is operated by L candidates Each candidate operator is one of the N candidate operators of the corresponding selection block; according to the training result, the internal parameters of the L candidate operators are updated; where L is any positive integer.
  20. 根据权利要求19所述的装置,其特征在于,所述模型生成模块还用于:The device according to claim 19, wherein the model generation module is further configured to:
    根据所述更新后的评分权值和预设条件,确定是否存在第一操作符,所述第一操作符为L个选择块的候选操作符中的一个或多个;Determine whether there is a first operator according to the updated scoring weight and the preset condition, where the first operator is one or more of the candidate operators of the L selection blocks;
    若存在第一操作符,则在第一操作符对应的选择块的候选操作符中剔除所述第一操作符。If there is a first operator, remove the first operator from the candidate operators of the selection block corresponding to the first operator.
  21. 根据权利要求20所述的装置,其特征在于,所述模型生成模块还用于在所述根据所述可微关系信息更新所述多个候选操作符的评分权值之后,判断是否满足截止条件,若不满足截止条件,则执行使用所述目标数据集训练第一神经网络模型的步骤;The device according to claim 20, wherein the model generation module is further configured to determine whether the cut-off condition is satisfied after the score weights of the multiple candidate operators are updated according to the differentiable relationship information , If the cut-off condition is not met, execute the step of using the target data set to train the first neural network model;
    若满足截止条件,则执行根据更新后的评分权值生成目标神经网络模型的步骤。If the cut-off condition is met, the step of generating the target neural network model according to the updated scoring weight is executed.
  22. 根据权利要求19至21任一项所述的装置,其特征在于,每个选择块的每个候选操作符被选取作为所述第一神经网络模型的一个操作符的概率相等。The device according to any one of claims 19 to 21, wherein each candidate operator of each selection block has an equal probability of being selected as an operator of the first neural network model.
  23. 根据权利要求14至21任一项所述的装置,其特征在于,所述获取模块还用于:获取测速装置的标识信息;The device according to any one of claims 14 to 21, wherein the acquisition module is further configured to: acquire identification information of the speed measurement device;
    根据所述标识信息,通过所述收发模块向所述测速装置发送神经网络模型配置信息,所述神经网络模型配置信息用于配置所述多个神经网络模型;Sending neural network model configuration information to the speed measuring device through the transceiver module according to the identification information, where the neural network model configuration information is used to configure the multiple neural network models;
    所述收发模块还用于接收所述测速装置发送的每个神经网络模型的时延。The transceiver module is also used to receive the time delay of each neural network model sent by the speed measurement device.
  24. 根据权利要求23所述的装置,其特征在于,所述神经网络模型配置信息包括多个网络结构编码信息,每个网络结构编码信息用于配置一个神经网络模型的各个操作符和操作符的连接关系。The device according to claim 23, wherein the neural network model configuration information includes a plurality of network structure coding information, and each network structure coding information is used to configure each operator of a neural network model and the connection of the operators relationship.
  25. 根据权利要求16至24任一项所述的装置,其特征在于,所述模型生成模块用于:The device according to any one of claims 16 to 24, wherein the model generation module is configured to:
    在每个选择块中选取所述选择块中评分权值最大的候选操作符作为所述目标神经网络模型的一个操作符,所述操作符的内部参数为更新后的内部参数。In each selection block, the candidate operator with the largest scoring weight in the selection block is selected as an operator of the target neural network model, and the internal parameter of the operator is the updated internal parameter.
  26. 根据权利要求16至25任一项所述的装置,其特征在于,所述获取模块用于:通过所述收发模块接收用户输入的所述目标数据集和所述时延调节参数;或者,The apparatus according to any one of claims 16 to 25, wherein the acquisition module is configured to: receive the target data set and the delay adjustment parameter input by the user through the transceiver module; or,
    通过所述收发模块接收用户输入的数据集选择信息和所述时延调节参数,根据所述数据集选择信息确定所述目标数据集;或者,Receive the data set selection information and the time delay adjustment parameter input by the user through the transceiver module, and determine the target data set according to the data set selection information; or,
    通过所述收发模块接收用户输入的数据集选择信息和期望复杂度信息,根据所述数据集选择信息确定所述目标数据集,根据所述期望复杂度信息确定所述时延调节参数。The data set selection information and expected complexity information input by the user are received through the transceiver module, the target data set is determined according to the data set selection information, and the delay adjustment parameter is determined according to the expected complexity information.
  27. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储器,用于存储一个或多个程序;Memory, used to store one or more programs;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-13中任一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-13.
  28. 一种计算机可读存储介质,其特征在于,包括计算机程序,所述计算机程序在计算机上被执行时,使得所述计算机执行权利要求1-13中任一项所述的方法。A computer-readable storage medium, characterized by comprising a computer program, which when executed on a computer, causes the computer to execute the method according to any one of claims 1-13.
  29. 一种计算机程序产品,其特征在于,所述计算机程序产品包括指令,在计算机上运行时,使得计算机执行如权利要求1-13中任一项所述的方法。A computer program product, characterized in that, the computer program product includes instructions that, when running on a computer, cause the computer to execute the method according to any one of claims 1-13.
  30. 一种芯片,其特征在于,包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于调用并运行所述存储器中存储的计算机程序,以执行如权利要求1-13中任一项所述的方法。A chip, characterized by comprising a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute any one of claims 1-13. The method described in one item.
PCT/CN2020/094837 2019-08-30 2020-06-08 Method and apparatus for generating target neural network model WO2021036397A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910814558.6A CN112446462A (en) 2019-08-30 2019-08-30 Generation method and device of target neural network model
CN201910814558.6 2019-08-30

Publications (1)

Publication Number Publication Date
WO2021036397A1 true WO2021036397A1 (en) 2021-03-04

Family

ID=74684081

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/094837 WO2021036397A1 (en) 2019-08-30 2020-06-08 Method and apparatus for generating target neural network model

Country Status (2)

Country Link
CN (1) CN112446462A (en)
WO (1) WO2021036397A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114969636A (en) * 2021-03-23 2022-08-30 华为技术有限公司 Model recommendation method and device and computer equipment

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114330698B (en) * 2022-03-15 2022-08-05 之江实验室 Neural model storage system and method of brain-like computer operating system
CN116881851B (en) * 2023-09-04 2023-12-19 成都无声讯通科技有限责任公司 Internet of things data processing method and device based on machine learning and server

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704926A (en) * 2017-11-23 2018-02-16 清华大学 A kind of depth migration learning method of the cross-cutting analysis of big data
CN108960317A (en) * 2018-06-27 2018-12-07 哈尔滨工业大学 Across the language text classification method with Classifier combination training is indicated based on across language term vector
CN109063719A (en) * 2018-04-23 2018-12-21 湖北工业大学 A kind of image classification method of co-ordinative construction similitude and category information
CN109816092A (en) * 2018-12-13 2019-05-28 北京三快在线科技有限公司 Deep neural network training method, device, electronic equipment and storage medium
CN110046706A (en) * 2019-04-18 2019-07-23 腾讯科技(深圳)有限公司 Model generating method, device and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704926A (en) * 2017-11-23 2018-02-16 清华大学 A kind of depth migration learning method of the cross-cutting analysis of big data
CN109063719A (en) * 2018-04-23 2018-12-21 湖北工业大学 A kind of image classification method of co-ordinative construction similitude and category information
CN108960317A (en) * 2018-06-27 2018-12-07 哈尔滨工业大学 Across the language text classification method with Classifier combination training is indicated based on across language term vector
CN109816092A (en) * 2018-12-13 2019-05-28 北京三快在线科技有限公司 Deep neural network training method, device, electronic equipment and storage medium
CN110046706A (en) * 2019-04-18 2019-07-23 腾讯科技(深圳)有限公司 Model generating method, device and server

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHRIS THORNTON, HUTTER FRANK, HOOS HOLGER H., LEYTON-BROWN KEVIN: "Auto-WEKA : combined selection and hyperparameter optimization of classification algorithms", CORNELL UNIVERSITY LIBRARY, NEW YORK, NEW YORK, USA, 6 March 2013 (2013-03-06), New York, New York, USA, pages 1 - 9, XP055723048, Retrieved from the Internet <URL:https://arxiv.org/pdf/1208.3719.pdf> [retrieved on 20200817], DOI: 10.1145/2487575.2487629 *
LUKAS TUGGENER; MOHAMMADREZA AMIRIAN; KATHARINA ROMBACH; STEFAN L\"ORWALD; ANASTASIA VARLET; CHRISTIAN WESTERMANN; THILO STADELMAN: "Automated Machine Learning in Practice: State of the Art and Recent Results", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 19 July 2019 (2019-07-19), 201 Olin Library Cornell University Ithaca, NY 14853, XP081444512, DOI: 10.1109/SDS.2019.00-11 *
QUANMING YAO; MENGSHUO WANG; YUQIANG CHEN; WENYUAN DAI; HU YI-QI; LI YU-FENG; TU WEI-WEI; YANG QIANG; YU YANG: "Taking Human out of Learning Applications: A Survey on Automated Machine Learning", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 31 October 2018 (2018-10-31), 201 Olin Library Cornell University Ithaca, NY 14853, XP081017670 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114969636A (en) * 2021-03-23 2022-08-30 华为技术有限公司 Model recommendation method and device and computer equipment
CN114969636B (en) * 2021-03-23 2023-10-03 华为技术有限公司 Model recommendation method and device and computer equipment

Also Published As

Publication number Publication date
CN112446462A (en) 2021-03-05

Similar Documents

Publication Publication Date Title
WO2022083536A1 (en) Neural network construction method and apparatus
EP4064130A1 (en) Neural network model update method, and image processing method and device
WO2021238366A1 (en) Neural network construction method and apparatus
WO2022042713A1 (en) Deep learning training method and apparatus for use in computing device
US20230325722A1 (en) Model training method, data processing method, and apparatus
WO2022022274A1 (en) Model training method and apparatus
WO2021036397A1 (en) Method and apparatus for generating target neural network model
WO2022068623A1 (en) Model training method and related device
CN111368972B (en) Convolutional layer quantization method and device
CN113705769A (en) Neural network training method and device
EP4322056A1 (en) Model training method and apparatus
CN113065635A (en) Model training method, image enhancement method and device
WO2021129668A1 (en) Neural network training method and device
CN111428854A (en) Structure searching method and structure searching device
CN113570029A (en) Method for obtaining neural network model, image processing method and device
WO2022012668A1 (en) Training set processing method and apparatus
US20230401830A1 (en) Model training method and related device
WO2021169366A1 (en) Data enhancement method and apparatus
CN111738403A (en) Neural network optimization method and related equipment
CN114266897A (en) Method and device for predicting pox types, electronic equipment and storage medium
CN115238909A (en) Data value evaluation method based on federal learning and related equipment thereof
WO2022063076A1 (en) Adversarial example identification method and apparatus
CN114169393A (en) Image classification method and related equipment thereof
WO2024046144A1 (en) Video processing method and related device thereof
CN113627421A (en) Image processing method, model training method and related equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20858400

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20858400

Country of ref document: EP

Kind code of ref document: A1