WO2021169844A1 - 神经网络模型的转换方法、模型精度定位方法及装置 - Google Patents
神经网络模型的转换方法、模型精度定位方法及装置 Download PDFInfo
- Publication number
- WO2021169844A1 WO2021169844A1 PCT/CN2021/076754 CN2021076754W WO2021169844A1 WO 2021169844 A1 WO2021169844 A1 WO 2021169844A1 CN 2021076754 W CN2021076754 W CN 2021076754W WO 2021169844 A1 WO2021169844 A1 WO 2021169844A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- neural network
- model
- network model
- accuracy
- target
- Prior art date
Links
- 238000003062 neural network model Methods 0.000 title claims abstract description 564
- 238000000034 method Methods 0.000 title claims abstract description 183
- 238000006243 chemical reaction Methods 0.000 title claims abstract description 173
- 238000012545 processing Methods 0.000 claims abstract description 91
- 238000012795 verification Methods 0.000 claims abstract description 58
- 230000008569 process Effects 0.000 claims description 110
- 238000010586 diagram Methods 0.000 claims description 37
- 238000013507 mapping Methods 0.000 claims description 33
- 238000013528 artificial neural network Methods 0.000 claims description 14
- 230000004044 response Effects 0.000 claims description 6
- 238000004590 computer program Methods 0.000 description 10
- 238000011022 operating instruction Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 6
- 238000010606 normalization Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000011176 pooling Methods 0.000 description 3
- 230000004913 activation Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 230000001174 ascending effect Effects 0.000 description 2
- 238000013136 deep learning model Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Definitions
- the present disclosure relates to the technical field of artificial intelligence (AI), and in particular to a neural network model conversion method, model accuracy positioning method and device.
- AI artificial intelligence
- the conversion of a neural network model refers to the conversion of a neural network model defined in a certain framework to another framework.
- the present disclosure provides a technical solution for neural network model conversion.
- a neural network model conversion method includes: a model conversion device obtains a first neural network model, model input data, and information of a target frame in a source frame; the model conversion device is based on the model Input data performs model conversion processing on the first neural network model under the source frame to obtain the second neural network model under the target frame; the model conversion device is based on the first neural network model and the second neural network The model separately processes the first inference result and the second inference result obtained by processing the model input data to obtain the accuracy verification result of the second neural network model.
- the model conversion device may perform model conversion processing based on a user instruction.
- the user instruction is used to instruct to convert the first neural network model under the source frame to the target frame.
- the user instruction includes the first neural network model under the source frame and model input. Data and information about the target framework.
- the model conversion device can also perform model conversion processing based on internal operating instructions, such as model conversion instructions.
- the internal operating instructions are used to instruct to convert the first neural network model under the source frame to the target frame.
- the internal operating instructions include The first neural network model under the source frame, model input data, and information about the target frame.
- the model conversion device obtains the first inference result of the first neural network model on the model input data in the process of performing model conversion processing on the first neural network model.
- the model conversion device locally stores the first inference result.
- the model conversion device processes the model input data through the second neural network model to obtain a second reasoning result.
- the model conversion device obtains the accuracy verification result of the second neural network model by comparing the first inference result with the second inference result.
- the performing model conversion processing on the first neural network model under the source framework to obtain the second neural network model under the target framework includes: performing a first process on the source The first neural network model under the framework performs model conversion processing to obtain the second neural network model under the target framework; the method further includes: creating a second process through the first process; calling through the first process The second process is to process the model input data through the second neural network model in the second process to obtain a second inference result.
- the model conversion device is based on a first inference result and a second inference result obtained by separately processing the model input data on the first neural network model and the second neural network model,
- Obtaining the accuracy verification result of the second neural network model includes: if the difference between the first inference result and the second inference result is within a preset error range, determining the accuracy of the second neural network model The verification result is accuracy alignment; or if the difference between the first inference result and the second inference result exceeds the preset error range, it is determined that the accuracy verification result of the second neural network model is accuracy misalignment.
- the method further includes: in response to determining that the accuracy verification result of the second neural network model is accuracy misalignment, the model conversion device locates the accuracy misalignment in the second neural network model The target network layer; the model conversion device outputs the information of the target network layer.
- the locating a target network layer whose accuracy is not aligned in the second neural network model includes: establishing the first neural network model and the second neural network model by the model conversion device The mapping relationship between the network layers in the model conversion device; the output data of each network layer and the output data of each network layer in the process of processing the model input data based on the first neural network model and the second neural network model respectively The mapping relationship is used to determine the target network layer whose accuracy is not aligned in the second neural network model.
- the target network layer is the network layer in which the accuracy is not aligned first among the multiple network layers included in the second neural network model.
- the target network layer is a plurality of network layers whose accuracy is not aligned in the second neural network model.
- it includes not only the network layer where the accuracy misalignment occurs first, but also the subsequent network layers of the network layer.
- the information of the target network layer includes at least one of the following: the identification, parameters, output data of the target network layer, the output data and the first neural network model The error between the output data of the network layer corresponding to the target network layer.
- the model conversion device performs model conversion processing on the first neural network model again, wherein, in the process of performing the model conversion processing again, the first neural network model is acquired Output data of each network layer, and/or establish a mapping relationship between the network layers in the first neural network model and the second neural network model.
- the model conversion device performs model conversion processing on the first neural network model in the source frame to obtain the second neural network model in the target frame, including: the model conversion device Building a network topology diagram through the processing of the input data of the model by the first neural network model, wherein the network topology diagram includes the information of the network layers in the first neural network model and the connection relationship of the network layers; The model conversion device obtains the second neural network model based on the network topology map and the information of the target frame.
- a model conversion device in a second aspect, includes: an acquisition unit for acquiring a first neural network model, model input data, and information about a target framework in a source framework; and a conversion unit for evaluating the Perform model conversion processing on the first neural network model in the source framework to obtain the second neural network model in the target framework; the verification unit is configured to perform a comparison between the first neural network model and the second neural network model based on the first neural network model and the second neural network model.
- the first inference result and the second inference result obtained by processing the input data of the model obtain the accuracy verification result of the second neural network model.
- an electronic device including a memory and a processor, wherein the memory stores program instructions, and the processor is used to call the program instructions stored in the memory to execute the first aspect or the first aspect. Any one of the aspects implements the described method.
- a computer-readable storage medium stores instructions that, when run on a computer, cause the computer to execute the above-mentioned first aspect or any one of the implementations of the first aspect. The method described.
- a computer program product containing instructions which when run on a computer, causes the computer to execute the method described in the first aspect or any one of the first aspects.
- the accuracy verification results of the second neural network model can be automatically obtained, which improves the neural network model conversion The accuracy of the verification efficiency.
- the embodiment of the present application also provides a model accuracy positioning solution.
- a model accuracy positioning method including: a model accuracy positioning device acquires a first neural network model, model input data, and information about a target frame in a source frame; The neural network model performs model conversion processing to obtain a second neural network model under the target framework; the model accuracy positioning device performs model input data on the model input data based on the first neural network model and the second neural network model The output data of each network layer obtained in the process of processing locates the target network layer whose accuracy is not aligned in the second neural network model; the model accuracy positioning device outputs the information of the target network layer.
- the model accuracy positioning device may perform model accuracy positioning based on a user instruction, and the user instruction is used to instruct to locate the accuracy of the second neural network model.
- the aligned target network layer, the user instruction includes the first neural network model under the source frame, model input data, and information about the target frame.
- the model accuracy positioning device can also perform model accuracy positioning based on internal operating instructions, such as model accuracy positioning instructions.
- the model accuracy positioning device acquires an instruction that the accuracy of the second neural network model and the first neural network model are not aligned, it triggers the model accuracy positioning instruction.
- the internal operation instruction is used to instruct the positioning of the target network layer whose accuracy is not aligned in the second neural network model, and the internal operation instruction includes the first neural network model under the source framework, model input data, and information about the target framework.
- the model input data is processed through the second neural network model to obtain the output data of each network layer in the second neural network model.
- the output data of each network layer where the first neural network model processes the model input data is obtained in the process of the model conversion processing.
- the target network layer is the network layer in which the accuracy is not aligned first among the multiple network layers included in the second neural network model.
- the target network layer is a plurality of network layers whose accuracy is not aligned in the second neural network model.
- it includes not only the network layer where the accuracy misalignment occurs first, but also the subsequent network layers of the network layer.
- the target network layer can be determined by comparing the output data of each network layer in the first neural network model and the second neural network model.
- the network is considered The layer is a network layer whose accuracy is not aligned.
- the information of the target network layer includes at least one of the following: the identification, parameters, output data of the target network layer, the output data and the first neural network model The error between the output data of the network layer corresponding to the target network layer.
- the method further includes: the model accuracy positioning device establishes a relationship between the network layers in the first neural network model and the second neural network model based on the model conversion processing Mapping relationship; the model accuracy positioning device locates the second neural network based on the output data of each network layer obtained by processing the model input data on the first neural network model and the second neural network model
- the target network layer whose accuracy is not aligned in the model includes: the model accuracy positioning device determines the target network layer based on the output data of each network layer in the first neural network model and the second neural network model and the mapping relationship. The target network layer whose accuracy is not aligned in the second neural network model is described.
- the model accuracy positioning device determines the second neural network based on the output data of each network layer in the first neural network model and the second neural network model and the mapping relationship.
- the target network layer whose accuracy is not aligned in the network model includes: the model accuracy positioning device sequentially compares the output data of the corresponding network layer in the first neural network model and the second neural network model based on the mapping relationship; and responding If the difference between the output data of the corresponding network layer in the first neural network model and the second neural network model exceeds the preset error range, the corresponding network layer is classified as the second neural network model.
- the network layer is determined as the target network layer.
- the model accuracy positioning device performs model conversion processing on the first neural network model under the source frame to obtain the second neural network model under the target frame, including: the model accuracy The positioning device establishes a network topology diagram through the processing of the input data of the model by the first neural network model, wherein the network topology diagram includes the information of the network layer in the first neural network model and the connections of the network layers Relationship; the model accuracy positioning device obtains the second neural network model based on the network topology map and the information of the target frame.
- a model accuracy positioning device including: an acquisition unit for acquiring a first neural network model under a source framework, model input data, and information about a target framework; and a conversion unit for evaluating the first neural network model
- the neural network model performs model conversion processing to obtain the second neural network model under the target framework; the positioning unit is used to process the input data of the model based on the first neural network model and the second neural network model.
- the output data of each network layer in the process locates the target network layer whose accuracy is not aligned in the second neural network model; the output unit is used to output the information of the target network layer.
- an electronic device including a memory and a processor, wherein the memory stores program instructions, and the processor is used to call the program instructions stored in the memory to execute the sixth aspect or the sixth aspect Any one of the implementations of the described method.
- a computer-readable storage medium stores instructions that, when run on a computer, cause the computer to execute the aforementioned sixth aspect or any one of the implementations of the sixth aspect. The method described.
- a computer program product containing instructions which when running on a computer, causes the computer to execute the method described in any one of the sixth aspect or the sixth aspect.
- the target network with misaligned accuracy in the second neural network model can be located Layer, to achieve accurate positioning of the network layer when the accuracy is not aligned.
- FIG. 1 is a schematic flowchart of a neural network model conversion method provided by an embodiment of the disclosure
- FIG. 2 is a schematic diagram of a conversion process of a neural network model provided by an embodiment of the disclosure
- FIG. 3 is a schematic diagram of another process of the neural network model conversion method provided by the embodiments of the disclosure.
- FIG. 4 is a schematic diagram of a network topology obtained in a process of positioning a target network layer according to an embodiment of the disclosure
- FIG. 5 is a schematic flowchart of a model accuracy positioning method provided by an embodiment of the disclosure.
- FIG. 6 is a schematic diagram of another process of the model accuracy positioning method provided by an embodiment of the present disclosure.
- FIG. 7 is a schematic structural diagram of a model conversion device provided by an embodiment of the disclosure.
- FIG. 8 is a schematic structural diagram of a model accuracy positioning device provided by an embodiment of the disclosure.
- FIG. 9 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the disclosure.
- FIG. 1 is a schematic flowchart of a neural network model conversion method provided by an embodiment of the present disclosure. The method includes the following steps:
- the model conversion device acquires the first neural network model under the source frame, the model input data, and the information of the target frame.
- the neural network model can be converted between frameworks.
- Each framework has its own network structure definition and toolkit.
- the conversion of a neural network model refers to the conversion of a neural network model defined in a certain framework to another framework, for example, the neural network model under the tensorflow framework is converted to the pytorch framework, or the neural network model under the custom framework
- the network model is converted to a more general framework such as pytorch or tensorflow, or vice versa, and so on.
- the corresponding frame before the neural network model conversion is called the "source frame”
- the corresponding frame after the neural network model conversion is called the "target frame”.
- the embodiments of the present disclosure do not limit the specific implementation of the source frame and the target frame.
- the model conversion device may perform model conversion processing based on a user instruction.
- the user instruction is used to instruct to convert the first neural network model under the source frame to the target frame.
- the user instruction includes the first neural network model under the source frame and model input. Data and information about the target framework.
- the model conversion device can also perform model conversion processing based on internal operating instructions, such as model conversion instructions.
- the internal operating instructions are used to instruct to convert the first neural network model under the source frame to the target frame.
- the internal operating instructions include The first neural network model under the source frame, model input data, and information about the target frame.
- the first neural network model is a general neural network model, which can be a neural network model with any function.
- the first neural network model includes one or more network layers, such as a convolutional layer, a pooling layer, a fully connected layer, a normalization layer, and so on.
- the first neural network model under the source framework includes the structure description file of each network layer in the first neural network model under the source framework, etc.
- the structure description file is used to describe the name of the network layer, the index of the layer, and the like.
- the model input data refers to model input data used for neural network model inference, or can be called test data.
- the input data of the model can be a picture, a paragraph of text, and so on.
- the target framework information includes the target framework's identification, format, toolkit, etc.
- the model conversion device performs model conversion processing on the first neural network model in the source frame to obtain the second neural network model in the target frame.
- the first neural network model under the source frame needs to be model-transformed, that is, the first neural network model is converted to the target frame.
- FIG. 2 which is a schematic diagram of the conversion process of the neural network model provided by the embodiment of the present disclosure
- a model conversion device also called a neural network model conversion tool
- the neural network model conversion tool can be used to perform the frame conversion of the neural network model.
- Use the neural network model conversion tool to convert the network layers of the first neural network model under the source frame into the format of the target frame, and obtain the network layers of the second neural network model under the target frame, thereby obtaining the first neural network model under the target frame.
- Neural network model where a network layer of the first neural network model may be converted into one or more network layers of the second neural network model, and a network layer of the second neural network model may correspond to the first neural network model One or more network layers, which are not limited in the embodiment of the present disclosure.
- the model conversion device runs the inference process of the first neural network model on the input data of the model to obtain the first inference result, for example, as shown in FIG. 2 Shown as output 1.
- the inference result can be stored or recorded locally as the first inference result.
- the first inference result can be used to verify the accuracy of the second neural network model. That is, in the process of model conversion, the inference result of the first neural network model on the input data of the model can be obtained without re-running the inference process. Thereby improving the efficiency of accuracy verification.
- the model conversion device may also re-input the model input data to the first neural network model, run the inference process of the first neural network model on the model input data, and obtain the first inference result.
- the model conversion device may pre-store the first inference result of the first neural network model on the model input data.
- the model conversion device performs model conversion processing on the first neural network model under the source frame to obtain the second neural network model under the target frame. Specifically, first, the model conversion device performs model analysis processing on the first neural network model to obtain a network topology diagram of the first neural network model, where, optionally, the model analysis processing can input the model through the first neural network model
- the network topology diagram can also be referred to as a calculation diagram, which can include the various network layers in the first neural network model and the connection relationship of the various network layers, such as the network topology structure shown in FIG. 4. Among them, the network topology diagram may not include the output of each network layer, which is beneficial to improve the model conversion efficiency.
- the model conversion device obtains the second neural network model based on the network topology map and the information of the target frame.
- the target framework has its own network structure definition and toolkit.
- the model conversion device can use the network structure definition of the target framework based on the network topology diagram of the first neural network and/ Or the toolkit performs adaptive network construction on the network topology map of the first neural network to obtain the second neural network model.
- the model conversion device separately processes the model input data based on the first inference result and the second inference result obtained by the first neural network model and the second neural network model, and obtains the accuracy verification result of the second neural network model.
- the above model input data can be input to the second neural network model, and the model input data can be used to run inferences on each network layer of the second neural network model.
- the inference result output by one network layer can be used as the input data of the next network layer, and finally the final inference result of the second neural network model, that is, the second inference result, is obtained.
- the first inference result is the inference result of the output of the last layer obtained by processing the input data of the model by the first neural network model under the source framework or the meaningful inference result of a certain reciprocal layer.
- the second inference result is the inference result of the output of the last layer obtained by processing the input data of the model by the second neural network model under the target framework or the meaningful inference result of a certain reciprocal layer.
- the present disclosure does not limit this.
- the model input data is input into the first neural network model under the source frame and the second neural network model under the target frame, respectively, to obtain output 1 (that is, the above-mentioned first inference result) and output 2 (that is, the above-mentioned first inference result). 2. Reasoning results).
- the first and second inference results are obtained by using the same model input data to run inferences in the first neural network model and the second neural network model, respectively.
- the accuracy verification result of the second neural network model under the target framework can be obtained.
- multiple parameter values of the second inference result can be matched with the corresponding parameter values in the first inference result one by one to obtain the matching result, that is, the aforementioned accuracy verification result can be obtained.
- the accuracy verification result may indicate a comparison result of the model accuracy of the second neural network model and the first neural network model, such as accuracy alignment or accuracy misalignment, or the accuracy verification result may indicate the second neural network model Whether the accuracy of the model meets expectations or a set standard, for example, the accuracy meets the standard or the accuracy does not meet the standard, etc., the embodiment of the present disclosure does not limit this.
- the accuracy verification result may be output, or the information of the second neural network model may also be saved, and the embodiments of the present disclosure are not limited thereto.
- the accuracy verification is performed according to the output 1 of the neural network model under the source frame and the output 2 of the neural network model under the target frame.
- the inference results obtained by the first neural network model under the source frame and the second neural network model under the target frame respectively on the input data of the same model can be automatically obtained
- the accuracy verification result of the second neural network model improves the accuracy verification efficiency of the neural network model conversion.
- FIG. 3 is a schematic diagram of another flow chart of the neural network model conversion method provided by the embodiment of the present disclosure.
- the method includes the following steps:
- the model conversion device obtains the first neural network model in the source frame, the model input data, and the information of the target frame.
- step S101 in the embodiment shown in FIG. 1.
- step S102 Part of the implementation of this step can refer to step S102 in the embodiment shown in FIG. 1.
- the above-mentioned model conversion process is carried out in the first process.
- a new process can be created through the above-mentioned first process, that is, the second process, which is identical to the above-mentioned first process.
- the resources occupied by the process are different.
- the neural network model conversion tool and the first neural network model under the source framework are generally developed based on a certain platform, but when the neural network model is converted, it will be based on different The target framework chooses different execution methods. Therefore, the second process created may be a process under the system environment or a process under the platform.
- the neural network model conversion tool and the source framework can be developed based on the Python platform.
- the target framework is the Caffe framework
- Caffe provides the Python interface of pycaffe
- the neural network model conversion tool and the source framework can be developed based on the Python platform.
- the os.system of the Python os module can be used to create a new process to execute commands in the system environment. Start the target framework.
- S204 Invoke the second process through the first process, so that the second process executes the processing of the second neural network model on the input data of the model, and obtains a second inference result.
- step S205 Determine whether the difference between the first inference result and the second inference result is within a preset error range, if so, proceed to step S206; if not, proceed to S207.
- S207 Determine that the accuracy verification result of the second neural network model is accuracy misalignment.
- the accuracy verification result of the second neural network model under the target framework can be obtained. Specifically, if the difference between the first inference result and the second inference result is within a preset error range, it is determined that the accuracy verification result of the second neural network model is accuracy alignment. If the difference between the first inference result and the second inference result exceeds the preset error range, it is determined that the accuracy verification result of the second neural network model is accuracy misalignment.
- the model conversion device In response to determining that the accuracy verification result of the second neural network model is accuracy misalignment, the model conversion device locates a target network layer in the second neural network model whose accuracy is not aligned.
- the target network layer is the network layer in which the accuracy is not aligned first among the multiple network layers included in the second neural network model.
- the target network layer is the first network layer in which the difference between the output data of the corresponding network layer of the first neural network model and the corresponding network layer of the second neural network model exceeds the preset error range.
- the inference results (also referred to as output data) of any layer are generally not saved.
- the neural network model conversion tool performs a neural network model conversion and inference again for positioning accuracy problems. That is, the model conversion device performs model conversion processing on the first neural network model again.
- the output data volume of each layer of the neural network model is relatively large.
- the output data of each layer of the neural network model is not stored in the memory, but the output data is localized, that is, stored locally. Therefore, in the process of performing the model conversion process again, the output data of each network layer in the first neural network model is saved locally.
- the source framework Since the neural network model conversion tool is used to convert each network layer of the first neural network model under the source framework into the format of the target framework, the source framework will use the model input data to run the reasoning on the first neural network model. , The information of the network layer in the first neural network model and the connection relationship of the network layer can be obtained. Then, the model conversion device can adaptively configure the network topology of the first neural network model based on the network topology of the first neural network model by using the network structure definition of the target framework and the toolkit to obtain the second neural network model. Therefore, further, in the process of performing the model conversion process again, the mapping relationship between the network layers in the first neural network model and the second neural network model can also be established. The mapping relationship between the network layers of the first neural network model and the second neural network model may be one-to-many, many-to-one, or one-to-one. Accordingly, the target network layer may be one or more network layers.
- the model conversion device obtains the output data of each network layer in the first neural network model and the second neural network model, and the mapping relationship between the network layers in the first neural network model and the second neural network model, Based on the output data and the mapping relationship of each network layer in the first neural network model and the second neural network model, it can be determined that the target network layer whose accuracy is not aligned first appears in the second neural network model.
- a serial number is assigned to each network layer in the first neural network model.
- the sequence number may be in ascending order, so that when positioning accuracy is a problem, each network layer in the first neural network model can be called in turn according to the sequence numbers of multiple network layers in the first neural network model.
- the reasoning result output by the previous network layer is input to the next network layer for reasoning, and the reasoning result of each network layer is obtained. And, according to the serial number of each network layer, the inference result of each network layer is correspondingly stored locally. And also identify the inference results of each network layer.
- a network layer may have multiple inputs. Only save the inference results of each layer output, because in addition to the initial input data, the inputs of other layers are the output of the previous layer, so once the initial input of the first neural network model and the output of each layer are recorded, it is equivalent to The input and output of all layers are recorded. As shown in FIG.
- the neural network model includes multiple network layers: a convolutional layer, an activation function, a normalization layer, an Eltwise layer and Pooling layer, etc. After the initial input data to the first network layer of the neural network model, the output of each network layer is used as the input of the next network layer.
- the inference result of the neural network model includes initial input data and input/output data 1-10.
- Each network layer in the first neural network model is individually converted to the target frame to obtain the second neural network model. Input the same model input data to the second neural network model, and then use the input of each layer to run the inference results of each layer of the model in the second neural network model, and save it locally, with the serial number of each network layer when saving Is the index.
- the reasoning under the target framework also needs to be carried out in a new process.
- the first neural network model in the source frame can be compared in turn.
- the inference result and the inference result of the corresponding network layer in the second neural network model under the target framework are located, and the network layer in the second neural network model whose accuracy is not aligned with the first neural network model first, that is, the target network layer is located.
- the model conversion device outputs the information of the target network layer.
- the model conversion device can output the information of the target network layer.
- the information of the target network layer includes the identification, parameters, input data, output results, etc. of the network layer.
- the administrator or user can analyze the reason for the misalignment of accuracy based on the information of the target network layer.
- the inference results obtained by the first neural network model under the source frame and the second neural network model under the target frame respectively on the input data of the same model can be automatically obtained
- the accuracy verification result of the second neural network model improves the accuracy verification efficiency of the neural network model conversion; and the input data of the same model is obtained according to the first neural network model under the source frame and the second neural network model under the target frame.
- the output data of each network layer can locate the target network layer whose accuracy is not aligned in the second neural network model, and realize the accurate positioning of the network layer when the accuracy is not aligned.
- the open source neural network model conversion tools do not verify whether the output accuracy of the neural network model before and after the conversion is consistent. The user needs to manually run and save the results under the two frameworks, and then compare them.
- the accuracy is inconsistent, the user needs to modify the neural network model based on experience, output the results of some layers in the modified neural network model, and locate the network layer that makes the inference results under the two frameworks inconsistent. This method will take a lot of time, and for some relatively large neural network models, it is often very difficult to locate the problem.
- FIG. 5 is a schematic flowchart of a model accuracy positioning method provided by an embodiment of the present disclosure. The method includes the following steps:
- the model accuracy positioning device acquires the first neural network model under the source frame, the model input data, and the information of the target frame.
- the model accuracy positioning device in this embodiment is only the difference in name from the model conversion device and neural network model conversion tool in the foregoing embodiment, and the same function can be realized.
- the model accuracy positioning device may perform model accuracy positioning based on a user instruction, and the user instruction is used to instruct to locate the accuracy of the second neural network model.
- the aligned target network layer, the user instruction includes the first neural network model under the source frame, model input data, and information about the target frame. For example, when the user obtains the result that the accuracy of the second neural network model and the first neural network model are not aligned, the user instruction is sent to the model accuracy positioning device.
- the model accuracy positioning device can also perform model accuracy positioning based on internal operating instructions, such as model accuracy positioning instructions. For example, when the model accuracy positioning device acquires an instruction that the accuracy of the second neural network model and the first neural network model are not aligned, it triggers the model accuracy positioning instruction.
- the internal operation instruction is used to instruct the positioning of the target network layer whose accuracy is not aligned in the second neural network model, and the internal operation instruction includes the first neural network model under the source framework, model input data, and information about the target framework.
- the model accuracy positioning device performs model conversion processing on the first neural network model to obtain a second neural network model under the target framework.
- step S102 in the embodiment shown in FIG. 1 or step S202 in the embodiment shown in FIG. 3.
- the model accuracy positioning device processes the output data of each network layer of the model input data respectively based on the first neural network model and the second neural network model, and locates the target network layer whose accuracy is not aligned in the second neural network model.
- the model accuracy positioning device runs the inference process of the first neural network model on the model input data, and can obtain each of the processing of the model input data by the first neural network model.
- the output data of the network layer can be stored or recorded locally.
- the model accuracy positioning device can also re-input the model input data to the first neural network model, run the inference process of the first neural network model on the model input data, and obtain the first neural network model to perform the model input data The output data of each network layer processed.
- the model accuracy positioning device may pre-store the output data of each network layer obtained by the first neural network model inferring the model input data.
- the above model input data can be input to the second neural network model, and the model input data can be used to run inferences on each network layer of the second neural network model.
- the inference result output by one network layer can be used as the input data of the next network layer to obtain the output data of each network layer in the second neural network model.
- the first and second inference results are obtained by using the same model input data to run inferences in the first neural network model and the second neural network model, respectively.
- the accuracy verification result of the second neural network model under the target framework can be obtained.
- multiple parameter values in the second inference result can be matched with the corresponding parameter values in the first inference result one by one to obtain a matching result, that is, the aforementioned accuracy verification result can be obtained.
- the accuracy verification result may indicate a comparison result of the model accuracy of the second neural network model and the first neural network model, such as accuracy alignment or accuracy misalignment, or the accuracy verification result may indicate the second neural network model Whether the accuracy of the model meets expectations or a set standard, for example, the accuracy meets the standard or the accuracy does not meet the standard, etc., the embodiment of the present disclosure does not limit this.
- the output results of each network layer of the first neural network model and the output results of each network layer of the second neural network model are obtained, the output results of each network layer of the first neural network model and the second neural network model
- the output result of each network layer of the network model is obtained by using the same model input data to run inferences in the first neural network model and the second neural network model. Therefore, according to the first neural network model of each network layer
- the output result and the output result of each network layer of the second neural network model can locate the target network layer whose accuracy is not aligned in the second neural network model.
- the target network layer is the network layer in which the accuracy is not aligned first among the multiple network layers included in the second neural network model. Specifically, if the difference between the output data of the network layer included in the second neural network model and the corresponding network layer of the first neural network model exceeds the preset error range, the network layer is determined to be a network layer with unaligned accuracy.
- the target network layer is a plurality of network layers with misaligned accuracy in the second neural network model.
- it includes not only the network layer where the accuracy misalignment occurs first, but also the subsequent network layers of the network layer.
- the number of subsequent network layers can be preset.
- the model accuracy positioning device outputs the information of the target network layer.
- the model accuracy positioning device can output the information of the target network layer.
- the information of the target network layer includes the identification, parameters, output data of the target network layer, and the error between the output data and the output data of the network layer corresponding to the target network layer in the first neural network model.
- the administrator or user can analyze the reason for the misalignment of accuracy based on the information of the target network layer.
- the output data of each network layer obtained from the input data of the same model according to the first neural network model under the source framework and the second neural network model under the target framework respectively,
- the target network layer whose accuracy is not aligned in the second neural network model can be located, and the accurate positioning of the target network layer when the accuracy is not aligned is realized.
- FIG. 6 is a schematic diagram of another flow chart of the model accuracy positioning method provided by an embodiment of the present disclosure.
- the method includes the following steps:
- the model accuracy positioning device acquires the first neural network model under the source frame, the model input data, and the information of the target frame.
- the model accuracy positioning device establishes a network topology map through the processing of the input data of the model by the first neural network model, where the network topology map includes the information of the network layers in the first neural network model and the connection relationship of the network layers.
- the model accuracy positioning device establishes a network topology diagram through the processing of the input data of the model by the first neural network model, wherein the network topology diagram includes the information of the network layer in the first neural network model and the connection relationship of the network layers.
- the source framework will use the model input data to run the inference on the first neural network model.
- the information of the network layer in the first neural network model and the connection relationship of the network layer can be obtained.
- the information of the network layer in the first neural network model and the connection relationship of the network layers constitute the network topology diagram of the first neural network model.
- the model accuracy positioning device obtains the second neural network model based on the network topology map and the information of the target frame, and records the output data of each network layer in the process of processing the input data of the model by the first neural network model, and performs conversion processing based on the model Establish the mapping relationship between the network layers in the first neural network model and the second neural network model.
- the target framework After the model accuracy positioning device obtains the network topology diagram of the first neural network, the target framework has its own network structure definition and toolkit.
- the model accuracy positioning device can be based on the network topology diagram of the first neural network and use the network structure definition of the target framework
- the toolkit adaptively configures the network topology of the first neural network to obtain the second neural network model.
- the source framework Since the neural network model conversion tool is used to convert each network layer of the first neural network model under the source framework into the format of the target framework, the source framework will use the model input data to run the reasoning on the first neural network model. , The information of the network layer in the first neural network model and the connection relationship of the network layer can be obtained. Then, the model accuracy positioning device can be based on the network topology of the first neural network, using the network structure definition of the target framework and the toolkit to adaptively configure the network topology of the first neural network to obtain the second neural network model. Therefore, further, in the process of model conversion processing, the mapping relationship between the network layers in the first neural network model and the second neural network model can also be established. The mapping relationship between the network layers of the first neural network model and the second neural network model may be one-to-many, many-to-one, or one-to-one. Accordingly, the target network layer may be one or more network layers.
- the model accuracy positioning device processes the model input data through the second neural network model to obtain output data of each network layer in the second neural network model.
- step S103 in the embodiment shown in FIG. 1 or step S203 in the embodiment shown in FIG. 3.
- the difference is that in this embodiment, the output data of each network layer of the second neural network model is recorded, while in the embodiment shown in FIG. 1 or 3, the output data of the second neural network model is recorded.
- the final inference result is the output data of the last network layer of the second neural network model.
- the model accuracy positioning device determines a target network layer whose accuracy is not aligned in the second neural network model based on the output data and the mapping relationship of each network layer in the first neural network model and the second neural network model.
- the model accuracy positioning device obtains the output data of each network layer in the first neural network model and the second neural network model, and the mapping relationship between the network layers in the first neural network model and the second neural network model, Based on the output data and the mapping relationship of each network layer in the first neural network model and the second neural network model, it can be determined that the target network layer whose accuracy is not aligned first appears in the second neural network model.
- a serial number is assigned to each network layer in the first neural network model.
- the sequence number may be in ascending order, so that when positioning accuracy is a problem, each network layer in the first neural network model can be called in turn according to the sequence numbers of multiple network layers in the first neural network model.
- the reasoning result output by the previous network layer is input to the next network layer for reasoning, and the reasoning result of each network layer is obtained. And, according to the serial number of each network layer, the inference result of each network layer is correspondingly stored locally. And also identify the inference results of each network layer.
- a network layer may have multiple inputs. Only save the inference results of each layer output, because in addition to the initial input data, the inputs of other layers are the output of the previous layer, so once the initial input of the first neural network model and the output of each layer are recorded, it is equivalent to The input and output of all layers are recorded.
- the neural network model includes multiple network layers: convolutional layer, activation function, normalization layer, Eltwise Layer and pooling layer, etc. After the initial input data to the first network layer of the neural network model, the output of each network layer is used as the input of the next network layer.
- the inference result of the neural network model includes initial input data and input/output data 1-10.
- Each network layer in the first neural network model is individually converted to the target frame to obtain the second neural network model. Input the same model input data to the second neural network model, and then use the input of each layer to run the inference results of each layer of the model in the second neural network model, and save it locally, with the serial number of each network layer when saving Is the index.
- the reasoning under the target framework also needs to be carried out in a new process.
- the first neural network model in the source frame can be compared in turn.
- the inference result and the inference result of the corresponding network layer in the second neural network model under the target framework are located, and the network layer in the second neural network model whose accuracy is not aligned with the first neural network model first, that is, the target network layer is located.
- the model accuracy positioning device outputs the information of the target network layer.
- the output data of each network layer obtained from the input data of the same model according to the first neural network model under the source framework and the second neural network model under the target framework respectively,
- the target network layer whose accuracy is not aligned in the second neural network model can be located, and the accurate positioning of the network layer when the accuracy is not aligned is realized.
- an embodiment of the present disclosure further provides a model conversion device, and the device 1000 includes:
- the obtaining unit 11 is used to obtain the first neural network model under the source frame, the model input data, and the information of the target frame;
- the conversion unit 12 is configured to perform model conversion processing on the first neural network model in the source framework to obtain the second neural network model in the target framework;
- the verification unit 13 is configured to obtain the second neural network based on the first inference result and the second inference result obtained by separately processing the model input data based on the first neural network model and the second neural network model The accuracy of the model is verified.
- the conversion unit 12 is configured to perform a model conversion process on the first neural network model under the source framework through a first process to obtain the second neural network model under the target framework;
- the device also includes:
- the creating unit 14 is configured to create a second process through the first process
- the inference unit 15 is configured to invoke the second process through the first process, so that the second process executes the processing of the second neural network model on the input data of the model to obtain a second inference result.
- the verification unit 13 is configured to determine the accuracy verification result of the second neural network model if the difference between the first inference result and the second inference result is within a preset error range For precision alignment; or
- the verification unit 13 is further configured to determine that the accuracy verification result of the second neural network model is that the accuracy of the second neural network model is misaligned if the difference between the first inference result and the second inference result exceeds the preset error range .
- the device further includes:
- the positioning unit 16 is configured to locate a target network layer whose accuracy is not aligned in the second neural network model in response to determining that the accuracy verification result of the second neural network model is accuracy misalignment;
- the output unit 17 is configured to output the information of the target network layer.
- the positioning unit 16 includes:
- the establishment unit 161 is configured to establish a mapping relationship between the network layers in the first neural network model and the second neural network model;
- the determining unit 162 is configured to determine the second neural network model and the second neural network model based on the output data of each network layer in the process of processing the input data of the model and the mapping relationship.
- the target network layer whose accuracy is not aligned in the neural network model.
- model conversion device performs model conversion processing on the first neural network model again, wherein, in the process of performing the model conversion processing again, the first neural network model is acquired Output data of each network layer, and/or establish a mapping relationship between the network layers in the first neural network model and the second neural network model.
- the conversion unit 12 is configured to process the input data of the model through the first neural network model to establish a network topology diagram, wherein the network topology diagram includes the first neural network model The information of the network layer in and the connection relationship of the network layer; and the second neural network model is obtained based on the network topology diagram and the information of the target framework.
- the second neural network model can be automatically obtained according to the inference results obtained by the first neural network model under the source framework and the second neural network model under the target framework on the input data of the same model.
- the accuracy verification result of the network model improves the accuracy verification efficiency of the neural network model conversion.
- an embodiment of the present disclosure further provides a model accuracy positioning device, and the device 2000 includes:
- the obtaining unit 21 is configured to obtain the first neural network model under the source frame, the model input data, and the information of the target frame;
- the conversion unit 22 is configured to perform model conversion processing on the first neural network model to obtain a second neural network model under the target framework;
- the positioning unit 23 is configured to locate the output data of each network layer in the process of separately processing the input data of the model based on the first neural network model and the second neural network model, and locate the accuracy in the second neural network model Unaligned target network layer;
- the output unit 24 is configured to output the information of the target network layer.
- the information of the target network layer includes at least one of the following: the identification, parameters, output data of the target network layer, and the output data and the first neural network model and the target network The error between the output data of the network layer corresponding to the layer.
- the device further includes:
- the first establishing unit 25 is configured to establish a mapping relationship between the network layers in the first neural network model and the second neural network model based on the model conversion processing;
- the positioning unit 23 is configured to determine that the accuracy of the second neural network model is not aligned based on the output data of each network layer in the first neural network model and the second neural network model and the mapping relationship The target network layer.
- the positioning unit 23 includes:
- the calling unit 231 is configured to sequentially compare output data of corresponding network layers in the first neural network model and the second neural network model based on the mapping relationship;
- the determining unit 232 is configured to respond to the difference between the output data of the corresponding network layer in the first neural network model and the second neural network model exceeding a preset error range, and classify the corresponding network layer as belonging to the The network layer in the second neural network model is determined as the target network layer.
- the conversion unit 22 includes:
- the second establishing unit 221 is used to process the input data of the model through the first neural network model to establish a network topology diagram, wherein the network topology diagram includes the network layer in the first neural network model The connection between information and network layers;
- the second obtaining unit 222 is configured to obtain the second neural network model based on the network topology map and the information of the target frame.
- the output data of each network layer obtained from the input data of the same model according to the first neural network model under the source framework and the second neural network model under the target framework,
- the target network layer whose accuracy is not aligned in the second neural network model can be located, and the accurate positioning of the network layer when the accuracy is not aligned is realized.
- FIG. 9 a schematic diagram of the hardware structure of an electronic device is also provided, and the electronic device is used to execute the above-mentioned neural network model conversion method/model accuracy positioning method.
- Part or all of the above methods can be implemented by hardware, and can also be implemented by software or firmware.
- the electronic device may be a chip or an integrated circuit during specific implementation.
- the neural network model conversion method/model accuracy positioning method of the foregoing embodiment when part or all of the neural network model conversion method/model accuracy positioning method of the foregoing embodiment is implemented by software or firmware, it may be implemented by an electronic device 3000 provided in FIG. 9. As shown in FIG. 9, the electronic device 3000 may include:
- the memory 33 and the processor 34 may be one or more, and one processor is taken as an example in FIG. 9
- the processor 34 may also include an input device 31 and an output device 32.
- the input device 31, the output device 32, the memory 33, and the processor 34 may be connected by a bus or other means, wherein the connection by a bus is taken as an example in FIG. 9.
- the processor 34 is used to execute the method steps executed in FIG. 1, FIG. 3, FIG. 5, and FIG. 6.
- the program of the above-mentioned neural network model conversion method/model accuracy positioning method may be stored in the memory 33.
- the memory 33 may be a physically independent unit, or may be integrated with the processor 34.
- the memory 33 can also be used to store data.
- the electronic device may also only include a processor.
- the memory used to store the program is located outside the electronic device, and the processor is connected to the memory through a circuit or wire for reading and executing the program stored in the memory.
- the processor may be a central processing unit (CPU), a network processor (NP), or a WLAN (Wireless Local Area Network) device.
- CPU central processing unit
- NP network processor
- WLAN Wireless Local Area Network
- the processor may further include a hardware chip.
- the above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof.
- the above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
- the memory may include volatile memory (volatile memory), such as random-access memory (RAM); the memory may also include non-volatile memory (non-volatile memory), such as flash memory (flash memory) , A hard disk drive (HDD) or a solid-state drive (solid-state drive, SSD); the memory may also include a combination of the foregoing types of memory.
- volatile memory such as random-access memory (RAM)
- non-volatile memory such as flash memory (flash memory)
- flash memory flash memory
- HDD hard disk drive
- solid-state drive solid-state drive
- one or more embodiments of the present disclosure may be provided as a method, a system, or a computer program product. Therefore, one or more embodiments of the present disclosure may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of the present disclosure may adopt computer programs implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The form of the product.
- computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
- the embodiments of the present disclosure also provide a computer-readable storage medium, and the storage medium may store a computer program.
- the program When the program is executed by a processor, the steps of the neural network model conversion method described in any of the embodiments of the present disclosure are realized. And/or, implement the steps of the model accuracy positioning method described in any embodiment of the present disclosure.
- the embodiments of the subject and functional operations described in the present disclosure can be implemented in the following: digital electronic circuits, tangible computer software or firmware, computer hardware including the structures disclosed in the present disclosure and structural equivalents thereof, or among them A combination of one or more.
- the embodiments of the subject matter described in the present disclosure may be implemented as one or more computer programs, that is, one or one of the computer program instructions encoded on a tangible non-transitory program carrier to be executed by a data processing device or instruct the operation of the data processing device Multiple modules.
- the program instructions may be encoded on artificially generated propagated signals, such as machine-generated electrical, optical or electromagnetic signals, which are generated to encode information and transmit it to a suitable receiver device for data transmission.
- the processing device executes.
- the computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them.
- the processing and logic flow described in the present disclosure can be executed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating according to input data and generating output.
- the processing and logic flow can also be executed by a dedicated logic circuit, such as a field programmable gate array (FPGA) or an application specific integrated circuit (ASIC), and the device can also be implemented as a dedicated logic circuit.
- FPGA field programmable gate array
- ASIC application specific integrated circuit
- Computers suitable for executing computer programs include, for example, general-purpose and/or special-purpose microprocessors, or any other type of central processing unit.
- the central processing unit will receive instructions and data from a read-only memory and/or a random access memory.
- the basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data.
- the computer will also include one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or the computer will be operatively coupled to this mass storage device to receive data from or send data to it. It transmits data, or both.
- the computer does not have to have such equipment.
- the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or, for example, a universal serial bus (USB ) Flash drives are portable storage devices, just to name a few.
- PDA personal digital assistant
- GPS global positioning system
- USB universal serial bus
- Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, for example, semiconductor memory devices (such as EPROM, EEPROM, and flash memory devices), magnetic disks (such as internal hard disks or Removable disks), magneto-optical disks, CD ROM and DVD-ROM disks.
- semiconductor memory devices such as EPROM, EEPROM, and flash memory devices
- magnetic disks such as internal hard disks or Removable disks
- magneto-optical disks CD ROM and DVD-ROM disks.
- the processor and the memory can be supplemented by or incorporated into a dedicated logic circuit.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Molecular Biology (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Image Analysis (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Navigation (AREA)
Abstract
Description
Claims (20)
- 一种神经网络模型的转换方法,其特征在于,所述方法包括:模型转换装置获取源框架下的第一神经网络模型、模型输入数据以及目标框架的信息;所述模型转换装置对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型;所述模型转换装置基于所述第一神经网络模型和所述第二神经网络模型分别对所述模型输入数据进行处理得到的第一推理结果和第二推理结果,得到所述第二神经网络模型的精度验证结果。
- 根据权利要求1所述的方法,其特征在于,所述对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型,包括:通过第一进程对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型;所述方法还包括:通过所述第一进程创建第二进程;通过所述第一进程调用所述第二进程,以在所述第二进程中通过所述第二神经网络模型对所述模型输入数据进行处理,得到第二推理结果。
- 根据权利要求1或2所述的方法,其特征在于,所述模型转换装置基于所述第一神经网络模型和所述第二神经网络模型分别对所述模型输入数据进行处理得到的第一推理结果和第二推理结果,得到所述第二神经网络模型的精度验证结果,包括:若所述第一推理结果与所述第二推理结果之间的差别处于预设误差范围内,确定所述第二神经网络模型的精度验证结果为精度对齐;或若所述第一推理结果与所述第二推理结果之间的差别超出所述预设误差范围,确定所述第二神经网络模型的精度验证结果为精度未对齐。
- 根据权利要求1至3中任一项所述的方法,其特征在于,所述方法还包括:响应于确定所述第二神经网络模型的精度验证结果为精度未对齐,所述模型转换装置定位所述第二神经网络模型中精度未对齐的目标网络层;所述模型转换装置输出所述目标网络层的信息。
- 根据权利要求4所述的方法,其特征在于,所述定位所述第二神经网络模型中精度未对齐的目标网络层,包括:所述模型转换装置建立所述第一神经网络模型和所述第二神经网络模型中的网络层之间的映射关系;所述模型转换装置基于所述第一神经网络模型和所述第二神经网络模型分别处理所述模型输入数据的过程中每个网络层的输出数据以及所述映射关系,确定所述第二神经网络模型中精度未对齐的目标网络层。
- 根据权利要求5所述的方法,其特征在于,其中,所述模型转换装置对所述第一神经网络模型再次进行模型转换处理,其中,在所述再次进行模型转换处理的过程中,获取所述第一神经网络模型中的每个网络层的输出数据,和/或建立所述第一神经网络模型和所述第二神经网络模型中的网络层之间的映射关系。
- 根据权利要求1至6中任一项所述的方法,其特征在于,所述模型转换装置对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型,包括:所述模型转换装置通过所述第一神经网络模型对所述模型输入数据的处理,建立网络拓扑图,其中,所述网络拓扑图包括所述第一神经网络模型中的网络层的信息以及网络层的连接关系;所述模型转换装置基于所述网络拓扑图以及所述目标框架的信息,得到所述第二神经网络模型。
- 一种模型精度定位方法,其特征在于,包括:模型精度定位装置获取源框架下的第一神经网络模型、模型输入数据以及目标框架的信息;所述模型精度定位装置对所述第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型;所述模型精度定位装置基于所述第一神经网络模型和所述第二神经网络模型分别处理所述模型 输入数据的过程中每个网络层的输出数据,定位所述第二神经网络模型中精度未对齐的目标网络层;所述模型精度定位装置输出所述目标网络层的信息。
- 根据权利要求8所述的方法,其特征在于,所述方法还包括:所述模型精度定位装置基于所述模型转换处理,建立所述第一神经网络模型和所述第二神经网络模型中的网络层之间的映射关系;所述模型精度定位装置基于所述第一神经网络模型和所述第二神经网络模型分别处理所述模型输入数据的过程中每个网络层的输出数据,定位所述第二神经网络模型中精度未对齐的目标网络层,包括:所述模型精度定位装置基于所述第一神经网络模型和所述第二神经网络模型中每个网络层的输出数据以及所述映射关系,确定所述第二神经网络模型中精度未对齐的目标网络层。
- 根据权利要求9所述的方法,其特征在于,所述模型精度定位装置基于所述第一神经网络模型和所述第二神经网络模型中每个网络层的输出数据以及所述映射关系,确定所述第二神经网络模型中精度未对齐的目标网络层,包括:所述模型精度定位装置基于所述映射关系依次比较所述第一神经网络模型和所述第二神经网络模型中对应网络层的输出数据;响应于所述第一神经网络模型和所述第二神经网络模型中对应网络层的输出数据之间的差别超出预设误差范围,将所述对应网络层中属于所述第二神经网络模型中的网络层确定为所述目标网络层。
- 根据权利要求8~10中任一项所述的方法,其特征在于,所述模型精度定位装置对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型,包括:所述模型精度定位装置通过所述第一神经网络模型对所述模型输入数据的处理,建立网络拓扑图,其中,所述网络拓扑图包括所述第一神经网络模型中的网络层的信息以及网络层的连接关系;所述模型精度定位装置基于所述网络拓扑图以及所述目标框架的信息,得到所述第二神经网络模型。
- 一种模型转换装置,其特征在于,所述装置包括:获取单元,用于获取源框架下的第一神经网络模型、模型输入数据以及目标框架的信息;转换单元,用于对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型;验证单元,用于基于所述第一神经网络模型和所述第二神经网络模型分别对所述模型输入数据进行处理得到的第一推理结果和第二推理结果,得到所述第二神经网络模型的精度验证结果。
- 根据权利要求12所述的装置,其特征在于,所述转换单元用于通过第一进程对所述源框架下的第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型;所述装置还包括:创建单元,用于通过所述第一进程创建第二进程;推理单元,用于通过所述第一进程调用所述第二进程,以使得所述第二进程执行所述第二神经网络模型对所述模型输入数据的处理,得到第二推理结果。
- 根据权利要求12或13所述的装置,其特征在于,所述验证单元用于若所述第一推理结果与所述第二推理结果之间的差别处于预设误差范围内,确定所述第二神经网络模型的精度验证结果为精度对齐;和/或所述验证单元还用于若所述第一推理结果与所述第二推理结果之间的差别超出所述预设误差范围,确定所述第二神经网络模型的精度验证结果为精度未对齐。
- 根据权利要求12至14中任一项所述的装置,其特征在于,所述装置还包括:定位单元,用于响应于确定所述第二神经网络模型的精度验证结果为精度未对齐,定位所述第二神经网络模型中精度未对齐的目标网络层;输出单元,用于输出所述目标网络层的信息。
- 根据权利要求15所述的装置,其特征在于,所述定位单元包括:建立单元,用于建立所述第一神经网络模型和所述第二神经网络模型中的网络层之间的映射关系;确定单元,用于基于所述第一神经网络模型和所述第二神经网络模型分别处理所述模型输入数据的过程中每个网络层的输出数据以及所述映射关系,确定所述第二神经网络模型中精度未对齐的目标网络层。
- 根据权利要求16所述的装置,其特征在于,其中,所述模型转换装置对所述第一神经网络模型再次进行模型转换处理,其中,在所述再次进行模型转换处理的过程中,获取所述第一神经网络模型中的每个网络层的输出数据,和/或建立所述第一神经网络模型和所述第二神经网络模型中的网络层之间的映射关系。
- 一种模型精度定位装置,其特征在于,包括:获取单元,用于获取源框架下的第一神经网络模型、模型输入数据以及目标框架的信息;转换单元,用于对所述第一神经网络模型进行模型转换处理,得到所述目标框架下的第二神经网络模型;定位单元,用于基于所述第一神经网络模型和所述第二神经网络模型分别处理所述模型输入数据的过程中每个网络层的输出数据,定位所述第二神经网络模型中精度未对齐的目标网络层;输出单元,用于输出所述目标网络层的信息。
- 一种电子设备,其特征在于,所述装置包括存储器和处理器,其中,所述存储器中存储程序指令,且所述处理器用于调用所述存储器中存储的程序指令,执行如权利要求1~11中任一项所述的方法。
- 一种计算机存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行如权利要求1~11中任一项所述的方法。
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2021570957A JP2022540300A (ja) | 2020-02-28 | 2021-02-18 | ニューラルネットワークモデル変換方法、モデル精度位置決め方法、および装置 |
SG11202113120YA SG11202113120YA (en) | 2020-02-28 | 2021-02-18 | Methods and apparatuses for transforming neural network model, and methods and apparatuses for positioning model precision |
KR1020217041100A KR20220008336A (ko) | 2020-02-28 | 2021-02-18 | 뉴럴 네트워크 모델의 변환 방법, 모델 정확도 확립 방법 및 장치 |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010129010.0A CN113326913A (zh) | 2020-02-28 | 2020-02-28 | 神经网络模型的转换方法、模型精度定位方法及装置 |
CN202010129010.0 | 2020-02-28 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021169844A1 true WO2021169844A1 (zh) | 2021-09-02 |
Family
ID=77412746
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/076754 WO2021169844A1 (zh) | 2020-02-28 | 2021-02-18 | 神经网络模型的转换方法、模型精度定位方法及装置 |
Country Status (6)
Country | Link |
---|---|
JP (1) | JP2022540300A (zh) |
KR (1) | KR20220008336A (zh) |
CN (1) | CN113326913A (zh) |
SG (1) | SG11202113120YA (zh) |
TW (1) | TW202133054A (zh) |
WO (1) | WO2021169844A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115878096A (zh) * | 2023-01-31 | 2023-03-31 | 北京面壁智能科技有限责任公司 | 深度学习模型统一应用方法、装置、服务器及存储介质 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115187821B (zh) * | 2022-07-05 | 2024-03-22 | 阿波罗智能技术(北京)有限公司 | 验证模型转换前后正确性的方法、相关装置及程序产品 |
CN117056238B (zh) * | 2023-10-11 | 2024-01-30 | 深圳鲲云信息科技有限公司 | 验证部署框架下模型转换正确性的方法及计算设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108229652A (zh) * | 2017-11-28 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络模型迁移方法和系统、电子设备、程序和介质 |
CN108229651A (zh) * | 2017-11-28 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络模型迁移方法和系统、电子设备、程序和介质 |
CN109993300A (zh) * | 2017-12-29 | 2019-07-09 | 华为技术有限公司 | 一种神经网络模型的训练方法及装置 |
CN110348566A (zh) * | 2019-07-15 | 2019-10-18 | 上海点积实业有限公司 | 一种生成神经网络训练用数字信号的方法和系统 |
US20200005183A1 (en) * | 2018-06-29 | 2020-01-02 | Renesas Electronics Corporation | Evaluation method for learning models, training method, device, and program |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108229646A (zh) * | 2017-08-08 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络模型压缩方法、装置、存储介质和电子设备 |
KR102593438B1 (ko) * | 2017-11-17 | 2023-10-24 | 삼성전자주식회사 | 뉴럴 네트워크 학습 방법 및 디바이스 |
-
2020
- 2020-02-28 CN CN202010129010.0A patent/CN113326913A/zh active Pending
-
2021
- 2021-02-18 JP JP2021570957A patent/JP2022540300A/ja not_active Withdrawn
- 2021-02-18 SG SG11202113120YA patent/SG11202113120YA/en unknown
- 2021-02-18 WO PCT/CN2021/076754 patent/WO2021169844A1/zh active Application Filing
- 2021-02-18 KR KR1020217041100A patent/KR20220008336A/ko not_active Application Discontinuation
- 2021-02-19 TW TW110105732A patent/TW202133054A/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108229652A (zh) * | 2017-11-28 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络模型迁移方法和系统、电子设备、程序和介质 |
CN108229651A (zh) * | 2017-11-28 | 2018-06-29 | 北京市商汤科技开发有限公司 | 神经网络模型迁移方法和系统、电子设备、程序和介质 |
CN109993300A (zh) * | 2017-12-29 | 2019-07-09 | 华为技术有限公司 | 一种神经网络模型的训练方法及装置 |
US20200005183A1 (en) * | 2018-06-29 | 2020-01-02 | Renesas Electronics Corporation | Evaluation method for learning models, training method, device, and program |
CN110348566A (zh) * | 2019-07-15 | 2019-10-18 | 上海点积实业有限公司 | 一种生成神经网络训练用数字信号的方法和系统 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115878096A (zh) * | 2023-01-31 | 2023-03-31 | 北京面壁智能科技有限责任公司 | 深度学习模型统一应用方法、装置、服务器及存储介质 |
CN115878096B (zh) * | 2023-01-31 | 2023-05-23 | 北京面壁智能科技有限责任公司 | 深度学习模型统一应用方法、装置、服务器及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN113326913A (zh) | 2021-08-31 |
SG11202113120YA (en) | 2021-12-30 |
JP2022540300A (ja) | 2022-09-15 |
TW202133054A (zh) | 2021-09-01 |
KR20220008336A (ko) | 2022-01-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021169844A1 (zh) | 神经网络模型的转换方法、模型精度定位方法及装置 | |
WO2017020654A1 (zh) | 无线网络接入方法和装置 | |
US10873512B2 (en) | Methods for managing self-healing cloud infrastructure and applications | |
US11893331B2 (en) | Device verification method, UVM verification platform, electronic apparatus and storage medium | |
US10354031B2 (en) | Information processing by interpenetrating signal transmission channel in design for testability of chip | |
WO2020006878A1 (zh) | 语音识别测试方法、装置、计算机设备及存储介质 | |
WO2020237508A1 (zh) | 一种断言验证代码绑定方法及装置 | |
US10656934B2 (en) | Efficient software testing | |
WO2020177385A1 (zh) | 虚拟机性能检测方法及装置、电子设备、存储介质 | |
US9846609B2 (en) | System and method for testing configuration and operation of I/O devices | |
CN111930613A (zh) | 待测芯片的测试用例生成方法、装置、电子设备以及介质 | |
WO2021051879A1 (zh) | 反向代理评价模型中目标参数选取方法及相关装置 | |
CN113127357B (zh) | 单元测试方法、装置、设备、存储介质及程序产品 | |
WO2020186518A1 (en) | Method and apparatus for debugging, and system on chip | |
CN112860587B (zh) | Ui自动测试方法和装置 | |
US9483593B2 (en) | Method for decomposing a hardware model and for accelerating formal verification of the hardware model | |
WO2024041335A1 (zh) | 一种寻址测试的方法、装置、存储介质及电子设备 | |
WO2021253239A1 (zh) | 云服务系统的资源配置确定方法及装置 | |
CN113485697A (zh) | 一种人工智能框架下的模型建设运营服务方法及系统 | |
KR101794016B1 (ko) | 분산 컴퓨팅 기반의 어플리케이션 객체 분석 방법, 이를 수행하는 어플리케이션 객체 분석 서버 및 이를 저장하는 기록매체 | |
WO2023213094A1 (zh) | 应用于集成电路器件的数据区域动态选取方法、系统、设备和计算机可读存储介质 | |
CN113691403B (zh) | 拓扑节点配置方法、相关装置及计算机程序产品 | |
CN113791792B (zh) | 应用调用信息的获取方法、设备以及存储介质 | |
CN106484625A (zh) | 一种基于通用测试软件开发平台测试子系统的方法 | |
CN115034164A (zh) | 验证方法、电子设备及存储介质 |
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: 21760426 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2021570957 Country of ref document: JP Kind code of ref document: A |
|
ENP | Entry into the national phase |
Ref document number: 20217041100 Country of ref document: KR Kind code of ref document: A |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21760426 Country of ref document: EP Kind code of ref document: A1 |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 27.03.2023) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21760426 Country of ref document: EP Kind code of ref document: A1 |