CN112686375A - Neural network model generation method and device - Google Patents

Neural network model generation method and device Download PDF

Info

Publication number
CN112686375A
CN112686375A CN202110019667.6A CN202110019667A CN112686375A CN 112686375 A CN112686375 A CN 112686375A CN 202110019667 A CN202110019667 A CN 202110019667A CN 112686375 A CN112686375 A CN 112686375A
Authority
CN
China
Prior art keywords
neural network
network model
configuration file
node
target edge
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110019667.6A
Other languages
Chinese (zh)
Inventor
郭杨
崔蒙晓
陈懂理
金罗军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Lynxi Technology Co Ltd
Original Assignee
Beijing Lynxi Technology Co Ltd
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 Beijing Lynxi Technology Co Ltd filed Critical Beijing Lynxi Technology Co Ltd
Priority to CN202110019667.6A priority Critical patent/CN112686375A/en
Publication of CN112686375A publication Critical patent/CN112686375A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method and a device for generating a neural network model. The generation method of the neural network model comprises the following steps: acquiring a general configuration file, wherein the general configuration file comprises node information and side information, the node information is used for describing each neural network unit in the neural network model, and the side information is used for describing a data transmission relation in the neural network model; and generating a neural network model according to the general configuration file. Therefore, the general configuration file comprises the side information for describing each neural network unit node of the neural network model and the data transmission relation node information for describing the neural network model, so that the corresponding neural network model can be established according to the general configuration file, the code writing is not required to be carried out by using a programming language, the convenience degree of establishing the neural network model is improved, and the model construction cost is reduced.

Description

Neural network model generation method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for generating a neural network model.
Background
In the related technology, a plurality of different types of neural network models are included, the building modes of the various types of neural network models have certain differences, in order to build the neural network models, a specific model framework is needed to build a programming language, and if the model framework needs to be replaced, workers need to learn and use new framework contents. Therefore, the existing neural network model is complex in building mode and high in cost.
Disclosure of Invention
The embodiment of the invention provides a method and a device for generating a neural network model, and aims to solve the problems that the existing neural network model is complex in construction mode and high in cost.
In a first aspect, an embodiment of the present invention provides a method for generating a neural network model, including the following steps:
acquiring a general configuration file, wherein the general configuration file comprises node information and side information, the node information is used for describing each neural network unit in the neural network model, and the side information is used for describing a data transmission relation in the neural network model;
and generating a neural network model according to the general configuration file.
Optionally, the step of obtaining the general configuration file includes:
acquiring demand information written by a user;
and generating the general configuration file according to the type of the demand information and the model framework.
Optionally, the step of obtaining the general configuration file includes:
acquiring an established neural network model;
and exporting a file in a preset format from the established neural network model as the general configuration file.
Optionally, the obtaining the general configuration file includes:
determining the type and the serial number of the neural network unit;
determining framework parameters of a neural network unit, wherein the framework parameters comprise at least one of tensor dimensionality and value range;
determining the node data precision of the neural network unit;
and generating node information according to the type and the serial number of the neural network unit, the frame parameters and the node data precision.
Optionally, the obtaining the general configuration file includes:
determining the starting position and the end position of the edge;
determining a node egress port and a node ingress port of an edge;
determining the data flow position of the edge;
generating side information according to the start position, the end position, the node inflow port, the node outflow port and the data flow position.
Optionally, when the information value of the starting position of the target edge in the edges is less than 0, the input data of the target edge is external data of the neural network model;
under the condition that the information value of the initial position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the initial position is the serial number of the neural network unit which inputs data to the target edge;
under the condition that the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;
under the condition that the information value of the end point position of the target edge is larger than 0, the output data of the target edge is output to a neural network unit in a neural network model, and the information value of the end point position is the serial number of the neural network unit to which the output data of the target edge is output;
under the condition that the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is external data of a neural network model;
when the information value of the node outgoing port of the target edge is greater than or equal to 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the node outgoing port is a port number for data transmission between the neural network unit which inputs data to the target edge and the target edge;
under the condition that the information value of the node inflow port of the target edge is smaller than 0, the output data of the target edge is output to the outside of the neural network model;
and under the condition that the information value of the node inflow port of the target edge is greater than or equal to 0, outputting the output data of the target edge to a neural network unit in a neural network model, wherein the information value of the node inflow port is the port number of the neural network unit for receiving the output data of the target edge.
Optionally, before generating the neural network model according to the general configuration file, the method further includes:
judging whether the model framework can completely analyze the general configuration file;
if not, discarding the part which can not be analyzed in the general configuration file to obtain the general configuration file which is completely compatible with the model framework.
Optionally, the format of the universal configuration file is a YAML serialization format.
Optionally, the model frame is at least one of a tensrflow frame, a Pytorch frame, and an MXNet frame.
In a second aspect, an embodiment of the present invention provides an apparatus for generating a neural network model, including:
an obtaining module, configured to obtain a general configuration file, where the general configuration file includes node information and side information, the node information is used to describe each neural network unit in the neural network model, and the side information is used to describe a data transmission relationship in the neural network model;
and the generating module is used for generating a neural network model according to the general configuration file.
In a third aspect, the present invention provides a computer program product stored on a computer-readable storage medium, where the computer program product, when executed, implements the steps of the method for generating a neural network model according to any one of the first aspect.
The embodiment of the invention obtains the general configuration file, wherein the general configuration file comprises node information and side information, the node information is used for describing each neural network unit in the neural network model, and the side information is used for describing the data transmission relation in the neural network model; and generating a neural network model according to the general configuration file. Therefore, the general configuration file comprises the side information for describing each neural network unit node of the neural network model and the data transmission relation node information for describing the neural network model, so that the corresponding neural network model can be established according to the general configuration file, the code writing is not required to be carried out by using a programming language, the convenience degree of establishing the neural network model is improved, and the model construction cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flow chart of a method for generating a neural network model according to an embodiment of the present invention;
FIG. 2 is a diagram of neural network connections in an embodiment of the present invention;
FIG. 3 is a schematic diagram of a scenario of a method for generating a neural network model according to an embodiment of the present invention;
fig. 4 is a block diagram of a neural network model generation device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a generation method of a neural network model.
In one embodiment, the generation method of the neural network model comprises the following steps:
step 101: and acquiring a general configuration file.
In this embodiment, the model framework refers to a framework for building a neural network model, and the types of the model frameworks may be different, but the basic structures of the neural network models are the same, and each neural network model includes a neural network unit (Operators, abbreviated as OP) for data processing and an Edge (Edge) for data transmission, where the neural network unit may also be referred to as a Node (Node) of the neural network model.
The underlying calculation model is Neural Network (NN) regardless of deep learning or brain-like calculation, and the main difference is that Artificial Neural Network (ANN) is mainly used for deep learning, while impulse neural network (SNN) is mainly used for brain-like calculation, and both basic constituent units are neurons and are connected into a network by a large number of neurons. The connections between neurons can be viewed as weighted directed edges, the output of a neuron will be weighted by the connections between neurons and then passed to the neuron to which it is connected, and all the inputs received by each neuron will be summed up for further processing to produce the output of the neuron. The main difference between ANN and SNN is that the neurons of ANN output numerical values, which are weighted by multiplying the edge weights; the neuron of the SNN outputs electric pulse signals, and the electric pulse signals are weighted into current signals with different intensities; the input of the neuron of the ANN to other neurons can directly calculate the output value of the neuron through an activation function; the SNN neuron receives current signals input by other neurons, updates the state of the current signals according to the neuron model, sends an electric pulse when reaching a specific state, and resets the state.
The neural network connection graph is a directed graph, each node in the graph represents a layer of neurons, each edge represents a connection relation between layers, the corresponding neural network connection graph is an acyclic directed graph under the condition of ANN neural network application, and the corresponding neural network connection graph is a directed cyclic graph under the condition of SNN neural network application.
Because the basic units of different neural network models are the same and all include nodes and edges, and most model frameworks generate the neural network models based on the descriptions of the nodes and the edges at present, in this embodiment, the nodes and the edges are respectively described through a general configuration file including node information and edge information, and different model frameworks can be adapted to generate and obtain a specific neural network model, so that the neural network models are built according to different frameworks based on the same general configuration file.
In some embodiments, the model framework may be at least one of a tensoflow framework, a Pytorch framework, and an MXNet framework.
In implementation, the applicable model framework is not limited to this, and obviously, the method can also be applied to other frameworks to build the neural network model according to needs.
In this embodiment, the general configuration file includes node information and side information, where the node information is used to describe each neural network unit in the neural network model, and the side information is used to describe a data transmission relationship in the neural network model.
Because the basic structures of the neural network models are the same and comprise nodes and edges, the neural network models of different types can be built according to the general configuration file comprising the node information and the edge information.
Step 102: and generating a neural network model according to the general configuration file.
After the generic configuration file is determined, a corresponding neural network model can be generated from the generic configuration file using a script generator.
In the embodiment of the invention, because the general configuration file comprises the side information describing each neural network unit of the neural network model and the node information describing the data transmission relation in the neural network model, the corresponding neural network model can be established according to the general configuration file without compiling codes by using a program language, the convenience degree of establishing the neural network model is improved, and the manpower cost and the learning difficulty of establishing the neural network model are favorably reduced.
In some embodiments, the step 101 includes:
acquiring demand information written by a user;
and generating the general configuration file according to the type of the demand information and the model framework.
In this embodiment, the requirement information may be directly written by the user, for example, a specific template may be provided, and the template may be provided in different manners, for example, in software such as excel (electronic form), when a general configuration file needs to be obtained, the user fills the requirement information in the template according to a certain format and requirement, and then inputs the filled requirement information into a script generator, and generates a corresponding general configuration file according to the requirement information filled by the user by using the script generator.
In the embodiment, the user can generate the configuration file and further build the neural network model by filling the requirement information according to a certain format requirement, so that the convenience of building the neural network model is improved, the requirement on the programming capability of the user is reduced, the cost of building the neural network model by the user is reduced, and the neural network model is more convenient to use.
In some other embodiments, the step 101 includes:
acquiring an established neural network model;
and exporting a file in a preset format from the established neural network model as the general configuration file.
The established neural network model in the embodiment refers to the established neural network model, and when the neural network model is implemented, a file meeting the format requirement can be derived from the established neural network model according to a certain format requirement to serve as a general configuration file, so that the general configuration file can be acquired.
In other embodiments, the general configuration file can be directly written according to the preset format.
In some embodiments, the format of the common configuration file is YAML serialized format, which is easier to read and migrate.
The general configuration file includes node information and side information, and thus, the process of acquiring the general configuration file is actually the process of acquiring the node information and the side information. In some embodiments, the general configuration file may further include a name, and the name may be set according to the habit of the user, and mainly has no influence on the actual application process of the general configuration file, compared with the general configuration file generated for distinguishing and marking.
In some embodiments, the general configuration file includes node information, and step 101 specifically includes:
determining the type and the serial number of the neural network unit;
determining framework parameters of a neural network unit, wherein the framework parameters comprise at least one of tensor dimensionality and value range;
determining the node data precision of the neural network unit;
and generating node information according to the type and the serial number of the neural network unit, the frame parameters and the node data precision.
In this embodiment, the node information is used to describe the neural network units, where the types of the neural network units are used to distinguish different neural network units, and the serial numbers are used to distinguish the same type of neural network units, and for the same type of neural network units, the serial numbers may be numbered sequentially from 1.
The frame parameters are main parameters of a model frame corresponding to the neural network unit, and specifically may include tensor dimensions, value ranges, and the like.
The node data precision is used to define the data precision of the input data.
In one embodiment, the node information of a certain neural network element can be represented by the following form:
Figure BDA0002888207360000071
in the node information, the name represents the type of the neural network unit, and the neural network unit may be specifically a neural network unit that performs different operations, such as a power operation and a convolution operation. In this embodiment, specifically, the power operation exp, the sequence number of the neural network unit is 2, which means that the sequence number of the neural network unit is 2 in the same neural network unit.
The frame parameters include tensor dimension tensor _ in _ shape, maximum value _ min and minimum value _ max of the value range.
The output state out is a parameter related to the model framework of the type in this embodiment, which may not need to be set when the model framework is modified.
The precision of the node data in the embodiment is 16-byte single-precision floating point number, and when other neural network models are built, the corresponding precision of the node data can be obviously set according to needs.
In this way, by generating node information for each neural network element, parameters for each neural network element can be described.
In some embodiments, the general configuration file includes side information, and the step 101 specifically includes:
determining the starting position and the end position of the edge;
determining a node egress port and a node ingress port of an edge;
determining the data flow position of the edge;
generating side information according to the start position, the end position, the node inflow port, the node outflow port and the data flow position.
Illustratively, in a specific implementation of this embodiment, the side information describing a certain side is as follows:
Figure BDA0002888207360000081
the side information is used to describe data transmission in the neural network model, wherein a start position prev _ node _ seq and an end position next _ node _ seq of the side are mainly used to distinguish whether a certain data transmission process is related to external data of the neural network model.
In one embodiment, it is set that, in the case where the information value of the start position of the target edge among the edges is less than 0, the input data of the target edge is external data of the neural network model; and under the condition that the information value of the initial position of the target edge is greater than 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the initial position is the serial number of the neural network unit which inputs data to the target edge.
In this embodiment, the value of the start position of the target edge may be-1 or a positive integer, when the information value of the start position is-1, it indicates that the input data of the target edge is external data of the neural network model, and when the information value of the start position is a positive integer, the information represents the sequence number of the neural network unit that acquires data from the target edge, which is specifically 1 in this embodiment, that is, the input data to the target edge of the neural network unit whose sequence number is 1.
The parameter value of the end position next _ node _ seq is similar to the start position.
Specifically, in the case where the information value at the end position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model, for example, if the information value at the end position is-1, the output data representing the target edge is output to the outside of the neural network model. When the information value of the end position of the target edge is greater than 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the end position is the serial number of the neural network unit to which the output data of the target edge is output, specifically 2 in this embodiment, it is described that the target edge outputs data to the neural network unit with the serial number sequence value of 2.
The node egress port and the node ingress port of an edge are used specifically to represent port numbers for data transmission between a neural network element and a target edge.
Under the condition that the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is external data of the neural network model; and in the case that the information value of the node inflow port of the target edge is less than 0, outputting the output data of the target edge to the outside of the neural network model.
The node outflow port included in the side information means that data flows out from the node outflow port of the neural network unit and flows into the side to perform data transmission through the side, and therefore, the node outflow port of the side actually corresponds to the data of the input side; the node inflow port included in the side information means that when the neural network unit receives data transmitted by a side, the data flows into the corresponding neural network unit through the node inflow port of the neural network unit, that is, the node inflow port actually corresponds to the data output by the side.
The value ranges of the information values of the node outflow port and the node inflow port of the edge can be integers which are larger than or equal to-1.
When the information value of the start position of the target edge is less than 0, specifically-1 in this embodiment, the input information of the target edge comes from the outside of the neural network model, and correspondingly, the value of the node outflow port of the target edge is also-1.
Similarly, when the information value of the end point position of the target edge is-1, the output data of the target edge is output to the outside of the neural network model, and the value of the information value of the node inflow port is also-1.
When the information value of the node outflow port and the information value of the node inflow port of the target edge are nonnegative integers, the information values represent corresponding port numbers, and the port numbers of the node outflow port and the node inflow port of each neural network unit are sequentially numbered from 0.
And when the information value of the node outgoing port of the target edge is greater than or equal to 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the node outgoing port is the port number for performing data transmission between the neural network unit which inputs data to the target edge and the target edge.
And under the condition that the information value of the node inflow port of the target edge is greater than or equal to 0, the output data of the target edge is output to a neural network unit in the neural network model, and the information value of the node inflow port is the port number of the neural network unit for receiving the output data of the target edge.
For example, the node outgoing port and the point incoming port in the above side information are both port No. 0 of the neural network unit.
The side information may further include a data location identification data _ file of a source or output location of the data. When the information value of the data position identifier of the target edge is None, it indicates that there is no data transmission between the target edge and the outside of the neural network model, that is, the data input to the target edge is from the neural network unit in the neural network model, but not from the outside, and the data of the target edge is output to the neural network unit in the neural network model, but not to the outside of the neural network model.
When the information value of the data position identifier is not None, it indicates that data interaction exists between the target edge and the outside of the neural network model, and at this time, it can be determined whether the target edge acquires external data or outputs data to the outside by combining the parameters such as the start position and the end position, and at this time, a specific data source or a data output address can be used as the information value of the data position identifier, so that the data flow direction of the target edge can be determined.
The process of building a neural network model is given as follows.
As shown in fig. 2, fig. 2 is a neural network connection diagram of the neural network model, which can be specifically understood as a directed acyclic graph, and includes two nodes and four edges, where a neural network unit receives two pieces of external data (Input data file), the two pieces of external Input data are Input to the neural network unit through different edges, processed by the neural network unit, Output to a next neural network unit through one edge, and Output through an edge after being processed by the next neural network unit, so as to obtain an Output file (Output data file).
As shown in tables 1 to 3, when the neural network model is built, a requirement document is first written in excel. Fig. 1 is a demand file corresponding to the side information, and fig. 2 and 3 are demand files corresponding to two nodes, respectively.
Table 1: demand information of side information
Figure BDA0002888207360000111
Table 2: requirement information of first node
Figure BDA0002888207360000112
Table 3: requirement information of the second node
caseName extra_info opname tensor_in_shape value_min value_max out
QA_exp_000001-Pytorch Pytorch exp [4,8,11,11] -1 1 None
The requirement information of the edge information in table 1 describes the information of the edge, for example, the feature of the requirement file is connection, the name of the requirement file is QA _ SMOKE _ connection _000001, one configuration file, case _ config _1, is QA _ Conv2d _000001-Pytorch, and the other configuration file, case _ config _2, is QA _ exp _ 000001-Pytorch. One tag case _ template _1 corresponds to the convolution operation unit Conv2d, and the other tag case _ template _2 corresponds to the power operation unit exp. The additional information Extra _ info for this edge indicates that this edge is for the two nodes of the connection.
The requirement information of the two node information in table 2 and table 3 describes relevant parameters of the two nodes, for example, the name caseName of the requirement file, the frame parameters such as the node type opname and the tensor dimension tensor _ in _ sha pe, and other required parameters.
Next, a general configuration file of the neural network model is obtained from the requirement file as described above, wherein the description in parentheses represents the specific meaning of the related contents and is not a part of the general configuration file.
Figure BDA0002888207360000113
Figure BDA0002888207360000121
Figure BDA0002888207360000131
Figure BDA0002888207360000141
Optionally, before generating the neural network model according to the general configuration file, the method further includes:
judging whether the model framework can completely analyze the general configuration file;
if not, discarding the part which can not be analyzed in the general configuration file to obtain the general configuration file which is completely compatible with the model framework.
In this embodiment, the compatibility of the general configuration file and the neural network model is also detected.
Illustratively, if a generic configuration file is derived from a model built using a model framework of a certain type, the generic configuration file is likely to not have compatibility problems when applied to building a neural network model using the same type of model framework.
When the general configuration file is applied to the process of building a neural network model by using other types of model frameworks, incompatibility may exist due to different model frameworks, and the specific expression is that a part of the general configuration file cannot be analyzed.
Illustratively, the parameter out in the node information of the neural network unit is a relevant parameter in the pytorch framework, and when the neural network model is built based on other model frameworks, the parameter does not need to be set. In this way, when the model framework used is not a pytore framework, the parameter out cannot be resolved, and since the model framework used by the parameter out is irrelevant, if the general configuration file cannot be completely resolved, the part which cannot be resolved, for example, the parameter out, is discarded, so that the obtained general configuration file is compatible with other frameworks and does not have a compatibility file, that is, the obtained general configuration file can be completely resolved by other frameworks.
It is clear that a similar problem may exist with a generic configuration file generated in other ways.
Therefore, in this embodiment, the types of the general configuration file and the neural network model to be generated are analyzed, and when a part which cannot be analyzed by the model framework exists in the general configuration file, the part is discarded, so that the general configuration file can be completely analyzed, and the problem of compatibility of the general configuration file with different model frameworks can be solved. .
It should be understood that the neural network models of different types are all composed of neural network units and edges, and therefore, the overall architecture of the general configuration file does not need to be adjusted, and only some specific parameters need to be adaptively adjusted.
Further, if the fully compatible general configuration file cannot be obtained after the general configuration file is processed and the part which cannot be analyzed is discarded, the model framework cannot support the partial content of the obtained general configuration file, and a result that the generation of the neural network model fails is output.
If the neural network model needs to be continuously constructed, the general configuration file can be regenerated so as to solve the possible compatibility problem. For example, the written general configuration file can be adaptively adjusted according to the model framework used, and the established neural network model can be selected according to the model framework used to derive the general configuration file so as to adapt to the model framework, thereby avoiding the incompatibility of the general configuration files caused by different model frameworks.
As shown in fig. 3, the technical solution of this embodiment may include a process of acquiring a general configuration file and generating a neural network model according to the general configuration file.
The general configuration file can be generated by inputting a requirement file into a specific script generator, can be directly written and obtained, and can also be derived from an established neural network model.
And after the general configuration file is obtained, inputting the general configuration file into a model generation system to generate a neural network model.
The working principle of the model generation system can be summarized as that the model and the data are generated according to the general configuration file provided by the staff.
And then loading the generated data to obtain a framework operation result, loading the generated model to obtain a model operation result, comparing the framework operation result with the model operation result, and returning the comparison result to the staff.
The invention also provides a device for generating the neural network model.
As shown in fig. 4, in one embodiment, the generating device 400 of the neural network model includes:
an obtaining module 401, configured to obtain a general configuration file, where the general configuration file includes node information and side information, the node information is used to describe each neural network unit in the neural network model, and the side information is used to describe a data transmission relationship in the neural network model;
a generating module 402, configured to generate a neural network model according to the general configuration file.
Optionally, the obtaining module 401 includes:
the demand information acquisition submodule is used for acquiring demand information written by a user;
and the generation submodule is used for generating the general configuration file according to the requirement information and the type of the model framework.
Optionally, the obtaining module 401 includes:
the model acquisition submodule is used for acquiring the established neural network model;
and the export submodule is used for exporting a file in a preset format from the established neural network model as the general configuration file.
Optionally, the obtaining module 401 includes:
the first determining submodule is used for determining the type and the serial number of the neural network unit;
the second determining submodule is used for determining frame parameters of the neural network unit, and the frame parameters comprise at least one of tensor dimensions and value ranges;
the third determining submodule is used for determining the node data precision of the neural network unit;
and the node information generation submodule is used for generating node information according to the type and the serial number of the neural network unit, the frame parameters and the node data precision.
Optionally, the obtaining module 401 includes:
the fourth determining submodule is used for determining the starting position and the end position of the edge;
a fifth determining submodule, configured to determine a node outgoing port and a node incoming port of an edge;
a sixth determining submodule for determining a data flow position of the edge;
and the side information generating submodule is used for generating side information according to the starting position, the end position, the node inflow port, the node outflow port and the data flowing position.
Optionally, when the information value of the starting position of the target edge in the edges is less than 0, the input data of the target edge is external data of the neural network model;
under the condition that the information value of the initial position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the initial position is the serial number of the neural network unit which inputs data to the target edge;
under the condition that the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;
under the condition that the information value of the end point position of the target edge is greater than or equal to 0, the output data of the target edge is output to a neural network unit in a neural network model, and the information value of the end point position is the serial number of the neural network unit to which the output data of the target edge is output;
under the condition that the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is external data of a neural network model;
when the information value of the node outgoing port of the target edge is greater than or equal to 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the node outgoing port is a port number for data transmission between the neural network unit which inputs data to the target edge and the target edge;
under the condition that the information value of the node inflow port of the target edge is smaller than 0, the output data of the target edge is output to the outside of the neural network model;
and under the condition that the information value of the node inflow port of the target edge is greater than 0, outputting the output data of the target edge to a neural network unit in a neural network model, wherein the information value of the node inflow port is the port number of the neural network unit for receiving the output data of the target edge.
Optionally, the method further includes:
the compatibility determining module is used for determining whether the type of the general configuration file is compatible with the type of the neural network model to be generated;
and the compatibility processing module is used for carrying out format conversion on the general configuration file under the condition that the type of the general configuration file is incompatible with the type of the neural network model to be generated so as to obtain the general configuration file compatible with the type of the neural network model to be generated.
Optionally, the format of the universal configuration file is a YAML serialization format.
Optionally, the model frame is at least one of a tensrflow frame, a Pytorch frame, and an MXNet frame.
The generation apparatus of a neural network model of this embodiment can implement each step of the above-mentioned generation method of a neural network model, and can implement substantially the same or similar technical effects, and details are not repeated here.
An embodiment of the present invention further provides a computer program product, where the computer program product is stored on a computer-readable storage medium, and when the computer program product is executed, the steps of the method for generating a neural network model according to any one of the first aspect are implemented.
In this embodiment, when the computer program product in the computer-readable storage medium runs, the steps of any one of the above methods for generating a neural network model can be implemented, so that at least all of the above technical effects can be implemented, and details are not described here.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (11)

1. A method for generating a neural network model, comprising the steps of:
acquiring a general configuration file, wherein the general configuration file comprises node information and side information, the node information is used for describing each neural network unit in the neural network model, and the side information is used for describing a data transmission relation in the neural network model;
and generating a neural network model according to the general configuration file.
2. The method of claim 1, wherein the step of obtaining the generic configuration file comprises:
acquiring demand information written by a user;
and generating the general configuration file according to the type of the demand information and the model framework.
3. The method of claim 1, wherein the step of obtaining the generic configuration file comprises:
acquiring an established neural network model;
and exporting a file in a preset format from the established neural network model as the general configuration file.
4. The method according to claim 2 or 3, wherein the obtaining the common configuration file comprises:
determining the type and the serial number of the neural network unit;
determining framework parameters of a neural network unit, wherein the framework parameters comprise at least one of tensor dimensionality and value range;
determining the node data precision of the neural network unit;
and generating node information according to the type and the serial number of the neural network unit, the frame parameters and the node data precision.
5. The method of claim 4, wherein obtaining the generic configuration file comprises:
determining the starting position and the end position of the edge;
determining a node egress port and a node ingress port of an edge;
determining the data flow position of the edge;
generating side information according to the start position, the end position, the node inflow port, the node outflow port and the data flow position.
6. The method of claim 5,
under the condition that the information value of the initial position of the target side in the sides is less than 0, the input data of the target side is external data of a neural network model;
under the condition that the information value of the initial position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the initial position is the serial number of the neural network unit which inputs data to the target edge;
under the condition that the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;
under the condition that the information value of the end point position of the target edge is larger than 0, the output data of the target edge is output to a neural network unit in a neural network model, and the information value of the end point position is the serial number of the neural network unit to which the output data of the target edge is output;
under the condition that the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is external data of a neural network model;
when the information value of the node outgoing port of the target edge is greater than or equal to 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the node outgoing port is a port number for data transmission between the neural network unit which inputs data to the target edge and the target edge;
under the condition that the information value of the node inflow port of the target edge is smaller than 0, the output data of the target edge is output to the outside of the neural network model;
and under the condition that the information value of the node inflow port of the target edge is greater than or equal to 0, outputting the output data of the target edge to a neural network unit in a neural network model, wherein the information value of the node inflow port is the port number of the neural network unit for receiving the output data of the target edge.
7. The method of claim 5, wherein prior to generating a neural network model from the generic configuration file, the method further comprises:
judging whether the model framework can completely analyze the general configuration file;
if not, discarding the part which can not be analyzed in the general configuration file to obtain the general configuration file which is completely compatible with the model framework.
8. The method of any of claims 1 to 3, wherein the format of the generic configuration file is a YAML serialization format.
9. The method of any one of claims 1 to 3, wherein the model framework is at least one of a Tensorflow framework, a Pythrch framework, and an MXNet framework.
10. An apparatus for generating a neural network model, comprising:
an obtaining module, configured to obtain a general configuration file, where the general configuration file includes node information and side information, the node information is used to describe each neural network unit in the neural network model, and the side information is used to describe a data transmission relationship in the neural network model;
and the generating module is used for generating a neural network model according to the general configuration file.
11. A computer program product, characterized in that it is stored on a computer-readable storage medium, which when executed implements the steps of the method of generating a neural network model of any one of claims 1 to 9.
CN202110019667.6A 2021-01-07 2021-01-07 Neural network model generation method and device Pending CN112686375A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110019667.6A CN112686375A (en) 2021-01-07 2021-01-07 Neural network model generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110019667.6A CN112686375A (en) 2021-01-07 2021-01-07 Neural network model generation method and device

Publications (1)

Publication Number Publication Date
CN112686375A true CN112686375A (en) 2021-04-20

Family

ID=75456424

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110019667.6A Pending CN112686375A (en) 2021-01-07 2021-01-07 Neural network model generation method and device

Country Status (1)

Country Link
CN (1) CN112686375A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024046460A1 (en) * 2022-09-02 2024-03-07 深圳忆海原识科技有限公司 Port model, construction method, system, and neural network construction platform
WO2024046463A1 (en) * 2022-09-02 2024-03-07 深圳忆海原识科技有限公司 Model construction method, apparatus and platform, electronic device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024046460A1 (en) * 2022-09-02 2024-03-07 深圳忆海原识科技有限公司 Port model, construction method, system, and neural network construction platform
WO2024046463A1 (en) * 2022-09-02 2024-03-07 深圳忆海原识科技有限公司 Model construction method, apparatus and platform, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US7243086B2 (en) Methods and systems for automatically generating provably correct computer program code
CN107273936B (en) GAN image processing method and system
CN112686375A (en) Neural network model generation method and device
CN110276456A (en) A kind of machine learning model auxiliary construction method, system, equipment and medium
JP2022529178A (en) Features of artificial intelligence recommended models Processing methods, devices, electronic devices, and computer programs
CN111985414B (en) Joint position determining method and device
CN111178512A (en) Device operation neural network test method and device
CN111432003B (en) Data pushing method and device applied to cloud computing, electronic equipment and system
CN111882038A (en) Model conversion method and device
CN115879547A (en) Open world knowledge graph complementing method and system based on LSTM and attention mechanism
CN112506503B (en) Programming method, device, terminal equipment and storage medium
CN103729523B (en) Automatic verification method orienting to parameterization system
CN104750610A (en) Dominating degree based aberrance reduction method for message passing parallel program
Li et al. Smoothness of Itô maps and diffusion processes on path spaces (I)
US11556760B2 (en) Learning-based data processing system and model update method
CN109697511B (en) Data reasoning method and device and computer equipment
CN110610140A (en) Training method, device and equipment of face recognition model and readable storage medium
CN112288032B (en) Method and device for quantitative model training based on generation of confrontation network
Wang et al. Derivative-free feasible backtracking search methods for nonlinear multiobjective optimization with simple boundary constraint
CN115730205A (en) Method and device for configuring decision device and related equipment
KR102222072B1 (en) Apparatus for Processing Data based on Learning and Method for Update of Model
KR102278284B1 (en) Apparatus and method for producing deep learning model using nested editable block
CN112699812B (en) Human model motion feature extraction method and device, electronic equipment and storage medium
KR102224066B1 (en) Analysis method for controller using artificial intelligence-based reverse engineering
EP4369214A1 (en) Merkle tree-based data management method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination