TW202133054A - Transformation method of neural network model, model accuracy positioning method and apparatuses - Google Patents

Transformation method of neural network model, model accuracy positioning method and apparatuses Download PDF

Info

Publication number
TW202133054A
TW202133054A TW110105732A TW110105732A TW202133054A TW 202133054 A TW202133054 A TW 202133054A TW 110105732 A TW110105732 A TW 110105732A TW 110105732 A TW110105732 A TW 110105732A TW 202133054 A TW202133054 A TW 202133054A
Authority
TW
Taiwan
Prior art keywords
model
neural network
network model
accuracy
target
Prior art date
Application number
TW110105732A
Other languages
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 TW202133054A publication Critical patent/TW202133054A/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Image Analysis (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Navigation (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present disclosure provides a transformation method of a neural network model, a model accuracy positioning method and apparatuses. In the transformation scheme of the neural network model, a model transformation apparatus may automatically obtain an accuracy verification result of a second neural network model based on an inference result obtained by a first neural network model under a source frame for model input data and an inference result obtained by a second neural network model under a target frame for the model input data, thereby improving the accuracy verification efficiency of the transformation of the neural network model. In the scheme of model accuracy positioning, the model accuracy positioning apparatus may locate a target network layer in the second neural network model with unaligned accuracy based on the output data of each network layer obtained by the first neural network model under the source frame and the second neural network model under the target frame for the same model input data, respectively, thereby achieving accurate positioning of the network layer with unaligned accuracy.

Description

神經網路模型的轉換方法、模型精度定位方法及裝置Neural network model conversion method, model accuracy positioning method and device

本發明涉及人工智慧(artificial intelligence,AI)技術領域,尤其涉及一種神經網路模型的轉換方法、模型精度定位方法及裝置。The present invention relates to the technical field of artificial intelligence (AI), in particular to a neural network model conversion method, model accuracy positioning method and device.

目前業界開發了各種各樣的深度學習模型框架,每個框架具備自己的網路結構定義和工具包。由於不同的框架在訓練、部署、平臺相容性等方面上有各自的優勢,因此經常需要對深度學習模型進行框架之間的轉換。神經網路模型的轉換是指把在某個框架下定義的神經網路模型轉換到另一個框架下。At present, the industry has developed a variety of deep learning model frameworks, each with its own network structure definition and toolkit. Since different frameworks have their own advantages in training, deployment, platform compatibility, etc., it is often necessary to convert deep learning models between frameworks. The conversion of a neural network model refers to the conversion of a neural network model defined in a certain framework to another framework.

然而,在神經網路模型轉換後,需要通過程式師手動來驗證模型精度,精度驗證效率低下。However, after the neural network model is converted, it is necessary to verify the accuracy of the model manually by the programmer, and the accuracy of the verification is inefficient.

本發明提供了一種神經網路模型的轉換技術方案。The invention provides a technical solution for neural network model conversion.

第一方面,提供了一種神經網路模型的轉換方法,所述方法包括:模型轉換裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊;模型轉換裝置基於所述模型輸入資料對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;模型轉換裝置基於所述第一神經網路模型和所述第二神經網路模型分別對所述模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到所述第二神經網路模型的精度驗證結果。In a first aspect, a neural network model conversion method is provided. The method includes: a model conversion device obtains a first neural network model in a source framework, model input data, and information about a target framework; the model conversion device is based on the Model input data performs 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 model conversion device is based on the first neural network model and the The second neural network 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 in the source frame to the target frame. The user instruction includes the first neural network in the source frame. Road model, model input data, and target framework information. 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 Including the first neural network model under the source frame, model input data, and information about the target frame.

在一種可能的實現中,模型轉換裝置在對第一神經網路模型進行模型轉換處理的過程中得到所述第一神經網路模型對所述模型輸入資料的第一推理結果。In a possible implementation, 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.

在一種可能的實現中,模型轉換裝置在本機存放區所述第一推理結果。In a possible implementation, the model conversion device stores the first inference result in the local storage area.

在一種可能的實現中,模型轉換裝置通過所述第二神經網路模型對所述模型輸入資料進行處理,得到第二推理結果。In a possible implementation, the model conversion device processes the model input data through the second neural network model to obtain a second reasoning result.

在一種可能的實現中,模型轉換裝置通過比較第一推理結果和第二推理結果,得到第二神經網路模型的精度驗證結果。In a possible implementation, 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.

在一種可能的實現中,所述對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型,包括:通過第一進程對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;所述方法還包括:通過所述第一進程創建第二進程;通過所述第一進程調用所述第二進程,以在所述第二進程中通過所述第二神經網路模型對所述模型輸入資料進行處理,得到第二推理結果。In a possible implementation, 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 The first neural network model in the source framework performs model conversion processing to obtain the second neural network model in the target framework; the method further includes: creating a second process through the first process; A process calls the second process to process the model input data through the second neural network model in the second process to obtain a second inference result.

在一種可能的實現中,所述模型轉換裝置基於所述第一神經網路模型和所述第二神經網路模型分別對所述模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到所述第二神經網路模型的精度驗證結果,包括:若所述第一推理結果與所述第二推理結果之間的差別處於預設誤差範圍內,確定所述第二神經網路模型的精度驗證結果為精度對齊;或若所述第一推理結果與所述第二推理結果之間的差別超出所述預設誤差範圍,確定所述第二神經網路模型的精度驗證結果為精度未對齊。In a possible implementation, 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, including: if the difference between the first inference result and the second inference result is within a preset error range, determining the second neural network The accuracy verification result of the model is accuracy alignment; or if the difference between the first inference result and the second inference result exceeds the preset error range, the accuracy verification result of the second neural network model is determined to be The precision is not aligned.

在一種可能的實現中,所述方法還包括:響應於確定所述第二神經網路模型的精度驗證結果為精度未對齊,所述模型轉換裝置定位所述第二神經網路模型中精度未對齊的目標網路層;所述模型轉換裝置輸出所述目標網路層的資訊。In a possible implementation, 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 in the second neural network model. Aligned target network layer; the model conversion device outputs information of the target network layer.

在一種可能的實現中,所述定位所述第二神經網路模型中精度未對齊的目標網路層,包括:所述模型轉換裝置建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係;所述模型轉換裝置基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層。In a possible implementation, 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 by the model conversion device The mapping relationship between the network layers in the network model; each network 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 by the model conversion device The output data of the path layer and the mapping relationship determine the target network layer whose accuracy is not aligned in the second neural network model.

在一種可能的實現中,所述目標網路層為第二神經網路模型包括的多個網路層中最先出現精度未對齊的網路層。In a possible implementation, 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.

在另一種可能的實現中,所述目標網路層為所述第二神經網路模型中出現精度未對齊的多個網路層。例如不僅包括最先出現精度未對齊的網路層,還包括所述網路層的後續網路層。In another possible implementation, the target network layer is a plurality of network layers whose accuracy is not aligned in the second neural network model. For example, it includes not only the network layer where the accuracy misalignment occurs first, but also the subsequent network layers of the network layer.

在一種可能的實現中,所述目標網路層的資訊,包括下列中的至少一項:所述目標網路層的標識、參數、輸出資料、該輸出資料與第一神經網路模型中與所述目標網路層對應的網路層的輸出資料之間的誤差。In a possible implementation, 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.

在一種可能的實現中,所述模型轉換裝置對所述第一神經網路模型再次進行模型轉換處理,其中,在所述再次進行模型轉換處理的過程中,獲取所述第一神經網路模型中的每個網路層的輸出資料,和/或建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係。In a possible implementation, 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 in and/or establish a mapping relationship between the network layers in the first neural network model and the second neural network model.

在一種可能的實現中,所述模型轉換裝置對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型,包括:所述模型轉換裝置通過所述第一神經網路模型對所述模型輸入資料的處理,建立網路拓撲圖,其中,所述網路拓撲圖包括所述第一神經網路模型中的網路層的資訊以及網路層的連接關係;所述模型轉換裝置基於所述網路拓撲圖以及所述目標框架的資訊,得到所述第二神經網路模型。In a possible implementation, the model conversion device performs model conversion processing on the first neural network model in the source framework to obtain the second neural network model in the target framework, including: the model conversion The device creates a network topology map by processing the input data of the model by the first neural network model, wherein the network topology map includes the information of the network layer in the first neural network model and The connection relationship of the network layer; the model conversion device obtains the second neural network model based on the network topology map and the information of the target frame.

第二方面,提供了一種模型轉換裝置,所述裝置包括:獲取單元,用於獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊;轉換單元,用於對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;驗證單元,用於基於所述第一神經網路模型和所述第二神經網路模型分別對所述模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到所述第二神經網路模型的精度驗證結果。In a second aspect, a model conversion device is provided. The device includes: an acquiring unit for acquiring a first neural network model, model input data, and information about a target frame under a source frame; 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 be based on the first neural network model and the second neural network The first inference result and the second inference result obtained by processing the input data of the model respectively by the path model obtain the accuracy verification result of the second neural network model.

第三方面,提供了一種電子設備,包括記憶體和處理器,其中,所述記憶體中存儲程式指令,且所述處理器用於調用所述記憶體中存儲的程式指令,執行第一方面或第一方面的任一個實現所述的方法。In a third aspect, an electronic device is provided, 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 Any one of the first aspect implements the method described.

第四方面,提供了一種計算機可讀存儲介質,所述計算機可讀存儲介質中存儲有指令,當其在計算機上運行時,使得計算機執行上述第一方面或第一方面的任一個實現所述的方法。In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions that, when run on a computer, cause the computer to execute the first aspect or any one of the first aspects described above. Methods.

第五方面,提供了一種包含指令的計算機程式產品,當其在計算機上運行時,使得計算機執行上述第一方面或第一方面的任一個實現所述的方法。In a fifth aspect, a computer program product containing instructions is provided, 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 conversion scheme using the neural network model of the present invention has the following technical effects:

根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的推理結果,可以自動得到第二神經網路模型的精度驗證結果,提高了神經網路模型轉換的精度驗證效率。According to the inference results of the first neural network model under the source framework and the second neural network model under the target framework on the same model input data, the accuracy verification results of the second neural network model can be automatically obtained, which improves the neural network. The accuracy of network model conversion verifies the efficiency.

本申請實施例還提供一種模型精度定位方案。The embodiment of the present application also provides a model accuracy positioning solution.

第六方面,提供了一種模型精度定位方法,包括:模型精度定位裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊;所述模型精度定位裝置對所述第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型對所述模型輸入資料進行處理的過程中得到的每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層;所述模型精度定位裝置輸出所述目標網路層的資訊。In a sixth aspect, a model accuracy positioning method is provided, including: a model accuracy positioning device acquires a first neural network model, model input data, and information about a target frame under 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 a model conversion process on the neural network model based on the first neural network model and the second neural network model The output data of each network layer obtained during the processing of the model input data is used to locate the target network layer whose accuracy is not aligned in the second neural network model; the model accuracy positioning device outputs the target network Layer of information.

在已知第二神經網路模型與第一神經網路模型的精度未對齊的情況下,模型精度定位裝置可以基於使用者指令進行模型精度定位,該使用者指令用於指示定位第二神經網路模型中精度未對齊的目標網路層,該使用者指令包括源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊。例如,使用者在獲取到第二神經網路模型與第一神經網路模型的精度未對齊的結果時,則向模型精度定位裝置發送該使用者指令。模型精度定位裝置也可以基於內部的操作指令進行模型精度定位,例如模型精度定位指令。例如,模型精度定位裝置在獲取到第二神經網路模型與第一神經網路模型的精度未對齊的指令時,則觸發模型精度定位指令。該內部的操作指令用於指示定位第二神經網路模型中精度未對齊的目標網路層,該內部的操作指令包括源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊。在一種可能的實現方式中,通過所述第二神經網路模型對所述模型輸入資料進行處理,得到所述第二神經網路模型中每個網路層的輸出資料。In the case where the accuracy of the second neural network model is known to be misaligned with the first neural network model, the model accuracy positioning device can perform model accuracy positioning based on a user instruction, which is used to instruct the positioning of the second neural network The target network layer in the road model with misaligned accuracy, the user command 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 obtains 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 instructions are used to instruct to locate the target network layer of the second neural network model whose accuracy is not aligned. The internal operation instructions include the first neural network model under the source frame, model input data, and information about the target frame . In a possible implementation manner, the input data of the model is processed through the second neural network model to obtain the output data of each network layer in the second neural network model.

在一種可能的實現方式中,在所述模型轉換處理的過程中得到所述第一神經網路模型對所述模型輸入資料進行處理的每個網路層的輸出資料。In a possible implementation manner, 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.

在一種可能的實現中,所述目標網路層為第二神經網路模型包括的多個網路層中最先出現精度未對齊的網路層。In a possible implementation, 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.

在另一種可能的實現中,所述目標網路層為所述第二神經網路模型中出現精度未對齊的多個網路層。例如不僅包括最先出現精度未對齊的網路層,還包括所述網路層的後續網路層。In another possible implementation, the target network layer is a plurality of network layers whose accuracy is not aligned in the second neural network model. For example, it includes not only the network layer where the accuracy misalignment occurs first, but also the subsequent network layers of the network layer.

在一種可能的實現中,可以通過比較第一神經網路模型和第二神經網路模型中各個網路層的輸出資料,確定目標網路層。In a possible implementation, 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.

在一種可能的實現方式中,若所述第二神經網路模型包括的網路層與所述第一神經網路模型的對應網路層的輸出資料之間的差別超過預設誤差範圍,則認定該網路層為精度未對齊的網路層。In a possible implementation, 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 a preset error range, then The network layer is considered to be a network layer with misaligned accuracy.

在一種可能的實現中,所述目標網路層的資訊,包括下列中的至少一項:所述目標網路層的標識、參數、輸出資料、該輸出資料與第一神經網路模型中與所述目標網路層對應的網路層的輸出資料之間的誤差。In a possible implementation, 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.

在一種可能的實現中,所述方法還包括:所述模型精度定位裝置基於所述模型轉換處理,建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係;所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型對所述模型輸入資料進行處理得到的每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層,包括:所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層。In a possible implementation, the method further includes: the model accuracy positioning device establishes one of the network layers in the first neural network model and the second neural network model based on the model conversion processing The model accuracy positioning device is based on the output data of each network layer obtained by processing the input data of the model based on the first neural network model and the second neural network model, and locates the output data of each network layer The target network layer whose accuracy is not aligned in the second neural network model includes: the model accuracy locating device is based on each network layer in the first neural network model and the second neural network model The output data and the mapping relationship determine the target network layer whose accuracy is not aligned in the second neural network model.

在一種可能的實現中,所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層,包括:所述模型精度定位裝置基於所述映射關係依次比較所述第一神經網路模型和所述第二神經網路模型中對應網路層的輸出資料;響應於所述第一神經網路模型和所述第二神經網路模型中對應網路層的輸出資料之間的差別超出預設誤差範圍,將所述對應網路層中屬於所述第二神經網路模型中的網路層確定為所述目標網路層。In a possible implementation, the model accuracy positioning device determines the first neural network model and the second neural network model based on the output data of each network layer and the mapping relationship. 2. Target network layers with misaligned accuracy in the neural network model, including: the model accuracy positioning device sequentially compares corresponding networks in the first neural network model and the second neural network model based on the mapping relationship Output data of the circuit layer; in response 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, the corresponding network layer The network layer in the second neural network model is determined as the target network layer.

在一種可能的實現中,所述模型精度定位裝置對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型,包括:所述模型精度定位裝置通過所述第一神經網路模型對所述模型輸入資料的處理,建立網路拓撲圖,其中,所述網路拓撲圖包括所述第一神經網路模型中的網路層的資訊以及網路層的連接關係;所述模型精度定位裝置基於所述網路拓撲圖以及所述目標框架的資訊,得到所述第二神經網路模型。In a possible implementation, the model accuracy positioning device performs model conversion processing on the first neural network model in the source framework to obtain the second neural network model in the target framework, including: the model The precision positioning device creates a network topology map by processing the input data of the model by the first neural network model, wherein the network topology map includes the network layer in the first neural network model The connection relationship between the information and the network layer; the model accuracy positioning device obtains the second neural network model based on the network topology map and the information of the target frame.

第七方面,提供了一種模型精度定位裝置,包括:獲取單元,用於獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊;轉換單元,用於對所述第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;定位單元,用於基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層;輸出單元,用於輸出所述目標網路層的資訊。In a seventh aspect, a model accuracy positioning device is provided, including: an acquiring unit for acquiring a first neural network model, model input data, and information about a target frame under a source frame; a conversion unit for comparing the first neural network model The neural network model performs model conversion processing to obtain a second neural network model under the target framework; a positioning unit is used to process the neural network model based on the first neural network model and the second neural network model respectively The output data of each network layer in the process of model input data 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.

第八方面,提供了一種電子設備,包括記憶體和處理器,其中,所述記憶體中存儲程式指令,且所述處理器用於調用所述記憶體中存儲的程式指令執行第六方面或第六方面的任一個實現所述的方法。In an eighth aspect, there is provided 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 first aspect. Any one of the six aspects implements the described method.

第九方面,提供了一種計算機可讀存儲介質,所述計算機可讀存儲介質中存儲有指令,當其在計算機上運行時,使得計算機執行上述第六方面或第六方面的任一個實現所述的方法。In a ninth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions that, when run on a computer, cause the computer to execute any one of the sixth aspect or the sixth aspect described above. Methods.

第十方面,提供了一種包含指令的計算機程式產品,當其在計算機上運行時,使得計算機執行上述第六方面或第六方面的任一個實現所述的方法。In a tenth aspect, a computer program product containing instructions is provided, which when run on a computer, causes the computer to execute the method described in any one of the sixth aspect or the sixth aspect.

採用本發明的模型精度定位方案,具有如下技術效果:Adopting the model accuracy positioning scheme of the present invention has the following technical effects:

根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的每個網路層的輸出資料,可以定位第二神經網路模型中精度未對齊的目標網路層,實現了精度未對齊時的網路層的準確定位。According to the output data of each network layer 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 of the second neural network model can be located. The aligned target network layer realizes the accurate positioning of the network layer when the accuracy is not aligned.

下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有作出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.

應理解,本發明中術語“和/或”,僅僅是一種描述關聯物件的關聯關係,表示可以存在三種關係,例如,A和/或B,可以表示:單獨存在A,同時存在A和B,單獨存在B這三種情況。另外,本文中字元“/”,一般表示前後關聯物件是一種“或”的關係。本發明中的術語“第一”、“第二”等是用於區別不同物件,而不是用於描述特定順序。It should be understood that the term "and/or" in the present invention is only an association relationship describing related objects, which means that three relationships can exist. For example, A and/or B can mean that A alone exists, and both A and B exist. There are three cases of B alone. In addition, the character "/" in this article generally indicates that the related objects before and after are in an "or" relationship. The terms "first", "second", etc. in the present invention are used to distinguish different objects, rather than to describe a specific order.

請參閱圖1,為本發明實施例提供的神經網路模型的轉換方法的流程示意圖,該方法包括以下步驟:Please refer to FIG. 1, which is a schematic flowchart of a neural network model conversion method provided by an embodiment of the present invention. The method includes the following steps:

S101、模型轉換裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊。S101. The model conversion device obtains the first neural network model under the source frame, the model input data, and the information of the target frame.

由於不同的框架在訓練、部署、平臺相容性等方面上有各自的優勢,因此可以對神經網路模型進行框架之間的轉換。每個框架具備自己的網路結構定義和工具包。神經網路模型的轉換是指把在某個框架下定義的神經網路模型轉換到另一個框架下,例如,將tensorflow框架下的神經網路模型轉換到pytorch框架下,或者,將自訂框架下的神經網路模型轉換到pytorch或者tensorflow等較為通用的框架或者反之,等等。神經網路模型轉換之前對應的框架稱為“源框架”,神經網路模型轉換之後對應的框架稱為“目標框架”,本發明實施例對源框架和目標框架的具體實現不做限定。Because different frameworks have their own advantages in training, deployment, platform compatibility, etc., neural network models 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 custom framework The following neural 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", and the corresponding frame after the neural network model conversion is called the "target frame". The embodiment of the present invention does 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 in the source frame to the target frame. The user instruction includes the first neural network in the source frame. Road model, model input data, and target framework information. 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 Including the first neural network model under the source frame, model input data, and information about the target frame. Among them, 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 and the layer Index etc. The model input data refers to the 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, etc. The target framework information includes the target framework's logo, format, toolkit, etc.

S102、模型轉換裝置對源框架下的第一神經網路模型進行模型轉換處理,得到目標框架下的第二神經網路模型。S102. 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.

要獲得目標框架下的第二神經網路模型,需對源框架下的第一神經網路模型進行模型轉換處理,即將第一神經網路模型轉換到目標框架下。如圖2所示,為本發明實施例提供的神經網路模型的轉換過程的示意圖,可以採用模型轉換裝置(也被稱為神經網路模型轉換工具)進行神經網路模型的框架轉換。利用神經網路模型轉換工具把源框架下的第一神經網路模型的各個網路層分別轉換成目標框架的格式,得到目標框架下的第二神經網路模型的各個網路層,從而得到目標框架下的第二神經網路模型,其中,第一神經網路模型的一個網路層可能會轉換成第二神經網路模型的一個或多個網路層,第二神經網路模型的一個網路層可能對應第一神經網路模型的一個或多個網路層,本發明實施例對此不做限定。To obtain the second neural network model under the target frame, the first neural network model under the source frame needs to be subjected to model conversion processing, that is, the first neural network model is converted to the target frame. As shown in FIG. 2, it is a schematic diagram of the conversion process of the neural network model provided by the embodiment of the present invention. A model conversion device (also called a 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 framework into the format of the target framework, and obtain the network layers of the second neural network model under the target framework, thereby obtaining The second neural network model under the target framework, where one network layer of the first neural network model may be converted into one or more network layers of the second neural network model, and the second neural network model One network layer may correspond to one or more network layers of the first neural network model, which is not limited in the embodiment of the present invention.

在一些實施例中,模型轉換裝置在對第一神經網路模型進行上述模型轉換處理的過程中,運行第一神經網路模型對模型輸入資料的推理過程,可以得到第一推理結果,例如圖2所示的輸出1。可選地,可以將該推理結果作為第一推理結果在本地進行存儲或記錄。該第一推理結果可以用於第二神經網路模型的精度的驗證。即在模型轉換過程中,即可得到第一神經網路模型對模型輸入資料的推理結果,而無需重新運行一遍推理過程。從而提高了精度驗證的效率。In some embodiments, in the process of performing the above-mentioned model conversion processing on the first neural network model, 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, such as a graph 2 shows the output 1. Optionally, 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.

在另外一些實施例中,模型轉換裝置也可以重新輸入模型輸入資料到第一神經網路模型,運行第一神經網路模型對模型輸入資料的推理過程,得到第一推理結果。In other embodiments, the model conversion device may also re-input the model input data to the first neural network model, and run the inference process of the first neural network model on the model input data to obtain the first inference result.

在另外一些實施例中,模型轉換裝置可能預先存儲了第一神經網路模型對模型輸入資料的第一推理結果。In other embodiments, the model conversion device may pre-store the first inference result of the first neural network model on the model input data.

模型轉換裝置對源框架下的第一神經網路模型進行模型轉換處理,得到目標框架下的第二神經網路模型。具體地,首先,模型轉換裝置對第一神經網路模型進行模型解析處理,得到第一神經網路模型的網路拓撲圖,其中,可選地,該模型解析處理可以通過第一神經網路模型對模型輸入資料的推理或者其他方式得到,該網路拓撲圖也可以稱為計算圖,可以包括第一神經網路模型中的各個網路層以及各個網路層的連接關係,例如如圖4所示的網路拓撲結構,其中,該網路拓撲圖可以不包含每個網路層的輸出,有利於提高模型轉換效率。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. 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. Optionally, the model analysis processing can be performed through the first neural network model. The model is obtained by reasoning on the input data of the model or obtained by other methods. The network topology diagram can also be called a computational diagram, which can include each network layer in the first neural network model and the connection relationship between each network layer, for example, as shown in the figure The network topology shown in 4, wherein the network topology diagram may not include the output of each network layer, which is beneficial to improve the model conversion efficiency.

然後,模型轉換裝置基於網路拓撲圖以及目標框架的資訊,得到第二神經網路模型。模型轉換裝置在獲得第一神經網路的網路拓撲圖後,目標框架具備自己的網路結構定義和工具包,模型轉換裝置可以基於第一神經網路的網路拓撲圖,利用目標框架的網路結構定義和/或工具包對該第一神經網路的網路拓撲圖進行適應性網路構建,得到第二神經網路模型。Then, the model conversion device obtains the second neural network model based on the network topology map and the information of the target frame. After the model conversion device obtains the network topology diagram of the first neural network, the target framework has its own network structure definition and toolkit. The model conversion device can be based on the network topology diagram of the first neural network and use the network topology diagram of the target framework. The network structure definition and/or toolkit performs adaptive network construction on the network topology map of the first neural network to obtain the second neural network model.

S103、模型轉換裝置基於第一神經網路模型和第二神經網路模型分別對模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到第二神經網路模型的精度驗證結果。S103. The model conversion device obtains a first inference result and a second inference result obtained by separately processing the model input data based on the first neural network model and the second neural network model to obtain the accuracy verification result of the second neural network model.

在獲得目標框架下的第二神經網路模型之後,可以將上述模型輸入資料輸入到第二神經網路模型,用該模型輸入資料在該第二神經網路模型上的每一個網路層運行一遍推理,上一個網路層輸出的推理結果可以作為下一個網路層的輸入資料,最後得到第二神經網路模型的最終的推理結果,即第二推理結果。After obtaining the second neural network model under the target framework, the above model input data can be input to the second neural network model, and the model input data can be used to run on each network layer of the second neural network model Inferring again, the inference result output by the previous 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 is obtained, that is, the second inference result.

可以理解的是,該第一推理結果是在源框架下的第一神經網路模型對模型輸入資料進行處理得到的最後一層的輸出的推理結果或者倒數的某一層的有意義的推理結果,相應地,該第二推理結果是在目標框架下的第二神經網路模型對模型輸入資料進行處理得到的最後一層的輸出的推理結果或者倒數的某一層的有意義的推理結果,本發明實施例對此不做限定。It is understandable that 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 in the source framework or the meaningful inference result of a certain reciprocal layer, correspondingly , The second inference result is the inference result of the last layer of output 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, which is the embodiment of the present invention Not limited.

如圖2所示,模型輸入資料分別輸入源框架下的第一神經網路模型和目標框架下的第二神經網路模型,分別得到輸出1(即上述第一推理結果)和輸出2(即上述第二推理結果)。As shown in Figure 2, 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, and output 1 (that is, the above-mentioned first inference result) and output 2 (that is, the above-mentioned first inference result) are obtained respectively The second reasoning result above).

在獲得第一推理結果和第二推理結果後,由於該第一推理結果和第二推理結果是採用同一模型輸入資料分別在第一神經網路模型和第二神經網路模型中運行推理得到的,因此,根據該第一推理結果和第二推理結果,例如,比較該第一推理結果和第二推理結果,可以得到目標框架下的第二神經網路模型的精度驗證結果。又例如,可以將第二推理結果的多個參數值,與第一推理結果中的相應的參數值一一進行匹配,得到匹配結果,即可以得到上述精度驗證結果。在一些實施例中,該精度驗證結果可以指示第二神經網路模型與第一神經網路模型的模型精度的比較結果,例如精度對齊或精度未對齊,或者該精度驗證結果可以指示第二神經網路模型的模型精度是否滿足預期或者設定標準,例如,精度達標或精度不達標,等等,本發明實施例對此不做限定。After obtaining the first inference result and the second inference result, because the first inference result and the second inference result are obtained by using the same model input data to run the inference in the first neural network model and the second neural network model, respectively Therefore, according to the first inference result and the second inference result, for example, by comparing the first inference result and the second inference result, the accuracy verification result of the second neural network model under the target framework can be obtained. For another example, 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. In some embodiments, 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 model accuracy of the network 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 invention does not limit this.

在一些實施例中,可以輸出該精度驗證結果,或者也可以保存第二神經網路模型的資訊,本發明實施例不限於此。In some embodiments, the accuracy verification result may be output, or the information of the second neural network model may also be saved, and the embodiment of the present invention is not limited to this.

如圖2所示,根據源框架下的神經網路模型的輸出1和目標框架下的神經網路模型的輸出2,進行精度驗證。As shown in Figure 2, the accuracy verification is performed based on the output 1 of the neural network model under the source framework and the output 2 of the neural network model under the target framework.

根據本發明實施例提供的一種神經網路模型的轉換方法,根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的推理結果,可以自動得到第二神經網路模型的精度驗證結果,提高了神經網路模型轉換的精度驗證效率。According to a neural network model conversion method provided by an embodiment of the present invention, according to the inference results obtained by the first neural network model in the source frame and the second neural network model in the target frame on the input data of the same model, The accuracy verification result of the second neural network model is automatically obtained, which improves the accuracy verification efficiency of the neural network model conversion.

請參閱圖3,為本發明實施例提供的神經網路模型的轉換方法的又一流程示意圖,該方法包括以下步驟:Please refer to FIG. 3, which is a schematic flowchart of another method for transforming a neural network model provided by an embodiment of the present invention. The method includes the following steps:

S201、模型轉換裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊。S201: The model conversion device obtains the first neural network model under the source frame, the model input data, and the information of the target frame.

該步驟的具體實現可參考圖1所示實施例中的步驟S101。For the specific implementation of this step, refer to step S101 in the embodiment shown in FIG. 1.

S202、通過第一進程對源框架下的第一神經網路模型進行模型轉換處理,得到目標框架下的第二神經網路模型,並記錄第一神經網路模型對模型輸入資料處理得到的第一推理結果。S202: Perform model conversion processing on the first neural network model under the source framework through the first process to obtain the second neural network model under the target framework, and record the first neural network model obtained by processing the input data of the model by the first neural network model. One reasoning result.

該步驟的部分實現可參考圖1所示實施例中的步驟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.

S203、通過第一進程創建第二進程。S203: Create a second process through the first process.

利用同一模型輸入資料在第二神經網路模型中運行推理時,為了防止運行推理過程中的資源衝突,可以通過上述第一進程創建新的進程,即第二進程,該第二進程與上述第一進程所佔用的資源不同。When using the same model input data to run inference in the second neural network model, in order to prevent resource conflicts during the running of the inference process, a new process can be created through the first process, that is, the second process. The resources occupied by a process are different.

可以理解的是,在多進程的調用上,神經網路模型轉換工具和源框架下的第一神經網路模型一般是基於某個平臺開發的,但在進行神經網路模型的框架轉換時,會根據不同的目標框架選擇不同的執行方式。因而,創建的該第二進程可以是系統環境下的進程,也可以是該平臺下的進程。在一些實施例中,神經網路模型轉換工具和源框架可基於Python平臺開發,在目標框架是Caffe框架時,由於Caffe提供pycaffe的Python介面,可使用Python的multiprocessing模組創建新進程以繼續在Python環境下使用目標框架。在一些實施例中,神經網路模型轉換工具和源框架可基於Python平臺開發,在目標框架支援命令列形式的調用時,可使用Python的os模組的os.system在系統環境下創建新進程執行命令啟動目標框架。It is understandable that in multi-process calls, 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, Different execution methods will be selected according to different target frameworks. Therefore, the second process created may be a process under the system environment or a process under the platform. In some embodiments, the neural network model conversion tool and the source framework can be developed based on the Python platform. When the target framework is the Caffe framework, since Caffe provides the Python interface of pycaffe, you can use the Python multiprocessing module to create a new process to continue in Use the target framework in the Python environment. In some embodiments, the neural network model conversion tool and the source framework can be developed based on the Python platform. When the target framework supports the invocation of the command line, the os.system of the Python os module can be used to create a new process in the system environment. Execute the command to start the target framework.

通過創建新的進程,在該新進程中運行第二神經網路模型對模型輸入資料的推理,可以避免在推理過程中,第二神經網路模型和第一神經網路模型在同一進程中的某些系統調用的衝突,導致程式奔潰。提高了推理過程的可靠性。By creating a new process and running the second neural network model in the new process to reason about the input data of the model, you can avoid the second neural network model and the first neural network model in the same process during the inference process. The conflict of certain system calls caused the program to crash. Improve the reliability of the reasoning process.

S204、通過第一進程調用第二進程,以使得第二進程執行第二神經網路模型對模型輸入資料的處理,得到第二推理結果。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 to obtain a second inference result.

通過第一進程調用新創建的第二進程,將上述模型輸入資料輸入第二神經網路模型,用該模型輸入資料在該第二神經網路模型上的每一個網路層運行一遍推理,上一個網路層輸出的推理結果可以作為下一個網路層的輸入資料,最後得到第二神經網路模型的最終的推理結果,即第二推理結果。Invoke the newly created second process through the first process, input the above model input data into the second neural network model, and use the model input data to run inferences on each network layer on 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 is obtained, that is, the second inference result.

S205、判斷第一推理結果與第二推理結果之間的差別是否處於預設誤差範圍內,若是,則進行到步驟S206;若否,則進行到S207。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.

S206、確定第二神經網路模型的精度驗證結果為精度對齊。S206: Determine that the accuracy verification result of the second neural network model is accuracy alignment.

S207、確定第二神經網路模型的精度驗證結果為精度未對齊。S207: Determine that the accuracy verification result of the second neural network model is accuracy misalignment.

在獲得第一推理結果和第二推理結果後,由於該第一推理結果和第二推理結果是採用同一模型輸入資料分別在第一神經網路模型和第二神經網路模型中運行推理得到的,因此,根據該第一推理結果和第二推理結果,可以得到目標框架下的第二神經網路模型的精度驗證結果。具體地,如果第一推理結果與第二推理結果之間的差別處於預設誤差範圍內,則確定第二神經網路模型的精度驗證結果為精度對齊。如果第一推理結果與第二推理結果之間的差別超出預設誤差範圍,則確定第二神經網路模型的精度驗證結果為精度未對齊。After obtaining the first inference result and the second inference result, because the first inference result and the second inference result are obtained by using the same model input data to run the inference in the first neural network model and the second neural network model, respectively Therefore, according to the first inference result and the second inference result, 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.

S208、響應於確定第二神經網路模型的精度驗證結果為精度未對齊,模型轉換裝置定位第二神經網路模型中精度未對齊的目標網路層。S208. In response to determining that the accuracy verification result of the second neural network model is accuracy misalignment, the model conversion device locates the target network layer of the second neural network model whose accuracy is not aligned.

當確定第二神經網路模型的精度驗證結果為精度未對齊時,需要定位出第一神經網路模型和第二神經網路模型中首先出現精度未對齊的網路層,即定位首先出現推理結果不一致的網路層,該定位出的網路層稱為目標網路層。其中,該目標網路層為第二神經網路模型包括的多個網路層中最先出現精度未對齊的網路層。或者說,該目標網路層為第二神經網路模型包括的多個網路層中與第一神經網路模型的對應網路層的輸出資料之間的差別超過預設誤差範圍的首個網路層。When it is determined that the accuracy verification result of the second neural network model is accuracy misalignment, it is necessary to locate the network layer in the first neural network model and the second neural network model where the accuracy is not aligned first, that is, the positioning first appears the reasoning The network layer with inconsistent results, the located network layer is called the target network layer. Wherein, 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. In other words, the target network layer is the first one of the multiple network layers included in the second neural network model where the difference between the output data of the corresponding network layer of the first neural network model exceeds the preset error range Network layer.

為了提升神經網路模型轉換工具的效率,在前述神經網路模型的精度驗證過程中,一般不保存任何層的推理結果(也被稱為輸出資料)。當精度驗證結果為精度未對齊時,神經網路模型轉換工具重新進行一次神經網路模型轉換和推理,用於定位精度問題。即模型轉換裝置對第一神經網路模型再次進行模型轉換處理。神經網路模型每一層的輸出資料量都較大,一般不將神經網路模型每一層的輸出資料保存在記憶體中,而是將輸出資料本地化,即存儲在本地。因此,在再次進行模型轉換處理的過程中,在本地保存第一神經網路模型中的每個網路層的輸出資料。在驗證某一個網路層的精度時把該網路層的輸出資料從本地載入到記憶體中。In order to improve the efficiency of the neural network model conversion tool, in the accuracy verification process of the aforementioned neural network model, the inference results (also called output data) of any layer are generally not saved. When the accuracy verification result is that the accuracy is not aligned, the neural network model conversion tool performs a neural network model conversion and inference again to locate the accuracy problem. That is, the model conversion device performs model conversion processing on the first neural network model again. The output data of each layer of the neural network model is relatively large. Generally, 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. When verifying the accuracy of a certain network layer, load the output data of the network layer from the local into the memory.

由於利用神經網路模型轉換工具把源框架下的第一神經網路模型的各個網路層分別轉換成目標框架的格式的過程中,源框架會用該模型輸入資料在第一神經網路模型上運行一遍推理,可以獲得第一神經網路模型中的網路層的資訊以及網路層的連接關係。然後,模型轉換裝置可以基於第一神經網路模型的網路拓撲圖,利用目標框架的網路結構定義和工具包對該第一神經網路模型的網路拓撲圖進行適應性配置,得到第二神經網路模型。因此,進一步地,在再次進行模型轉換處理的過程中,還可以建立第一神經網路模型和第二神經網路模型中的網路層之間的映射關係。其中,第一神經網路模型和第二神經網路模型的網路層之間的映射關係可以為一對多、多對一或者一對一,相應地,目標網路層可以為一個或多個網路層。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 to input data in the first neural network model. Run the reasoning on it once to obtain the information of the network layer in the first neural network model and the connection relationship of the network layer. Then, the model conversion device can use the network structure definition of the target framework and the toolkit to adaptively configure the network topology of the first neural network model based on the network topology of the first neural network model to obtain the first neural network model. 2. 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. Among them, the mapping relationship between the network layers of the first neural network model and the second neural network model can be one-to-many, many-to-one, or one-to-one. Accordingly, the target network layer can be one or more Network layer.

然後將同一模型輸入資料輸入到第二神經網路模型中,記錄第二神經網路模型處理模型輸入資料的過程中每個網路層的輸出資料。Then input the same model input data into the second neural network model, and record the output data of each network layer in the process of processing the model input data by the second neural network model.

模型轉換裝置在獲得了於第一神經網路模型和第二神經網路模型中每個網路層的輸出資料,以及第一神經網路模型和第二神經網路模型中的網路層之間的映射關係後,可以基於第一神經網路模型和第二神經網路模型中每個網路層的輸出資料以及映射關係,確定第二神經網路模型中首先出現精度未對齊的目標網路層。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 difference between the network layers in the first neural network model and the second neural network model After the mapping relationship between the two, based on the output data and 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 with misaligned accuracy first appears in the second neural network model. Road layer.

具體地,在精度定位過程中,為了準確定位首先出現精度未對齊的目標網路層,給第一神經網路模型中的每個網路層配置一個序號。該序號可以是昇冪的,從而在定位精度問題時,可以根據第一神經網路模型中的多個網路層的序號,依次調用第一神經網路模型中的每一個網路層。Specifically, in the accuracy positioning process, in order to accurately locate the target network layer whose accuracy is not aligned first, a serial number is assigned to each network layer in the first neural network model. The sequence number can be in ascending powers, 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.

對於調用的每一個網路層,將上一個網路層輸出的推理結果輸入下一個網路層進行推理,得到每一個網路層的推理結果。並且,根據每一個網路層的序號,在本地對應存儲每一個網路層的推理結果。並且給每一個網路層的推理結果也進行標識。其中,一個網路層可能存在多個輸入。只保存每層輸出的推理結果,因為除了最初的輸入資料,其它層的輸入都是上一層的輸出,因此一旦記錄了第一神經網路模型的最初的輸入和每一層的輸出,相當於記錄了所有層的輸入和輸出。如圖4所示,為本發明實施例提供的目標網路層定位過程中得到的網路拓撲示意圖,該神經網路模型包括多個網路層:卷積層、啟動函數、歸一化層、Eltwise層和池化層等。初始輸入資料到神經網路模型的第一個網路層後,每個網路層的輸出作為下一個網路層的輸入。該神經網路模型的推理結果包括初始輸入資料、輸入/輸出資料1~10。For each network layer called, the inference result output by the previous network layer is input to the next network layer for inference, and the inference result of each network layer is obtained. Moreover, 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. Among them, 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 recording The input and output of all layers are included. As shown in FIG. 4, it is a schematic diagram of the network topology obtained in the process of locating the target network layer according to the embodiment of the present invention. 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 results of the neural network model include initial input data and input/output data 1-10.

把第一神經網路模型中的每個網路層單獨地轉換到目標框架下,得到第二神經網路模型。輸入同一模型輸入資料到第二神經網路模型,然後使用每層的輸入運行出模型的每一層在第二神經網路模型中的推理結果,並保存在本地,保存時以每個網路層的序號為索引。當然,在目標框架下的推理同樣需要在新的進程中進行。Each network layer in the first neural network model is individually converted to the target framework 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. The serial number is the index. Of course, the reasoning under the target framework also needs to be carried out in a new process.

在獲得了神經網路模型的每個網路層在源框架和目標框架下的推理結果之後,可以根據每個網路層的序號,依次比較源框架下的第一神經網路模型中的每一個網路層的推理結果與目標框架下的第二神經網路模型中的對應的網路層的推理結果,定位第二神經網路模型中與第一神經網路模型首先精度未對齊的網路層,即目標網路層。After obtaining the inference results of each network layer of the neural network model in the source frame and the target frame, you can compare each layer in the first neural network model in the source frame according to the sequence number of each network layer. The inference result of a network layer and the inference result of the corresponding network layer in the second neural network model under the target framework are located, and the network in the second neural network model whose accuracy is not aligned with the first neural network model first Road layer, that is, the target network layer.

S209、模型轉換裝置輸出目標網路層的資訊。S209. The model conversion device outputs the information of the target network layer.

模型轉換裝置在確定了目標網路層後,可以輸出該目標網路層的資訊。該目標網路層的資訊包括網路層的標識、參數、輸入資料、輸出結果等。管理員或使用者可根據該目標網路層的資訊分析精度未對齊的原因。After determining 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.

根據本發明實施例提供的一種神經網路模型的轉換方法,根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的推理結果,可以自動得到第二神經網路模型的精度驗證結果,提高了神經網路模型轉換的精度驗證效率;且根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的每個網路層的輸出資料,可以定位第二神經網路模型中精度未對齊的目標網路層,實現了精度未對齊時的網路層的準確定位。According to a neural network model conversion method provided by an embodiment of the present invention, according to the inference results obtained by the first neural network model under the source frame and the second neural network model under the target frame on the same model input data, it is possible to The accuracy verification result of the second neural network model is automatically obtained, which improves the accuracy verification efficiency of the neural network model conversion; and 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 obtained from the model input data 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.

當把源框架的神經網路模型轉換到目標框架時,給神經網路模型同一個模型輸入資料,判斷源框架的輸出與在目標框架的輸出偏差是否在誤差範圍內。若不在誤差範圍內,則需要定位神經網路模型的哪一個網路層導致在兩個框架下的推理結果不同。目前已開源的神經網路模型轉換工具均不驗證神經網路模型轉換前後的輸出精度是否一致,需要使用者手動在兩個框架下運行保存結果,然後進行比對。精度不一致時使用者便需要根據經驗修改神經網路模型,輸出修改後的神經網路模型中一些層的結果,定位出使兩個框架下的推理結果不一致的網路層。這樣的方式會花費很多時間,同時對於一些比較大的神經網路模型,定位問題往往非常困難。When converting the neural network model of the source frame to the target frame, input data to the same model of the neural network model, and judge whether the deviation between the output of the source frame and the output of the target frame is within the error range. If it is not within the error range, it is necessary to locate which network layer of the neural network model causes different inference results under the two frameworks. At present, 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. When 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.

請參閱圖5,為本發明實施例提供的模型精度定位方法的流程示意圖,該方法包括以下步驟:Please refer to FIG. 5, which is a schematic flowchart of a model accuracy positioning method provided by an embodiment of the present invention. The method includes the following steps:

S301、模型精度定位裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊。S301: 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. In the case where the accuracy of the second neural network model is known to be misaligned with the first neural network model, the model accuracy positioning device can perform model accuracy positioning based on a user instruction, which is used to instruct the positioning of the second neural network The target network layer in the road model with misaligned accuracy, the user command 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 obtains 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 instructions are used to instruct to locate the target network layer of the second neural network model whose accuracy is not aligned. The internal operation instructions include the first neural network model under the source frame, model input data, and information about the target frame .

該步驟的具體實現可參考圖1所示實施例的步驟S101,或者圖3所示實施例的步驟S201。For the specific implementation of this step, refer to step S101 in the embodiment shown in FIG. 1 or step S201 in the embodiment shown in FIG. 3.

S302、模型精度定位裝置對第一神經網路模型進行模型轉換處理,得到目標框架下的第二神經網路模型。S302. 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.

該步驟的具體實現可參考圖1所示實施例的步驟S102,或者圖3所示實施例的步驟S202。For the specific implementation of this step, refer to step S102 in the embodiment shown in FIG. 1 or step S202 in the embodiment shown in FIG. 3.

S303、模型精度定位裝置基於第一神經網路模型和第二神經網路模型分別處理模型輸入資料的每個網路層的輸出資料,定位第二神經網路模型中精度未對齊的目標網路層。S303. The model accuracy positioning device processes the output data of each network layer of the model input data separately based on the first neural network model and the second neural network model, and locates the target network whose accuracy is not aligned in the second neural network model Floor.

模型精度定位裝置在對第一神經網路模型進行上述模型轉換處理的過程中,運行第一神經網路模型對模型輸入資料的推理過程,可以得到第一神經網路模型對模型輸入資料進行處理的每個網路層的輸出資料。可選地,可以將第一神經網路模型的每個網路層的輸出資料在本地進行存儲或記錄。In the process of performing the model conversion processing on the first neural network model, the model accuracy positioning device runs the inference process of the first neural network model on the input data of the model to obtain the first neural network model to process the input data of the model The output data of each network layer. Optionally, the output data of each network layer of the first neural network model can be stored or recorded locally.

在另外一些實施例中,模型精度定位裝置也可以重新輸入模型輸入資料到第一神經網路模型,運行第一神經網路模型對模型輸入資料的推理過程,得到第一神經網路模型對模型輸入資料進行處理的每個網路層的輸出資料。In other embodiments, the model accuracy positioning device may also re-input the model input data to the first neural network model, and run the inference process of the first neural network model to the model input data to obtain the first neural network model-to-model The output data of each network layer where the input data is processed.

在另外一些實施例中,模型精度定位裝置可能預先存儲了第一神經網路模型對模型輸入資料進行推理得到的每個網路層的輸出資料。In other embodiments, 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.

在獲得目標框架下的第二神經網路模型之後,可以將上述模型輸入資料輸入到第二神經網路模型,用該模型輸入資料在該第二神經網路模型上的每一個網路層運行一遍推理,上一個網路層輸出的推理結果可以作為下一個網路層的輸入資料,得到第二神經網路模型中每個網路層的輸出資料。After obtaining the second neural network model under the target framework, the above model input data can be input to the second neural network model, and the model input data can be used to run on each network layer of the second neural network model Inferring again, the inference result output by the previous 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.

在獲得第一推理結果和第二推理結果後,由於該第一推理結果和第二推理結果是採用同一模型輸入資料分別在第一神經網路模型和第二神經網路模型中運行推理得到的,因此,根據該第一推理結果和第二推理結果,例如,比較該第一推理結果和第二推理結果,可以得到目標框架下的第二神經網路模型的精度驗證結果。又例如,可以將第二推理結果中的多個參數值,與第一推理結果中的相應的參數值一一進行匹配,得到匹配結果,即可以得到上述精度驗證結果。在一些實施例中,該精度驗證結果可以指示第二神經網路模型與第一神經網路模型的模型精度的比較結果,例如精度對齊或精度未對齊,或者該精度驗證結果可以指示第二神經網路模型的模型精度是否滿足預期或者設定標準,例如,精度達標或精度不達標,等等,本發明實施例對此不做限定。After obtaining the first inference result and the second inference result, because the first inference result and the second inference result are obtained by using the same model input data to run the inference in the first neural network model and the second neural network model, respectively Therefore, according to the first inference result and the second inference result, for example, by comparing the first inference result and the second inference result, the accuracy verification result of the second neural network model under the target framework can be obtained. For another example, 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. In some embodiments, 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 model accuracy of the network 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 invention does not limit this.

在獲得第一神經網路模型的每個網路層的輸出結果和第二神經網路模型的每個網路層的輸出結果後,由於該第一神經網路模型的每個網路層的輸出結果和第二神經網路模型的每個網路層的輸出結果是採用同一模型輸入資料分別在第一神經網路模型和第二神經網路模型中運行推理得到的,因此,根據該第一神經網路模型的每個網路層的輸出結果和第二神經網路模型的每個網路層的輸出結果,可以定位第二神經網路模型中精度未對齊的目標網路層。After obtaining 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, due to the The output results and the output results of each network layer of the second neural network model are 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 The output result of each network layer of a neural network model 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.

在一個實現中,該目標網路層為第二神經網路模型包括的多個網路層中最先出現精度未對齊的網路層。具體地,若第二神經網路模型包括的網路層與第一神經網路模型的對應網路層的輸出資料之間的差別超過預設誤差範圍,則認定該網路層為精度未對齊的網路層。In one implementation, the target network layer is the network layer in which accuracy misalignment appears 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 deemed to be misaligned in accuracy Network layer.

在另一個實現中,目標網路層為第二神經網路模型中出現精度未對齊的多個網路層。例如不僅包括最先出現精度未對齊的網路層,還包括網路層的後續網路層。後續網路層的層數可以預先設定。In another implementation, the target network layer is a plurality of network layers with misaligned accuracy in the second neural network model. For example, it includes not only the first network layer where accuracy misalignment occurs, but also the subsequent network layers of the network layer. The number of subsequent network layers can be preset.

具體地,依次比較源框架下的第一神經網路模型中的每一個網路層的推理結果與目標框架下的第二神經網路模型中的對應的網路層的推理結果,定位第二神經網路模型中與第一神經網路模型首先精度未對齊的網路層,即目標網路層。Specifically, sequentially compare the inference results of each network layer in the first neural network model under the source framework with the inference results of the corresponding network layer in the second neural network model under the target framework, and locate the second In the neural network model, the network layer whose accuracy is not aligned with the first neural network model first is the target network layer.

S304、模型精度定位裝置輸出目標網路層的資訊。S304. The model accuracy positioning device outputs the information of the target network layer.

模型精度定位裝置在確定了目標網路層後,可以輸出該目標網路層的資訊。該目標網路層的資訊包括目標網路層的標識、參數、輸出資料、以及該輸出資料與在第一神經網路模型中與目標網路層對應的網路層的輸出資料之間的誤差等。管理員或使用者可根據該目標網路層的資訊分析精度未對齊的原因。After determining 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 Wait. The administrator or user can analyze the reason for the misalignment of accuracy based on the information of the target network layer.

根據本發明實施例提供的一種模型精度定位方法,根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的每個網路層的輸出資料,可以定位第二神經網路模型中精度未對齊的目標網路層,實現了精度未對齊時的目標網路層的準確定位。According to a model accuracy positioning method provided by an embodiment of the present invention, the output of each network layer obtained from the input data of the same model according to the first neural network model under the source frame and the second neural network model under the target frame The data can be used to locate the target network layer whose accuracy is not aligned in the second neural network model, and realize the accurate positioning of the target network layer when the accuracy is not aligned.

請參閱圖6,為本發明實施例提供的模型精度定位方法的又一流程示意圖,該方法包括以下步驟:Please refer to FIG. 6, which is a schematic flowchart of another model accuracy positioning method provided by an embodiment of the present invention. The method includes the following steps:

S401、模型精度定位裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊。S401: 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.

該步驟的具體實現可參考圖1所示實施例的步驟S101,或者圖3所示實施例的步驟S201,或者圖5所示實施例的步驟S301。For the specific implementation of this step, refer to step S101 in the embodiment shown in FIG. 1, or step S201 in the embodiment shown in FIG. 3, or step S301 in the embodiment shown in FIG. 5.

S402、模型精度定位裝置通過第一神經網路模型對模型輸入資料的處理,建立網路拓撲圖,其中,該網路拓撲圖包括第一神經網路模型中的網路層的資訊以及網路層的連接關係。S402. The model accuracy positioning device creates a network topology map by processing the input data of the model by the first neural network model, where the network topology map includes the information of the network layer in the first neural network model and the network Layer connection relationship.

模型精度定位裝置通過第一神經網路模型對模型輸入資料的處理,建立網路拓撲圖,其中,該網路拓撲圖包括第一神經網路模型中的網路層的資訊以及網路層的連接關係。利用神經網路模型轉換工具把源框架下的第一神經網路模型的各個網路層分別轉換成目標框架的格式的過程中,源框架會用該模型輸入資料在第一神經網路模型上運行一遍推理,可以獲得第一神經網路模型中的網路層的資訊以及網路層的連接關係。上述第一神經網路模型中的網路層的資訊以及網路層的連接關係構成第一神經網路模型的網路拓撲圖。The model accuracy positioning device creates a network topology map through the processing of the input data of the model by the first neural network model, wherein the network topology map includes the information of the network layer in the first neural network model and the network layer information Connection relationship. In the process of using the neural network model conversion tool 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 to input data on the first neural network model Run the reasoning again to obtain the information of the network layer in the first neural network model and the connection relationship of the network layer. The information of the network layer in the above-mentioned first neural network model and the connection relationship between the network layers constitute the network topology diagram of the first neural network model.

S403、模型精度定位裝置基於網路拓撲圖以及目標框架的資訊,得到第二神經網路模型,並記錄第一神經網路模型處理模型輸入資料的過程中每個網路層的輸出資料,並基於模型轉換處理,建立第一神經網路模型和第二神經網路模型中的網路層之間的映射關係。S403. 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 Based on the model conversion processing, a mapping relationship between the network layers in the first neural network model and the second neural network model is established.

模型精度定位裝置在獲得第一神經網路的網路拓撲圖後,目標框架具備自己的網路結構定義和工具包,模型精度定位裝置可以基於第一神經網路的網路拓撲圖,利用目標框架的網路結構定義和工具包對該第一神經網路的網路拓撲圖進行適應性配置,得到第二神經網路模型。After the model accuracy positioning device obtains the network topology 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 of the first neural network and use the target The network structure definition and toolkit of the framework adaptively configure the network topology of the first neural network to obtain the second neural network model.

由於利用神經網路模型轉換工具把源框架下的第一神經網路模型的各個網路層分別轉換成目標框架的格式的過程中,源框架會用該模型輸入資料在第一神經網路模型上運行一遍推理,可以獲得第一神經網路模型中的網路層的資訊以及網路層的連接關係。然後,模型精度定位裝置可以基於第一神經網路的網路拓撲圖,利用目標框架的網路結構定義和工具包對該第一神經網路的網路拓撲圖進行適應性配置,得到第二神經網路模型。因此,進一步地,在進行模型轉換處理的過程中,還可以建立第一神經網路模型和第二神經網路模型中的網路層之間的映射關係。其中,第一神經網路模型和第二神經網路模型的網路層之間的映射關係可以為一對多、多對一或者一對一,相應地,目標網路層可以為一個或多個網路層。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 to input data in the first neural network model. Run the reasoning on it once to obtain the information of the network layer in the first neural network model and the connection relationship of the network layer. 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. Among them, the mapping relationship between the network layers of the first neural network model and the second neural network model can be one-to-many, many-to-one, or one-to-one. Accordingly, the target network layer can be one or more Network layer.

S404、模型精度定位裝置通過第二神經網路模型對模型輸入資料進行處理,得到第二神經網路模型中每個網路層的輸出資料。S404. 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.

該步驟的具體實現可參考圖1所示實施例的步驟S103,或者圖3所示實施例的步驟S203。For the specific implementation of this step, refer to step S103 in the embodiment shown in FIG. 1 or step S203 in the embodiment shown in FIG. 3.

所不同的是,本實施例中,記錄的是第二神經網路模型的每個網路層的輸出資料,而在圖1或圖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 second neural network is recorded. The final inference result of the road model is the output data of the last network layer of the second neural network model.

S405、模型精度定位裝置基於第一神經網路模型和第二神經網路模型中每個網路層的輸出資料以及映射關係,確定第二神經網路模型中精度未對齊的目標網路層。S405. The model accuracy positioning device determines the target network layer in the second neural network model whose accuracy is not aligned 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 difference between the network layers in the first neural network model and the second neural network model After the mapping relationship between the two, based on the output data and 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 with misaligned accuracy first appears in the second neural network model. Road layer.

具體地,在精度定位過程中,為了準確定位首先出現精度未對齊的目標網路層,給第一神經網路模型中的每個網路層配置一個序號。該序號可以是昇冪的,從而在定位精度問題時,可以根據第一神經網路模型中的多個網路層的序號,依次調用第一神經網路模型中的每一個網路層。Specifically, in the accuracy positioning process, in order to accurately locate the target network layer whose accuracy is not aligned first, a serial number is assigned to each network layer in the first neural network model. The sequence number can be in ascending powers, 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.

對於調用的每一個網路層,將上一個網路層輸出的推理結果輸入下一個網路層進行推理,得到每一個網路層的推理結果。並且,根據每一個網路層的序號,在本地對應存儲每一個網路層的推理結果。並且給每一個網路層的推理結果也進行標識。其中,一個網路層可能存在多個輸入。只保存每層輸出的推理結果,因為除了最初的輸入資料,其它層的輸入都是上一層的輸出,因此一旦記錄了第一神經網路模型的最初的輸入和每一層的輸出,相當於記錄了所有層的輸入和輸出。如圖4所示,為示例的神經網路模型轉換後精度未對齊時的目標網路層的定位過程示意圖,該神經網路模型包括多個網路層:卷積層、啟動函數、歸一化層、Eltwise層和池化層等。初始輸入資料到神經網路模型的第一個網路層後,每個網路層的輸出作為下一個網路層的輸入。該神經網路模型的推理結果包括初始輸入資料、輸入/輸出資料1~10。For each network layer called, the inference result output by the previous network layer is input to the next network layer for inference, and the inference result of each network layer is obtained. Moreover, 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. Among them, 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 recording The input and output of all layers are included. As shown in Figure 4, it is a schematic diagram of the positioning process of the target network layer when the accuracy is not aligned after the conversion of the example neural network model. The neural network model includes multiple network layers: convolutional layer, activation function, and 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 results of the neural network model include initial input data and input/output data 1-10.

把第一神經網路模型中的每個網路層單獨地轉換到目標框架下,得到第二神經網路模型。輸入同一模型輸入資料到第二神經網路模型,然後使用每層的輸入運行出模型的每一層在第二神經網路模型中的推理結果,並保存在本地,保存時以每個網路層的序號為索引。當然,在目標框架下的推理同樣需要在新的進程中進行。Each network layer in the first neural network model is individually converted to the target framework 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. The serial number is the index. Of course, the reasoning under the target framework also needs to be carried out in a new process.

在獲得了神經網路模型的每個網路層在源框架和目標框架下的推理結果之後,可以根據每個網路層的序號,依次比較源框架下的第一神經網路模型中的每一個網路層的推理結果與目標框架下的第二神經網路模型中的對應的網路層的推理結果,定位第二神經網路模型中與第一神經網路模型首先精度未對齊的網路層,即目標網路層。After obtaining the inference results of each network layer of the neural network model in the source frame and the target frame, you can compare each layer in the first neural network model in the source frame according to the sequence number of each network layer. The inference result of a network layer and the inference result of the corresponding network layer in the second neural network model under the target framework are located, and the network in the second neural network model whose accuracy is not aligned with the first neural network model first Road layer, that is, the target network layer.

S406、模型精度定位裝置輸出目標網路層的資訊。S406: The model accuracy positioning device outputs the information of the target network layer.

該步驟的具體實現可參考圖5所示實施例的步驟S304。For the specific implementation of this step, refer to step S304 of the embodiment shown in FIG. 5.

根據本發明實施例提供的一種模型精度定位方法,根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的每個網路層的輸出資料,可以定位第二神經網路模型中精度未對齊的目標網路層,實現了精度未對齊時的網路層的準確定位。According to a model accuracy positioning method provided by an embodiment of the present invention, the output of each network layer obtained from the input data of the same model according to the first neural network model under the source frame and the second neural network model under the target frame The data 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.

基於上述神經網路模型的轉換方法的同一構思,如圖7所示,本發明實施例還提供一種模型轉換裝置,該裝置1000包括:Based on the same concept of the above neural network model conversion method, as shown in FIG. 7, an embodiment of the present invention also provides a model conversion device, and the device 1000 includes:

獲取單元11,用於獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊;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;

轉換單元12,用於對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;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;

驗證單元13,用於基於所述第一神經網路模型和所述第二神經網路模型分別對所述模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到所述第二神經網路模型的精度驗證結果。The verification unit 13 is configured to obtain a first inference result and a second inference result obtained by processing the model input data based on the first neural network model and the second neural network model, respectively, to obtain the second The accuracy verification result of the neural network model.

在一個實現中,所述轉換單元12用於通過第一進程對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;In one implementation, 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:

創建單元14,用於通過所述第一進程創建第二進程;The creating unit 14 is configured to create a second process through the first process;

推理單元15,用於通過所述第一進程調用所述第二進程,以使得所述第二進程執行所述第二神經網路模型對所述模型輸入資料的處理,得到第二推理結果。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 model input data to obtain a second inference result.

在又一個實現中,所述驗證單元13用於若所述第一推理結果與所述第二推理結果之間的差別處於預設誤差範圍內,確定所述第二神經網路模型的精度驗證結果為精度對齊;或In another implementation, the verification unit 13 is configured to determine the accuracy verification 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 The result is precision aligned; or

所述驗證單元13還用於若所述第一推理結果與所述第二推理結果之間的差別超出所述預設誤差範圍,確定所述第二神經網路模型的精度驗證結果為精度未對齊。The verification unit 13 is further configured to determine that the accuracy verification result of the second neural network model is not accurate if the difference between the first inference result and the second inference result exceeds the preset error range. Aligned.

在又一個實現中,所述裝置還包括:In yet another implementation, the device further includes:

定位單元16,用於響應於確定所述第二神經網路模型的精度驗證結果為精度未對齊,定位所述第二神經網路模型中精度未對齊的目標網路層;The positioning unit 16 is configured to locate the target network layer in the second neural network model whose accuracy is not aligned in response to determining that the accuracy verification result of the second neural network model is accuracy misalignment;

輸出單元17,用於輸出所述目標網路層的資訊。The output unit 17 is used to output the information of the target network layer.

在又一個實現中,所述定位單元16包括:In another implementation, the positioning unit 16 includes:

建立單元161,用於建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係;The establishing 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;

確定單元162,用於基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層。The determining unit 162 is configured to determine the output data of each network layer and the mapping relationship 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 The target network layer whose accuracy is not aligned in the second neural network model.

在又一個實現中,其中,所述模型轉換裝置對所述第一神經網路模型再次進行模型轉換處理,其中,在所述再次進行模型轉換處理的過程中,獲取所述第一神經網路模型中的每個網路層的輸出資料,和/或建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係。In yet another implementation, wherein the model conversion device performs a model conversion process on the first neural network model again, wherein, in the process of performing the model conversion process again, the first neural network is obtained Output data of each network layer in the model, and/or establish a mapping relationship between the network layers in the first neural network model and the second neural network model.

在又一個實現中,所述轉換單元12用於通過所述第一神經網路模型對所述模型輸入資料的處理,建立網路拓撲圖,其中,所述網路拓撲圖包括所述第一神經網路模型中的網路層的資訊以及網路層的連接關係;以及基於所述網路拓撲圖以及所述目標框架的資訊,得到所述第二神經網路模型。In another implementation, the conversion unit 12 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 first neural network model. The information of the network layer in the neural network model and the connection relationship of the network layer; and the second neural network model is obtained based on the network topology map and the information of the target frame.

有關上述各單元的具體實現可參考圖1或圖3所示的神經網路模型的轉換方法中的相關描述,在此不再贅述。For the specific implementation of the above-mentioned units, reference may be made to the relevant description in the neural network model conversion method shown in FIG. 1 or FIG. 3, which will not be repeated here.

根據本發明實施例提供的一種模型轉換裝置,根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的推理結果,可以自動得到第二神經網路模型的精度驗證結果,提高了神經網路模型轉換的精度驗證效率。According to a model conversion device provided by an embodiment of the present invention, the second neural network model in the source framework and the second neural network model in the target framework respectively obtain the inference results of the same model input data, and the second neural network model can be automatically obtained. The accuracy verification result of the neural network model improves the accuracy verification efficiency of the neural network model conversion.

基於上述模型精度定位方法的同一構思,如圖8所示,本發明實施例還提供一種模型精度定位裝置,該裝置2000包括:Based on the same concept of the above model accuracy positioning method, as shown in FIG. 8, an embodiment of the present invention also provides a model accuracy positioning device. The device 2000 includes:

獲取單元21,用於獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊;The obtaining unit 21 is used to obtain the first neural network model under the source frame, the model input data, and the information of the target frame;

轉換單元22,用於對所述第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型;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;

定位單元23,用於基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層;The positioning unit 23 is configured to locate the second neural network based on 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 Target network layer whose accuracy is not aligned in the road model;

輸出單元24,用於輸出所述目標網路層的資訊。The output unit 24 is used to output the information of the target network layer.

在一個實現中,所述目標網路層的資訊,包括下列中的至少一項:所述目標網路層的標識、參數、輸出資料、以及該輸出資料與第一神經網路模型中與所述目標網路層對應的網路層的輸出資料之間的誤差。In one implementation, 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. State the error between the output data of the network layer corresponding to the target network layer.

在又一個實現中,所述裝置還包括:In yet another implementation, the device further includes:

第一建立單元25,用於基於所述模型轉換處理,建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係;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;

所述定位單元23,用於基於所述第一神經網路模型和所述第二神經網路模型中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層。The positioning unit 23 is configured to determine the second neural network model 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 with medium precision misalignment.

在又一個實現中,所述定位單元23包括:In another implementation, the positioning unit 23 includes:

調用單元231,用於基於所述映射關係依次比較所述第一神經網路模型和所述第二神經網路模型中對應網路層的輸出資料;The calling unit 231 is configured to sequentially compare 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;

確定單元232,用於響應於所述第一神經網路模型和所述第二神經網路模型中對應網路層的輸出資料之間的差別超出預設誤差範圍,將所述對應網路層中屬於所述第二神經網路模型中的網路層確定為所述目標網路層。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 determine the corresponding network layer The network layer in the second neural network model is determined as the target network layer.

在又一個實現中,所述轉換單元22包括:In another implementation, the conversion unit 22 includes:

第二建立單元221,用於通過所述第一神經網路模型對所述模型輸入資料的處理,建立網路拓撲圖,其中,所述網路拓撲圖包括所述第一神經網路模型中的網路層的資訊以及網路層的連接關係;The second creating unit 221 is used to process the input data of the model by the first neural network model to create a network topology diagram, wherein the network topology diagram includes the first neural network model The information of the network layer and the connection relationship of the network layer;

第二獲取單元222,用於基於所述網路拓撲圖以及所述目標框架的資訊,得到所述第二神經網路模型。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 framework.

有關上述各單元的具體實現可參考圖5或圖6所示實施例中的具體描述,在此不再贅述。For the specific implementation of the foregoing units, reference may be made to the specific description in the embodiment shown in FIG. 5 or FIG. 6, which will not be repeated here.

根據本發明實施例提供的一種模型精度定位裝置,根據源框架下的第一神經網路模型和目標框架下的第二神經網路模型對同一模型輸入資料分別得到的每個網路層的輸出資料,可以定位第二神經網路模型中精度未對齊的目標網路層,實現了精度未對齊時的網路層的準確定位。According to a model accuracy positioning device provided by an embodiment of the present invention, the output of each network layer is obtained from the input data of the same model according to the first neural network model under the source frame and the second neural network model under the target frame The data 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.

如圖9所示,還提供了一種電子設備的硬體結構示意圖,該電子設備用於執行上述神經網路模型的轉換方法/模型精度定位方法。上述方法中的部分或全部可以通過硬體來實現,也可以通過軟體或固件來實現。As shown in 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.

可選的,該電子設備在具體實現時可以是晶片或者積體電路。Optionally, the electronic device may be a chip or an integrated circuit in specific implementation.

可選的,當上述實施例的神經網路模型的轉換方法/模型精度定位方法中的部分或全部通過軟體或固件來實現時,可以通過圖9提供的一種電子設備3000來實現。如圖9所示,該電子設備3000可包括:Optionally, 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 can be implemented by an electronic device 3000 provided in FIG. 9. As shown in FIG. 9, the electronic device 3000 may include:

記憶體33和處理器34(裝置中的處理器34可以是一個或多個,圖9中以一個處理器為例),還可以包括輸入裝置31、輸出裝置32。在本實施例中,輸入裝置31、輸出裝置32、記憶體33和處理器34可通過匯流排或其它方式連接,其中,圖9中以通過匯流排連接為例。The memory 33 and the processor 34 (the processor 34 in the device may be one or more, and one processor is taken as an example in FIG. 9), and may also include an input device 31 and an output device 32. In this embodiment, 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.

其中,處理器34用於執行圖1、圖3、圖5、圖6中所執行的方法步驟。Wherein, the processor 34 is used to execute the method steps executed in FIG. 1, FIG. 3, FIG. 5, and FIG. 6.

可選的,上述神經網路模型的轉換方法/模型精度定位方法的程式可以存儲在記憶體33中。該記憶體33可以是物理上獨立的單元,也可以與處理器34集成在一起。該記憶體33也可以用於存儲資料。Optionally, 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.

可選的,當上述實施例的神經網路模型的轉換方法/模型精度定位方法中的部分或全部通過軟體實現時,該電子設備也可以只包括處理器。用於存儲程式的記憶體位於該電子設備之外,處理器通過電路或電線與記憶體連接,用於讀取並執行記憶體中存儲的程式。Optionally, when part or all of the neural network model conversion method/model accuracy positioning method of the foregoing embodiment is implemented by software, 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.

處理器可以是中央處理器(central processing unit,CPU),網路處理器(network processor,NP),或WLAN(Wireless Local Area Network)設備。The processor may be a central processing unit (CPU), a network processor (NP), or a WLAN (Wireless Local Area Network) device.

處理器還可以進一步包括硬體晶片。上述硬體晶片可以是專用積體電路(application-specific integrated circuit,ASIC),可程式設計邏輯裝置(programmable logic device,PLD)或其組合。上述PLD可以是複雜可程式設計邏輯裝置(complex programmable logic device,CPLD),現場可程式設計邏輯閘陣列(field-programmable gate array,FPGA),通用陣列邏輯(generic array logic,GAL)或其任意組合。The processor may further include a hardware chip. The aforementioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof .

記憶體可以包括易失性記憶體(volatile memory),例如隨機存取記憶體(random-access memory,RAM);記憶體也可以包括非易失性記憶體(non-volatile memory),例如快閃記憶體(flash memory),硬碟(hard disk drive,HDD)或固態硬碟(solid-state drive,SSD);記憶體還可以包括上述種類的記憶體的組合。The memory may include volatile memory (volatile memory), such as random-access memory (random-access memory, RAM); the memory may also include non-volatile memory (non-volatile memory), such as flash Memory (flash memory), hard disk drive (HDD) or solid-state drive (SSD); memory may also include a combination of the above types of memory.

本領域技術人員應明白,本發明一個或多個實施例可提供為方法、系統或計算機程式產品。因此,本發明一個或多個實施例可採用完全硬體實施例、完全軟體實施例或結合軟體和硬體方面的實施例的形式。而且,本發明一個或多個實施例可採用在一個或多個其中包含有計算機可用程式碼的計算機可用存儲介質(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的計算機程式產品的形式。Those skilled in the art should understand that one or more embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, one or more embodiments of the present invention may adopt the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of the present invention can be implemented on one or more computer usable storage media (including but not limited to magnetic disk memory, CD-ROM, optical memory, etc.) containing computer usable program codes. In the form of a computer program product.

本發明實施例還提供一種計算機可讀存儲介質,該存儲介質上可以存儲有計算機程式,所述程式被處理器執行時實現本發明任一實施例描述的神經網路模型的轉換方法的步驟,和/或,實現本發明任一實施例描述的模型精度定位方法的步驟。The embodiment of the present invention also provides a computer-readable storage medium, the storage medium may store a computer program, and the program is executed by a processor to realize the steps of the neural network model conversion method described in any embodiment of the present invention. And/or, implement the steps of the model accuracy positioning method described in any embodiment of the present invention.

本發明中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於上述裝置實施例而言,由於其基本相似於方法實施例,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the foregoing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiments.

上述對本發明特定實施例進行了描述。其它實施例在所附權利要求書的範圍內。在一些情況下,在權利要求書中記載的行為或步驟可以按照不同於實施例中的順序來執行並且仍然可以實現期望的結果。另外,在附圖中描繪的過程不一定要求示出的特定順序或者連續順序才能實現期望的結果。在某些實施方式中,多工處理和並行處理也是可以的或者可能是有利的。The foregoing describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than in the embodiments and still achieve desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown in order to achieve the desired results. In some embodiments, multiplexing and parallel processing are also possible or may be advantageous.

本發明中描述的主題及功能操作的實施例可以在以下中實現:數位電子電路、有形體現的計算機軟體或固件、包括本發明中發明的結構及其結構性等同物的計算機硬體、或者它們中的一個或多個的組合。本發明中描述的主題的實施例可以實現為一個或多個計算機程式,即編碼在有形非暫時性程式載體上以被資料處理裝置執行或指示資料處理裝置的操作的計算機程式指令中的一個或多個模組。可替代地或附加地,程式指令可以被編碼在人工生成的傳播信號上,例如機器生成的電、光或電磁信號,該信號被生成以將資訊編碼並傳輸到合適的接收機裝置以由資料處理裝置執行。計算機存儲介質可以是機器可讀存放裝置、機器可讀存儲基板、隨機或串列存取記憶體設備、或它們中的一個或多個的組合。The embodiments of the subject and functional operations described in the present invention can be implemented in the following: digital electronic circuits, tangible computer software or firmware, computer hardware including the structure of the present invention and structural equivalents thereof, or their A combination of one or more of them. Embodiments of the subject matter described in the present invention can 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 to instruct the operation of the data processing device Multiple modules. Alternatively or additionally, 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.

本發明中描述的處理及邏輯流程可以由執行一個或多個計算機程式的一個或多個可程式設計計算機執行,以通過根據輸入資料進行操作並生成輸出來執行相應的功能。所述處理及邏輯流程還可以由專用邏輯電路—例如現場可程式設計閘陣列(FPGA)或專用積體電路(ASIC)來執行,並且裝置也可以實現為專用邏輯電路。The processing and logic flow described in the present invention 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 a dedicated integrated circuit (ASIC), and the device can also be implemented as a dedicated logic circuit.

適合用於執行計算機程式的計算機包括,例如通用和/或專用微處理器,或任何其他類型的中央處理單元。通常,中央處理單元將從唯讀記憶體和/或隨機存取記憶體接收指令和資料。計算機的基本元件包括用於實施或執行指令的中央處理單元以及用於存儲指令和資料的一個或多個記憶體設備。通常,計算機還將包括用於存儲資料的一個或多個大型存放區設備,例如磁片、磁光碟或光碟等,或者計算機將可操作地與此大型存放區設備耦接以從其接收資料或向其傳送資料,抑或兩種情況兼而有之。然而,計算機不是必須具有這樣的設備。此外,計算機可以嵌入在另一設備中,例如行動電話、個人數位助理(PDA)、移動音訊或視頻播放機、遊戲操縱臺、全球定位系統(GPS)接收機、或例如通用序列匯流排(USB)快閃記憶體驅動器的可擕式存放裝置,僅舉幾例。Computers suitable for executing computer programs include, for example, general-purpose and/or special-purpose microprocessors, or any other type of central processing unit. Generally, the central processing unit will receive commands and data from read-only memory and/or random access memory. The basic elements of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Generally, the computer will also include one or more large storage area devices for storing data, such as floppy disks, magneto-optical disks, or optical discs, or the computer will be operably coupled to this large storage area device to receive data or Send data to it, or both. However, the computer does not have to have such equipment. In addition, 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 a universal serial bus (USB) ) Portable storage devices for flash drives, to name a few.

適合於存儲計算機程式指令和資料的計算機可讀介質包括所有形式的非易失性記憶體、媒介和記憶體設備,例如包括半導體記憶體設備(例如EPROM、EEPROM和快閃記憶體設備)、磁片(例如內部硬碟或可移動盤)、磁光碟以及CD ROM和DVD-ROM盤。處理器和記憶體可由專用邏輯電路補充或併入專用邏輯電路中。Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, such as semiconductor memory devices (such as EPROM, EEPROM, and flash memory devices), magnetic Disks (such as internal hard disks or removable disks), magneto-optical disks, and CD ROM and DVD-ROM disks. The processor and memory can be supplemented by or incorporated into a dedicated logic circuit.

雖然本發明包含許多具體實施細節,但是這些不應被解釋為限制任何發明的範圍或所要求保護的範圍,而是主要用於描述特定發明的具體實施例的特徵。本發明內在多個實施例中描述的某些特徵也可以在單個實施例中被組合實施。另一方面,在單個實施例中描述的各種特徵也可以在多個實施例中分開實施或以任何合適的子組合來實施。此外,雖然特徵可以如上所述在某些組合中起作用並且甚至最初如此要求保護,但是來自所要求保護的組合中的一個或多個特徵在一些情況下可以從該組合中去除,並且所要求保護的組合可以指向子組合或子組合的變型。Although the present invention contains many specific implementation details, these should not be construed as limiting the scope of any invention or the claimed scope, but are mainly used to describe the features of specific embodiments of the specific invention. Certain features described in multiple embodiments of the present invention can also be implemented in combination in a single embodiment. On the other hand, various features described in a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination. In addition, although features may function in certain combinations as described above and even initially claimed as such, one or more features from the claimed combination may in some cases be removed from the combination, and the claimed The combination of protection can be directed to a sub-combination or a variant of the sub-combination.

類似地,雖然在附圖中以特定順序描繪了操作,但是這不應被理解為要求這些操作以所示的特定循序執行或順次執行、或者要求所有例示的操作被執行,以實現期望的結果。在某些情況下,多工和並行處理可能是有利的。此外,上述實施例中的各種系統模組和元件的分離不應被理解為在所有實施例中均需要這樣的分離,並且應當理解,所描述的程式元件和系統通常可以一起集成在單個軟體產品中,或者封裝成多個軟體產品。Similarly, although operations are depicted in a specific order in the drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve desired results . In some cases, multiplexing and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can usually be integrated together in a single software product. Or packaged into multiple software products.

由此,主題的特定實施例已被描述。其他實施例在所附權利要求書的範圍以內。在某些情況下,權利要求書中記載的動作可以以不同的循序執行並且仍實現期望的結果。此外,附圖中描繪的處理並非必需所示的特定順序或順次順序,以實現期望的結果。在某些實現中,多工和並行處理可能是有利的。Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve desired results. In addition, the processes depicted in the drawings are not necessarily in the specific order or sequential order shown in order to achieve the desired result. In some implementations, multiplexing and parallel processing may be advantageous.

以上所述僅為本發明一個或多個實施例的較佳實施例而已,並不用以限制本發明一個或多個實施例,凡在本發明一個或多個實施例的精神和原則之內,所做的任何修改、等同替換、改進等,均應包含在本發明一個或多個實施例保護的範圍之內。The foregoing descriptions are only preferred embodiments of one or more embodiments of the present invention, and are not intended to limit one or more embodiments of the present invention. All within the spirit and principle of one or more embodiments of the present invention, Any modifications, equivalent replacements, improvements, etc. made should be included in the protection scope of one or more embodiments of the present invention.

1000:模型轉換裝置 11、21:獲取單元 12、22:轉換單元 13:驗證單元 14:創建單元 15:推理單元 16、23:定位單元 161:建立單元 162、232:確定單元 17、24:輸出單元 221:第二建立單元 222:第二獲取單元 231:調用單元 25:第一建立單元 2000:模型精度定位裝置 3000:電子設備 31:輸入裝置 32:輸出裝置 33:記憶體 34:處理器 S101~S103、S201~S209、S301~S304、S401~S406:步驟1000: Model conversion device 11, 21: get unit 12, 22: conversion unit 13: Verification unit 14: Create a unit 15: Reasoning Unit 16, 23: positioning unit 161: Building Unit 162, 232: Determining the unit 17, 24: output unit 221: The second establishment unit 222: The second acquisition unit 231: call unit 25: The first establishment unit 2000: Model accuracy positioning device 3000: electronic equipment 31: Input device 32: output device 33: Memory 34: processor S101~S103, S201~S209, S301~S304, S401~S406: steps

圖1為本發明實施例提供的神經網路模型的轉換方法的流程示意圖; 圖2為本發明實施例提供的神經網路模型的轉換過程的示意圖; 圖3為本發明實施例提供的神經網路模型的轉換方法的又一流程示意圖; 圖4為本發明實施例提供的目標網路層定位過程中得到的網路拓撲示意圖; 圖5為本發明實施例提供的模型精度定位方法的流程示意圖; 圖6為本發明實施例提供的模型精度定位方法的又一流程示意圖; 圖7為本發明實施例提供的模型轉換裝置的結構示意圖; 圖8為本發明實施例提供的模型精度定位裝置的結構示意圖; 圖9為本發明實施例提供的電子設備的硬體結構示意圖。FIG. 1 is a schematic flowchart of a neural network model conversion method provided by an embodiment of the present invention; 2 is a schematic diagram of a conversion process of a neural network model provided by an embodiment of the present invention; 3 is a schematic diagram of another process of the neural network model conversion method provided by the embodiment of the present invention; FIG. 4 is a schematic diagram of a network topology obtained during a target network layer positioning process provided by an embodiment of the present invention; 5 is a schematic flowchart of a model accuracy positioning method provided by an embodiment of the present invention; FIG. 6 is another schematic flowchart of a model accuracy positioning method provided by an embodiment of the present invention; FIG. 7 is a schematic structural diagram of a model conversion device provided by an embodiment of the present invention; FIG. 8 is a schematic structural diagram of a model accuracy positioning device provided by an embodiment of the present invention; FIG. 9 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention.

S101~S103:步驟 S101~S103: steps

Claims (15)

一種神經網路模型的轉換方法,其特徵在於,所述方法包括: 模型轉換裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊; 所述模型轉換裝置對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型; 所述模型轉換裝置基於所述第一神經網路模型和所述第二神經網路模型分別對所述模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到所述第二神經網路模型的精度驗證結果。A neural network model conversion method, characterized in that the method includes: The model conversion device obtains the first neural network model under the source frame, model input data, and information about the target frame; 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 model conversion device obtains the second neural network model based on the first inference result and the second inference result obtained by processing the model input data respectively based on the first neural network model and the second neural network model The accuracy verification result of the network model. 如請求項1所述的方法,其特徵在於,對所述源框架下的第一神經網路模型進行所述模型轉換處理,得到所述目標框架下的第二神經網路模型,包括: 通過第一進程對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型; 所述方法還包括: 通過所述第一進程創建第二進程; 通過所述第一進程調用所述第二進程,以在所述第二進程中通過所述第二神經網路模型對所述模型輸入資料進行處理,得到第二推理結果。The method according to claim 1, wherein performing the model conversion processing on the first neural network model in the source framework to obtain the second neural network model in the target framework includes: Performing model conversion processing on the first neural network model under the source framework through the first process to obtain the second neural network model under the target framework; The method also includes: Creating a second process through the first process; Invoke the second process through the first process to process the model input data through the second neural network model in the second process to obtain a second inference result. 如請求項1或2所述的方法,其特徵在於,所述模型轉換裝置基於所述第一神經網路模型和所述第二神經網路模型分別對所述模型輸入資料進行處理得到的第一推理結果和第二推理結果,得到所述第二神經網路模型的精度驗證結果,包括: 若所述第一推理結果與所述第二推理結果之間的差別處於預設誤差範圍內,確定所述第二神經網路模型的精度驗證結果為精度對齊;或 若所述第一推理結果與所述第二推理結果之間的差別超出所述預設誤差範圍,確定所述第二神經網路模型的精度驗證結果為精度未對齊。The method according to claim 1 or 2, wherein the model conversion device is based on the first neural network model and the second neural network model to process the model input data to obtain the first An inference result and a second inference result to obtain the accuracy verification result of the second neural network model, including: If the difference between the first inference result and the second inference result is within a preset error range, determining that the accuracy verification result of the second neural network model 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. 如請求項1至3中任一項所述的方法,其特徵在於,所述方法還包括: 響應於確定所述第二神經網路模型的精度驗證結果為精度未對齊,所述模型轉換裝置定位所述第二神經網路模型中精度未對齊的目標網路層; 所述模型轉換裝置輸出所述目標網路層的資訊。The method according to any one of claims 1 to 3, wherein 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 a target network layer whose accuracy is not aligned in the second neural network model; The model conversion device outputs the information of the target network layer. 如請求項4所述的方法,其特徵在於,所述定位所述第二神經網路模型中精度未對齊的目標網路層,包括: 所述模型轉換裝置建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係; 所述模型轉換裝置基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層。The method according to claim 4, wherein the locating a target network layer whose accuracy is not aligned in the second neural network model includes: The model conversion device establishes a mapping relationship between the network layers in the first neural network model and the second neural network model; The model conversion device determines the output data of each network layer and the mapping relationship 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 The target network layer whose accuracy is not aligned in the second neural network model. 如請求項5所述的方法,其特徵在於,其中,所述模型轉換裝置對所述第一神經網路模型再次進行模型轉換處理,其中,在所述再次進行模型轉換處理的過程中,獲取所述第一神經網路模型中的每個網路層的輸出資料,和/或建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係。The method according to claim 5, wherein the model conversion device performs a model conversion process on the first neural network model again, wherein, in the process of performing the model conversion process again, obtain Output data of each network layer in the first neural network model, and/or establish a mapping relationship between the network layers in the first neural network model and the second neural network model . 如請求項1至6中任一項所述的方法,其特徵在於,所述模型轉換裝置對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型,包括: 所述模型轉換裝置通過所述第一神經網路模型對所述模型輸入資料的處理,建立網路拓撲圖,其中,所述網路拓撲圖包括所述第一神經網路模型中的網路層的資訊以及網路層的連接關係; 所述模型轉換裝置基於所述網路拓撲圖以及所述目標框架的資訊,得到所述第二神經網路模型。The method according to any one of claims 1 to 6, wherein the model conversion device performs model conversion processing on the first neural network model in the source framework to obtain the first neural network model in the target framework Two neural network models, including: The model conversion device creates a network topology map by processing the input data of the model by the first neural network model, wherein the network topology map includes the network in the first neural network model Layer information and the connection relationship of the network layer; The model conversion device obtains the second neural network model based on the network topology map and the information of the target framework. 一種模型精度定位方法,其特徵在於,包括: 模型精度定位裝置獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊; 所述模型精度定位裝置對所述第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型; 所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層; 所述模型精度定位裝置輸出所述目標網路層的資訊。A model accuracy positioning method, which is characterized in that it includes: The model accuracy positioning device acquires the first neural network model under the source frame, model input data, and information about the target frame; 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; The model accuracy positioning device locates the second neural network based on the output data of each network layer in the process of separately processing the input data of the model by the first neural network model and the second neural network model Target network layer whose accuracy is not aligned in the road model; The model accuracy positioning device outputs the information of the target network layer. 如請求項8所述的方法,其特徵在於,所述方法還包括: 所述模型精度定位裝置基於所述模型轉換處理,建立所述第一神經網路模型和所述第二神經網路模型中的網路層之間的映射關係; 所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層,包括: 所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層。The method according to claim 8, wherein the method further includes: The model accuracy positioning device establishes 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 model accuracy positioning device locates the second neural network based on the output data of each network layer in the process of separately processing the input data of the model by the first neural network model and the second neural network model The target network layer whose accuracy is not aligned in the road model includes: The model accuracy positioning device determines the accuracy in the second neural network model 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 Unaligned target network layer. 如請求項9所述的方法,其特徵在於,所述模型精度定位裝置基於所述第一神經網路模型和所述第二神經網路模型中每個網路層的輸出資料以及所述映射關係,確定所述第二神經網路模型中精度未對齊的目標網路層,包括: 所述模型精度定位裝置基於所述映射關係依次比較所述第一神經網路模型和所述第二神經網路模型中對應網路層的輸出資料; 響應於所述第一神經網路模型和所述第二神經網路模型中對應網路層的輸出資料之間的差別超出預設誤差範圍,將所述對應網路層中屬於所述第二神經網路模型中的網路層確定為所述目標網路層。The method according to claim 9, wherein the model accuracy positioning device is 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, determining the target network layer whose accuracy is not aligned in the second neural network model, including: The model accuracy positioning device sequentially compares output data of corresponding network layers in the first neural network model and the second neural network model based on the mapping relationship; In response 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, classify the corresponding network layer as belonging to the second The network layer in the neural network model is determined to be the target network layer. 如請求項8~10中任一項所述的方法,其特徵在於,所述模型精度定位裝置對所述源框架下的第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型,包括: 所述模型精度定位裝置通過所述第一神經網路模型對所述模型輸入資料的處理,建立網路拓撲圖,其中,所述網路拓撲圖包括所述第一神經網路模型中的網路層的資訊以及網路層的連接關係; 所述模型精度定位裝置基於所述網路拓撲圖以及所述目標框架的資訊,得到所述第二神經網路模型。The method according to any one of claim 8 to 10, wherein the model accuracy positioning device performs model conversion processing on the first neural network model under the source framework to obtain the The second neural network model includes: The model accuracy positioning device creates a network topology map by processing the input data of the model by the first neural network model, wherein the network topology map includes the network in the first neural network model The information of the road layer and the connection relationship of the network layer; 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 conversion device, characterized in that the device includes: The obtaining unit is used to obtain the first neural network model under the source frame, the model input data, and the information of the target frame; A conversion unit, 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 is configured to obtain the first inference result and the second inference result obtained by processing the input data of the model based on the first neural network model and the second neural network model, respectively, to obtain the second neural network The accuracy verification result of the network model. 一種模型精度定位裝置,其特徵在於,包括: 獲取單元,用於獲取源框架下的第一神經網路模型、模型輸入資料以及目標框架的資訊; 轉換單元,用於對所述第一神經網路模型進行模型轉換處理,得到所述目標框架下的第二神經網路模型; 定位單元,用於基於所述第一神經網路模型和所述第二神經網路模型分別處理所述模型輸入資料的過程中每個網路層的輸出資料,定位所述第二神經網路模型中精度未對齊的目標網路層; 輸出單元,用於輸出所述目標網路層的資訊。A model accuracy positioning device, which is characterized in that it comprises: The obtaining unit is used to obtain the first neural network model under the source frame, the model input data, and the information of the target frame; A conversion unit for performing model conversion processing on the first neural network model to obtain a second neural network model under the target framework; The positioning unit is configured to locate the second neural network based on 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 Target network layer whose accuracy is not aligned in the model; The output unit is used to output the information of the target network layer. 一種電子設備,其特徵在於,所述裝置包括記憶體和處理器,其中,所述記憶體中存儲程式指令,且所述處理器用於調用所述記憶體中存儲的程式指令,執行如權利要求1~11中任一項所述的方法。An electronic device, characterized in that the device includes 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 as claimed The method described in any one of 1 to 11. 一種計算機存儲介質,其特徵在於,所述計算機可讀存儲介質中存儲有指令,當其在計算機上運行時,使得計算機執行如權利要求1~11中任一項所述的方法。A computer storage medium, characterized in that instructions are stored in the computer-readable storage medium, which when run on a computer, cause the computer to execute the method according to any one of claims 1 to 11.
TW110105732A 2020-02-28 2021-02-19 Transformation method of neural network model, model accuracy positioning method and apparatuses TW202133054A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010129010.0A CN113326913A (en) 2020-02-28 2020-02-28 Neural network model conversion method, model precision positioning method and device
CN202010129010.0 2020-02-28

Publications (1)

Publication Number Publication Date
TW202133054A true TW202133054A (en) 2021-09-01

Family

ID=77412746

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110105732A TW202133054A (en) 2020-02-28 2021-02-19 Transformation method of neural network model, model accuracy positioning method and apparatuses

Country Status (6)

Country Link
JP (1) JP2022540300A (en)
KR (1) KR20220008336A (en)
CN (1) CN113326913A (en)
SG (1) SG11202113120YA (en)
TW (1) TW202133054A (en)
WO (1) WO2021169844A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115187821B (en) * 2022-07-05 2024-03-22 阿波罗智能技术(北京)有限公司 Method, related device and program product for verifying correctness of model before and after conversion
CN115878096B (en) * 2023-01-31 2023-05-23 北京面壁智能科技有限责任公司 Unified application method and device for deep learning model, server and storage medium
CN117056238B (en) * 2023-10-11 2024-01-30 深圳鲲云信息科技有限公司 Method and computing device for verifying correctness of model conversion under deployment framework

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108229646A (en) * 2017-08-08 2018-06-29 北京市商汤科技开发有限公司 neural network model compression method, device, storage medium and electronic equipment
KR102593438B1 (en) * 2017-11-17 2023-10-24 삼성전자주식회사 Method and device for learning neural network
CN108229651A (en) * 2017-11-28 2018-06-29 北京市商汤科技开发有限公司 Neural network model moving method and system, electronic equipment, program and medium
CN108229652B (en) * 2017-11-28 2021-05-04 北京市商汤科技开发有限公司 Neural network model migration method and system, electronic device, program, and medium
CN112836792A (en) * 2017-12-29 2021-05-25 华为技术有限公司 Training method and device of neural network model
JP2020004178A (en) * 2018-06-29 2020-01-09 ルネサスエレクトロニクス株式会社 Learning model evaluation method, learning method, device, and program
CN110348566B (en) * 2019-07-15 2023-01-06 上海点积实业有限公司 Method and system for generating digital signal for neural network training

Also Published As

Publication number Publication date
CN113326913A (en) 2021-08-31
KR20220008336A (en) 2022-01-20
JP2022540300A (en) 2022-09-15
WO2021169844A1 (en) 2021-09-02
SG11202113120YA (en) 2021-12-30

Similar Documents

Publication Publication Date Title
WO2021169844A1 (en) Neural network model conversion method, model precision positioning method, and devices
US10873512B2 (en) Methods for managing self-healing cloud infrastructure and applications
US11893331B2 (en) Device verification method, UVM verification platform, electronic apparatus and storage medium
US8924907B1 (en) Bitstream verification on embedded processor—FPGA platform
CN111079354B (en) Chip integration method and device, chip integration equipment and readable storage medium
WO2020177385A1 (en) Virtual machine function detection method and apparatus, electronic device and storage medium
EP3185027A1 (en) Information processing method and device and computer storage medium
US10656934B2 (en) Efficient software testing
US9846609B2 (en) System and method for testing configuration and operation of I/O devices
CN105700956A (en) Distributed job processing method and system
CN110955715A (en) ERP system, data conversion method and device of target platform and electronic equipment
TW201947418A (en) System and method for micro-service heterogeneous regenerating based on industrial internet, readable storage medium
CN110321629A (en) Coding method, device, equipment and the storage medium of building template
JP2011233127A (en) System and method for customizing scsi error response received from scsi target in storage network environment
WO2020186518A1 (en) Method and apparatus for debugging, and system on chip
US9483593B2 (en) Method for decomposing a hardware model and for accelerating formal verification of the hardware model
CN110750295B (en) Information processing method, device, electronic equipment and storage medium
CN108920175B (en) Method and system for realizing BMC (baseboard management controller) code logic
CN115964984A (en) Method and device for balanced winding of digital chip layout
KR102465680B1 (en) Method for, device for, and system for tracking a dialogue state
CN115034164A (en) Verification method, electronic device, and storage medium
CN106933646A (en) A kind of method and device for creating virtual machine
CN115219884A (en) Chip analysis method and device, electronic equipment and storage medium
WO2022001317A1 (en) Chip simulation method, apparatus and system, and device and storage medium
CN114745749A (en) Virtual network element testing method and device, electronic equipment and readable storage medium