WO2020243973A1 - Model-based signal inference method and apparatus - Google Patents

Model-based signal inference method and apparatus Download PDF

Info

Publication number
WO2020243973A1
WO2020243973A1 PCT/CN2019/090442 CN2019090442W WO2020243973A1 WO 2020243973 A1 WO2020243973 A1 WO 2020243973A1 CN 2019090442 W CN2019090442 W CN 2019090442W WO 2020243973 A1 WO2020243973 A1 WO 2020243973A1
Authority
WO
WIPO (PCT)
Prior art keywords
operator
frame
inference
reasoning
preset model
Prior art date
Application number
PCT/CN2019/090442
Other languages
French (fr)
Chinese (zh)
Inventor
张珺
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201980097133.6A priority Critical patent/CN113966516A/en
Priority to PCT/CN2019/090442 priority patent/WO2020243973A1/en
Publication of WO2020243973A1 publication Critical patent/WO2020243973A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models

Definitions

  • the embodiments of the present application relate to the field of data processing technology, and in particular, to a model-based signal reasoning method and device.
  • the model after the model is trained, it can provide input data and related attribute control for the model through the interface provided by the deep learning framework, perform reasoning, and get the reasoning result.
  • different data can be input for repeated execution.
  • different frames of the video can be input for continuous inference. If computing resources are abundant, parallel execution can be used to improve execution efficiency.
  • the embodiment of the present application provides a model-based signal reasoning method and device, which improves the reasoning performance when there is data dependency between reasoning.
  • an embodiment of the present application provides a model-based signal reasoning method, including:
  • Receive input signals which are digital signals that can be processed by a computer or processor.
  • the input signal is inferred from the preset model to obtain the output signal.
  • the preset model includes an operator, and the operator includes input parameters and output parameters; the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, at least one of the operators in the target frame inference Dependence of the input parameter or output parameter of at least one of the operator in the reference frame reasoning with the input parameter or output parameter of the operator, the target frame reasoning is at least one frame of the multi-frame reasoning, and the reference frame reasoning is the multi-frame At least one frame of reasoning in other frame of reasoning except the target frame of reasoning.
  • the dependency information in the preset model can indicate that when the model is used for multi-frame reasoning, the input parameters or output parameters of the operator in the target frame reasoning and the reference frame reasoning The dependency between input parameters or output parameters.
  • multi-frame reasoning with dependencies can be executed in parallel at the same time, making full use of the computing power of computing resources, and improving the reasoning performance of multi-frame reasoning.
  • the preset model before performing multi-frame inference of the preset model on the input signal according to the dependency information in the preset model, it may further include: description information of the preset model Dependency information is set in.
  • the description information is used to describe at least one operator included in the preset model and the input parameter and output parameter of each operator in the at least one operator.
  • setting the dependency information in the description information of the preset model includes: setting the dependency information in the description information of the preset model by calling the interface of the preset model, The interface of the preset model is used to provide an entrance for information modification of the preset model.
  • setting dependency information in the description information of the preset model includes: receiving dependency information input by the user, and describing the dependency information in the preset model according to the dependency information input by the user. Set dependent information in the information.
  • the method before setting the dependency information in the description information of the preset model, the method further includes: acquiring the description information. Obtain dependency information according to at least one operator included in the description information and the input parameters and output parameters of each operator.
  • performing the inference of the preset model on the input signal according to the dependency information in the preset model includes: loading the preset model and the dependency information. Schedule each operator of the preset model in the current frame inference according to the dependency information.
  • scheduling each operator of the preset model in the current frame inference according to the dependency information includes: determining each operator of the preset model in the current frame inference according to the dependency information The order of execution. Each operator of the preset model in the current frame inference is added to the multiple execution queues according to the execution order; wherein, there is no dependency between the input parameters of the multiple operators that are executed at the same time in the multiple execution queues.
  • an embodiment of the present application provides a model-based signal inference device, including a processor and a transmission interface.
  • the transmission interface is used to receive input signals
  • the input signals are digital signals that can be processed by a computer or a processor.
  • the processor is used to perform the inference of the preset model on the input signal according to the dependency information in the preset model to obtain the output signal.
  • the preset model includes an operator, and the operator includes input parameters and output parameters;
  • the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, at least one of the operators in the target frame inference Dependence of the input parameter or output parameter of at least one of the operator in the reference frame reasoning with the input parameter or output parameter of the operator, the target frame reasoning is at least one frame of the multi-frame reasoning, and the reference frame reasoning is the multi-frame At least one frame of reasoning in other frame of reasoning except the target frame of reasoning.
  • the processor is further configured to: set dependency information in the description information of the preset model; wherein the description information is used to describe at least one calculation included in the preset model.
  • the processor is specifically configured to: set dependency information in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used for The preset model provides an entrance for information modification.
  • the transmission interface is further configured to receive dependency information input by the user, and the processor is specifically configured to set dependency information in the description information of the preset model according to the dependency information input by the user. information.
  • the processor is further configured to: obtain description information. Obtain dependency information according to at least one operator included in the description information and the input and output parameters of each operator.
  • the processor is specifically configured to: load the preset model and dependent information, and schedule each operator of the preset model in the current frame inference according to the dependent information.
  • the processor is specifically configured to determine the execution sequence of each operator of the preset model in the current frame inference according to the dependency information.
  • Each operator of the preset model in the current frame inference is added to the multiple execution queues according to the execution order; wherein, there is no dependency between the input parameters of the multiple operators that are executed at the same time in the multiple execution queues.
  • an embodiment of the present application provides a model-based signal inference device, including: a unit for executing each step of the model-based signal inference method provided in the first aspect.
  • an embodiment of the present application provides a model-based signal inference device, including a processor, configured to connect to a memory and call a program stored in the memory to execute the model-based signal inference method provided in the first aspect above .
  • the memory can be located inside the device or outside the device.
  • the processor includes one or more.
  • embodiments of the present application provide a computer program product containing instructions, which when the instructions run on a computer or processor, cause the computer or processor to execute the model-based signal inference method provided in the first aspect above.
  • an embodiment of the present application provides a computer-readable storage medium with instructions stored in the computer-readable storage medium.
  • the instructions run on a computer or a processor, the model-based Signal reasoning method.
  • the dependency information includes the dependency relationship between the input parameter of the operator in the target frame reasoning and the output parameter of the operator in the reference frame reasoning.
  • the dependency information includes a first inter-frame interval, a first operator identifier, and a first parameter identifier
  • the first inter-frame interval is used to indicate a connection with the target frame
  • the first input parameter of the first operator is dependent on the frame interval between the reference frame inference and the target frame inference.
  • the first operator identifier is used to indicate the operator in the reference frame inference that is dependent on the first operator
  • the first parameter identifier is used to indicate a parameter that is dependent on the first input parameter in the reference frame reasoning.
  • the dependency information includes the dependency relationship between the output parameter of the operator in the target frame reasoning and the input parameter of the operator in the reference frame reasoning.
  • the dependency information includes a second inter-frame interval, a second operator identifier, and a second parameter identifier
  • the second inter-frame interval is used to indicate a connection with the target frame In inference, the interval between reference frame inference and target frame inference for which the first output parameter of the second operator has a dependency relationship
  • the second operator identifier is used to indicate the operator in reference frame inference that has a dependency relationship with the second operator
  • the second parameter identifier is used to indicate a parameter that is dependent on the first output parameter in the reference frame inference.
  • the processable digital signal includes at least one of the following: image data, voice data, and text data.
  • Figure 1 is a schematic diagram of an application scenario to which an embodiment of the application is applicable;
  • Figure 2 is a schematic structural diagram of a model provided by an embodiment of the application.
  • FIG. 3 is a flowchart of deploying a deep learning model provided by an embodiment of the application
  • FIG. 4 is a diagram of the neural network application architecture provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of the structure of model multi-frame reasoning provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of another structure of a model provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of description information of a model provided by an embodiment of the application.
  • FIG. 8 is a flowchart of a model-based signal reasoning method provided by an embodiment of the application.
  • FIG. 9 is a flowchart of another model-based signal reasoning method provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of an execution queue in multi-frame reasoning provided by an embodiment of the application.
  • FIG. 11 is a schematic diagram of description information and dependency information of a model provided by an embodiment of the application.
  • FIG. 12 is another schematic diagram of description information and dependency information of a model provided by an embodiment of this application.
  • FIG. 13 is a schematic structural diagram of a model-based signal reasoning device provided by an embodiment of the application.
  • FIG. 14 is a schematic diagram of another structure of a model-based signal reasoning device provided by an embodiment of the application.
  • FIG. 15 is a schematic diagram of another structure of the model-based signal reasoning device provided by an embodiment of the application.
  • the model-based signal reasoning method provided in the embodiment of the present application can be applied to a model-based signal reasoning device.
  • the model-based signal reasoning device uses the preset model to perform continuous multi-frame reasoning of the preset model
  • the model-based signal reasoning method provided in the embodiment of the present application can be executed.
  • the embodiment of the present application does not limit the specific implementation of the model-based signal inference device, as long as the device has computing capability and can use the model to perform inference.
  • FIG. 1 is a schematic diagram of an application scenario to which an embodiment of the application is applicable.
  • the model-based signal inference device may include a terminal device 11, a server 12 and a computer 13.
  • the terminal device 11, the server 12, and the computer 13 may be connected to the network to obtain data or publish data through the network.
  • the terminal device 11 may also be referred to as user equipment (UE), mobile station (mobile station, MS), or mobile terminal (mobile terminal, MT), etc., which is a way to provide users with voice/data connectivity device of.
  • handheld devices with wireless connectivity or vehicle-mounted devices.
  • some examples of terminal devices can be: mobile phones (mobile phones), tablet computers, notebook computers, palmtop computers, mobile internet devices (MID), wearable devices, virtual reality (VR) devices, Augmented reality (AR) equipment, wireless terminals in industrial control, wireless terminals in unmanned driving (self-driving), wireless terminals in remote medical surgery, and smart grid (smart grid) ), the wireless terminal in transportation safety, the wireless terminal in the smart city, or the wireless terminal in the smart home.
  • FIG. 1 is only an example, and does not limit the implementation of the model-based signal inference device.
  • models can be used to process data and achieve specific functions.
  • the input X can be predicted and analyzed, and the result Y can be output.
  • the model can realize different functions, and the specific forms of X and Y can also be different.
  • the model can be reused. Model reuse can be achieved through parameter settings. For example, for different objects in the same scene, model reuse can be achieved by assigning different parameter values.
  • an autonomous vehicle can take images of the road ahead of the vehicle.
  • Inputting the image into the preset model can output obstacles in the road to realize obstacle detection.
  • the obstacle can be other vehicles, bicycles, or pedestrians in front of the vehicle.
  • the speaker's speech signal will be disturbed by the noise of the surrounding environment.
  • the speaker's speech signal and the signal of the environment noise are mixed into the preset model, the speaker's speech signal can be output, the environment noise can be filtered out, and the signal noise can be reduced.
  • the realization of the algorithm is not the overall realization.
  • the algorithm is split, and a model is built according to the execution logic of the algorithm through multiple operators with a single granularity.
  • each operator has input parameters and output parameters.
  • the input parameters of the operator may be the input of the model, or the output parameters of other operators.
  • the output parameter of this operator may be the output of the model or the input parameters of other operators.
  • the embodiment of the present application does not limit the number of operators included in the model, the number of input parameters and the number of output parameters of each operator.
  • Figure 2 is a schematic structural diagram of a model provided by an embodiment of the application. As shown in Figure 2, the model includes 4 operators, namely operators A to D.
  • Operator A has 1 input parameter x and 1 output parameter a.
  • the input parameter of operator A is also the input x of the model.
  • Operator B has 1 input parameter a and 1 output parameter b.
  • the input parameter of operator B is the output parameter a of operator A.
  • the output parameter of operator B is the input parameter b of operator D.
  • Operator C has 1 input parameter a and 1 output parameter c.
  • the input parameter of operator C is the output parameter a of operator A.
  • the output parameter of operator C is the input parameter c of operator D.
  • Operator D has 2 input parameters b and c, and 1 output parameter y.
  • the input parameter b of operator D is the output parameter b of operator B
  • the input parameter c of operator D is the output parameter c of operator C.
  • the output parameter of operator D is the output y of the model.
  • the model needs to be trained before it can be inferred and deployed.
  • Model training refers to the constant optimization of its own parameters for an initial model, so that the model can achieve corresponding functions.
  • the model can be trained through a training data set.
  • the training data set includes labeled data.
  • the training data set may include multiple images, each of which has been pre-marked with obstacles.
  • Model reasoning refers to the process of inputting the data to be processed into the trained model to obtain the output result.
  • a model that realizes obstacle detection is also taken as an example. Take an image and input the image into the model to output obstacle information.
  • Model deployment refers to the process of applying the trained model on the hardware platform to run the model.
  • Fig. 3 is a flowchart of deploying a deep learning model provided by an embodiment of the application.
  • the deployment model can include:
  • the preset model can be loaded into the device memory.
  • the interface provided by the deep learning framework provides input data and related attribute control for the loaded preset model, executes the inference (forward), and obtains the inference result.
  • operators are encapsulated in the model, and users generally only care about the input and output of the model, not the input and output of each operator.
  • FIG. 4 is a neural network application architecture diagram provided by an embodiment of the application.
  • the neural network application architecture provided by the embodiment of the present application may include: application program entry 41, model external interface 42, deep learning structure 43, device driver 44, central processing unit 45, graphics processor 46, network The processor 47 and the digital processor 48.
  • the application program entry 41 is used to select a neural network model.
  • the model external interface 42 is used to call the selected neural network model.
  • the deep learning structure 43 is used to process the input first user image through the neural network model.
  • the deep learning structure 43 may include an environment manager 431, a model manager 432, a task scheduler 433, a task performer 434, and an event manager 435.
  • the environment manager 431 is used to control the startup and shutdown of the device-related environment.
  • the model manager 432 is responsible for operations such as loading the neural network model and unloading the neural network model.
  • the task scheduler 433 is used to manage the sequence in which the neural network model is scheduled.
  • the task executor 434 is responsible for executing the task of the neural network model.
  • the event manager 435 is responsible for the notification of various events.
  • FIG. 4 is only an example, and the embodiment of the present application does not limit the neural network application architecture.
  • different data can be input to repeatedly perform the reasoning.
  • different frames of the video can be input to continuously perform inference.
  • the model performs a frame inference.
  • the model performs multi-frame inference.
  • multi-frame reasoning is also referred to as multiple reasoning, continuous reasoning, multiple frame continuous reasoning, continuous multiple frame reasoning, and continuous multiple reasoning. Every frame of reasoning is also called every frame of reasoning and frame reasoning.
  • the model executes multi-frame inference, it can execute inference either serially or in parallel, depending on the type of model interface and the availability of computing resources.
  • Fig. 5 is a schematic diagram of the structure of a model multi-frame reasoning provided by an embodiment of the application. It is assumed that the input of each frame of inference of the model does not depend on the output of other frames of inference. As shown in Figure 5, when multi-frame inference is executed serially, the first frame inference is executed at T0, the second frame is executed at T1, and the third frame is executed at T2. When multi-frame inference is executed in parallel, since the input of each frame of inference of the model does not depend on the output of other frame inferences, it is possible to execute 3 frames of inference at the same time at T0. It can be seen that if the computing resources are abundant and the input data of each frame of inference is not dependent, the utilization of resources can be improved and the inference speed can be improved by executing multi-frame inference in parallel.
  • FIG. 6 is a schematic diagram of another structure of a model provided by an embodiment of the application.
  • the model includes operators A to D. Among them, the operator A and the operator D are similar to the operator A and the operator D in the model shown in FIG. 2, and will not be repeated here.
  • Operator B has two input parameters.
  • An input parameter of operator B in the second frame of reasoning is the output parameter c of operator C in the first frame of reasoning.
  • an input parameter of operator B in the third frame of reasoning is the operator C in the second frame of reasoning.
  • the output parameter c and so on.
  • the input of each frame of inference depends on the output of the previous frame of inference. At this time, if the parallel execution mode is used for multi-frame inference, the dependency between different frame inferences needs to be considered.
  • the description information of the model is used to describe at least one operator included in the model and the input parameters and output parameters of each operator.
  • the embodiment of the present application does not limit the storage method of the description information in the model and the specific content included.
  • the description information of the model can be stored in a file, and the file can be a binary file, a text file, and so on.
  • FIG. 7 is a schematic diagram of description information of a model provided by an embodiment of the application.
  • the description information shown in FIG. 7 is the description information of the model shown in FIG. 6.
  • the model has two input parameters, x and y.
  • the model has 4 operators, which are operators A to D.
  • the operator A has 1 input parameter x and 1 output parameter a.
  • Operator B has 2 input parameters a and y, and 1 output parameter b.
  • Operator C has 1 input parameter a and 1 output parameter c.
  • Operator D has 2 input parameters b and c, and 1 output parameter d.
  • the output parameter c of the operator C and the output parameter d of the operator D are marked as true, which is represented as the output of the model.
  • the descriptive information shown in Fig. 7 still cannot reflect the dependence relationship between the multi-frame reasoning of the model.
  • FIG. 7 is only an example, and does not limit the implementation of the description information.
  • the dependency information of the model is used to indicate that the input parameter or output parameter of at least one of the operators in the target frame reasoning and at least one of the operators in the reference frame reasoning is used for multi-frame reasoning using the preset model.
  • the dependency relationship of the input parameters or output parameters of the child, the target frame reasoning is at least one frame reasoning in the multi-frame reasoning, and the reference frame reasoning is at least one frame reasoning in the multi-frame reasoning except for the target frame reasoning. .
  • multi-frame reasoning is performed in a parallel execution mode, and the constraint condition is that the input of each frame of reasoning does not depend on the output of other frames of reasoning, such as the scene shown in Figure 2 or Figure 5.
  • the input of the n+mth frame of inference depends on the output of the nth frame of inference
  • the input on the n+mth frame inference is only the output of a certain operator in the nth frame of inference, it must wait until all the operators in the nth frame of inference are executed. In this way, when the computing resources are relatively abundant, the computing power of the computing resources is reduced, and the inference performance is reduced.
  • the embodiments of the present application provide a model-based signal reasoning method, which can be applied to multi-frame reasoning of the model.
  • the dependency information of the model can be used to know the dependencies between different operators in different frame inferences, so that parallel execution can be performed in units of operators, making full use of computing resources. Computing power improves inference performance.
  • Fig. 8 is a flowchart of a model-based signal reasoning method provided by an embodiment of the application. As shown in Figure 8, the model-based signal reasoning method provided by this embodiment includes:
  • the input signal is a signal to be processed input to a preset model, and is a digital signal that can be processed by a computer or a processor.
  • the input signal may include but is not limited to at least one of the following: a voice signal, a video signal, an image signal, a text signal, a temperature signal, or a pressure signal.
  • the input signal when applied to an image processing scene, an object detection scene, or a face recognition scene, the input signal may be an image signal.
  • the image signal may be a landscape signal taken by a camera, an image signal of a community environment captured by a monitoring device, a facial signal of a face obtained by an access control system, a facial signal of a participant obtained by a conference system, etc.
  • the input signal may be a voice signal.
  • the voice signal may be a voice signal recorded by a recording device, a voice signal received by a mobile phone or a fixed phone during a call, a voice signal received by a radio from a radio station, or a voice signal of a participant received by the conference system.
  • the input signal can be a text signal.
  • the text signal may be a TXT text signal, a Word text signal, or a PDF text signal.
  • the processable digital signal may include, but is not limited to, at least one of the following: voice data, image data, video data, text data, temperature data, or pressure data.
  • S802 Perform the inference of the preset model on the input signal according to the dependency information in the preset model to obtain the output signal.
  • the preset model includes operators, and the operators include input parameters and output parameters.
  • the dependency information is used to indicate that at least one of the input parameter or output parameter of at least one operator in the target frame reasoning and the operator in the reference frame reasoning when multi-frame reasoning is performed on the input signal using the preset model Dependency of the input parameter or output parameter of the operator, the target frame reasoning is at least one frame of multi-frame reasoning, and the reference frame reasoning is at least one frame of the other frame reasoning except the target frame reasoning. reasoning.
  • the dependency information in the preset model may indicate the dependency relationship.
  • the dependency is specifically the dependency between the input parameter or output parameter of the operator in the target frame inference and the input parameter or output parameter of the operator in the reference frame inference.
  • multi-frame reasoning with dependencies can be executed in parallel at the same time, making full use of the computing power of computing resources, and improving the reasoning performance of multi-frame reasoning.
  • operators can be used as the execution unit, and operators without dependencies can be executed in parallel at the same time. For operators with dependencies, they can be executed sequentially at different times. Therefore, when performing multi-frame reasoning on a preset model, some operators can be executed in parallel, and some operators can be executed serially, which fully utilizes the computing power of computing resources and improves the inference performance of multi-frame reasoning.
  • the following uses examples to illustrate the dependency information of the preset model.
  • the dependency information of the preset model may indicate that the input parameter (c) of the operator B in the target frame reasoning has a dependency relationship with the output parameter (c) of the operator C in the reference frame reasoning.
  • the target frame reasoning can be the next frame reasoning in two consecutive frames of reasoning
  • the reference frame reasoning can be the previous frame reasoning of the two consecutive frames of reasoning.
  • the dependency information of the preset model may indicate that the input parameters of the operator B in the target frame reasoning have a dependency relationship with the output parameters of the operator C in the reference frame reasoning.
  • the target frame reasoning can be the Nth frame reasoning and the N+1th frame reasoning
  • the reference frame reasoning can be the N-2th frame reasoning.
  • N is an odd number greater than 2.
  • the dependency information of the preset model may indicate that the input parameters of operator B in the target frame reasoning have a dependency relationship with the output parameters of operator C in the first reference frame reasoning, and the The input parameters are dependent on the output parameters of the operator D in the second reference frame inference.
  • the target frame reasoning can be the Nth frame reasoning
  • the first reference frame reasoning can be the N-2th frame reasoning
  • the second reference frame reasoning can be the N-1th frame reasoning.
  • N is an integer greater than 2. It can be seen that the input parameters of operator B in the third frame of reasoning depend on the output parameters of operator C in the second frame of reasoning, and the input parameters of operator A in the third frame of reasoning depend on the output of operator D in the first frame of reasoning. parameter.
  • the input parameters of operator B in the fourth frame of reasoning depend on the output parameters of operator C in the third frame of reasoning, and the input parameters of operator A in the fourth frame of reasoning depend on the output parameters of operator D in the second frame of reasoning. And so on.
  • this embodiment does not limit the storage method of the dependency information in the preset model in the preset model and the specific content included.
  • the dependency information in the preset model can be stored in a file, and the file can be a binary file, a text file, or the like.
  • the file and the file corresponding to the description information of the preset model are the same file or different files.
  • the description information of the preset model please refer to the description of the aforementioned concept, the principle is similar, and will not be repeated here.
  • this embodiment does not limit the preset model, and may be any model that performs multi-frame inference.
  • This embodiment provides a model-based signal reasoning method, including: receiving an input signal, the input signal is a digital signal that can be processed by a computer or a processor, and performing a preset model inference on the input signal according to the dependency information in the preset model, Get the output signal.
  • the model-based signal inference method provided in this embodiment enables multi-frame inference with dependencies to be executed in parallel at the same time based on the dependency information in the preset model, fully utilizes the computing power of computing resources, and improves multi-frame inference Inference performance.
  • FIG. 9 is a flowchart of another model-based signal reasoning method provided by an embodiment of the application. This embodiment provides an exemplary implementation of S802. As shown in Fig. 9, S802, inferring the input signal with the preset model according to the dependency information in the preset model, may include:
  • each operator in the current frame inference has a dependency relationship with the operator in the inference frame before the current frame, so that each operator of the preset model in the current frame inference can be scheduled to execute in parallel. Since the computing power of computing resources can be fully utilized, the reasoning performance of multi-frame reasoning is improved.
  • scheduling each operator of the preset model in the current frame inference according to the dependency information may include:
  • each operator of the preset model in the current frame inference is added to multiple execution queues. Among them, there is no dependency between the input parameters of the multiple operators executed at the same time in the multiple execution queues.
  • the model-based signal inference device may include multiple processors, and this embodiment does not limit the type and number of processors.
  • the processor may include but is not limited to at least one of the following: a central processing unit (CPU), a graphics processing unit (GPU), and a network processing unit (NPU).
  • CPU central processing unit
  • GPU graphics processing unit
  • NPU network processing unit
  • Each processor can correspond to at least one execution queue. This embodiment does not limit the number of execution queues corresponding to the processor.
  • the multi-frame reasoning of the preset model is exemplified.
  • the number of execution queues is 4, and the time to execute each operator is the same, which is T.
  • Inference of the model for 3 consecutive frames can create all the operator tasks of the 3 frame inference.
  • the operators in the first frame of inference are marked as 1A, 1B, 1C, and 1D respectively.
  • the operators in the second frame of inference are marked as 2A, 2B, 2C, and 2D.
  • the operators in the third frame of inference are marked as 3A, 3B, 3C, and 3D.
  • the dependency information in the preset model is used to indicate that the input parameter (c) of the operator B in the target frame reasoning has a dependency relationship with the output parameter (c) of the operator C in the reference frame reasoning.
  • the target frame reasoning can be the next frame reasoning in two consecutive frames of reasoning
  • the reference frame reasoning can be the previous frame reasoning of the two consecutive frames of reasoning.
  • the execution order of the operators in 3 consecutive frames of inference can be determined.
  • operator 2B depends on the operator 1C in the first frame of inference and the operator 2A in the second frame of inference. Therefore, the execution order of operator 2B needs to be after the first frame operator 1C and the second frame operator 2A.
  • operator 3B depends on operator 2C in frame 2 inference and operator 3A in frame 3 inference. The execution order of operator 3B needs to be after the second frame operator 2C and the third frame operator 3A.
  • the input parameter or output parameter of at least one operator in each frame of reasoning and the input parameter or input parameter of other operators except the at least one operator can be obtained through the description information in the model.
  • Dependency of output parameters In the model shown in Figure 6, for the first frame of inference, operator 1B and operator 1C depend on operator 1A, and operator 1D depends on operator 1B and operator 1C. Therefore, the execution order of operators in the first frame of inference is: operator 1A, operator 1B, operator 1C, and operator 1D. Similarly, for the second frame of reasoning, the execution order of the operators is: operator 2A, operator 2B, operator 2C, and operator 2D. For the third frame of inference, the execution order of operators is: operator 3A, operator 3B, operator 3C, and operator 3D.
  • each operator is added to multiple execution queues, as follows:
  • Operator A can start execution in all three frames of inference. Specifically, operator 1A is in execution queue 1, operator 2A is in execution queue 2, and operator 3A is in execution queue 3.
  • the second time T (marked as 2T): In the first frame of inference, the operator 1B and the operator 1C are relieved of the dependence on the operator 1A in the first frame of inference, and execution is started. Operator 1B is in execution queue 1, and operator 1C is in execution queue 2. In the second frame of inference, the operator 2C removes the dependence on the operator 2A in the second frame of inference and starts execution. Operator 2C is in execution queue 3. In the third frame of inference, the operator 3C removes the dependence on the operator 3A in the third frame of inference, and starts execution. Operator 3C is in execution queue 4.
  • the third time T (marked as 3T): In the first frame of inference, the operator 1D removes the dependence on the operator 1B and the operator 1C in the first frame of inference, starts execution, and the operator 1D is in the execution queue 2. In the second frame of inference, the operator 2B relieves the dependence on the operator 1C in the first frame of inference, starts execution, and the operator 2B is in the execution queue 3. In the third frame of inference, the operator 3B relieves the dependence on the operator 2C in the second frame of inference, starts execution, and the operator 3B is in the execution queue 4.
  • the fourth time T (marked as 4T): In the second frame of inference, the operator 2D relieves the dependence on the operator 2B and the operator 2C in the second frame of inference, and starts execution, and the operator 2D is in the execution queue 3. In the third frame of inference, the operator 3D is relieved of the dependence on the operator 3B and the operator 3C in the third frame of inference, and execution is started, and the operator 3D is in the execution queue 4.
  • execution queue the operator is added to is only an example, and this embodiment does not limit this.
  • the operator 1D can also be in the execution queue 1
  • the operator 2D can also be in the execution queue 1
  • the operator 3D can also be Execute in execution queue 2.
  • each operator of the preset model in the current frame inference can be scheduled according to the dependent information, so that the operators can be executed in parallel, making full use of computing resources Its computing power improves the reasoning performance of multi-frame reasoning.
  • the model-based signal inference method provided in this embodiment can also include:
  • the description information is used to describe at least one operator included in the preset model and the input parameter and output parameter of each operator in the at least one operator.
  • the description information of the preset model is used to describe the basic information of the operators in the preset model, including the number, names, input parameters, and output parameters of the operators.
  • the description information cannot reflect the dependency between different frames when the preset model is used for multi-frame reasoning.
  • FIG. 7 operator B has two input parameters a and y.
  • the dependency relationship between the input parameter y of operator B and operator C cannot be obtained from the description information.
  • the input parameter y of operator B in the next frame of inference is the output parameter c of operator C in the previous frame of inference.
  • the dependency information By setting the dependency information in the description information of the preset model, the dependency information can be added to the preset model, so that the multi-frame reasoning with dependencies can be executed in parallel according to the dependency information in the multi-frame reasoning, and the multi-frame reasoning can be improved. Inference performance.
  • setting dependency information in the description information of the preset model may include:
  • Dependent information is set in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used to provide an entrance for information modification of the preset model.
  • the interface of the preset model may include at least one of the following: a function interface, an application programming interface (application programming interface, API) interface, and an executable command.
  • an executable command can be called, and the dependency information can be set by adding a new independent parameter (file or character string) in the description information of the preset model.
  • the execution command is:
  • the function interface For different open source frameworks, such as tensorflow, you can call the function interface and set the dependency information in the description information of the preset model.
  • the python interface is provided as follows:
  • the description information of the preset model can be a binary file or a TXT file.
  • FIG. 11 is a schematic diagram of description information and dependency information of a model provided by an embodiment of the application. Among them, the left side in FIG. 11 is the original description information of the preset model, which can be referred to the related description in FIG. 7, which is not repeated here. You can call executable commands to set dependent information in the original description information of the preset model, as shown on the right in Figure 11.
  • the dependency information may include the interframe interval -1, which is used to indicate that the input parameter (c) of the operator B in the target frame reasoning has a dependency relationship with the output parameter (c) of the operator C in the reference frame reasoning.
  • the target frame reasoning can be the next frame reasoning in two consecutive frames of reasoning
  • the reference frame reasoning can be the previous frame reasoning of the two consecutive frames of reasoning.
  • the execution command is:
  • the dependency information in the description information of the preset model may also include:
  • the dependency information can be acquired through the basic information of the operator included in the description information, and the implementation manner is simple.
  • setting dependency information in the description information of the preset model may include:
  • the dependence information can be directly set in the description information of the preset model according to the dependence information input by the user, and the implementation manner is simple.
  • the dependency information may include the dependency relationship between the input parameter of the operator in the target frame inference and the output parameter of the operator in the reference frame inference.
  • the target frame reasoning is behind the reference frame reasoning.
  • the input parameters of the operator in the target frame inference depend on the output parameters of the operator in the reference frame inference.
  • the target frame reasoning can be the second frame reasoning
  • the reference frame reasoning can be the first frame reasoning.
  • the input parameters of operator B in the second frame of inference are dependent on the output parameters of operator C in the first frame of inference.
  • the dependency information may include a first inter-frame interval, a first operator identifier, and a first parameter identifier
  • the first inter-frame interval is used to indicate a dependency relationship with the first input parameter of the first operator in the target frame inference
  • the interval between the reference frame reasoning and the target frame reasoning, the first operator identifier is used to indicate the operator that has a dependency relationship with the first operator in the reference frame reasoning, and the first parameter identifier is used to indicate the reference frame reasoning and the first operator.
  • An input parameter has a dependency relationship.
  • the target frame reasoning can be the second frame reasoning, and the reference frame reasoning can be the first frame reasoning.
  • the first operator in target frame reasoning is operator B.
  • the first input parameter of the first operator in the target frame inference is the parameter c.
  • the first inter-frame interval is the inter-frame interval between the second frame of inference and the first frame of inference, specifically -1.
  • the first operator is identified as the operator C in the first frame of inference.
  • the first parameter is identified as the output parameter c of the operator C in the first frame of inference.
  • the first interframe interval, the first operator identifier, and the first parameter identifier are just examples.
  • the specific parameters of the parameters are different.
  • the specific fetching is not limited.
  • the dependency information includes the dependency relationship between the output parameter of the operator in the target frame reasoning and the input parameter of the operator in the reference frame reasoning.
  • the target frame reasoning is in front of the reference frame reasoning.
  • the input parameters of the operator in the reference frame reasoning depend on the output parameters of the operator in the target frame reasoning.
  • the target frame reasoning can be the first frame reasoning
  • the reference frame reasoning can be the second frame reasoning.
  • the input parameters of operator B in the second frame of inference are dependent on the output parameters of operator C in the first frame of inference.
  • the dependency information may include a second inter-frame interval, a second operator identifier, and a second parameter identifier
  • the second inter-frame interval is used to indicate a dependency relationship with the first output parameter of the second operator in the target frame inference
  • the interval between the reference frame reasoning and the target frame reasoning, the second operator identifier is used to indicate the operator that has a dependency relationship with the second operator in the reference frame reasoning, and the second parameter identifier is used to indicate the reference frame reasoning and the first A parameter whose output parameter has a dependency relationship.
  • the target frame reasoning can be the first frame reasoning
  • the reference frame reasoning can be the second frame reasoning.
  • the second operator in target frame reasoning is operator C.
  • the first output parameter of the second operator in the target frame inference is the parameter c.
  • the second inter-frame interval is the interval between the second frame of inference and the first frame of inference, and is specifically 1.
  • the second operator is identified as operator B in frame 2 inference.
  • the second parameter is identified as the input parameter c of operator B in the second frame of inference.
  • the indications of the second inter-frame interval, the second operator identifier, and the second parameter identifier are just examples.
  • the specific indications of the parameters are different.
  • the specific fetching is not limited.
  • FIG. 13 is a schematic structural diagram of a model-based signal reasoning device provided by an embodiment of the application.
  • the model-based signal reasoning device provided in this embodiment can execute the model-based signal reasoning method provided in the embodiment of this application.
  • the model-based signal reasoning device provided in this embodiment may include:
  • the receiving module 21 is configured to receive an input signal, the input signal being a digital signal that can be processed by a computer or a processor;
  • the processing module 22 is configured to perform inference of the preset model on the input signal according to the dependency information in the preset model to obtain an output signal;
  • the preset model includes an operator, the operator includes an input parameter and an output parameter;
  • the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, the target frame is inferred
  • the dependency relationship between the input parameter or output parameter of at least one of the operators in the operator and the input parameter or output parameter of the at least one operator in the reference frame reasoning, and the target frame reasoning is For at least one frame of reasoning in the multi-frame reasoning, the reference frame reasoning is at least one frame of reasoning in the multi-frame reasoning other than the target frame reasoning.
  • processing module 22 is further configured to:
  • the dependency information is set in the description information of the preset model; wherein the description information is used to describe at least one operator included in the preset model and the input of each operator in the at least one operator Parameters and output parameters.
  • processing module 22 is specifically configured to:
  • the dependency information is set in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used to provide an entrance for information modification for the preset model.
  • the receiving module 21 is further configured to receive the dependency information input by the user;
  • the processing module 22 is specifically configured to set the dependency information in the description information of the preset model according to the dependency information input by the user.
  • processing module 22 is further configured to:
  • the dependency information is acquired according to at least one operator included in the description information and the input parameter and output parameter of each operator.
  • the dependency information includes a dependency relationship between an input parameter of an operator in the target frame inference and an output parameter of the operator in the reference frame inference.
  • the dependency information includes a first inter-frame interval, a first operator identifier, and a first parameter identifier
  • the first inter-frame interval is used to indicate the first interval of the first operator in the inference with the target frame.
  • the interval between the reference frame reasoning whose input parameters have a dependency relationship and the target frame reasoning, and the first operator identifier is used to indicate an operator that has a dependency relationship with the first operator in the reference frame reasoning
  • the first parameter identifier is used to indicate a parameter that has a dependency relationship with the first input parameter in the reference frame inference.
  • the dependency information includes the dependency relationship between the output parameter of the operator in the target frame inference and the input parameter of the operator in the reference frame inference.
  • the dependency information includes a second inter-frame interval, a second operator identifier, and a second parameter identifier
  • the second inter-frame interval is used to indicate the first interval of the second operator in inference with the target frame.
  • the interval between the reference frame reasoning whose output parameter has a dependency relationship and the target frame reasoning, and the second operator identifier is used to indicate an operator that has a dependency relationship with the second operator in the reference frame reasoning
  • the second parameter identifier is used to indicate a parameter that is dependent on the first output parameter in the reference frame inference.
  • processing module 22 is specifically configured to:
  • processing module 22 is specifically configured to:
  • Each operator of the preset model in the current frame reasoning is added to multiple execution queues according to the execution order; wherein, the input parameters of the multiple operators that are executed at the same time in the multiple execution queues There is no dependency between.
  • the processable digital signal includes at least one of the following: image data, voice data, and text data.
  • the model-based signal reasoning device provided in this embodiment can execute the model-based signal reasoning method provided in the embodiment of this application.
  • the technical principles and technical effects are similar, and will not be repeated here.
  • modules in the above device is only a division of logical functions, and may be fully or partially integrated into one physical entity in actual implementation, or may be physically separated.
  • the modules in the device may be all implemented in the form of software called through processing elements, or all may be implemented in the form of hardware, some modules may also be implemented in the form of software called through the processing elements, and some modules are implemented in the form of hardware.
  • each module can be a separately set up processing element, or it can be integrated in a certain chip of the device for implementation.
  • it can also be stored in the memory in the form of a program, which is called and executed by a certain processing element of the device.
  • all or part of these modules can be integrated together or implemented independently.
  • the processing element described here can also become a processor, which can be an integrated circuit with signal processing capabilities.
  • each step of the above method or each of the above modules may be implemented by an integrated logic circuit of hardware in a processor element or implemented in a form of being called by software through a processing element.
  • the modules in the above device may be one or more integrated circuits configured to implement the above method, for example: one or more application specific integrated circuits (ASIC), or one or more Data signal processor (digital signal processor, DSP), or, one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuits.
  • ASIC application specific integrated circuits
  • DSP Data signal processor
  • FPGA field programmable gate arrays
  • the modules in the above device can be implemented in the form of a processing element scheduler
  • the processing element can be a general-purpose processor, such as a CPU or other processors that can call programs.
  • these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
  • SOC system-on-a-chip
  • the above receiving module may be the interface circuit of the above device, which is used to transmit signals with other devices.
  • FIG. 14 is a schematic diagram of another structure of a model-based signal inference device provided by an embodiment of the application.
  • the model-based signal reasoning device provided in this embodiment can execute the model-based signal reasoning method provided in the embodiment of this application.
  • the model-based signal inference device provided in this embodiment may include a processor 31 and a transmission interface 32. Wherein, the transmission interface 32 can communicate with other devices, and the processor 31 can execute the model-based signal reasoning method provided in the embodiment of the present application.
  • the model-based signal inference device may further include a memory.
  • model-based signal inference device may be a terminal device, a server, or a computer as shown in FIG. 1.
  • the processor may be a general-purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the implementation of this application.
  • the general-purpose processor may be a microprocessor or any conventional processor.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
  • the memory may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory (volatile memory), for example Random access memory (random access memory, RAM).
  • the memory is any medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory in the embodiments of the present application may also be a circuit or any other device capable of realizing a storage function, for storing program instructions and/or data.
  • FIG. 15 is a schematic diagram of another structure of the model-based signal reasoning device provided by an embodiment of the application.
  • the hardware architecture of the model-based signal inference device can be applied to SOC and application processor (application processor, AP), and can execute the model-based signal inference method provided in the embodiments of the present application.
  • the model-based signal inference device may include at least one CPU, at least one memory, GPU, decoder, dedicated video/graphics processor, receiving interface, transmitting interface, etc.
  • the model-based signal inference device may also include a microprocessor and a microcontroller (microcontroller unit, MCU), etc.
  • MCU microcontroller unit
  • the above-mentioned parts of the model-based signal inference device are coupled through connectors. It should be understood that, in each embodiment of the present application, coupling refers to mutual connection in a specific manner, including direct connection or Indirect connection through other devices, such as various interfaces, transmission lines or buses, etc.
  • interfaces are usually electrical communication interfaces, but it is not excluded that they may be mechanical interfaces or other forms of interfaces, which are not limited in this embodiment .
  • the above-mentioned parts are integrated on the same chip.
  • the CPU, GPU, decoder, receiving interface, and sending interface can be integrated on a chip, and the internal parts of the chip access external memory through a bus.
  • the dedicated video/graphics processor can be integrated with the CPU on the same chip, or it can exist as a separate processor chip, for example, the dedicated video/graphics processor can be a dedicated image signal processor (ISP) .
  • ISP dedicated image signal processor
  • the chip involved in the embodiments of this application is a system manufactured on the same semiconductor substrate by an integrated circuit process, also called a semiconductor chip, which can be manufactured on a substrate using an integrated circuit process (usually a semiconductor such as silicon)
  • the outer layer of the integrated circuit formed on the material) is usually encapsulated by a semiconductor packaging material.
  • the integrated circuit may include various types of functional devices, and each type of functional device includes transistors such as logic gate circuits, metal-oxide-semiconductor (MOS) transistors, bipolar transistors or diodes, and may also include capacitors and resistors. Or inductance and other components.
  • MOS metal-oxide-semiconductor
  • Each functional device can work independently or under the action of necessary driver software, and can realize various functions such as communication, calculation, or storage.
  • the CPU may be a single-CPU (single-CPU) processor or a multi-core (multi-CPU) processor.
  • the CPU may be a processor group composed of multiple processors, and the multiple processors are coupled to each other through one or more buses.
  • part of the processing of the image signal or video signal is completed by the GPU, part is completed by a dedicated video/graphics processor, and may also be completed by software code running on a general-purpose CPU or GPU.
  • the device may also include a memory, which may be used to store computer program instructions, including various computer program codes including an operating system (OS), various user application programs, and program codes for executing the solutions of the present application.
  • the memory can also be used to store video data, image data, and so on.
  • the CPU may be used to execute the computer program code stored in the memory to implement the method in the embodiment of the present application.
  • the memory may be a non-power-down volatile memory, such as an embedded multimedia card (EMMC), universal flash storage (UFS) or read-only memory (ROM).
  • EMMC embedded multimedia card
  • UFS universal flash storage
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • CD-ROM compact disc read-only memory
  • optical disc storage including compact discs, laser discs
  • Optical discs digital universal discs, Blu-ray discs, etc.
  • magnetic disk storage media or other magnetic storage devices, or any other computer-readable storage that can be used to carry or store program code in the form of instructions or data structures and that can be accessed by a computer Medium, but not limited to this.
  • the receiving interface may be a data input interface of the processor chip.
  • the receiving interface may be a mobile industry processor interface (MIPI) or a high definition multimedia interface (MIPI). multimedia interface, HDMI) or Display Port (DP), etc.
  • MIPI mobile industry processor interface
  • MIPI high definition multimedia interface
  • HDMI HDMI
  • DP Display Port

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

Embodiments of the present application provide a model-based signal inference method and apparatus. The model-based signal inference method comprises receiving an input signal, and according to dependency information in a preset model, performing inference of the preset model on the input signal to obtain an output signal, wherein the preset model comprises operators, and each operator comprises an input parameter and an output parameter; the dependency information is used for indicating a dependency relationship between the input parameter or output parameter of at least one of the operators in the inference of a target frame and the input parameter or output parameter of at least one of the operators in the inference of a reference frame when the preset model is used to perform multi-frame inference on the input signal; the inference of the target frame is the inference of at least one frame in the inference of multiple frames; the inference of the reference frame is the inference of at least one frame in the inference of other frames except for the inference of the target frame in the inference of the multiple frames. The inference of the multiple frames having the dependency relationship can be concurrently performed according to the dependency information in the preset model, thereby improving multi-frame inference performance.

Description

基于模型的信号推理方法和装置Model-based signal reasoning method and device 技术领域Technical field
本申请实施例涉及数据处理技术领域,尤其涉及一种基于模型的信号推理方法和装置。The embodiments of the present application relate to the field of data processing technology, and in particular, to a model-based signal reasoning method and device.
背景技术Background technique
随着深度学习的应用越来越广泛,出现了各种各样的训练和推理框架。当一个模型训练好后部署到生产环境时,推理性能是非常重要的指标。如果在不改变硬件配置的前提下,可以充分利用算力,将极大提升产品的竞争力。With the increasing application of deep learning, various training and reasoning frameworks have emerged. When a model is trained and deployed to a production environment, inference performance is a very important indicator. If the computing power can be fully utilized without changing the hardware configuration, it will greatly enhance the competitiveness of the product.
目前,当模型训练好后,可以通过深度学习框架提供的接口为模型提供输入数据和相关属性控制,执行推理,得到推理结果。在推理过程中,可以输入不同的数据反复执行,比如,对于图像检测模型,可以输入视频的不同帧连续执行推理。如果计算资源比较丰富,可以通过并行执行来提高执行效率。At present, after the model is trained, it can provide input data and related attribute control for the model through the interface provided by the deep learning framework, perform reasoning, and get the reasoning result. In the inference process, different data can be input for repeated execution. For example, for an image detection model, different frames of the video can be input for continuous inference. If computing resources are abundant, parallel execution can be used to improve execution efficiency.
但是,当推理之间有数据依赖时,比如,当第n+m帧推理的输入依赖于第n帧推理的输出时,就必须等待第n帧的推理结束后才能执行第n+m帧的推理,而无法通过并行执行来提高执行效率。这样,当计算资源比较丰富时,不能充分利用计算资源的运算力,降低了推理性能。However, when there is data dependence between inferences, for example, when the input of the n+mth frame inference depends on the output of the nth frame inference, you must wait for the end of the nth frame inference before executing the n+mth frame Reasoning, but cannot improve execution efficiency through parallel execution. In this way, when the computing resources are relatively abundant, the computing power of the computing resources cannot be fully utilized, which reduces the inference performance.
发明内容Summary of the invention
本申请实施例提供一种基于模型的信号推理方法和装置,当推理之间有数据依赖时,提升了推理性能。The embodiment of the present application provides a model-based signal reasoning method and device, which improves the reasoning performance when there is data dependency between reasoning.
第一方面,本申请实施例提供一种基于模型的信号推理方法,包括:In the first aspect, an embodiment of the present application provides a model-based signal reasoning method, including:
接收输入信号,输入信号为计算机或处理器可处理的数字信号。根据预设模型中的依赖信息对输入信号进行预设模型的推理,得到输出信号。其中,预设模型包括算子,算子包括输入参数和输出参数;依赖信息用于指示在利用预设模型对输入信号进行多帧推理时,目标帧推理中的算子中的至少一个算子的输入参数或输出参数与参考帧推理中的算子中的至少一个算子的输入参数或输出参数的依赖关系,目标帧推理为多帧推理中的至少一帧推理,参考帧推理为多帧推理中的除目标帧推理之外的其他帧推理中的至少一帧推理。Receive input signals, which are digital signals that can be processed by a computer or processor. According to the dependency information in the preset model, the input signal is inferred from the preset model to obtain the output signal. Wherein, the preset model includes an operator, and the operator includes input parameters and output parameters; the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, at least one of the operators in the target frame inference Dependence of the input parameter or output parameter of at least one of the operator in the reference frame reasoning with the input parameter or output parameter of the operator, the target frame reasoning is at least one frame of the multi-frame reasoning, and the reference frame reasoning is the multi-frame At least one frame of reasoning in other frame of reasoning except the target frame of reasoning.
通过第一方面提供的基于模型的信号推理方法,预设模型中的依赖信息可以指示利用模型进行多帧推理时,目标帧推理中算子的输入参数或输出参数与参考帧推理中算子的输入参数或输出参数之间的依赖关系。根据预设模型中的依赖信息,使得具有依赖关系的多帧推理可以在同一时间并行执行,充分利用了计算资源的运算力,提升了多帧推理的推理性能。Through the model-based signal reasoning method provided by the first aspect, the dependency information in the preset model can indicate that when the model is used for multi-frame reasoning, the input parameters or output parameters of the operator in the target frame reasoning and the reference frame reasoning The dependency between input parameters or output parameters. According to the dependency information in the preset model, multi-frame reasoning with dependencies can be executed in parallel at the same time, making full use of the computing power of computing resources, and improving the reasoning performance of multi-frame reasoning.
可选的,在第一方面的一种可能的实施方式中,在根据预设模型中的依赖信息对输入信号进行预设模型的多帧推理之前,还可以包括:在预设模型的描述信息中设置依赖信息。其中,描述信息用于描述预设模型包括的至少一个算子以及至少一个算子中每个算子的输入参数和输出参数。Optionally, in a possible implementation of the first aspect, before performing multi-frame inference of the preset model on the input signal according to the dependency information in the preset model, it may further include: description information of the preset model Dependency information is set in. The description information is used to describe at least one operator included in the preset model and the input parameter and output parameter of each operator in the at least one operator.
可选的,在第一方面的一种可能的实施方式中,在预设模型的描述信息中设置依赖信息,包括:通过调用预设模型的接口在预设模型的描述信息中设置依赖信息,预设模型的接口用于为预设模型提供信息修改的入口。Optionally, in a possible implementation of the first aspect, setting the dependency information in the description information of the preset model includes: setting the dependency information in the description information of the preset model by calling the interface of the preset model, The interface of the preset model is used to provide an entrance for information modification of the preset model.
可选的,在第一方面的一种可能的实施方式中,在预设模型的描述信息中设置依赖信息,包括:接收用户输入的依赖信息,根据用户输入的依赖信息在预设模型的描述信息中设置依赖信息。Optionally, in a possible implementation manner of the first aspect, setting dependency information in the description information of the preset model includes: receiving dependency information input by the user, and describing the dependency information in the preset model according to the dependency information input by the user. Set dependent information in the information.
可选的,在第一方面的一种可能的实施方式中,在预设模型的描述信息中设置依赖信息之前,还包括:获取描述信息。根据描述信息包括的至少一个算子以及每个算子的输入参数和输出参数,获取依赖信息。Optionally, in a possible implementation manner of the first aspect, before setting the dependency information in the description information of the preset model, the method further includes: acquiring the description information. Obtain dependency information according to at least one operator included in the description information and the input parameters and output parameters of each operator.
可选的,在第一方面的一种可能的实施方式中,根据预设模型中的依赖信息对输入信号进行预设模型的推理,包括:加载预设模型和依赖信息。根据依赖信息调度当前帧推理中预设模型的各个算子。Optionally, in a possible implementation manner of the first aspect, performing the inference of the preset model on the input signal according to the dependency information in the preset model includes: loading the preset model and the dependency information. Schedule each operator of the preset model in the current frame inference according to the dependency information.
可选的,在第一方面的一种可能的实施方式中,根据依赖信息调度当前帧推理中预设模型的各个算子,包括:根据依赖信息确定当前帧推理中预设模型的各个算子的执行顺序。根据执行顺序将当前帧推理中预设模型的各个算子加入至多个执行队列中;其中,多个执行队列中在同一时间分别执行的多个算子的输入参数之间没有依赖关系。Optionally, in a possible implementation of the first aspect, scheduling each operator of the preset model in the current frame inference according to the dependency information includes: determining each operator of the preset model in the current frame inference according to the dependency information The order of execution. Each operator of the preset model in the current frame inference is added to the multiple execution queues according to the execution order; wherein, there is no dependency between the input parameters of the multiple operators that are executed at the same time in the multiple execution queues.
第二方面,本申请实施例提供一种基于模型的信号推理装置,包括:处理器和传输接口。其中,传输接口,用于接收输入信号,输入信号为计算机或处理器可处理的数字信号。处理器,用于根据预设模型中的依赖信息对输入信号进行预设模型的推理,得到输出信号。其中,预设模型包括算子,算子包括输入参数和输出参数;依赖信息用于指示在利用预设模型对输入信号进行多帧推理时,目标帧推理中的算子中的至少一个算子的输入参数或输出参数与参考帧推理中的算子中的至少一个算子的输入参数或输出参数的依赖关系,目标帧推理为多帧推理中的至少一帧推理,参考帧推理为多帧推理中的除目标帧推理之外的其他帧推理中的至少一帧推理。In the second aspect, an embodiment of the present application provides a model-based signal inference device, including a processor and a transmission interface. Among them, the transmission interface is used to receive input signals, and the input signals are digital signals that can be processed by a computer or a processor. The processor is used to perform the inference of the preset model on the input signal according to the dependency information in the preset model to obtain the output signal. Wherein, the preset model includes an operator, and the operator includes input parameters and output parameters; the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, at least one of the operators in the target frame inference Dependence of the input parameter or output parameter of at least one of the operator in the reference frame reasoning with the input parameter or output parameter of the operator, the target frame reasoning is at least one frame of the multi-frame reasoning, and the reference frame reasoning is the multi-frame At least one frame of reasoning in other frame of reasoning except the target frame of reasoning.
可选的,在第二方面的一种可能的实施方式中,处理器还用于:在预设模型的描述信息中设置依赖信息;其中,描述信息用于描述预设模型包括的至少一个算子以及至少一个算子中每个算子的输入参数和输出参数。Optionally, in a possible implementation manner of the second aspect, the processor is further configured to: set dependency information in the description information of the preset model; wherein the description information is used to describe at least one calculation included in the preset model. The input parameters and output parameters of each operator in at least one operator.
可选的,在第二方面的一种可能的实施方式中,处理器具体用于:通过调用预设模型的接口在预设模型的描述信息中设置依赖信息,预设模型的接口用于为预设模型提供信息修改的入口。Optionally, in a possible implementation of the second aspect, the processor is specifically configured to: set dependency information in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used for The preset model provides an entrance for information modification.
可选的,在第二方面的一种可能的实施方式中,传输接口还用于接收用户输入的依赖信息,处理器具体用于根据用户输入的依赖信息在预设模型的描述信息中设置依赖信息。Optionally, in a possible implementation manner of the second aspect, the transmission interface is further configured to receive dependency information input by the user, and the processor is specifically configured to set dependency information in the description information of the preset model according to the dependency information input by the user. information.
可选的,在第二方面的一种可能的实施方式中,处理器还用于:获取描述信息。根据描述信息包括的至少一个算子以及每个算子的输入参数和输出参数,获取依赖信 息。Optionally, in a possible implementation manner of the second aspect, the processor is further configured to: obtain description information. Obtain dependency information according to at least one operator included in the description information and the input and output parameters of each operator.
可选的,在第二方面的一种可能的实施方式中,处理器具体用于:加载预设模型和依赖信息,根据依赖信息调度当前帧推理中预设模型的各个算子。Optionally, in a possible implementation of the second aspect, the processor is specifically configured to: load the preset model and dependent information, and schedule each operator of the preset model in the current frame inference according to the dependent information.
可选的,在第二方面的一种可能的实施方式中,处理器具体用于:根据依赖信息确定当前帧推理中预设模型的各个算子的执行顺序。根据执行顺序将当前帧推理中预设模型的各个算子加入至多个执行队列中;其中,多个执行队列中在同一时间分别执行的多个算子的输入参数之间没有依赖关系。Optionally, in a possible implementation manner of the second aspect, the processor is specifically configured to determine the execution sequence of each operator of the preset model in the current frame inference according to the dependency information. Each operator of the preset model in the current frame inference is added to the multiple execution queues according to the execution order; wherein, there is no dependency between the input parameters of the multiple operators that are executed at the same time in the multiple execution queues.
第三方面,本申请实施例提供一种基于模型的信号推理装置,包括:用于执行上述第一方面提供的基于模型的信号推理方法的各步骤的单元。In a third aspect, an embodiment of the present application provides a model-based signal inference device, including: a unit for executing each step of the model-based signal inference method provided in the first aspect.
第四方面,本申请实施例提供一种基于模型的信号推理装置,包括处理器,用于与存储器相连,并调用存储器中存储的程序,以执行以上第一方面提供的基于模型的信号推理方法。该存储器可以位于该装置之内,也可以位于该装置之外。且该处理器包括一个或多个。In a fourth aspect, an embodiment of the present application provides a model-based signal inference device, including a processor, configured to connect to a memory and call a program stored in the memory to execute the model-based signal inference method provided in the first aspect above . The memory can be located inside the device or outside the device. And the processor includes one or more.
第五方面,本申请实施例提供一种包含指令的计算机程序产品,当指令在计算机或处理器上运行时,使得计算机或处理器执行以上第一方面提供的基于模型的信号推理方法。In the fifth aspect, embodiments of the present application provide a computer program product containing instructions, which when the instructions run on a computer or processor, cause the computer or processor to execute the model-based signal inference method provided in the first aspect above.
第六方面,本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令在计算机或处理器上运行时,实现以上第一方面提供的基于模型的信号推理方法。In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium with instructions stored in the computer-readable storage medium. When the instructions run on a computer or a processor, the model-based Signal reasoning method.
在以上各个方面中,可选的,在一种可能的实施方式中,依赖信息包括目标帧推理中算子的输入参数与参考帧推理中算子的输出参数之间的依赖关系。In each of the above aspects, optionally, in a possible implementation manner, the dependency information includes the dependency relationship between the input parameter of the operator in the target frame reasoning and the output parameter of the operator in the reference frame reasoning.
在以上各个方面中,可选的,在一种可能的实施方式中,依赖信息包括第一帧间间隔、第一算子标识和第一参数标识,第一帧间间隔用于指示与目标帧推理中第一算子的第一输入参数有依赖关系的参考帧推理与目标帧推理的帧间间隔,第一算子标识用于指示参考帧推理中与第一算子有依赖关系的算子,第一参数标识用于指示参考帧推理中与第一输入参数有依赖关系的参数。In each of the above aspects, optionally, in a possible implementation manner, the dependency information includes a first inter-frame interval, a first operator identifier, and a first parameter identifier, and the first inter-frame interval is used to indicate a connection with the target frame In inference, the first input parameter of the first operator is dependent on the frame interval between the reference frame inference and the target frame inference. The first operator identifier is used to indicate the operator in the reference frame inference that is dependent on the first operator , The first parameter identifier is used to indicate a parameter that is dependent on the first input parameter in the reference frame reasoning.
在以上各个方面中,可选的,在一种可能的实施方式中,依赖信息包括目标帧推理中算子的输出参数与参考帧推理中算子的输入参数之间的依赖关系。In the above aspects, optionally, in a possible implementation manner, the dependency information includes the dependency relationship between the output parameter of the operator in the target frame reasoning and the input parameter of the operator in the reference frame reasoning.
在以上各个方面中,可选的,在一种可能的实施方式中,依赖信息包括第二帧间间隔、第二算子标识和第二参数标识,第二帧间间隔用于指示与目标帧推理中第二算子的第一输出参数有依赖关系的参考帧推理与目标帧推理的帧间间隔,第二算子标识用于指示参考帧推理中与第二算子有依赖关系的算子,第二参数标识用于指示参考帧推理中与第一输出参数有依赖关系的参数。In each of the above aspects, optionally, in a possible implementation manner, the dependency information includes a second inter-frame interval, a second operator identifier, and a second parameter identifier, and the second inter-frame interval is used to indicate a connection with the target frame In inference, the interval between reference frame inference and target frame inference for which the first output parameter of the second operator has a dependency relationship, and the second operator identifier is used to indicate the operator in reference frame inference that has a dependency relationship with the second operator , The second parameter identifier is used to indicate a parameter that is dependent on the first output parameter in the reference frame inference.
在以上各个方面中,可选的,在一种可能的实施方式中,可处理的数字信号包括下列中的至少一种:图像数据、语音数据和文本数据。In each of the above aspects, optionally, in a possible implementation manner, the processable digital signal includes at least one of the following: image data, voice data, and text data.
附图说明Description of the drawings
图1为本申请实施例适用的应用场景示意图;Figure 1 is a schematic diagram of an application scenario to which an embodiment of the application is applicable;
图2为本申请实施例提供的模型的一种结构示意图;Figure 2 is a schematic structural diagram of a model provided by an embodiment of the application;
图3为本申请实施例提供的部署深度学习模型的流程图;FIG. 3 is a flowchart of deploying a deep learning model provided by an embodiment of the application;
图4为本申请实施例提供的神经网络应用架构图;FIG. 4 is a diagram of the neural network application architecture provided by an embodiment of the application;
图5为本申请实施例提供的模型多帧推理的结构示意图;5 is a schematic diagram of the structure of model multi-frame reasoning provided by an embodiment of the application;
图6为本申请实施例提供的模型的另一种结构示意图;FIG. 6 is a schematic diagram of another structure of a model provided by an embodiment of the application;
图7为本申请实施例提供的模型的描述信息的一种示意图;FIG. 7 is a schematic diagram of description information of a model provided by an embodiment of the application;
图8为本申请实施例提供的一种基于模型的信号推理方法的流程图;FIG. 8 is a flowchart of a model-based signal reasoning method provided by an embodiment of the application;
图9为本申请实施例提供的另一种基于模型的信号推理方法的流程图;FIG. 9 is a flowchart of another model-based signal reasoning method provided by an embodiment of the application;
图10为本申请实施例提供的多帧推理中执行队列的示意图;10 is a schematic diagram of an execution queue in multi-frame reasoning provided by an embodiment of the application;
图11为本申请实施例提供的模型的描述信息和依赖信息的一种示意图;FIG. 11 is a schematic diagram of description information and dependency information of a model provided by an embodiment of the application;
图12为本申请实施例提供的模型的描述信息和依赖信息的另一种示意图;FIG. 12 is another schematic diagram of description information and dependency information of a model provided by an embodiment of this application;
图13为本申请实施例提供的基于模型的信号推理装置的一种结构示意图;FIG. 13 is a schematic structural diagram of a model-based signal reasoning device provided by an embodiment of the application;
图14为本申请实施例提供的基于模型的信号推理装置的另一种结构示意图;FIG. 14 is a schematic diagram of another structure of a model-based signal reasoning device provided by an embodiment of the application;
图15为本申请实施例提供的基于模型的信号推理装置的又一种结构示意图。FIG. 15 is a schematic diagram of another structure of the model-based signal reasoning device provided by an embodiment of the application.
具体实施方式Detailed ways
下面结合附图描述本申请实施例。The embodiments of the present application are described below in conjunction with the drawings.
本申请实施例提供的基于模型的信号推理方法,可以应用于基于模型的信号推理装置中。当基于模型的信号推理装置利用预设模型进行预设模型的连续多帧推理时,可以执行本申请实施例提供的基于模型的信号推理方法。本申请实施例对于基于模型的信号推理装置的具体实现方式不做限定,只要具有计算能力且可以利用模型进行推理的设备均可。示例性的,图1为本申请实施例适用的应用场景示意图。如图1所示,基于模型的信号推理装置可以包括终端设备11、服务器12和电脑13。可选的,终端设备11、服务器12和电脑13可以连接到网络中,通过网络获取数据或者发布数据。The model-based signal reasoning method provided in the embodiment of the present application can be applied to a model-based signal reasoning device. When the model-based signal reasoning device uses the preset model to perform continuous multi-frame reasoning of the preset model, the model-based signal reasoning method provided in the embodiment of the present application can be executed. The embodiment of the present application does not limit the specific implementation of the model-based signal inference device, as long as the device has computing capability and can use the model to perform inference. Exemplarily, FIG. 1 is a schematic diagram of an application scenario to which an embodiment of the application is applicable. As shown in FIG. 1, the model-based signal inference device may include a terminal device 11, a server 12 and a computer 13. Optionally, the terminal device 11, the server 12, and the computer 13 may be connected to the network to obtain data or publish data through the network.
可选的,终端设备11也可以称为用户设备(user equipment,UE)、移动台(mobile station,MS)或移动终端(mobile terminal,MT)等,是一种向用户提供语音/数据连通性的设备。例如,具有无线连接功能的手持式设备、或车载设备等。目前,一些终端设备的举例可以为:手机(mobile phone)、平板电脑、笔记本电脑、掌上电脑、移动互联网设备(mobile internet device,MID)、可穿戴设备、虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端或智慧家庭(smart home)中的无线终端等。Optionally, the terminal device 11 may also be referred to as user equipment (UE), mobile station (mobile station, MS), or mobile terminal (mobile terminal, MT), etc., which is a way to provide users with voice/data connectivity device of. For example, handheld devices with wireless connectivity, or vehicle-mounted devices. At present, some examples of terminal devices can be: mobile phones (mobile phones), tablet computers, notebook computers, palmtop computers, mobile internet devices (MID), wearable devices, virtual reality (VR) devices, Augmented reality (AR) equipment, wireless terminals in industrial control, wireless terminals in unmanned driving (self-driving), wireless terminals in remote medical surgery, and smart grid (smart grid) ), the wireless terminal in transportation safety, the wireless terminal in the smart city, or the wireless terminal in the smart home.
需要说明的是,图1仅是一种示例,并不对基于模型的信号推理装置的实现方式进行限制。It should be noted that FIG. 1 is only an example, and does not limit the implementation of the model-based signal inference device.
下面,对本申请实施例涉及的概念进行说明。Below, the concepts involved in the embodiments of the present application will be described.
(1)模型(1) Model
在人工智能、机器学习、深度学习、神经网络等领域中,可以利用模型来处理数据,实现特定的功能。利用模型,可以对输入的X进行预测分析,输出结果Y。根据 实际需求的不同,模型可以实现不同的功能,X和Y的具体形式也可以不同。模型可以实现复用。模型的复用可以通过参数设置实现。例如,同一场景针对不同的对象,通过赋予不同的参数值可以实现模型的复用。In the fields of artificial intelligence, machine learning, deep learning, neural networks, etc., models can be used to process data and achieve specific functions. Using the model, the input X can be predicted and analyzed, and the result Y can be output. According to different actual needs, the model can realize different functions, and the specific forms of X and Y can also be different. The model can be reused. Model reuse can be achieved through parameter settings. For example, for different objects in the same scene, model reuse can be achieved by assigning different parameter values.
下面通过示例对模型进行说明。The model is explained below with examples.
例如,在图像处理领域中,自动驾驶的车辆可以拍摄车辆前方道路的图像。将该图像输入预设模型中,可以输出道路中的障碍物,实现障碍物的检测。障碍物可以为车辆前方的其他车辆、自行车或行人等。For example, in the field of image processing, an autonomous vehicle can take images of the road ahead of the vehicle. Inputting the image into the preset model can output obstacles in the road to realize obstacle detection. The obstacle can be other vehicles, bicycles, or pedestrians in front of the vehicle.
又例如,在语音处理领域中,说话者的语音信号会受到周围环境噪声的干扰。将说话者的语音信号与环境噪声混合的信号输入预设模型中,可以输出说话者的语音信号,过滤掉环境噪声,实现信号降噪。For another example, in the field of speech processing, the speaker's speech signal will be disturbed by the noise of the surrounding environment. The speaker's speech signal and the signal of the environment noise are mixed into the preset model, the speaker's speech signal can be output, the environment noise can be filtered out, and the signal noise can be reduced.
(2)模型中的算子、算子的输入参数、算子的输出参数(2) Operators in the model, their input parameters, and their output parameters
在模型中,算法的实现并非整体实现。通常,将算法进行拆分,通过多个粒度单一的算子,按照算法的执行逻辑搭建模型。其中,每个算子有输入参数和输出参数。对于一个算子来说,该算子的输入参数可能是模型的输入,也可能是其他算子的输出参数。该算子的输出参数可能是模型的输出,也可能是其他算子的输入参数。In the model, the realization of the algorithm is not the overall realization. Usually, the algorithm is split, and a model is built according to the execution logic of the algorithm through multiple operators with a single granularity. Among them, each operator has input parameters and output parameters. For an operator, the input parameters of the operator may be the input of the model, or the output parameters of other operators. The output parameter of this operator may be the output of the model or the input parameters of other operators.
需要说明的是,本申请实施例对于模型中包括的算子的数量、每个算子的输入参数的数量和输出参数的数量不做限定。It should be noted that the embodiment of the present application does not limit the number of operators included in the model, the number of input parameters and the number of output parameters of each operator.
下面结合示例进行说明。The following is a description with examples.
图2为本申请实施例提供的模型的一种结构示意图。如图2所示,模型包括4个算子,分别为算子A~D。Figure 2 is a schematic structural diagram of a model provided by an embodiment of the application. As shown in Figure 2, the model includes 4 operators, namely operators A to D.
算子A有1个输入参数x,1个输出参数a。算子A的输入参数也是模型的输入x。Operator A has 1 input parameter x and 1 output parameter a. The input parameter of operator A is also the input x of the model.
算子B有1个输入参数a,1个输出参数b。算子B的输入参数是算子A的输出参数a。算子B的输出参数是算子D的输入参数b。Operator B has 1 input parameter a and 1 output parameter b. The input parameter of operator B is the output parameter a of operator A. The output parameter of operator B is the input parameter b of operator D.
算子C有1个输入参数a,1个输出参数c。算子C的输入参数是算子A的输出参数a。算子C的输出参数是算子D的输入参数c。Operator C has 1 input parameter a and 1 output parameter c. The input parameter of operator C is the output parameter a of operator A. The output parameter of operator C is the input parameter c of operator D.
算子D有2个输入参数b、c,1个输出参数y。算子D的输入参数b是算子B的输出参数b,算子D的输入参数c是算子C的输出参数c。算子D的输出参数为模型的输出y。Operator D has 2 input parameters b and c, and 1 output parameter y. The input parameter b of operator D is the output parameter b of operator B, and the input parameter c of operator D is the output parameter c of operator C. The output parameter of operator D is the output y of the model.
(3)模型的训练、推理和部署(3) Model training, inference and deployment
模型需要经过训练后,才能进行推理和部署。The model needs to be trained before it can be inferred and deployed.
模型的训练,是指对一个初始的模型通过不断的优化自身参数,使得模型可以实现相应的功能。模型的训练方式有很多,本申请实施例对此不作限定。例如,可以通过训练数据集(training dataset)训练模型。示例性的,训练数据集包括有标签的数据。例如,在对实现障碍物检测的模型进行训练时,训练数据集可以包括多个图像,每个图像中已经预先标记出了障碍物。Model training refers to the constant optimization of its own parameters for an initial model, so that the model can achieve corresponding functions. There are many training methods for the model, which are not limited in the embodiment of the present application. For example, the model can be trained through a training data set. Exemplarily, the training data set includes labeled data. For example, when training a model for obstacle detection, the training data set may include multiple images, each of which has been pre-marked with obstacles.
模型的推理,是指将需要处理的数据输入已经训练好的模型,从而获得输出结果的过程。例如,还以实现障碍物检测的模型为例。拍摄获得一个图像,将该图像输入模型中,可以输出障碍物信息。Model reasoning refers to the process of inputting the data to be processed into the trained model to obtain the output result. For example, a model that realizes obstacle detection is also taken as an example. Take an image and input the image into the model to output obstacle information.
模型的部署,是指将已经训练好的模型应用在硬件平台上,从而运行模型的过程。Model deployment refers to the process of applying the trained model on the hardware platform to run the model.
下面以深度学习模型为例,对模型的部署进行说明。图3为本申请实施例提供的部署深度学习模型的流程图。如图3所示,部署模型可以包括:The following uses a deep learning model as an example to illustrate the deployment of the model. Fig. 3 is a flowchart of deploying a deep learning model provided by an embodiment of the application. As shown in Figure 3, the deployment model can include:
S301、加载模型(load graph)。S301. Load a graph (load graph).
通过深度学习框架提供的接口,可以将预设模型加载到设备内存中。Through the interface provided by the deep learning framework, the preset model can be loaded into the device memory.
S302、执行模型推理(forward)。S302. Perform model inference (forward).
通过深度学习框架提供的接口为加载的预设模型提供输入数据及相关属性控制,执行推理(forward),得到推理结果。在模型的推理过程中,算子被封装在模型中,用户一般只关心模型的输入和模型的输出,不用关注每个算子的输入和输出。The interface provided by the deep learning framework provides input data and related attribute control for the loaded preset model, executes the inference (forward), and obtains the inference result. In the inference process of the model, operators are encapsulated in the model, and users generally only care about the input and output of the model, not the input and output of each operator.
示例性的,图4为本申请实施例提供的神经网络应用架构图。如图4所示,本申请实施例提供的神经网络应用架构可以包括:应用程序入口41、模型对外接口42、深度学习结构43、设备驱动程序44、中央处理器45、图形处理器46、网络处理器47和数字处理器48。其中,应用程序入口41,用于选择神经网络模型。模型对外接口42,用于调用选择的神经网络模型。深度学习结构43,用于通过神经网络模型对输入的第一用户图像进行处理。示例性的,深度学习结构43可以包括环境管理者431、模型管理者432、任务调度者433、任务执行者434和事件管理者435。其中,环境管理者431,用于控制设备相关环境的启动和关闭。模型管理者432,用于负责加载神经网络模型、卸载神经网络模型等操作。任务调度者433,用于负责管理神经网络模型以何种序列进行调度。任务执行者434,用于负责执行神经网络模型的任务。事件管理者435,用于负责各种事件的通知等。Exemplarily, FIG. 4 is a neural network application architecture diagram provided by an embodiment of the application. As shown in Figure 4, the neural network application architecture provided by the embodiment of the present application may include: application program entry 41, model external interface 42, deep learning structure 43, device driver 44, central processing unit 45, graphics processor 46, network The processor 47 and the digital processor 48. Among them, the application program entry 41 is used to select a neural network model. The model external interface 42 is used to call the selected neural network model. The deep learning structure 43 is used to process the input first user image through the neural network model. Exemplarily, the deep learning structure 43 may include an environment manager 431, a model manager 432, a task scheduler 433, a task performer 434, and an event manager 435. Among them, the environment manager 431 is used to control the startup and shutdown of the device-related environment. The model manager 432 is responsible for operations such as loading the neural network model and unloading the neural network model. The task scheduler 433 is used to manage the sequence in which the neural network model is scheduled. The task executor 434 is responsible for executing the task of the neural network model. The event manager 435 is responsible for the notification of various events.
需要说明的是,图4仅是一种示例,本申请实施例对于神经网络应用架构不做限定。It should be noted that FIG. 4 is only an example, and the embodiment of the present application does not limit the neural network application architecture.
(4)每帧推理、多帧推理(4) Reasoning per frame, multi-frame reasoning
在模型的推理中,可以输入不同的数据反复执行推理。比如,对于图像检测的模型,可以输入视频的不同帧连续执行推理。其中,对于视频中的某个帧来说,模型执行一帧推理。对于视频的多个帧来说,模型执行多帧推理。在本申请实施例中,多帧推理也称为多次推理、连续推理、多帧连续推理、连续多帧推理、连续多次推理。每帧推理也称为每次推理、帧推理。In the reasoning of the model, different data can be input to repeatedly perform the reasoning. For example, for an image detection model, different frames of the video can be input to continuously perform inference. Among them, for a certain frame in the video, the model performs a frame inference. For multiple frames of the video, the model performs multi-frame inference. In the embodiments of the present application, multi-frame reasoning is also referred to as multiple reasoning, continuous reasoning, multiple frame continuous reasoning, continuous multiple frame reasoning, and continuous multiple reasoning. Every frame of reasoning is also called every frame of reasoning and frame reasoning.
模型在执行多帧推理时,可以通过串行执行的方式执行推理,也可以通过并行执行的方式执行推理,具体情况根据模型接口类型的不同、计算资源是否充足而有所不同。When the model executes multi-frame inference, it can execute inference either serially or in parallel, depending on the type of model interface and the availability of computing resources.
下面结合图5进行说明。图5为本申请实施例提供的模型多帧推理的结构示意图。假设,模型每一帧推理的输入不依赖其他帧推理的输出。如图5所示,在串行执行多帧推理时,T0时刻执行第1帧推理,T1时刻执行第2帧推理,T2时刻执行第3帧推理。在并行执行多帧推理时,由于模型每一帧推理的输入都不依赖其他帧推理的输出,因此,可以在T0时刻同时执行3帧推理。可见,如果计算资源比较丰富,并且每帧推理的输入数据无依赖关系,通过并行执行多帧推理,可以提高资源的利用率,提升了推理速度。The description will be given below in conjunction with FIG. 5. Fig. 5 is a schematic diagram of the structure of a model multi-frame reasoning provided by an embodiment of the application. It is assumed that the input of each frame of inference of the model does not depend on the output of other frames of inference. As shown in Figure 5, when multi-frame inference is executed serially, the first frame inference is executed at T0, the second frame is executed at T1, and the third frame is executed at T2. When multi-frame inference is executed in parallel, since the input of each frame of inference of the model does not depend on the output of other frame inferences, it is possible to execute 3 frames of inference at the same time at T0. It can be seen that if the computing resources are abundant and the input data of each frame of inference is not dependent, the utilization of resources can be improved and the inference speed can be improved by executing multi-frame inference in parallel.
下面对模型每一帧推理的输入依赖其他帧推理的输出的情况进行说明。图6为本申请实施例提供的模型的另一种结构示意图。如图6所示,模型包括算子A~D。其中, 算子A和算子D与图2所示模型中的算子A和算子D相似,此处不再赘述。算子B有两个输入参数。第2帧推理中算子B的一个输入参数为第1帧推理中算子C的输出参数c,类似的,第3帧推理中算子B的一个输入参数为第2帧推理中算子C的输出参数c,以此类推。每一帧推理的输入依赖上一帧推理的输出。此时,如果采用并行执行方式进行多帧推理,需要考虑不同帧推理之间的依赖关系。The following describes the case where the input of each frame of reasoning of the model depends on the output of other frames of reasoning. FIG. 6 is a schematic diagram of another structure of a model provided by an embodiment of the application. As shown in Figure 6, the model includes operators A to D. Among them, the operator A and the operator D are similar to the operator A and the operator D in the model shown in FIG. 2, and will not be repeated here. Operator B has two input parameters. An input parameter of operator B in the second frame of reasoning is the output parameter c of operator C in the first frame of reasoning. Similarly, an input parameter of operator B in the third frame of reasoning is the operator C in the second frame of reasoning. The output parameter c, and so on. The input of each frame of inference depends on the output of the previous frame of inference. At this time, if the parallel execution mode is used for multi-frame inference, the dependency between different frame inferences needs to be considered.
(5)模型的描述信息(5) Descriptive information of the model
模型的描述信息用于描述模型包括的至少一个算子以及每个算子的输入参数和输出参数。本申请实施例对于描述信息在模型中的存储方式以及包括的具体内容不做限定。例如,模型的描述信息可以存储在文件中,所述文件可以为二进制文件、文本文件,等。The description information of the model is used to describe at least one operator included in the model and the input parameters and output parameters of each operator. The embodiment of the present application does not limit the storage method of the description information in the model and the specific content included. For example, the description information of the model can be stored in a file, and the file can be a binary file, a text file, and so on.
下面通过示例对描述信息进行说明。The following describes the description information with examples.
图7为本申请实施例提供的模型的描述信息的一种示意图。图7所示的描述信息为图6所示模型的描述信息。如图6和图7所示,模型有两个输入参数,分别为x和y。通过描述信息可知,模型有4个算子,分别为算子A~D。其中,算子A有1个输入参数x,1个输出参数a。算子B有2个输入参数a、y,1个输出参数b。算子C有1个输入参数a,1个输出参数c。算子D有2个输入参数b、c,1个输出参数d。其中,算子C的输出参数c和算子D的输出参数d标记为真,表示为模型的输出。通过图7所示的描述信息,还无法反映出模型的多帧推理之间的依赖关系。FIG. 7 is a schematic diagram of description information of a model provided by an embodiment of the application. The description information shown in FIG. 7 is the description information of the model shown in FIG. 6. As shown in Figure 6 and Figure 7, the model has two input parameters, x and y. According to the description information, the model has 4 operators, which are operators A to D. Among them, the operator A has 1 input parameter x and 1 output parameter a. Operator B has 2 input parameters a and y, and 1 output parameter b. Operator C has 1 input parameter a and 1 output parameter c. Operator D has 2 input parameters b and c, and 1 output parameter d. Among them, the output parameter c of the operator C and the output parameter d of the operator D are marked as true, which is represented as the output of the model. The descriptive information shown in Fig. 7 still cannot reflect the dependence relationship between the multi-frame reasoning of the model.
需要说明的是,图7仅是一种示例,并不对描述信息的实现方式进行限制。It should be noted that FIG. 7 is only an example, and does not limit the implementation of the description information.
(6)模型的依赖信息(6) Model dependency information
模型的依赖信息用于指示在利用预设模型进行多帧推理时,目标帧推理中的算子中的至少一个算子的输入参数或输出参数与参考帧推理中的算子中的至少一个算子的输入参数或输出参数的依赖关系,目标帧推理为多帧推理中的至少一帧推理,参考帧推理为多帧推理中的除目标帧推理之外的其他帧推理中的至少一帧推理。后续通过本申请的各个实施例进行详细说明。The dependency information of the model is used to indicate that the input parameter or output parameter of at least one of the operators in the target frame reasoning and at least one of the operators in the reference frame reasoning is used for multi-frame reasoning using the preset model. The dependency relationship of the input parameters or output parameters of the child, the target frame reasoning is at least one frame reasoning in the multi-frame reasoning, and the reference frame reasoning is at least one frame reasoning in the multi-frame reasoning except for the target frame reasoning. . Detailed descriptions will be given later through various embodiments of the present application.
目前,采用并行执行的方式进行多帧推理,约束条件是每一帧推理的输入不依赖于其他帧推理的输出,例如图2或图5所示场景。但是,当多帧推理之间有数据依赖时(例如图6所示场景),第n+m帧推理的输入依赖于第n帧推理的输出,则必须等待第n帧推理结束后才能执行第n+m帧推理。即使第n+m帧推理依赖的输入只是第n帧推理中某个算子的输出,也必须等到第n帧推理中所有算子执行完才行。这样,当计算资源比较丰富时,降低了计算资源的运算力,降低了推理性能。Currently, multi-frame reasoning is performed in a parallel execution mode, and the constraint condition is that the input of each frame of reasoning does not depend on the output of other frames of reasoning, such as the scene shown in Figure 2 or Figure 5. However, when there is data dependence between multi-frame inferences (such as the scenario shown in Figure 6), the input of the n+mth frame of inference depends on the output of the nth frame of inference, you must wait for the end of the nth frame of inference to execute the first n+m frame reasoning. Even if the input on the n+mth frame inference is only the output of a certain operator in the nth frame of inference, it must wait until all the operators in the nth frame of inference are executed. In this way, when the computing resources are relatively abundant, the computing power of the computing resources is reduced, and the inference performance is reduced.
针对上述技术问题,本申请实施例提供一种基于模型的信号推理方法,可以应用于模型的多帧推理中。针对不同帧推理中输入输出参数存在依赖的场景,通过模型的依赖信息可以获知不同帧推理中不同算子之间的依赖关系,从而可以以算子为单位进行并行执行,充分利用了计算资源的运算力,提升了推理性能。In view of the foregoing technical problems, the embodiments of the present application provide a model-based signal reasoning method, which can be applied to multi-frame reasoning of the model. For scenarios where the input and output parameters in different frame inferences are dependent, the dependency information of the model can be used to know the dependencies between different operators in different frame inferences, so that parallel execution can be performed in units of operators, making full use of computing resources. Computing power improves inference performance.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。The technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
图8为本申请实施例提供的一种基于模型的信号推理方法的流程图。如图8所示,本实施例提供的基于模型的信号推理方法,包括:Fig. 8 is a flowchart of a model-based signal reasoning method provided by an embodiment of the application. As shown in Figure 8, the model-based signal reasoning method provided by this embodiment includes:
S801、接收输入信号,输入信号为计算机或处理器可处理的数字信号。S801. Receive an input signal, where the input signal is a digital signal that can be processed by a computer or a processor.
其中,输入信号为输入预设模型的待处理信号,是计算机或处理器可处理的数字信号。Among them, the input signal is a signal to be processed input to a preset model, and is a digital signal that can be processed by a computer or a processor.
需要说明的是,预设模型实现的功能不同,应用场景不同,输入信号和可处理的数字信号的具体实现形式以及包括的内容可以不同,本实施例对此不作限定。It should be noted that the functions implemented by the preset model are different, the application scenarios are different, and the specific implementation forms of the input signal and the processable digital signal and the included content may be different, which is not limited in this embodiment.
可选的,输入信号可以包括但不限于下列中的至少一种:语音信号、视频信号、图像信号、文本信号、温度信号或压力信号等。Optionally, the input signal may include but is not limited to at least one of the following: a voice signal, a video signal, an image signal, a text signal, a temperature signal, or a pressure signal.
例如,当应用于图像处理场景、物体检测场景、人脸识别场景中时,输入信号可以为图像信号。图像信号可以是相机拍摄的风景信号、监控设备捕捉的社区环境的图像信号、门禁系统获取的人脸的面部信号、会议系统获取到的参会人员的面部信号,等。For example, when applied to an image processing scene, an object detection scene, or a face recognition scene, the input signal may be an image signal. The image signal may be a landscape signal taken by a camera, an image signal of a community environment captured by a monitoring device, a facial signal of a face obtained by an access control system, a facial signal of a participant obtained by a conference system, etc.
当应用于音频处理场景、语音识别场景、声纹识别场景中时,输入信号可以为语音信号。该语音信号可以是录音设备录制的语音信号、移动手机或固定电话在通话过程中接收的语音信号、收音机接收的电台发送的语音信号或会议系统接收的参会人员的语音信号等。When used in audio processing scenarios, voice recognition scenarios, and voiceprint recognition scenarios, the input signal may be a voice signal. The voice signal may be a voice signal recorded by a recording device, a voice signal received by a mobile phone or a fixed phone during a call, a voice signal received by a radio from a radio station, or a voice signal of a participant received by the conference system.
当应用于语言翻译、语义识别场景中时,输入信号可以为文本信号。该文本信号可以是TXT文本信号、Word文本信号或PDF文本信号等。When used in language translation and semantic recognition scenarios, the input signal can be a text signal. The text signal may be a TXT text signal, a Word text signal, or a PDF text signal.
可选的,可处理的数字信号可以包括但不限于下列中的至少一种:语音数据、图像数据、视频数据、文本数据、温度数据或压力数据等。Optionally, the processable digital signal may include, but is not limited to, at least one of the following: voice data, image data, video data, text data, temperature data, or pressure data.
S802、根据预设模型中的依赖信息对输入信号进行预设模型的推理,得到输出信号。其中,预设模型包括算子,算子包括输入参数和输出参数。依赖信息用于指示在利用预设模型对输入信号进行多帧推理时,目标帧推理中的算子中的至少一个算子的输入参数或输出参数与参考帧推理中的算子中的至少一个算子的输入参数或输出参数的依赖关系,目标帧推理为多帧推理中的至少一帧推理,参考帧推理为多帧推理中的除目标帧推理之外的其他帧推理中的至少一帧推理。S802: Perform the inference of the preset model on the input signal according to the dependency information in the preset model to obtain the output signal. Among them, the preset model includes operators, and the operators include input parameters and output parameters. The dependency information is used to indicate that at least one of the input parameter or output parameter of at least one operator in the target frame reasoning and the operator in the reference frame reasoning when multi-frame reasoning is performed on the input signal using the preset model Dependency of the input parameter or output parameter of the operator, the target frame reasoning is at least one frame of multi-frame reasoning, and the reference frame reasoning is at least one frame of the other frame reasoning except the target frame reasoning. reasoning.
具体的,执行预设模型的连续多帧推理时,不同帧之间具有依赖关系。预设模型中的依赖信息可以指示该依赖关系。该依赖关系具体为目标帧推理中算子的输入参数或输出参数与参考帧推理中算子的输入参数或输出参数之间的依赖关系。这样,就可以根据预设模型中的依赖信息,使得具有依赖关系的多帧推理可以在同一时间并行执行,充分利用了计算资源的运算力,提升了多帧推理的推理性能。进一步的,在多帧推理中可以以算子为执行单位,对于没有依赖关系的算子,可以在同一时间并行执行。对于有依赖关系的算子,可以在不同的时间顺序执行。因此,在对预设模型执行多帧推理时,一部分算子可以实现并行执行,一部分算子可以实现串行执行,充分利用了计算资源的运算力,提升了多帧推理的推理性能。Specifically, when performing continuous multi-frame reasoning of the preset model, different frames have a dependency relationship. The dependency information in the preset model may indicate the dependency relationship. The dependency is specifically the dependency between the input parameter or output parameter of the operator in the target frame inference and the input parameter or output parameter of the operator in the reference frame inference. In this way, based on the dependency information in the preset model, multi-frame reasoning with dependencies can be executed in parallel at the same time, making full use of the computing power of computing resources, and improving the reasoning performance of multi-frame reasoning. Furthermore, in multi-frame reasoning, operators can be used as the execution unit, and operators without dependencies can be executed in parallel at the same time. For operators with dependencies, they can be executed sequentially at different times. Therefore, when performing multi-frame reasoning on a preset model, some operators can be executed in parallel, and some operators can be executed serially, which fully utilizes the computing power of computing resources and improves the inference performance of multi-frame reasoning.
下面通过示例对预设模型的依赖信息进行示例性说明。The following uses examples to illustrate the dependency information of the preset model.
在一个示例中,请参照图6。模型进行多帧推理时,连续的两帧推理具有依赖关 系。预设模型的依赖信息可以指示:目标帧推理中算子B的输入参数(c)与参考帧推理中算子C的输出参数(c)具有依赖关系。其中,目标帧推理可以为连续两帧推理中的后一帧推理,参考帧推理可以为连续两帧推理中的前一帧推理。In an example, please refer to Figure 6. When the model performs multi-frame reasoning, two consecutive frames of reasoning have a dependency relationship. The dependency information of the preset model may indicate that the input parameter (c) of the operator B in the target frame reasoning has a dependency relationship with the output parameter (c) of the operator C in the reference frame reasoning. Among them, the target frame reasoning can be the next frame reasoning in two consecutive frames of reasoning, and the reference frame reasoning can be the previous frame reasoning of the two consecutive frames of reasoning.
在另一个示例中,预设模型的依赖信息可以指示:目标帧推理中算子B的输入参数与参考帧推理中算子C的输出参数具有依赖关系。其中,目标帧推理可以为第N帧推理和第N+1帧推理,参考帧推理可以为第N-2帧推理。N为大于2的奇数。可见,第3帧推理和第4帧推理中算子B的输入参数都依赖于第1帧推理中算子C的输出参数。第5帧推理和第6帧推理中算子B的输入参数都依赖于第3帧推理中算子C的输出参数。以此类推。In another example, the dependency information of the preset model may indicate that the input parameters of the operator B in the target frame reasoning have a dependency relationship with the output parameters of the operator C in the reference frame reasoning. Among them, the target frame reasoning can be the Nth frame reasoning and the N+1th frame reasoning, and the reference frame reasoning can be the N-2th frame reasoning. N is an odd number greater than 2. It can be seen that the input parameters of operator B in the third frame of inference and the fourth frame of inference both depend on the output parameters of operator C in the first frame of inference. The input parameters of operator B in the fifth frame of inference and the sixth frame of inference both depend on the output parameters of operator C in the third frame of inference. And so on.
在又一个示例中,预设模型的依赖信息可以指示:目标帧推理中算子B的输入参数与第一参考帧推理中算子C的输出参数具有依赖关系,目标帧推理中算子A的输入参数与第二参考帧推理中算子D的输出参数具有依赖关系。其中,目标帧推理可以为第N帧推理,第一参考帧推理可以为第N-2帧推理,第二参考帧推理可以为第N-1帧推理。N为大于2的整数。可见,第3帧推理中算子B的输入参数依赖于第2帧推理中算子C的输出参数,第3帧推理中算子A的输入参数依赖于第1帧推理中算子D的输出参数。第4帧推理中算子B的输入参数依赖于第3帧推理中算子C的输出参数,第4帧推理中算子A的输入参数依赖于第2帧推理中算子D的输出参数。以此类推。In another example, the dependency information of the preset model may indicate that the input parameters of operator B in the target frame reasoning have a dependency relationship with the output parameters of operator C in the first reference frame reasoning, and the The input parameters are dependent on the output parameters of the operator D in the second reference frame inference. Among them, the target frame reasoning can be the Nth frame reasoning, the first reference frame reasoning can be the N-2th frame reasoning, and the second reference frame reasoning can be the N-1th frame reasoning. N is an integer greater than 2. It can be seen that the input parameters of operator B in the third frame of reasoning depend on the output parameters of operator C in the second frame of reasoning, and the input parameters of operator A in the third frame of reasoning depend on the output of operator D in the first frame of reasoning. parameter. The input parameters of operator B in the fourth frame of reasoning depend on the output parameters of operator C in the third frame of reasoning, and the input parameters of operator A in the fourth frame of reasoning depend on the output parameters of operator D in the second frame of reasoning. And so on.
需要说明的是,本实施例对于预设模型中的依赖信息在预设模型中的存储方式以及包括的具体内容不做限定。例如,预设模型中的依赖信息可以存储在文件中,所述文件可以为二进制文件、文本文件等。可选的,所述文件与预设模型的描述信息对应的文件为同一个文件或者为不同的文件。预设模型的描述信息可以参见前述概念的说明,原理相似,此处不再赘述。It should be noted that this embodiment does not limit the storage method of the dependency information in the preset model in the preset model and the specific content included. For example, the dependency information in the preset model can be stored in a file, and the file can be a binary file, a text file, or the like. Optionally, the file and the file corresponding to the description information of the preset model are the same file or different files. For the description information of the preset model, please refer to the description of the aforementioned concept, the principle is similar, and will not be repeated here.
需要说明的是,本实施例对于预设模型不做限定,可以是执行多帧推理的任意模型。It should be noted that this embodiment does not limit the preset model, and may be any model that performs multi-frame inference.
本实施例提供一种基于模型的信号推理方法,包括:接收输入信号,输入信号为计算机或处理器可处理的数字信号,根据预设模型中的依赖信息对输入信号进行预设模型的推理,得到输出信号。本实施例提供的基于模型的信号推理方法,根据预设模型中的依赖信息,使得具有依赖关系的多帧推理可以在同一时间并行执行,充分利用了计算资源的运算力,提升了多帧推理的推理性能。This embodiment provides a model-based signal reasoning method, including: receiving an input signal, the input signal is a digital signal that can be processed by a computer or a processor, and performing a preset model inference on the input signal according to the dependency information in the preset model, Get the output signal. The model-based signal inference method provided in this embodiment enables multi-frame inference with dependencies to be executed in parallel at the same time based on the dependency information in the preset model, fully utilizes the computing power of computing resources, and improves multi-frame inference Inference performance.
图9为本申请实施例提供的另一种基于模型的信号推理方法的流程图。本实施例提供了S802的一种示例性的实现方式。如图9所示,S802,根据预设模型中的依赖信息对输入信号进行预设模型的推理,可以包括:FIG. 9 is a flowchart of another model-based signal reasoning method provided by an embodiment of the application. This embodiment provides an exemplary implementation of S802. As shown in Fig. 9, S802, inferring the input signal with the preset model according to the dependency information in the preset model, may include:
S901、加载预设模型和依赖信息。S901. Load the preset model and dependent information.
S902、根据依赖信息调度当前帧推理中预设模型的各个算子。S902. Schedule each operator of the preset model in the current frame inference according to the dependency information.
具体的,在进行模型的推理时,加载预设模型和依赖信息。根据依赖信息,可以确定当前帧推理中每个算子是否与所述当前帧之前的推理帧中的算子存在依赖关系,从而,可以调度当前帧推理中预设模型的各个算子并行执行。由于可以充分利用计算资源的运算力,因此,提升了多帧推理的推理性能。Specifically, when performing model inference, load the preset model and dependent information. According to the dependency information, it can be determined whether each operator in the current frame inference has a dependency relationship with the operator in the inference frame before the current frame, so that each operator of the preset model in the current frame inference can be scheduled to execute in parallel. Since the computing power of computing resources can be fully utilized, the reasoning performance of multi-frame reasoning is improved.
可选的,S902中,根据依赖信息调度当前帧推理中预设模型的各个算子,可以包括:Optionally, in S902, scheduling each operator of the preset model in the current frame inference according to the dependency information may include:
根据依赖信息确定当前帧推理中预设模型的各个算子的执行顺序。Determine the execution order of each operator of the preset model in the current frame inference according to the dependency information.
根据执行顺序将当前帧推理中预设模型的各个算子加入多个执行队列中。其中,多个执行队列中在同一时间分别执行的多个算子的输入参数之间没有依赖关系。According to the execution sequence, each operator of the preset model in the current frame inference is added to multiple execution queues. Among them, there is no dependency between the input parameters of the multiple operators executed at the same time in the multiple execution queues.
具体的,基于模型的信号推理装置中可以包括多个处理器,本实施例对于处理器的类型和数量不做限定。例如,处理器可以包括但不限于下列中的至少一种:中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)和网络处理器(network processing unit,NPU)。每个处理器可以对应至少一个执行队列。本实施例对于处理器对应的执行队列的数量不做限定。Specifically, the model-based signal inference device may include multiple processors, and this embodiment does not limit the type and number of processors. For example, the processor may include but is not limited to at least one of the following: a central processing unit (CPU), a graphics processing unit (GPU), and a network processing unit (NPU). Each processor can correspond to at least one execution queue. This embodiment does not limit the number of execution queues corresponding to the processor.
下面,以图6所示模型为例,结合图10,对预设模型的多帧推理进行示例性说明。假设,执行队列的数量为4个,执行每个算子的时间相同,均为T。对模型进行连续3帧的推理,可以创建3帧推理的所有算子任务。假设第1帧推理没有帧间依赖关系。其中,第1帧推理中的算子分别标记为1A、1B、1C、1D。第2帧推理中的算子分别标记为2A、2B、2C、2D。第3帧推理中的算子分别标记为3A、3B、3C、3D。预设模型中的依赖信息用于指示:目标帧推理中算子B的输入参数(c)与参考帧推理中算子C的输出参数(c)具有依赖关系。其中,目标帧推理可以为连续两帧推理中的后一帧推理,参考帧推理可以为连续两帧推理中的前一帧推理。In the following, taking the model shown in FIG. 6 as an example, in conjunction with FIG. 10, the multi-frame reasoning of the preset model is exemplified. Assume that the number of execution queues is 4, and the time to execute each operator is the same, which is T. Inference of the model for 3 consecutive frames can create all the operator tasks of the 3 frame inference. Assume that there is no inter-frame dependency in the first frame of inference. Among them, the operators in the first frame of inference are marked as 1A, 1B, 1C, and 1D respectively. The operators in the second frame of inference are marked as 2A, 2B, 2C, and 2D. The operators in the third frame of inference are marked as 3A, 3B, 3C, and 3D. The dependency information in the preset model is used to indicate that the input parameter (c) of the operator B in the target frame reasoning has a dependency relationship with the output parameter (c) of the operator C in the reference frame reasoning. Among them, the target frame reasoning can be the next frame reasoning in two consecutive frames of reasoning, and the reference frame reasoning can be the previous frame reasoning of the two consecutive frames of reasoning.
具体的,根据预设模型中的依赖信息可以确定连续3帧推理中算子的执行顺序。对于第2帧推理,算子2B依赖于第1帧推理中的算子1C和第2帧推理中的算子2A。因此,算子2B的执行顺序需要在第1帧算子1C和第2帧算子2A的后面。相似的,对于第3帧推理,算子3B依赖于第2帧推理中的算子2C和第3帧推理中的算子3A。算子3B的执行顺序需要在第2帧算子2C和第3帧算子3A的后面。Specifically, according to the dependency information in the preset model, the execution order of the operators in 3 consecutive frames of inference can be determined. For the second frame of inference, operator 2B depends on the operator 1C in the first frame of inference and the operator 2A in the second frame of inference. Therefore, the execution order of operator 2B needs to be after the first frame operator 1C and the second frame operator 2A. Similarly, for frame 3 inference, operator 3B depends on operator 2C in frame 2 inference and operator 3A in frame 3 inference. The execution order of operator 3B needs to be after the second frame operator 2C and the third frame operator 3A.
需要说明的是,对于每帧推理,可以通过模型中的描述信息获取每帧推理中至少一个算子的输入参数或输出参数与除所述至少一个算子之外的其他算子的输入参数或输出参数的依赖关系。在图6所示模型中,对于第1帧推理,算子1B和算子1C依赖于算子1A,算子1D依赖于算子1B和算子1C。因此,第1帧推理中算子的执行顺序为:算子1A、算子1B和算子1C、算子1D。相似的,对于第2帧推理,算子的执行顺序为:算子2A、算子2B和算子2C、算子2D。对于第3帧推理,算子的执行顺序为:算子3A、算子3B和算子3C、算子3D。It should be noted that for each frame of reasoning, the input parameter or output parameter of at least one operator in each frame of reasoning and the input parameter or input parameter of other operators except the at least one operator can be obtained through the description information in the model. Dependency of output parameters. In the model shown in Figure 6, for the first frame of inference, operator 1B and operator 1C depend on operator 1A, and operator 1D depends on operator 1B and operator 1C. Therefore, the execution order of operators in the first frame of inference is: operator 1A, operator 1B, operator 1C, and operator 1D. Similarly, for the second frame of reasoning, the execution order of the operators is: operator 2A, operator 2B, operator 2C, and operator 2D. For the third frame of inference, the execution order of operators is: operator 3A, operator 3B, operator 3C, and operator 3D.
综上,根据执行顺序将各个算子加入至多个执行队列中,具体如下:In summary, according to the execution order, each operator is added to multiple execution queues, as follows:
第1个时间T(标记为1T):3帧推理中算子A都可以启动执行。具体的,算子1A在执行队列1中,算子2A在执行队列2中,算子3A在执行队列3中。The first time T (marked as 1T): Operator A can start execution in all three frames of inference. Specifically, operator 1A is in execution queue 1, operator 2A is in execution queue 2, and operator 3A is in execution queue 3.
第2个时间T(标记为2T):第1帧推理中算子1B和算子1C解除了对第1帧推理中算子1A的依赖,启动执行。算子1B在执行队列1中,算子1C在执行队列2中。第2帧推理中算子2C解除对第2帧推理中算子2A的依赖,启动执行。算子2C在执行队列3中。第3帧推理中算子3C解除对第3帧推理中算子3A的依赖,启动执行。算子3C在执行队列4中。The second time T (marked as 2T): In the first frame of inference, the operator 1B and the operator 1C are relieved of the dependence on the operator 1A in the first frame of inference, and execution is started. Operator 1B is in execution queue 1, and operator 1C is in execution queue 2. In the second frame of inference, the operator 2C removes the dependence on the operator 2A in the second frame of inference and starts execution. Operator 2C is in execution queue 3. In the third frame of inference, the operator 3C removes the dependence on the operator 3A in the third frame of inference, and starts execution. Operator 3C is in execution queue 4.
第3个时间T(标记为3T):第1帧推理中算子1D解除对第1帧推理中算子1B 和算子1C的依赖,启动执行,算子1D在执行队列2中。第2帧推理中算子2B解除对第1帧推理中算子1C的依赖,启动执行,算子2B在执行队列3中。第3帧推理中算子3B解除对第2帧推理中算子2C的依赖,启动执行,算子3B在执行队列4中。The third time T (marked as 3T): In the first frame of inference, the operator 1D removes the dependence on the operator 1B and the operator 1C in the first frame of inference, starts execution, and the operator 1D is in the execution queue 2. In the second frame of inference, the operator 2B relieves the dependence on the operator 1C in the first frame of inference, starts execution, and the operator 2B is in the execution queue 3. In the third frame of inference, the operator 3B relieves the dependence on the operator 2C in the second frame of inference, starts execution, and the operator 3B is in the execution queue 4.
第4个时间T(标记为4T):第2帧推理中算子2D解除对第2帧推理中算子2B和算子2C的依赖,启动执行,算子2D在执行队列3中。第3帧推理中算子3D解除对第3帧推理中算子3B和算子3C的依赖,启动执行,算子3D在执行队列4中。The fourth time T (marked as 4T): In the second frame of inference, the operator 2D relieves the dependence on the operator 2B and the operator 2C in the second frame of inference, and starts execution, and the operator 2D is in the execution queue 3. In the third frame of inference, the operator 3D is relieved of the dependence on the operator 3B and the operator 3C in the third frame of inference, and execution is started, and the operator 3D is in the execution queue 4.
可见,3帧连续推理中的算子可以实现并行调度,从而充分利用了计算资源的运算力,提升了多帧推理的推理性能。It can be seen that the operators in the 3-frame continuous reasoning can realize parallel scheduling, thereby making full use of the computing power of computing resources and improving the reasoning performance of multi-frame reasoning.
需要说明的是,在上述示例中,将算子加入到哪个执行队列中仅是一种示例,本实施例对此不作限定。例如,在第3个时间T(3T)时,算子1D也可以在执行队列1中,在第4个时间T(4T)时,算子2D也可以在执行队列1,算子3D也可以在执行队列2中执行。It should be noted that, in the foregoing example, which execution queue the operator is added to is only an example, and this embodiment does not limit this. For example, at the third time T(3T), the operator 1D can also be in the execution queue 1, and at the fourth time T(4T), the operator 2D can also be in the execution queue 1, and the operator 3D can also be Execute in execution queue 2.
本实施例提供的基于模型的信号推理方法,通过加载预设模型和依赖信息,可以根据依赖信息调度当前帧推理中预设模型的各个算子,使得算子可以并行执行,充分利用了计算资源的运算力,提升了多帧推理的推理性能。In the model-based signal inference method provided in this embodiment, by loading the preset model and dependent information, each operator of the preset model in the current frame inference can be scheduled according to the dependent information, so that the operators can be executed in parallel, making full use of computing resources Its computing power improves the reasoning performance of multi-frame reasoning.
在上述任一实施例的基础上,可选的,在根据预设模型中的依赖信息对输入信号进行预设模型的多帧推理(S802)之前,本实施例提供的基于模型的信号推理方法,还可以包括:On the basis of any of the foregoing embodiments, optionally, before performing multi-frame inference (S802) of the preset model on the input signal according to the dependency information in the preset model, the model-based signal inference method provided in this embodiment , Can also include:
在预设模型的描述信息中设置依赖信息。其中,描述信息用于描述预设模型包括的至少一个算子以及至少一个算子中每个算子的输入参数和输出参数。Set the dependency information in the description information of the preset model. The description information is used to describe at least one operator included in the preset model and the input parameter and output parameter of each operator in the at least one operator.
具体的,预设模型的描述信息用于描述预设模型中算子的基本信息,包括算子的数量、名称、输入参数和输出参数等。但是,通过描述信息并不能反映出预设模型进行多帧推理时不同帧之间的依赖关系。例如,参照图6和图7。图7所示的描述信息中,算子B有两个输入参数a和y。但是,根据描述信息无法获知算子B的输入参数y与算子C之间的依赖关系。而如图6可知,对于相邻的两帧推理,后一帧推理中算子B的输入参数y就是前一帧推理中算子C的输出参数c。通过在预设模型的描述信息中设置依赖信息,可以为预设模型增加依赖信息,从而可以在多帧推理中根据该依赖信息对具有依赖关系的多帧推理实现并行执行,提升多帧推理的推理性能。Specifically, the description information of the preset model is used to describe the basic information of the operators in the preset model, including the number, names, input parameters, and output parameters of the operators. However, the description information cannot reflect the dependency between different frames when the preset model is used for multi-frame reasoning. For example, refer to Figures 6 and 7. In the description information shown in Fig. 7, operator B has two input parameters a and y. However, the dependency relationship between the input parameter y of operator B and operator C cannot be obtained from the description information. As shown in Figure 6, for two adjacent frames of inference, the input parameter y of operator B in the next frame of inference is the output parameter c of operator C in the previous frame of inference. By setting the dependency information in the description information of the preset model, the dependency information can be added to the preset model, so that the multi-frame reasoning with dependencies can be executed in parallel according to the dependency information in the multi-frame reasoning, and the multi-frame reasoning can be improved. Inference performance.
可选的,在一种实现方式中,在预设模型的描述信息中设置依赖信息,可以包括:Optionally, in an implementation manner, setting dependency information in the description information of the preset model may include:
通过调用预设模型的接口在预设模型的描述信息中设置依赖信息,预设模型的接口用于为预设模型提供信息修改的入口。Dependent information is set in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used to provide an entrance for information modification of the preset model.
可选的,预设模型的接口可以包括下列中的至少一种:函数接口、应用程序编程接口(application programming interface,API)接口和可执行命令。Optionally, the interface of the preset model may include at least one of the following: a function interface, an application programming interface (application programming interface, API) interface, and an executable command.
下面通过示例进行说明。The following is an example to illustrate.
在第一个示例中,可以调用可执行命令,在预设模型的描述信息中通过新增加独立的参数(文件或字符串方式)来设置依赖信息。比如,执行命令为:In the first example, an executable command can be called, and the dependency information can be set by adding a new independent parameter (file or character string) in the description information of the preset model. For example, the execution command is:
Modeltrans orgModel:xxx desModel:yyy frameDependDecs:"{OP(B)input(c)}depend{frame(-1)OP(C)output(c)}"Modeltrans orgModel:xxx desModel:yyy frameDependDecs:"{OP(B)input(c)}depend{frame(-1)OP(C)output(c)}"
在第二个示例中,针对不同的开源框架,比如tensorflow,可以调用函数接口,在预设模型的描述信息中设置依赖信息。比如,提供python接口如下:In the second example, for different open source frameworks, such as tensorflow, you can call the function interface and set the dependency information in the description information of the preset model. For example, the python interface is provided as follows:
import xxximport xxx
xxx.add_frame_depend(orgGraph,frameDependInfo,destGraph)xxx.add_frame_depend(orgGraph,frameDependInfo,destGraph)
在第三个示例中,预设模型的描述信息可以为二进制文件或者TXT文件。参考图11。图11为本申请实施例提供的模型的描述信息和依赖信息的一种示意图。其中,图11中左侧为预设模型的原始描述信息,可以参见图7的相关描述,此处不再赘述。可以调用可执行命令,在预设模型的原始描述信息中设置依赖信息,如图11中右侧所示。其中,依赖信息可以包括帧间间隔-1,用于指示目标帧推理中算子B的输入参数(c)与参考帧推理中算子C的输出参数(c)具有依赖关系。其中,目标帧推理可以为连续两帧推理中的后一帧推理,参考帧推理可以为连续两帧推理中的前一帧推理。比如,执行命令为:In the third example, the description information of the preset model can be a binary file or a TXT file. Refer to Figure 11. FIG. 11 is a schematic diagram of description information and dependency information of a model provided by an embodiment of the application. Among them, the left side in FIG. 11 is the original description information of the preset model, which can be referred to the related description in FIG. 7, which is not repeated here. You can call executable commands to set dependent information in the original description information of the preset model, as shown on the right in Figure 11. Wherein, the dependency information may include the interframe interval -1, which is used to indicate that the input parameter (c) of the operator B in the target frame reasoning has a dependency relationship with the output parameter (c) of the operator C in the reference frame reasoning. Among them, the target frame reasoning can be the next frame reasoning in two consecutive frames of reasoning, and the reference frame reasoning can be the previous frame reasoning of the two consecutive frames of reasoning. For example, the execution command is:
Modeltrans orgModel:{xxx,graphDescFile}desModel:yyyModeltrans orgModel:{xxx,graphDescFile}desModel:yyy
可选的,在预设模型的描述信息中设置依赖信息之前,还可以包括:Optionally, before setting the dependency information in the description information of the preset model, it may also include:
获取描述信息。Get the description information.
根据描述信息包括的至少一个算子以及每个算子的输入参数和输出参数,获取依赖信息。Obtain dependency information according to at least one operator included in the description information and the input parameters and output parameters of each operator.
在该种实现方式中,通过获取预设模型的描述信息,通过描述信息中包括的算子的基础信息可以获取依赖信息,实现方式简单。In this implementation manner, by acquiring the description information of the preset model, the dependency information can be acquired through the basic information of the operator included in the description information, and the implementation manner is simple.
可选的,在另一种实现方式中,在预设模型的描述信息中设置依赖信息,可以包括:Optionally, in another implementation manner, setting dependency information in the description information of the preset model may include:
接收用户输入的依赖信息。Receive dependency information entered by the user.
根据用户输入的依赖信息在预设模型的描述信息中设置依赖信息。Set the dependency information in the description information of the preset model according to the dependency information input by the user.
在该种实现方式中,可以根据用户输入的依赖信息直接在预设模型的描述信息中设置所述依赖信息,实现方式简单。In this implementation manner, the dependence information can be directly set in the description information of the preset model according to the dependence information input by the user, and the implementation manner is simple.
下面,在上述任一实施例的基础上,对预设模型中的依赖信息进行详细说明。Below, on the basis of any of the foregoing embodiments, the dependency information in the preset model will be described in detail.
可选的,在一种实现方式中,依赖信息可以包括目标帧推理中算子的输入参数与参考帧推理中算子的输出参数之间的依赖关系。Optionally, in an implementation manner, the dependency information may include the dependency relationship between the input parameter of the operator in the target frame inference and the output parameter of the operator in the reference frame inference.
在该种实现方式中,在时间上,目标帧推理位于参考帧推理的后面。目标帧推理中算子的输入参数依赖于参考帧推理中算子的输出参数。比如,如图6所示,目标帧推理可以为第2帧推理,参考帧推理可以为第1帧推理。第2帧推理中算子B的输入参数与第1帧推理中算子C的输出参数存在依赖关系。In this implementation, in terms of time, the target frame reasoning is behind the reference frame reasoning. The input parameters of the operator in the target frame inference depend on the output parameters of the operator in the reference frame inference. For example, as shown in Figure 6, the target frame reasoning can be the second frame reasoning, and the reference frame reasoning can be the first frame reasoning. The input parameters of operator B in the second frame of inference are dependent on the output parameters of operator C in the first frame of inference.
可选的,依赖信息可以包括第一帧间间隔、第一算子标识和第一参数标识,第一帧间间隔用于指示与目标帧推理中第一算子的第一输入参数有依赖关系的参考帧推理与目标帧推理的帧间间隔,第一算子标识用于指示参考帧推理中与第一算子有依赖关系的算子,第一参数标识用于指示参考帧推理中与第一输入参数有依赖关系的参数。Optionally, the dependency information may include a first inter-frame interval, a first operator identifier, and a first parameter identifier, and the first inter-frame interval is used to indicate a dependency relationship with the first input parameter of the first operator in the target frame inference The interval between the reference frame reasoning and the target frame reasoning, the first operator identifier is used to indicate the operator that has a dependency relationship with the first operator in the reference frame reasoning, and the first parameter identifier is used to indicate the reference frame reasoning and the first operator. An input parameter has a dependency relationship.
下面结合图6和图11,对依赖信息进行说明。The dependency information will be described below in conjunction with Figure 6 and Figure 11.
如图6和图11所示,目标帧推理可以为第2帧推理,参考帧推理可以为第1帧推 理。目标帧推理中的第一算子为算子B。目标帧推理中第一算子的第一输入参数为参数c。第一帧间间隔为第2帧推理与第1帧推理之前的帧间间隔,具体为-1。第一算子标识为第1帧推理中的算子C。第一参数标识为第1帧推理中算子C的输出参数c。As shown in Figure 6 and Figure 11, the target frame reasoning can be the second frame reasoning, and the reference frame reasoning can be the first frame reasoning. The first operator in target frame reasoning is operator B. The first input parameter of the first operator in the target frame inference is the parameter c. The first inter-frame interval is the inter-frame interval between the second frame of inference and the first frame of inference, specifically -1. The first operator is identified as the operator C in the first frame of inference. The first parameter is identified as the output parameter c of the operator C in the first frame of inference.
需要说明的是,在该示例中,第一帧间间隔、第一算子标识和第一参数标识的取指只是示例,当预设模型不同时,参数的具体取指不同,本实施例对于具体取指不做限定。It should be noted that in this example, the first interframe interval, the first operator identifier, and the first parameter identifier are just examples. When the preset models are different, the specific parameters of the parameters are different. The specific fetching is not limited.
可选的,在另一种实现方式中,依赖信息包括目标帧推理中算子的输出参数与参考帧推理中算子的输入参数之间的依赖关系。Optionally, in another implementation manner, the dependency information includes the dependency relationship between the output parameter of the operator in the target frame reasoning and the input parameter of the operator in the reference frame reasoning.
在该种实现方式中,在时间上,目标帧推理位于参考帧推理的前面。参考帧推理中算子的输入参数依赖于目标帧推理中算子的输出参数。比如,如图6所示,目标帧推理可以为第1帧推理,参考帧推理可以为第2帧推理。第2帧推理中算子B的输入参数与第1帧推理中算子C的输出参数存在依赖关系。In this implementation manner, in terms of time, the target frame reasoning is in front of the reference frame reasoning. The input parameters of the operator in the reference frame reasoning depend on the output parameters of the operator in the target frame reasoning. For example, as shown in Figure 6, the target frame reasoning can be the first frame reasoning, and the reference frame reasoning can be the second frame reasoning. The input parameters of operator B in the second frame of inference are dependent on the output parameters of operator C in the first frame of inference.
可选的,依赖信息可以包括第二帧间间隔、第二算子标识和第二参数标识,第二帧间间隔用于指示与目标帧推理中第二算子的第一输出参数有依赖关系的参考帧推理与目标帧推理的帧间间隔,第二算子标识用于指示参考帧推理中与第二算子有依赖关系的算子,第二参数标识用于指示参考帧推理中与第一输出参数有依赖关系的参数。Optionally, the dependency information may include a second inter-frame interval, a second operator identifier, and a second parameter identifier, and the second inter-frame interval is used to indicate a dependency relationship with the first output parameter of the second operator in the target frame inference The interval between the reference frame reasoning and the target frame reasoning, the second operator identifier is used to indicate the operator that has a dependency relationship with the second operator in the reference frame reasoning, and the second parameter identifier is used to indicate the reference frame reasoning and the first A parameter whose output parameter has a dependency relationship.
下面结合图6和图12,对依赖信息进行说明。The dependency information will be described below in conjunction with Figure 6 and Figure 12.
如图6和图12所示,目标帧推理可以为第1帧推理,参考帧推理可以为第2帧推理。目标帧推理中的第二算子为算子C。目标帧推理中第二算子的第一输出参数为参数c。第二帧间间隔为第2帧推理与第1帧推理之前的帧间间隔,具体为1。第二算子标识为第2帧推理中的算子B。第二参数标识为第2帧推理中算子B的输入参数c。As shown in Figure 6 and Figure 12, the target frame reasoning can be the first frame reasoning, and the reference frame reasoning can be the second frame reasoning. The second operator in target frame reasoning is operator C. The first output parameter of the second operator in the target frame inference is the parameter c. The second inter-frame interval is the interval between the second frame of inference and the first frame of inference, and is specifically 1. The second operator is identified as operator B in frame 2 inference. The second parameter is identified as the input parameter c of operator B in the second frame of inference.
需要说明的是,在该示例中,第二帧间间隔、第二算子标识和第二参数标识的取指只是示例,当预设模型不同时,参数的具体取指不同,本实施例对于具体取指不做限定。It should be noted that, in this example, the indications of the second inter-frame interval, the second operator identifier, and the second parameter identifier are just examples. When the preset models are different, the specific indications of the parameters are different. The specific fetching is not limited.
图13为本申请实施例提供的基于模型的信号推理装置的一种结构示意图。本实施例提供的基于模型的信号推理装置,可以执行本申请实施例提供的基于模型的信号推理方法。如图13所示,本实施例提供的基于模型的信号推理装置,可以包括:FIG. 13 is a schematic structural diagram of a model-based signal reasoning device provided by an embodiment of the application. The model-based signal reasoning device provided in this embodiment can execute the model-based signal reasoning method provided in the embodiment of this application. As shown in FIG. 13, the model-based signal reasoning device provided in this embodiment may include:
接收模块21,用于接收输入信号,所述输入信号为计算机或处理器可处理的数字信号;The receiving module 21 is configured to receive an input signal, the input signal being a digital signal that can be processed by a computer or a processor;
处理模块22,用于根据预设模型中的依赖信息对所述输入信号进行所述预设模型的推理,得到输出信号;The processing module 22 is configured to perform inference of the preset model on the input signal according to the dependency information in the preset model to obtain an output signal;
其中,所述预设模型包括算子,所述算子包括输入参数和输出参数;所述依赖信息用于指示在利用所述预设模型对所述输入信号进行多帧推理时,目标帧推理中的所述算子中的至少一个算子的输入参数或输出参数与参考帧推理中的所述算子中的至少一个算子的输入参数或输出参数的依赖关系,所述目标帧推理为所述多帧推理中的至少一帧推理,所述参考帧推理为所述多帧推理中的除所述目标帧推理之外的其他帧推理中的至少一帧推理。Wherein, the preset model includes an operator, the operator includes an input parameter and an output parameter; the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, the target frame is inferred The dependency relationship between the input parameter or output parameter of at least one of the operators in the operator and the input parameter or output parameter of the at least one operator in the reference frame reasoning, and the target frame reasoning is For at least one frame of reasoning in the multi-frame reasoning, the reference frame reasoning is at least one frame of reasoning in the multi-frame reasoning other than the target frame reasoning.
可选的,所述处理模块22还用于:Optionally, the processing module 22 is further configured to:
在所述预设模型的描述信息中设置所述依赖信息;其中,所述描述信息用于描述所述预设模型包括的至少一个算子以及所述至少一个算子中每个算子的输入参数和输出参数。The dependency information is set in the description information of the preset model; wherein the description information is used to describe at least one operator included in the preset model and the input of each operator in the at least one operator Parameters and output parameters.
可选的,所述处理模块22具体用于:Optionally, the processing module 22 is specifically configured to:
通过调用所述预设模型的接口在所述预设模型的描述信息中设置所述依赖信息,所述预设模型的接口用于为所述预设模型提供信息修改的入口。The dependency information is set in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used to provide an entrance for information modification for the preset model.
可选的,所述接收模块21还用于,接收用户输入的所述依赖信息;Optionally, the receiving module 21 is further configured to receive the dependency information input by the user;
所述处理模块22具体用于,根据所述用户输入的所述依赖信息在所述预设模型的描述信息中设置所述依赖信息。The processing module 22 is specifically configured to set the dependency information in the description information of the preset model according to the dependency information input by the user.
可选的,所述处理模块22还用于:Optionally, the processing module 22 is further configured to:
获取所述描述信息;Obtain the description information;
根据所述描述信息包括的至少一个算子以及每个所述算子的输入参数和输出参数,获取所述依赖信息。The dependency information is acquired according to at least one operator included in the description information and the input parameter and output parameter of each operator.
可选的,所述依赖信息包括所述目标帧推理中算子的输入参数与所述参考帧推理中算子的输出参数之间的依赖关系。Optionally, the dependency information includes a dependency relationship between an input parameter of an operator in the target frame inference and an output parameter of the operator in the reference frame inference.
可选的,所述依赖信息包括第一帧间间隔、第一算子标识和第一参数标识,所述第一帧间间隔用于指示与所述目标帧推理中第一算子的第一输入参数有依赖关系的参考帧推理与所述目标帧推理的帧间间隔,所述第一算子标识用于指示所述参考帧推理中与所述第一算子有依赖关系的算子,所述第一参数标识用于指示所述参考帧推理中与所述第一输入参数有依赖关系的参数。Optionally, the dependency information includes a first inter-frame interval, a first operator identifier, and a first parameter identifier, and the first inter-frame interval is used to indicate the first interval of the first operator in the inference with the target frame. The interval between the reference frame reasoning whose input parameters have a dependency relationship and the target frame reasoning, and the first operator identifier is used to indicate an operator that has a dependency relationship with the first operator in the reference frame reasoning, The first parameter identifier is used to indicate a parameter that has a dependency relationship with the first input parameter in the reference frame inference.
可选的,所述依赖信息包括所述目标帧推理中算子的输出参数与所述参考帧推理中算子的输入参数之间的依赖关系。Optionally, the dependency information includes the dependency relationship between the output parameter of the operator in the target frame inference and the input parameter of the operator in the reference frame inference.
可选的,所述依赖信息包括第二帧间间隔、第二算子标识和第二参数标识,所述第二帧间间隔用于指示与所述目标帧推理中第二算子的第一输出参数有依赖关系的参考帧推理与所述目标帧推理的帧间间隔,所述第二算子标识用于指示所述参考帧推理中与所述第二算子有依赖关系的算子,所述第二参数标识用于指示所述参考帧推理中与所述第一输出参数有依赖关系的参数。Optionally, the dependency information includes a second inter-frame interval, a second operator identifier, and a second parameter identifier, and the second inter-frame interval is used to indicate the first interval of the second operator in inference with the target frame. The interval between the reference frame reasoning whose output parameter has a dependency relationship and the target frame reasoning, and the second operator identifier is used to indicate an operator that has a dependency relationship with the second operator in the reference frame reasoning, The second parameter identifier is used to indicate a parameter that is dependent on the first output parameter in the reference frame inference.
可选的,所述处理模块22具体用于:Optionally, the processing module 22 is specifically configured to:
加载所述预设模型和所述依赖信息;Loading the preset model and the dependency information;
根据所述依赖信息调度当前帧推理中所述预设模型的各个算子。Scheduling each operator of the preset model in the current frame inference according to the dependency information.
可选的,所述处理模块22具体用于:Optionally, the processing module 22 is specifically configured to:
根据所述依赖信息确定所述当前帧推理中所述预设模型的各个算子的执行顺序;Determine the execution order of the operators of the preset model in the current frame reasoning according to the dependency information;
根据所述执行顺序将所述当前帧推理中所述预设模型的各个算子加入至多个执行队列中;其中,所述多个执行队列中在同一时间分别执行的多个算子的输入参数之间没有依赖关系。Each operator of the preset model in the current frame reasoning is added to multiple execution queues according to the execution order; wherein, the input parameters of the multiple operators that are executed at the same time in the multiple execution queues There is no dependency between.
可选的,所述可处理的数字信号包括下列中的至少一种:图像数据、语音数据和文本数据。Optionally, the processable digital signal includes at least one of the following: image data, voice data, and text data.
本实施例提供的基于模型的信号推理装置,可以执行本申请实施例提供的基于模型的信号推理方法,技术原理和技术效果相似,此处不再赘述。The model-based signal reasoning device provided in this embodiment can execute the model-based signal reasoning method provided in the embodiment of this application. The technical principles and technical effects are similar, and will not be repeated here.
应理解,以上装置中模块的划分仅仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。且装置中的模块可以全部以软件通过处理元件调用的形式实现,也可以全部以硬件的形式实现,还可以部分模块以软件通过处理元件调用的形式实现,部分模块以硬件的形式实现。例如,各个模块可以为单独设立的处理元件,也可以集成在装置的某一个芯片中实现,此外,也可以以程序的形式存储于存储器中,由装置的某一个处理元件调用并执行该模块的功能。此外这些模块全部或部分可以集成在一起,也可以独立实现。这里所述的处理元件又可以成为处理器,可以是一种具有信号的处理能力的集成电路。在实现过程中,上述方法的各步骤或以上各个模块可以通过处理器元件中的硬件的集成逻辑电路实现或者以软件通过处理元件调用的形式实现。It should be understood that the division of modules in the above device is only a division of logical functions, and may be fully or partially integrated into one physical entity in actual implementation, or may be physically separated. In addition, the modules in the device may be all implemented in the form of software called through processing elements, or all may be implemented in the form of hardware, some modules may also be implemented in the form of software called through the processing elements, and some modules are implemented in the form of hardware. For example, each module can be a separately set up processing element, or it can be integrated in a certain chip of the device for implementation. In addition, it can also be stored in the memory in the form of a program, which is called and executed by a certain processing element of the device. Features. In addition, all or part of these modules can be integrated together or implemented independently. The processing element described here can also become a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules may be implemented by an integrated logic circuit of hardware in a processor element or implemented in a form of being called by software through a processing element.
在一个例子中,以上装置中的模块可以是被配置成实施以上方法的一个或多个集成电路,例如:一个或多个特定集成电路(application specific integrated circuit,ASIC),或,一个或多个数据信号处理器(digital singnal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA),或这些集成电路形式中至少两种的组合。再如,当以上装置中的模块可以通过处理元件调度程序的形式实现时,该处理元件可以是通用处理器,例如CPU或其它可以调用程序的处理器。再如,这些模块可以集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现。In an example, the modules in the above device may be one or more integrated circuits configured to implement the above method, for example: one or more application specific integrated circuits (ASIC), or one or more Data signal processor (digital signal processor, DSP), or, one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuits. For another example, when the modules in the above device can be implemented in the form of a processing element scheduler, the processing element can be a general-purpose processor, such as a CPU or other processors that can call programs. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
在一个例子中,以上用于接收的模块可以是以上装置的接口电路,用于与其它设备传输信号。In an example, the above receiving module may be the interface circuit of the above device, which is used to transmit signals with other devices.
图14为本申请实施例提供的基于模型的信号推理装置的另一种结构示意图。本实施例提供的基于模型的信号推理装置,可以执行本申请实施例提供的基于模型的信号推理方法。如图14所示,本实施例提供的基于模型的信号推理装置,可以包括处理器31和传输接口32。其中,传输接口32可以与其他设备进行通信,处理器31可以执行本申请实施例提供的基于模型的信号推理方法。可选的,基于模型的信号推理装置还可以包括存储器。FIG. 14 is a schematic diagram of another structure of a model-based signal inference device provided by an embodiment of the application. The model-based signal reasoning device provided in this embodiment can execute the model-based signal reasoning method provided in the embodiment of this application. As shown in FIG. 14, the model-based signal inference device provided in this embodiment may include a processor 31 and a transmission interface 32. Wherein, the transmission interface 32 can communicate with other devices, and the processor 31 can execute the model-based signal reasoning method provided in the embodiment of the present application. Optionally, the model-based signal inference device may further include a memory.
需要说明的是,本实施例对于基于模型的信号推理装置的类型不做限定。例如,基于模型的信号推理装置可以为图1所示的终端设备、服务器或者电脑,等。It should be noted that this embodiment does not limit the type of model-based signal inference device. For example, the model-based signal inference device may be a terminal device, a server, or a computer as shown in FIG. 1.
应理解,处理器可以是通用处理器、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。It should be understood that the processor may be a general-purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the implementation of this application. The methods, steps and logic block diagrams disclosed in the examples. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
在本申请实施例中,存储器可以是非易失性存储器,比如硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)等,还可以是易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何介质,但不限于此。本申请实施例中的存储器还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。In the embodiment of the present application, the memory may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory (volatile memory), for example Random access memory (random access memory, RAM). The memory is any medium that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto. The memory in the embodiments of the present application may also be a circuit or any other device capable of realizing a storage function, for storing program instructions and/or data.
图15为本申请实施例提供的基于模型的信号推理装置的又一种结构示意图。如图15所示,基于模型的信号推理装置的硬件架构可以适用于SOC和应用处理器(application processor,AP),可以执行本申请实施例提供的基于模型的信号推理方法。FIG. 15 is a schematic diagram of another structure of the model-based signal reasoning device provided by an embodiment of the application. As shown in FIG. 15, the hardware architecture of the model-based signal inference device can be applied to SOC and application processor (application processor, AP), and can execute the model-based signal inference method provided in the embodiments of the present application.
示例性的,该基于模型的信号推理装置可以包括至少一个CPU、至少一个存储器、GPU、解码器、专用的视频/图形处理器、接收接口和发送接口等。可选的,基于模型的信号推理装置还可以包括微处理器和微控制器(microcontroller unit,MCU)等。在一种可选的情况中,基于模型的信号推理装置的上述各个部分通过连接器相耦合,应当理解,本申请的各个实施例中,耦合是指通过特定方式的相互连接,包括直接相连或者通过其他设备间接相连,例如可以通过各类接口、传输线或总线等相连,这些接口通常是电性通信接口,但是也不排除可能是机械接口或其它形式的接口,本实施例对此不做限定。在一种可选的情况中,上述各部分集成在同一个芯片上。在另一种可选的情况中,CPU、GPU、解码器、接收接口以及发送接口可以集成在一个芯片上,该芯片内部的各部分通过总线访问外部的存储器。专用的视频/图形处理器可以与CPU集成在同一个芯片上,也可以作为单独的处理器芯片存在,例如,专用的视频/图形处理器可以为专用图像信号处理器(image signal processor,ISP)。在本申请实施例中涉及的芯片是以集成电路工艺制造在同一个半导体衬底上的系统,也叫半导体芯片,其可以是利用集成电路工艺制作在衬底(通常是例如硅一类的半导体材料)上形成的集成电路的集合,其外层通常被半导体封装材料封装。所述集成电路可以包括各类功能器件,每一类功能器件包括逻辑门电路、金属氧化物半导体(metal-oxide-semiconductor,MOS)晶体管、双极晶体管或二极管等晶体管,也可包括电容、电阻或电感等其他部件。每个功能器件可以独立工作或者在必要的驱动软件的作用下工作,可以实现通信、运算、或存储等各类功能。Exemplarily, the model-based signal inference device may include at least one CPU, at least one memory, GPU, decoder, dedicated video/graphics processor, receiving interface, transmitting interface, etc. Optionally, the model-based signal inference device may also include a microprocessor and a microcontroller (microcontroller unit, MCU), etc. In an optional situation, the above-mentioned parts of the model-based signal inference device are coupled through connectors. It should be understood that, in each embodiment of the present application, coupling refers to mutual connection in a specific manner, including direct connection or Indirect connection through other devices, such as various interfaces, transmission lines or buses, etc. These interfaces are usually electrical communication interfaces, but it is not excluded that they may be mechanical interfaces or other forms of interfaces, which are not limited in this embodiment . In an optional case, the above-mentioned parts are integrated on the same chip. In another optional situation, the CPU, GPU, decoder, receiving interface, and sending interface can be integrated on a chip, and the internal parts of the chip access external memory through a bus. The dedicated video/graphics processor can be integrated with the CPU on the same chip, or it can exist as a separate processor chip, for example, the dedicated video/graphics processor can be a dedicated image signal processor (ISP) . The chip involved in the embodiments of this application is a system manufactured on the same semiconductor substrate by an integrated circuit process, also called a semiconductor chip, which can be manufactured on a substrate using an integrated circuit process (usually a semiconductor such as silicon) The outer layer of the integrated circuit formed on the material) is usually encapsulated by a semiconductor packaging material. The integrated circuit may include various types of functional devices, and each type of functional device includes transistors such as logic gate circuits, metal-oxide-semiconductor (MOS) transistors, bipolar transistors or diodes, and may also include capacitors and resistors. Or inductance and other components. Each functional device can work independently or under the action of necessary driver software, and can realize various functions such as communication, calculation, or storage.
可选的,CPU可以是一个单核(single-CPU)处理器或多核(multi-CPU)处理器。可选的,CPU可以是多个处理器构成的处理器组,多个处理器之间通过一个或多个总线彼此耦合。在一种可选的情况中,对于图像信号或视频信号的处理一部分由GPU完成,一部分由专用视频/图形处理器完成,还有可能由跑在通用CPU或GPU上的软件代码完成。Optionally, the CPU may be a single-CPU (single-CPU) processor or a multi-core (multi-CPU) processor. Optionally, the CPU may be a processor group composed of multiple processors, and the multiple processors are coupled to each other through one or more buses. In an optional situation, part of the processing of the image signal or video signal is completed by the GPU, part is completed by a dedicated video/graphics processor, and may also be completed by software code running on a general-purpose CPU or GPU.
该装置还可以包括存储器,可用于存储计算机程序指令,包括操作系统(operation system,OS)、各种用户应用程序、以及用于执行本申请方案的程序代码在内的各类计算机程序代码。存储器还可以用于存储视频数据、图像数据等。CPU可以用于执行存储器中存储的计算机程序代码,以实现本申请实施例中的方法。可选的,存储器可以是非掉电易失性存储器,例如是嵌入式多媒体卡(embedded multi media card,EMMC)、通用闪存存储(universal flash storage,UFS)或只读存储器(read-only memory,ROM),或者是可存储静态信息和指令的其他类型的静态存储设备,还可以是掉电易失性存储器(volatile memory),例如RAM或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光 碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的程序代码并能够由计算机存取的任何其他计算机可读存储介质,但不限于此。The device may also include a memory, which may be used to store computer program instructions, including various computer program codes including an operating system (OS), various user application programs, and program codes for executing the solutions of the present application. The memory can also be used to store video data, image data, and so on. The CPU may be used to execute the computer program code stored in the memory to implement the method in the embodiment of the present application. Optionally, the memory may be a non-power-down volatile memory, such as an embedded multimedia card (EMMC), universal flash storage (UFS) or read-only memory (ROM). ), or other types of static storage devices that can store static information and instructions, or volatile memory, such as RAM or other types of dynamic storage devices that can store information and instructions, or It is electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs) , Optical discs, digital universal discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other computer-readable storage that can be used to carry or store program code in the form of instructions or data structures and that can be accessed by a computer Medium, but not limited to this.
该接收接口可以为处理器芯片的数据输入的接口,在一种可选的情况下,该接收接口可以是移动产业处理器接口(mobile industry processor interface,MIPI)、高清晰度多媒体接口(high definition multimedia interface,HDMI)或Display Port(DP)等。The receiving interface may be a data input interface of the processor chip. In an optional case, the receiving interface may be a mobile industry processor interface (MIPI) or a high definition multimedia interface (MIPI). multimedia interface, HDMI) or Display Port (DP), etc.

Claims (25)

  1. 一种基于模型的信号推理方法,其特征在于,包括:A model-based signal reasoning method, which is characterized in that it includes:
    接收输入信号,所述输入信号为计算机或处理器可处理的数字信号;Receiving an input signal, the input signal being a digital signal that can be processed by a computer or a processor;
    根据预设模型中的依赖信息对所述输入信号进行所述预设模型的推理,得到输出信号;Perform the inference of the preset model on the input signal according to the dependency information in the preset model to obtain the output signal;
    其中,所述预设模型包括算子,所述算子包括输入参数和输出参数;所述依赖信息用于指示在利用所述预设模型对所述输入信号进行多帧推理时,目标帧推理中的所述算子中的至少一个算子的输入参数或输出参数与参考帧推理中的所述算子中的至少一个算子的输入参数或输出参数的依赖关系,所述目标帧推理为所述多帧推理中的至少一帧推理,所述参考帧推理为所述多帧推理中的除所述目标帧推理之外的其他帧推理中的至少一帧推理。Wherein, the preset model includes an operator, the operator includes an input parameter and an output parameter; the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, the target frame is inferred The dependency relationship between the input parameter or output parameter of at least one of the operators in the operator and the input parameter or output parameter of the at least one operator in the reference frame reasoning, and the target frame reasoning is For at least one frame of reasoning in the multi-frame reasoning, the reference frame reasoning is at least one frame of reasoning in the multi-frame reasoning other than the target frame reasoning.
  2. 根据权利要求1所述的方法,其特征在于,在所述根据预设模型中的依赖信息对所述输入信号进行所述预设模型的多帧推理之前,所述方法还包括:The method according to claim 1, wherein before the multi-frame reasoning of the preset model is performed on the input signal according to the dependency information in the preset model, the method further comprises:
    在所述预设模型的描述信息中设置所述依赖信息;其中,所述描述信息用于描述所述预设模型包括的至少一个算子以及所述至少一个算子中每个算子的输入参数和输出参数。The dependency information is set in the description information of the preset model; wherein the description information is used to describe at least one operator included in the preset model and the input of each operator in the at least one operator Parameters and output parameters.
  3. 根据权利要求2所述的方法,其特征在于,所述在所述预设模型的描述信息中设置所述依赖信息,包括:The method according to claim 2, wherein the setting the dependency information in the description information of the preset model comprises:
    通过调用所述预设模型的接口在所述预设模型的描述信息中设置所述依赖信息,所述预设模型的接口用于为所述预设模型提供信息修改的入口。The dependency information is set in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used to provide an entrance for information modification for the preset model.
  4. 根据权利要求2所述的方法,其特征在于,所述在所述预设模型的描述信息中设置所述依赖信息,包括:The method according to claim 2, wherein the setting the dependency information in the description information of the preset model comprises:
    接收用户输入的所述依赖信息;Receiving the dependency information input by the user;
    根据所述用户输入的所述依赖信息在所述预设模型的描述信息中设置所述依赖信息。The dependency information is set in the description information of the preset model according to the dependency information input by the user.
  5. 根据权利要求2或3所述的方法,其特征在于,所述在所述预设模型的描述信息中设置所述依赖信息之前,还包括:The method according to claim 2 or 3, wherein before setting the dependency information in the description information of the preset model, the method further comprises:
    获取所述描述信息;Obtain the description information;
    根据所述描述信息包括的至少一个算子以及每个所述算子的输入参数和输出参数,获取所述依赖信息。The dependency information is acquired according to at least one operator included in the description information and the input parameter and output parameter of each operator.
  6. 根据权利要求1至5任一项所述的方法,其特征在于,所述依赖信息包括所述目标帧推理中算子的输入参数与所述参考帧推理中算子的输出参数之间的依赖关系。The method according to any one of claims 1 to 5, wherein the dependency information includes the dependency between the input parameters of the operator in the target frame reasoning and the output parameters of the operator in the reference frame reasoning relationship.
  7. 根据权利要求6所述的方法,其特征在于,所述依赖信息包括第一帧间间隔、第一算子标识和第一参数标识,所述第一帧间间隔用于指示与所述目标帧推理中第一算子的第一输入参数有依赖关系的参考帧推理与所述目标帧推理的帧间间隔,所述第一算子标识用于指示所述参考帧推理中与所述第一算子有依赖关系的算子,所述第一参数标识用于指示所述参考帧推理中与所述第一输入参数有依赖关系的参数。The method according to claim 6, wherein the dependency information includes a first inter-frame interval, a first operator identifier, and a first parameter identifier, and the first inter-frame interval is used to indicate a connection with the target frame In the inference, the first input parameter of the first operator has a dependency relationship between the reference frame inference and the target frame inference, and the first operator identifier is used to indicate the reference frame inference and the first The operator has a dependency relationship, and the first parameter identifier is used to indicate a parameter that has a dependency relationship with the first input parameter in the reference frame reasoning.
  8. 根据权利要求1至5任一项所述的方法,其特征在于,所述依赖信息包括所述 目标帧推理中算子的输出参数与所述参考帧推理中算子的输入参数之间的依赖关系。The method according to any one of claims 1 to 5, wherein the dependency information includes the dependency between the output parameter of the operator in the target frame reasoning and the input parameter of the operator in the reference frame reasoning relationship.
  9. 根据权利要求8所述的方法,其特征在于,所述依赖信息包括第二帧间间隔、第二算子标识和第二参数标识,所述第二帧间间隔用于指示与所述目标帧推理中第二算子的第一输出参数有依赖关系的参考帧推理与所述目标帧推理的帧间间隔,所述第二算子标识用于指示所述参考帧推理中与所述第二算子有依赖关系的算子,所述第二参数标识用于指示所述参考帧推理中与所述第一输出参数有依赖关系的参数。The method according to claim 8, wherein the dependency information includes a second inter-frame interval, a second operator identifier, and a second parameter identifier, and the second inter-frame interval is used to indicate a relationship with the target frame In inference, the interval between the reference frame inference and the target frame inference on which the first output parameter of the second operator has a dependency relationship, and the second operator identifier is used to indicate that the reference frame inference is related to the second The operator has a dependency relationship, and the second parameter identifier is used to indicate a parameter that has a dependency relationship with the first output parameter in the reference frame inference.
  10. 根据权利要求1至5任一项所述的方法,其特征在于,所述根据预设模型中的依赖信息对所述输入信号进行所述预设模型的推理,包括:The method according to any one of claims 1 to 5, wherein the inference of the preset model on the input signal according to dependency information in the preset model comprises:
    加载所述预设模型和所述依赖信息;Loading the preset model and the dependency information;
    根据所述依赖信息调度当前帧推理中所述预设模型的各个算子。Scheduling each operator of the preset model in the current frame inference according to the dependency information.
  11. 根据权利要求10所述的方法,其特征在于,所述根据所述依赖信息调度当前帧推理中所述预设模型的各个算子,包括:The method according to claim 10, wherein the scheduling each operator of the preset model in the current frame inference according to the dependency information comprises:
    根据所述依赖信息确定所述当前帧推理中所述预设模型的各个算子的执行顺序;Determine the execution order of the operators of the preset model in the current frame reasoning according to the dependency information;
    根据所述执行顺序将所述当前帧推理中所述预设模型的各个算子加入至多个执行队列中;其中,所述多个执行队列中在同一时间分别执行的多个算子的输入参数之间没有依赖关系。Each operator of the preset model in the current frame reasoning is added to multiple execution queues according to the execution order; wherein, the input parameters of the multiple operators that are executed at the same time in the multiple execution queues There is no dependency between.
  12. 根据权利要求1至5任一项所述的方法,其特征在于,所述可处理的数字信号包括下列中的至少一种:图像数据、语音数据和文本数据。The method according to any one of claims 1 to 5, wherein the processable digital signal includes at least one of the following: image data, voice data, and text data.
  13. 一种基于模型的信号推理装置,其特征在于,包括:处理器和传输接口;A model-based signal reasoning device, which is characterized by comprising: a processor and a transmission interface;
    所述传输接口,用于接收输入信号,所述输入信号为计算机或处理器可处理的数字信号;The transmission interface is used to receive an input signal, and the input signal is a digital signal that can be processed by a computer or a processor;
    所述处理器,用于根据预设模型中的依赖信息对所述输入信号进行所述预设模型的推理,得到输出信号;The processor is configured to perform inference of the preset model on the input signal according to the dependency information in the preset model to obtain an output signal;
    其中,所述预设模型包括算子,所述算子包括输入参数和输出参数;所述依赖信息用于指示在利用所述预设模型对所述输入信号进行多帧推理时,目标帧推理中的所述算子中的至少一个算子的输入参数或输出参数与参考帧推理中的所述算子中的至少一个算子的输入参数或输出参数的依赖关系,所述目标帧推理为所述多帧推理中的至少一帧推理,所述参考帧推理为所述多帧推理中的除所述目标帧推理之外的其他帧推理中的至少一帧推理。Wherein, the preset model includes an operator, the operator includes an input parameter and an output parameter; the dependency information is used to indicate that when the preset model is used to perform multi-frame inference on the input signal, the target frame is inferred The dependency relationship between the input parameter or output parameter of at least one of the operators in the operator and the input parameter or output parameter of the at least one operator in the reference frame reasoning, and the target frame reasoning is For at least one frame of reasoning in the multi-frame reasoning, the reference frame reasoning is at least one frame of the other frame reasoning in the multi-frame reasoning except the target frame reasoning.
  14. 根据权利要求13所述的装置,其特征在于,所述处理器还用于:The device according to claim 13, wherein the processor is further configured to:
    在所述预设模型的描述信息中设置所述依赖信息;其中,所述描述信息用于描述所述预设模型包括的至少一个算子以及所述至少一个算子中每个算子的输入参数和输出参数。The dependency information is set in the description information of the preset model; wherein the description information is used to describe at least one operator included in the preset model and the input of each operator in the at least one operator Parameters and output parameters.
  15. 根据权利要求14所述的装置,其特征在于,所述处理器具体用于:The device according to claim 14, wherein the processor is specifically configured to:
    通过调用所述预设模型的接口在所述预设模型的描述信息中设置所述依赖信息,所述预设模型的接口用于为所述预设模型提供信息修改的入口。The dependency information is set in the description information of the preset model by calling the interface of the preset model, and the interface of the preset model is used to provide an entrance for information modification for the preset model.
  16. 根据权利要求14所述的装置,其特征在于,The device according to claim 14, wherein:
    所述传输接口,还用于接收用户输入的所述依赖信息;The transmission interface is also used to receive the dependency information input by the user;
    所述处理器具体用于,根据所述用户输入的所述依赖信息在所述预设模型的描述 信息中设置所述依赖信息。The processor is specifically configured to set the dependency information in the description information of the preset model according to the dependency information input by the user.
  17. 根据权利要求14或15所述的装置,其特征在于,所述处理器还用于:The device according to claim 14 or 15, wherein the processor is further configured to:
    获取所述描述信息;Obtain the description information;
    根据所述描述信息包括的至少一个算子以及每个所述算子的输入参数和输出参数,获取所述依赖信息。The dependency information is acquired according to at least one operator included in the description information and the input parameter and output parameter of each operator.
  18. 根据权利要求13至17任一项所述的装置,其特征在于,所述依赖信息包括所述目标帧推理中算子的输入参数与所述参考帧推理中算子的输出参数之间的依赖关系。The device according to any one of claims 13 to 17, wherein the dependency information includes the dependency between the input parameter of the operator in the target frame inference and the output parameter of the operator in the reference frame inference relationship.
  19. 根据权利要求18所述的装置,其特征在于,所述依赖信息包括第一帧间间隔、第一算子标识和第一参数标识,所述第一帧间间隔用于指示与所述目标帧推理中第一算子的第一输入参数有依赖关系的参考帧推理与所述目标帧推理的帧间间隔,所述第一算子标识用于指示所述参考帧推理中与所述第一算子有依赖关系的算子,所述第一参数标识用于指示所述参考帧推理中与所述第一输入参数有依赖关系的参数。The apparatus according to claim 18, wherein the dependency information includes a first inter-frame interval, a first operator identifier, and a first parameter identifier, and the first inter-frame interval is used to indicate a connection with the target frame In the inference, the first input parameter of the first operator has a dependency relationship between the reference frame inference and the target frame inference, and the first operator identifier is used to indicate the reference frame inference and the first The operator has a dependency relationship, and the first parameter identifier is used to indicate a parameter that has a dependency relationship with the first input parameter in the reference frame reasoning.
  20. 根据权利要求13至19任一项所述的装置,其特征在于,所述依赖信息包括所述目标帧推理中算子的输出参数与所述参考帧推理中算子的输入参数之间的依赖关系。The apparatus according to any one of claims 13 to 19, wherein the dependency information includes the dependency between the output parameter of the operator in the target frame reasoning and the input parameter of the operator in the reference frame reasoning relationship.
  21. 根据权利要求20所述的装置,其特征在于,所述依赖信息包括第二帧间间隔、第二算子标识和第二参数标识,所述第二帧间间隔用于指示与所述目标帧推理中第二算子的第一输出参数有依赖关系的参考帧推理与所述目标帧推理的帧间间隔,所述第二算子标识用于指示所述参考帧推理中与所述第二算子有依赖关系的算子,所述第二参数标识用于指示所述参考帧推理中与所述第一输出参数有依赖关系的参数。The apparatus according to claim 20, wherein the dependency information includes a second inter-frame interval, a second operator identifier, and a second parameter identifier, and the second inter-frame interval is used to indicate a connection with the target frame In inference, the interval between the reference frame inference and the target frame inference on which the first output parameter of the second operator has a dependency relationship, and the second operator identifier is used to indicate that the reference frame inference is related to the second The operator has a dependency relationship, and the second parameter identifier is used to indicate a parameter that has a dependency relationship with the first output parameter in the reference frame inference.
  22. 根据权利要求13至21任一项所述的装置,其特征在于,所述处理器具体用于:The device according to any one of claims 13 to 21, wherein the processor is specifically configured to:
    加载所述预设模型和所述依赖信息;Loading the preset model and the dependency information;
    根据所述依赖信息调度当前帧推理中所述预设模型的各个算子。Scheduling each operator of the preset model in the current frame inference according to the dependency information.
  23. 根据权利要求22所述的装置,其特征在于,所述处理器具体用于:The device according to claim 22, wherein the processor is specifically configured to:
    根据所述依赖信息确定所述当前帧推理中所述预设模型的各个算子的执行顺序;Determine the execution order of the operators of the preset model in the current frame reasoning according to the dependency information;
    根据所述执行顺序将所述当前帧推理中所述预设模型的各个算子加入至多个执行队列中;其中,所述多个执行队列中在同一时间分别执行的多个算子的输入参数之间没有依赖关系。Each operator of the preset model in the current frame reasoning is added to multiple execution queues according to the execution order; wherein, the input parameters of the multiple operators that are executed at the same time in the multiple execution queues There is no dependency between.
  24. 根据权利要求13至23任一项所述的装置,其特征在于,所述可处理的数字信号包括下列中的至少一种:图像数据、语音数据和文本数据。The device according to any one of claims 13 to 23, wherein the processable digital signal comprises at least one of the following: image data, voice data, and text data.
  25. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有指令,当所述指令在计算机或处理器上运行时,实现如权利要求1至12任一项所述的基于模型的信号推理方法。A computer-readable storage medium, characterized in that instructions are stored in the computer-readable storage medium, and when the instructions are run on a computer or a processor, the instructions described in any one of claims 1 to 12 are implemented. Model-based signal reasoning method.
PCT/CN2019/090442 2019-06-06 2019-06-06 Model-based signal inference method and apparatus WO2020243973A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980097133.6A CN113966516A (en) 2019-06-06 2019-06-06 Model-based signal reasoning method and device
PCT/CN2019/090442 WO2020243973A1 (en) 2019-06-06 2019-06-06 Model-based signal inference method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/090442 WO2020243973A1 (en) 2019-06-06 2019-06-06 Model-based signal inference method and apparatus

Publications (1)

Publication Number Publication Date
WO2020243973A1 true WO2020243973A1 (en) 2020-12-10

Family

ID=73652728

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/090442 WO2020243973A1 (en) 2019-06-06 2019-06-06 Model-based signal inference method and apparatus

Country Status (2)

Country Link
CN (1) CN113966516A (en)
WO (1) WO2020243973A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130060807A1 (en) * 2011-09-01 2013-03-07 Ajay Manoj Rambhia Relational metal- model and associated domain context-based knowledge inference engine for knowledge discovery and organization
CN105956021A (en) * 2016-04-22 2016-09-21 华中科技大学 Automated task parallel method suitable for distributed machine learning and system thereof
CN108595157A (en) * 2018-04-28 2018-09-28 百度在线网络技术(北京)有限公司 Processing method, device, equipment and the storage medium of block chain data
CN109697511A (en) * 2017-10-24 2019-04-30 华为技术有限公司 Data reasoning method, apparatus and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130060807A1 (en) * 2011-09-01 2013-03-07 Ajay Manoj Rambhia Relational metal- model and associated domain context-based knowledge inference engine for knowledge discovery and organization
CN105956021A (en) * 2016-04-22 2016-09-21 华中科技大学 Automated task parallel method suitable for distributed machine learning and system thereof
CN109697511A (en) * 2017-10-24 2019-04-30 华为技术有限公司 Data reasoning method, apparatus and computer equipment
CN108595157A (en) * 2018-04-28 2018-09-28 百度在线网络技术(北京)有限公司 Processing method, device, equipment and the storage medium of block chain data

Also Published As

Publication number Publication date
CN113966516A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
JP7191240B2 (en) Video stream decoding method, device, terminal equipment and program
US10515056B2 (en) API for resource discovery and utilization
CN109064399B (en) Image super-resolution reconstruction method and system, computer device and storage medium thereof
CN111258744A (en) Task processing method based on heterogeneous computation and software and hardware framework system
US11494614B2 (en) Subsampling training data during artificial neural network training
CN110070496B (en) Method and device for generating image special effect and hardware device
US20210096903A1 (en) Method and apparatus for a step-enabled workflow
EP3198870B1 (en) Processing parameters for operations on blocks while decoding images
CN115600676A (en) Deep learning model reasoning method, device, equipment and storage medium
WO2020243973A1 (en) Model-based signal inference method and apparatus
US11252457B2 (en) Multimedia streaming and routing apparatus and operation method of the same
WO2018119616A1 (en) Multi-operating system multimedia data coding and decoding method and apparatus, electronic device and computer program product
KR20210097448A (en) Image data processing method and sensor device for perfoming the same
WO2015184902A1 (en) Concurrent processing method for intelligent split-screen and corresponding intelligent terminal
CN115098262A (en) Multi-neural-network task processing method and device
CN112753016A (en) Management method and device for computing resources in data preprocessing stage in neural network
CN110554968B (en) Interface calling method and device
CN110597521B (en) Data processing method, electronic device, and medium
CN104090911A (en) Information processing method and electronic equipment
WO2022213802A1 (en) Dynamic graphic editing method and apparatus
CN112041817A (en) Method and node for managing requests for hardware acceleration by means of an accelerator device
US11966789B2 (en) System and method for queuing node load for malware analysis
CN110569031B (en) Programming implementation method and device
CN117808857B (en) Self-supervision 360-degree depth estimation method, device, equipment and medium
US11050643B2 (en) Method for managing software service, and server

Legal Events

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

Ref document number: 19931777

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19931777

Country of ref document: EP

Kind code of ref document: A1