Neural network model conversion method based on MXNet and ONNX

By adopting a neural network model conversion method based on MXNet and ONNX, the compatibility and performance issues between different deep learning frameworks are solved, and efficient and complete conversion between MXNet and ONNX frameworks is achieved, improving the portability and compatibility of the model.

CN119337922BActive Publication Date: 2026-06-23XIDIAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIDIAN UNIV
Filing Date
2024-11-01
Publication Date
2026-06-23

Smart Images

  • Figure CN119337922B_ABST
    Figure CN119337922B_ABST
Patent Text Reader

Abstract

The application provides a neural network model conversion method based on MXNet and ONNX, solves the problem that neural network models under the MXNet framework and the ONNX framework cannot be converted to each other in the prior art, and comprises the following steps: through MXNet model loading and analysis, operator correspondence and conversion, conversion data processing, network layer conversion, ONNX model construction, ONNX model saving and other processes, the conversion process of the neural network model of the MXNet framework to the ONNX model is realized; through ONNX model loading and analysis, operator correspondence and conversion, conversion data processing, computation graph conversion, MXNet model export and other processes, the conversion process of the neural network model of the ONNX framework to the MXNet model is realized; the method realizes complete and efficient conversion of the neural network model under the MXNet framework to the ONNX framework, and enhances the portability and flexibility of the neural network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of deep learning and artificial intelligence, and in particular to a method for converting neural network models based on MXNet (Multilayer Neural Network) and ONNX (Open Neural Network Exchange). Background Technology

[0002] In recent years, artificial intelligence technology has gradually developed towards greater intelligence and autonomy, bringing numerous conveniences to human life. The development of deep learning technology has also driven the continuous advancement of deep learning frameworks. However, for some neural network models that need to be converted between different frameworks, the characteristics of different deep learning frameworks in terms of usage methods and applicable scenarios have become a constraint. Specifically, each deep learning framework has its own internal format for representing and training deep learning models, and these formats are usually not recognizable by other frameworks. This results in the limitations imposed by their respective characteristics and advantages on model conversion between different neural network frameworks. Furthermore, the optimization and improvement of deep learning frameworks are often concentrated within the framework itself. These factors ultimately lead to difficulties in interoperability between different frameworks. In actual production applications, scenarios often arise where the development environment and the deployment environment differ. For example, a neural network model trained in a heavyweight deep learning environment (such as TensorFlow, PyTorch, MXNet) needs to be deployed on a resource-constrained environment (such as IoT devices), which may require a lightweight deep learning framework; or, compared to the development environment, the deployment environment needs to support a wider set of features, allowing for more in-depth model modification and optimization, thus requiring a clear definition.

[0003] The root cause of the above problems is the lack of a unified, standardized model format. Based on this, ONNX was developed. ONNX stands for Open Neural Network Exchange, and it is an open neural network exchange format. ONNX enhances the interoperability of neural network models across various deep learning frameworks by defining a set of environment- and platform-independent standard formats.

[0004] Apache MXNet is a lightweight, flexible, and highly scalable open-source distributed deep learning framework. MXNet provides multi-language APIs and supports operation on various hardware devices, offering significant cross-platform advantages. Distinctly different from most current deep learning systems, MXNet seamlessly combines imperative and symbolic programming, achieving a good balance between flexibility and efficiency. The widespread use of MXNet necessitates the implementation of interoperability between MXNet and other deep learning frameworks for neural network models.

[0005] ONNX is used as a unified intermediate representation format to achieve neural network model conversion between different deep learning frameworks, comprehensively considering both overall coverage of classic deep learning frameworks and extended support for emerging deep learning frameworks. Based on this, support for the MXNet framework is implemented, meaning the conversion of deep learning models trained on the MXNet framework to the ONNX representation format, or the conversion of deep learning models in the ONNX file format to the MXNet framework.

[0006] The current series of conversion tools developed by industry and academia to solve the model conversion problem between different deep learning frameworks have two main design problems: First, the tools are fragmented. Different tools support a limited number of deep learning frameworks and are not easily extended. The scattered distribution of tools cannot guarantee the effectiveness of model conversion and their role is extremely limited. Second, the current tools do not support MXNet framework model conversion. The widespread use of the MXNet framework, which is known for its flexibility and efficiency, reflects the necessity of realizing MXNet framework model conversion.

[0007] Meanwhile, with the rapid development of deep learning technology, existing technologies have gradually revealed some problems, specifically: poor compatibility. Current support for model conversion may be limited to one or more versions of the deep learning framework. Since deep learning frameworks themselves are constantly being updated and iterated, there may be API differences between different versions. Model conversion support lags behind the development of the deep learning framework itself, leading to version compatibility issues in neural network model conversion tools. Furthermore, performance cannot be guaranteed. Current neural network model conversion work focuses more on the conversion itself, lacking a complete theoretical basis for measuring and comparing conversion effects.

[0008] For the MXNet framework, the widely used conversion tool MMDnn has its own unique intermediate representation format, which is only used to temporarily save the parsed model information and will not be exported as a specific file. Although this independent intermediate representation format is more lightweight, it is precisely because of its maximum simplification that it becomes difficult to extend some new nodes. Summary of the Invention

[0009] This invention provides a neural network model conversion method based on MXNet and ONNX, which solves the problem in the prior art that neural network models under the MXNet framework and neural network models under the ONNX framework cannot be converted to each other. It realizes the complete and efficient conversion of neural network models under the MXNet framework to the ONNX framework, and can also complete and efficient conversion of neural network models in ONNX format to the MXNet framework, thereby enhancing the portability and flexibility of neural network models.

[0010] This invention provides a neural network model conversion method based on MXNet and ONNX, the method comprising:

[0011] Determine whether the input neural network model to be converted is a neural network model under the MXNet framework. If so, obtain the initial conditions based on the neural network model to be converted.

[0012] Read the symbol file from the initial conditions and convert the symbol file into a Symbol object;

[0013] Read the weight parameter file from the initial conditions and process the weight parameter file to obtain the weight parameter file of the MXNet model under the MXNet framework; wherein, the weight parameter file includes: data tags for each data;

[0014] The names of each network layer in the neural network model to be converted are determined, and the useless network layers in the neural network model to be converted are labeled to obtain the labeled network layers;

[0015] The weight parameter file of the MXNet model is processed to obtain a general NumPy array;

[0016] Initialize the input node list, output node list, and operation node list under the MXNet framework; construct the operator conversion function between the MXNet framework and the ONNX framework; traverse all operation nodes in the labeled network layer to determine the operator type of each operation node; call the operator conversion function according to the operator type to convert the operation nodes under the MXNet framework to operation nodes under the MXNet framework; and update the input node list, the output node list, and the operation node list; wherein, the operation node includes an operator and operator parameters;

[0017] Based on the input node list, the output node list, the operation node list, and the general NumPy array, construct a neural network model under the ONNX framework;

[0018] The neural network model under the ONNX framework is serialized to obtain a binary string, and the binary string is persisted.

[0019] In one possible implementation, obtaining the initial conditions from the neural network model to be converted includes:

[0020] Determine the symbol file and weight parameter file of the neural network model to be converted;

[0021] Obtain the tensor layout of the neural network model to be converted in MXNet;

[0022] Determine the save path of the converted neural network model corresponding to the neural network model to be converted under ONNX.

[0023] In one possible implementation, reading the symbol file from the initial conditions and converting the symbol file into a Symbol object includes:

[0024] Read the symbol file from the initial conditions and convert the symbol file into a Python object;

[0025] Convert the binary data in the Python object into a Symbol object.

[0026] In one possible implementation, the data processing of the weight parameter file to obtain the weight parameter file of the MXNet model under the MXNet framework includes:

[0027] Convert the read weight parameter file into a list of node attribute dictionaries and a list of node weight dictionaries;

[0028] The node attribute dictionary list and the node weight dictionary list are merged to obtain the weight parameter file of the MXNet model under the MXNet framework.

[0029] In one possible implementation, the operator transformation function for constructing the MXNet framework and the ONNX framework includes:

[0030] Determine the mapping relationship between all operators in the neural network model to be converted and all operators under the ONNX framework, obtain the operator conversion function, and register the operator conversion function;

[0031] The operator parameters in the neural network model to be converted are converted into the parameters required by the corresponding operator pairs under the ONNX framework.

[0032] Based on the parameters of the corresponding operators under the ONNX framework, the operators under the ONNX framework are constructed, and the operator transformation function is obtained.

[0033] In one possible implementation, the useless network layer includes: a unique model layer of the neural network model to be converted.

[0034] In one possible implementation, the step of processing the weight parameter file of the MXNet model to obtain a generic NumPy array includes:

[0035] The data types of the elements in the weight parameter file of the MXNet model are converted, and the data tags are deleted.

[0036] In one possible implementation, the step of traversing all operation nodes in the labeled network layer, determining the operator type of each operation node, calling the operator conversion function according to the operator type to convert the operation nodes under the MXNet framework to operation nodes under the MXNet framework, and updating the input node list, the output node list, and the operation node column includes:

[0037] Obtain the list of nodes in the labeled network layer under the MXNet framework;

[0038] Traverse all operation nodes in the node list, determine the operator type of the operation node, and call the operator conversion function according to the operation node and the operator type to realize the operation node conversion and obtain the converted operation node;

[0039] The input node list, the output node list, and the operation node list are updated based on the transformed operation node and the operator type.

[0040] In one possible implementation, constructing a neural network model under the ONNX framework based on the input node list, the output node list, the operation node list, and the general NumPy array includes:

[0041] The ONNX computation graph under the ONNX framework is constructed based on the updated input node list, output node list, operation node list, and general NumPy array.

[0042] Based on the ONNX computation graph and the neural network model to be converted, a neural network model under the ONNX framework is constructed.

[0043] In one possible implementation, the serialization of the neural network model under the ONNX framework to obtain a binary string, and the persistence of the binary string, includes:

[0044] The SerializeToString() method is used to serialize the neural network model under the ONNX framework, resulting in a binary string corresponding to the neural network model under the ONNX framework.

[0045] The binary string is written to a file for persistence.

[0046] One or more technical solutions provided in this invention have at least the following technical effects or advantages:

[0047] (1) This invention provides a neural network model conversion method based on MXNet and ONNX, which can convert MXNet pre-trained neural network models into ONNX format and ONNX neural network models into MXNet framework, thus meeting the needs of researchers for cross-framework research on neural network models.

[0048] (2) This invention provides a neural network model conversion method based on MXNet and ONNX, which maps the operators used in the MXNet framework to the equivalent operators in the ONNX framework, and defines conversion functions for different operations for different operators, and performs special processing on the parameters of different operators;

[0049] (3) This invention provides a neural network model conversion method based on MXNet and ONNX, which can complete the loading and parsing of the source neural network model, the efficient conversion of operators, computation graphs, and models, and the serialization and saving of the target model. The structure of the converted model is consistent with that before the conversion, and the model inference accuracy is also consistent with that before the conversion, with the model conversion accuracy reaching a maximum value of 1. Attached Figure Description

[0050] Figure 1 A flowchart illustrating the steps of the neural network model conversion method based on MXNet and ONNX provided in this embodiment of the invention. Detailed Implementation

[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0052] This invention provides a neural network model conversion method based on MXNet and ONNX, such as... Figure 1 As shown, the method includes the following steps S101 to S107.

[0053] S101, determine whether the input neural network model to be converted is a neural network model under the MXNet framework. If so, obtain the initial conditions according to the neural network model to be converted.

[0054] Specifically, in step S101, the initial conditions are obtained from the neural network model to be converted, including the following steps S1011 to S1013.

[0055] S1011, Determine the symbol file and weight parameter file of the neural network model to be converted;

[0056] S1012, Obtain the tensor layout of the neural network model to be converted in MXNet;

[0057] S1013, Determine the save path of the converted neural network model corresponding to the neural network model to be converted under ONNX.

[0058] For example, the neural network format conversion software between the MXNet and ONNX frameworks in this invention comprises two directions. The MXNet to ONNX neural network model conversion requires three aspects of input: First, neural network model information conforming to the MXNet format, typically including model structure (computation graph structure), weight parameters, node attributes of various network layers, input tensor dimensions, etc., which are obtained directly or indirectly by reading the MXNet model file; second, information tailored to the specific requirements of the model conversion, primarily used to unify the tensor layout of the neural network model before and after the conversion; and third, information concerning the specific requirements for exporting the ONNX file, including the export file path and the ONNX format opset version. The conversion process is completed after three steps: loading the MXNet model file, converting the MXNet format neural network model computation graph to the ONNX format neural network model, and serializing and saving the ONNX model.

[0059] S102, read the symbol file in the initial conditions, convert the symbol file into a Symbol object, and read the weight parameter file in the initial conditions. Then, process the weight parameter file to obtain the weight parameter file of the MXNet model under the MXNet framework. The weight parameter file includes the data tags of each data point.

[0060] Specifically, in step S102, the symbol file in the initial conditions is read and the symbol file is converted into a Symbol object, including the following steps S1021 to S1022.

[0061] S1021, Read the symbol file from the initial conditions and convert the symbol file into a Python object;

[0062] S1022 converts binary data in a Python object into a Symbol object.

[0063] For example, reading an ONNX model file. The ONNX model structure and weight information are stored in Protobuf format in a file with the .onnx extension. The ONNX model loading interface is used to read the contents of the ONNX file in binary mode.

[0064] The reading of symbol files mainly relies on the mxnet.symbol.load() function. This function takes a string as the path to the symbol file, uses the json.load() method to read the file content into memory and convert it into a Python object. Then, it creates a Symbol object in the MXNet framework to store the neural network model structure. Based on the attributes stored in the Python object, it completes the parameters and attributes of the Symbol object, and finally obtains a complete MXNet type Symbol object.

[0065] Specifically, in step S102, the weight parameter file in the initial conditions is read, and the weight parameter file is processed to obtain the weight parameter file of the MXNet model under the MXNet framework; wherein, the weight parameter file includes: data labels for each data;

[0066] Data processing is performed on the weight parameter file to obtain the weight parameter file for the MXNet model under the MXNet framework, including:

[0067] (1) Convert the read weight parameter file into a list of node attribute dictionaries and a list of node weight dictionaries;

[0068] (2) Merge the node attribute dictionary list and the node weight dictionary list accordingly to obtain the weight parameter file of the MXNet model under the MXNet framework.

[0069] For example, parse binary data. Use the ONNX model parsing interface to deserialize the byte data read in step S102.

[0070] The reading of the weight parameter file mainly relies on the mxnet.ndarray.load() function, which also accepts the parameter file path as a string, loads the parameter information into memory and saves it as a dictionary object.

[0071] S103, determine the names of each network layer in the neural network model to be converted, and label the useless network layers in the neural network model to be converted to obtain the labeled network layers;

[0072] Specifically, in step S103, the useless network layer includes: the unique model layer of the neural network model to be converted.

[0073] For example, the penultimate network layer of the MXNet neural network model is unique to the MXNet framework and does not represent an actual operator. The network layer name is constructed by obtaining the name of the last intermediate layer node and adding the suffix "_label" to it, which makes it easier to delete the corresponding operator by name later.

[0074] S104, process the weight parameter file of the MXNet model to obtain a general NumPy array;

[0075] Specifically, in step S104, the weight parameter file of the MXNet model is processed to obtain a general NumPy array, including: converting the data type of the elements in the weight parameter file of the MXNet model to a different data type and deleting data markers.

[0076] For example, the tensor information of type TensorProto in the ONNX model is first converted into a general NumPy array for transition, and then converted into the mxnet.ndarray type specific to the MXNet framework.

[0077] S105: Initialize the input node list, output node list, and operation node list under the MXNet framework; construct the operator conversion function between the MXNet framework and the ONNX framework; traverse all operation nodes in the labeled network layer to determine the operator type of each operation node; call the operator conversion function according to the operator type to convert the operation nodes under the MXNet framework to operation nodes under the MXNet framework; and update the input node list, output node list, and operation node list. Here, an operation node includes an operator and operator parameters.

[0078] Specifically, in step S105, the operator transformation function between the MXNet framework and the ONNX framework is constructed, including:

[0079] (1) Determine the mapping relationship between the operators in the neural network model to be converted and the operators under the ONNX framework, obtain the operator conversion function, and register the operator conversion function;

[0080] (2) Convert the operator parameters in the neural network model to be converted into the parameters required by the corresponding operator pairs under the ONNX framework;

[0081] (3) Construct operators under the ONNX framework based on the parameters of the corresponding operators under the ONNX framework, and obtain the operator transformation function.

[0082] For example, the operator transformation function from the ONNX framework to the MXNet framework is first determined, and then the operator transformation function is constructed.

[0083] Then the ONNX operator parameters are processed according to the format and type required by the MXNet framework.

[0084] Then call the MXNet operator creation interface to process the ONNX operator parameters according to the format and type required by the MXNet framework.

[0085] Finally, the operator transformation function is obtained.

[0086] Specifically, in step S105, all operation nodes in the labeled network layer are traversed to determine the operator type of each operation node. Based on the operator type, the operator conversion function is called to convert the operation nodes under the MXNet framework to operation nodes under the MXNet framework, and the input node list, output node list, and operation node list are updated, including:

[0087] (1) Obtain the list of nodes in the labeled network layer under the MXNet framework;

[0088] (2) Traverse all operation nodes in the node list, determine the operator type of the operation node, and call the operator conversion function according to the operation node and operator type to realize the operation node conversion and obtain the converted operation node;

[0089] (3) Update the input node list, output node list and operation node list according to the transformed operation node and operator type.

[0090] For example, the operation nodes of the computation graph under the ONNX framework are traversed to generate the corresponding MXNet computation graph. Specifically, this includes:

[0091] (1) Convert the input information of the computation graph;

[0092] (2) Process the ONNX operator parameters according to the format and type required by the MXNet framework;

[0093] (3) Determine the corresponding MXNet operator type based on the ONNX operator type and operator mapping table; call the MXNet operator creation interface, pass in the input information, construct the MXNet operator and return the current MXNet computation graph.

[0094] (4) The ONNX network parameters are split into two parts: weight parameters and auxiliary parameters, and marked with “arg” and “aux” respectively.

[0095] (5) Convert the output information of the computation graph and update the input node list, output node list and operation node list.

[0096] S106. Construct a neural network model under the ONNX framework based on the input node list, output node list, operation node list, and general NumPy array.

[0097] Specifically, in step S106, a neural network model under the ONNX framework is constructed based on the input node list, output node list, operation node list, and general NumPy array, including:

[0098] (1) Construct the ONNX computation graph under the ONNX framework based on the updated input node list, output node list, operation node list and general NumPy array;

[0099] (2) Construct a neural network model under the ONNX framework based on the ONNX computation graph and the neural network model to be converted.

[0100] For example, model parameters marked with "arg" and "aux" are merged into a dictionary, the MXNet function for saving NDArray arrays is used, and the "arg" and "aux" marks are removed, and parameter file persistence is performed.

[0101] The ONNX operators, constructed according to the MXNet node order, first call the static graph construction interface provided by the ONNX official documentation. This interface takes in various information such as the node list, input list, output list, and initialization tensor list of the computation graph, and constructs the corresponding ONNX static graph. Then, combining this with the model's metadata, the constructed ONNX computation graph object is associated with the model, resulting in a complete neural network model within the ONNX framework.

[0102] S107 serializes the neural network model under the ONNX framework to obtain a binary string, and persists the binary string.

[0103] Specifically, in step S107, the neural network model under the ONNX framework is serialized to obtain a binary string, and the binary string is persisted, including the following steps S1071 to S1072.

[0104] S1071, use the SerializeToString() method to serialize the neural network model under the ONNX framework to obtain the binary string corresponding to the neural network model under the ONNX framework;

[0105] S1072, writes the binary string to a file for persistence.

[0106] For example, the ONNX model object is serialized into a binary string using the SerializeToString() method provided by Protocol Buffers; the binary string is then written to a file using Python's built-in write() method.

[0107] This invention provides software for converting between MXNet neural network models and ONNX neural network models. It can convert MXNet pre-trained neural network models to ONNX format and ONNX neural network models to the MXNet framework, meeting the needs of researchers for cross-framework research on neural network models.

[0108] In a specific embodiment of the present invention, when the required neural network model cannot match the current system framework, the method provided by the present invention is first used to convert the neural network model under different frameworks to obtain a neural network model that can adapt to the current system, so that it can adapt to multiple different frameworks in the specific model usage process.

[0109] For example, the neural network model RESNET50 developed under the MXNet framework cannot run directly under the ONNX framework. When the developer's development environment is ONNX, it is necessary to convert the neural network model RESNET50 developed under the MXNet framework to the ONNX framework. At this time, the network model conversion method provided by the present invention can quickly solve this problem, and the converted neural network model RESNET50 can run stably in the ONNX environment.

[0110] The neural network conversion method provided by this invention can improve the portability and compatibility of models: through model conversion, a model trained in one framework can be transferred to another framework, enabling the model to run in different environments and improving its compatibility and portability. This is very useful for deploying models on different platforms and devices.

[0111] Optimizing performance and resource utilization: Different deep learning frameworks may differ in performance and resource utilization. Model conversion allows you to select a framework more suitable for a specific hardware platform, thereby optimizing model efficiency and resource utilization. For example, converting a model from TensorFlow to ncnn can significantly improve its running speed on mobile devices.

[0112] Reduced costs and simplified deployment: Retraining a model requires significant computational resources and time, which can be avoided through model conversion, thus saving time and costs. Furthermore, model conversion simplifies the deployment process, making the model easier to apply in different production environments.

[0113] Supports multiple application scenarios: Different frameworks may be more suitable for different application scenarios. Through model transformation, the most suitable framework can be selected according to specific needs, thereby improving the adaptability and effectiveness of the model.

[0114] Promoting Technological Innovation and Standardization: The development of model transformation technology has facilitated technological exchange and integration between different frameworks, driving technological innovation and standardization processes. This contributes to the formation of a more open and collaborative deep learning ecosystem.

[0115] In summary, the conversion of network models under different frameworks has significant beneficial effects on improving model portability, optimizing performance, reducing costs, simplifying deployment, and promoting technological innovation.

[0116] The various embodiments described in this specification are presented in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. All or part of this invention can be used in numerous general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, mobile communication terminals, multiprocessor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices, etc.

[0117] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present invention.

Claims

1. A neural network model conversion method based on MXNet and ONNX, characterized in that, include: Determine whether the input neural network model to be converted is a neural network model under the MXNet framework. If so, obtain the initial conditions based on the neural network model to be converted. The symbol file in the initial conditions is read, converted into Symbol objects, and the weight parameter file in the initial conditions is read and processed to obtain the weight parameter file of the MXNet model under the MXNet framework. The weight parameter file includes data tags for each data point. Processing the weight parameter file to obtain the weight parameter file of the MXNet model under the MXNet framework includes: converting the read weight parameter file into a list of node attribute dictionaries and a list of node weight dictionaries; merging the node attribute dictionary list and the node weight dictionary list accordingly to obtain the weight parameter file of the MXNet model under the MXNet framework. The names of each network layer in the neural network model to be converted are determined, and the useless network layers in the neural network model to be converted are labeled to obtain the labeled network layers; the useless network layers include: the unique model layers of the neural network model to be converted; The weight parameter file of the MXNet model is processed to obtain a general NumPy array; Initialize the input node list, output node list, and operation node list under the MXNet framework; construct the operator conversion function between the MXNet framework and the ONNX framework; traverse all operation nodes in the labeled network layer to determine the operator type of each operation node; call the operator conversion function according to the operator type to convert the operation nodes under the MXNet framework to operation nodes under the MXNet framework; and update the input node list, the output node list, and the operation node list; wherein, the operation node includes an operator and operator parameters; Based on the input node list, the output node list, the operation node list, and the general NumPy array, construct a neural network model under the ONNX framework; The neural network model under the ONNX framework is serialized to obtain a binary string, and the binary string is persisted.

2. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The step of obtaining initial conditions from the neural network model to be converted includes: Determine the symbol file and weight parameter file of the neural network model to be converted; Obtain the tensor layout of the neural network model to be converted in MXNet; Determine the save path of the converted neural network model corresponding to the neural network model to be converted under ONNX.

3. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The step of reading the symbol file from the initial conditions and converting the symbol file into a Symbol object includes: Read the symbol file from the initial conditions and convert the symbol file into a Python object; Convert the binary data in the Python object into a Symbol object.

4. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The operator transformation function for constructing the MXNet framework and the ONNX framework includes: The mapping relationship between the operators in the neural network model to be converted and the operators under the ONNX framework is determined to obtain the operator conversion function, and the operator conversion function is registered. The operator parameters in the neural network model to be converted are converted into the parameters required by the corresponding operator pairs under the ONNX framework. Based on the parameters of the corresponding operators under the ONNX framework, the operators under the ONNX framework are constructed, and the operator transformation function is obtained.

5. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The step of processing the weight parameter file of the MXNet model to obtain a general NumPy array includes: The data types of the elements in the weight parameter file of the MXNet model are converted, and the data tags are deleted.

6. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The process of traversing all operation nodes in the labeled network layer, determining the operator type of each operation node, calling the operator conversion function according to the operator type to convert the operation nodes under the MXNet framework to operation nodes under the MXNet framework, and updating the input node list, the output node list, and the operation node list includes: Obtain the list of nodes in the labeled network layer under the MXNet framework; Traverse all operation nodes in the node list, determine the operator type of the operation node, and call the operator conversion function according to the operation node and the operator type to realize the operation node conversion and obtain the converted operation node; The input node list, the output node list, and the operation node list are updated based on the transformed operation node and the operator type.

7. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The step of constructing a neural network model under the ONNX framework based on the input node list, the output node list, the operation node list, and the general NumPy array includes: The ONNX computation graph under the ONNX framework is constructed based on the updated input node list, output node list, operation node list, and general NumPy array. Based on the ONNX computation graph and the neural network model to be converted, a neural network model under the ONNX framework is constructed.

8. The neural network model conversion method based on MXNet and ONNX according to claim 1, characterized in that, The step of serializing the neural network model under the ONNX framework to obtain a binary string and persisting the binary string includes: The SerializeToString() method is used to serialize the neural network model under the ONNX framework, resulting in a binary string corresponding to the neural network model under the ONNX framework. The binary string is written to a file for persistence.