mxpi_distributor

Function

Sends data of a specified class or channel to different ports. You can enter the class index or channel index in the configuration file to select the result to be output.

Synchronous/Asynchronous (Status)

Asynchronous

Constraints

Currently, data can be distributed by channel ID or class ID.

Plugin Base Class (Factory)

mxpi_distributor

Input/Output

Static input: buffer (data type: MxpiBuffer) and metadata (data type: MxpiObjectList, MxpiClassList, MxpiObject, or MxpiClass)

Dynamic output: buffer (data type: MxpiBuffer) and metadata (data type: MxpiObjectList, MxpiClassList, MxpiObject, or MxpiClass)

Property

For details, see Table 1.

Table 1 mxpi_distributor plugin properties

Property Name

Description

Mandatory or Not

Modifiable or Not

dataSource

Index of the input data. The default value is the metadata key of the output port corresponding to the upstream plugin.

No

Yes

classIds

Indexes of the class to be output, separated by commas (,). This plugin reorganizes different objects based on the customized classes and distributes them to downstream plugins through different output ports in the class sequence. The downstream plugin uses id of the object distribution plugin as the key to obtain metadata. (id indicates the output port number of the object distribution plugin, which starts from 0 and increases by 1.)

Yes

Yes

distributeAll

Whether to distribute data to a port when the port does not have target data. The value can be yes or no (default).

No

This field is used together with classIds.

Yes

channelIds

Indexes of the channel to be output, separated by commas (,). This plugin distributes the buffer to downstream plugins through different output ports in the sequence of channel indexes based on the channels configured by users.

Yes

Yes

  • The mxpi_distributor plugin is often used together with the queue plugin. That is, each output port of the mxpi_distributor plugin connects to the queue plugin.
  • The channelIds property must be set when distribution is performed based on the channel ID. The classIds and dataSource properties must be configured when distribution is performed based on the class ID.
  • The distribution plugin allows each output port to contain data of multiple classes (or channels). The indexes of each output port are separated by vertical bars (|). For details, see Example.

Example

  • If only the classIds and dataSource properties are configured, the distribution plugin sends the buffer with the metadata of the class to the downstream plugin in the sequence of the object index (class ID).

    Assume that the distribution plugin mxpi_distributor0 receives the buffer of the demoA plugin, uses demoA as the key to obtain metadata, and reorganizes the metadata by class.
    • Use mxpi_distributor0_0 as the key to mount the metadata whose class is 4 and 5 and send the buffer to the demoA0 plugin.
    • Use mxpi_distributor0_1 as the key to mount the metadata whose class is 6 and send the buffer to the demoA1 plugin.
    • Use mxpi_distributor0_2 as the key to mount the metadata whose class is 7 and send the buffer to the demoA2 plugin.
  • If only the channelIds property is set, the distribution plugin sends buffers to downstream plugins in the sequence of channel IDs.

    Assume that the distribution plugin mxpi_distributor0 receives the buffer of the demoA plugin:
    • The buffer whose channel index is 1 or 2 is sent to the demoA0 plugin.
    • The buffer whose channel index is 3 is sent to the demoA1 plugin.
    • The buffer whose channel index is 4 is sent to the demoA2 plugin.