mxpi_class2osdinstances

Function

Converts classification results to drawing units. For example, it can convert MxpiClassList to MxpiOsdInstancesList for OSD drawing. MxpiVisionList provides the coordinate information of the submap. If the dynamic port is not used, MxpiVisionList is directly obtained from the buffer.

Synchronous/Asynchronous

Synchronous

Constraints

-

Plugin Base Class (Factory)

mxpi_class2osdinstances

Input/Output

  • Input:
    • buffer (data type: MxpiBuffer), metadata (data type: MxpiClassList)
    • buffer (data type: MxpiBuffer), metadata (data type: MxpiVisionList)
  • Output:
    • buffer (data type: MxpiBuffer), metadata (data type: MxpiOsdInstancesList)

Port Format (Caps)

  • Static input: {"metadata/class"}; dynamic input: {"image/yuv"}
  • Static output: {"metadata/osd"}

Property

For details, see Table 1.

Table 1 mxpi_class2osdinstances plugin properties

Property Name

Description

Mandatory or Not

Modifiable or Not

dataSourceClass

Index name of the classification result. The default value is the key of the metadata corresponding to the output port of the upstream plugin.

No

Yes

dataSourceImage

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

No

Yes

topK

Top K classes to be displayed. The value range is [0, 100]. The default value is 1.

No

Yes

position

Position of the classification result text in the image. The options are as follows. The default value is LEFT_TOP_IN.

  • LEFT_TOP_OUT: outside of the upper left corner of the image
  • LEFT_TOP_IN: interior of the upper left corner of the image
  • LEFT_BOTTOM_IN: interior of the lower left corner of the image
  • RIGHT_TOP_IN: interior of the upper right corner of the image
  • RIGHT_BOTTOM_IN: interior of the lower right corner of the image

No

Yes

fontFace

Font type. Corresponding to the enumerated values of the OpenCV font type. For details, see Table 2.

No

Yes

fontScale

Font size. The default value is 1.0. The value is of the double type that falls within the range of [0.0, 100.0].

No

Yes

fontThickness

Font width. The default value is 1. The value is an integer ranging from 1 to 100.

No

Yes

fontLineType

Line type of the font. Corresponding to the enumerated values of the OpenCV font type. For details, see Table 2.

No

Yes

createRect

Whether to create a rectangle boundary for the classification result text. The options are 0 (no) and 1 (yes). The default value is 1.

No

Yes

colorMap

Rectangle boundary color: "R1,G1,B1|R2,G2,B2|R3,G3,B3|...". Configuration example: 255,255,255|0,0,0|128,128,128. If the class ID is greater than the number of configured colors, the last color is used. If this property is not set, the default color table is used.

No

Yes

rectThickness

Width of the rectangle boundary. The default value is 1. The value is an integer ranging from -1 to 100. When this parameter is set to -1, the rectangle is filled with a color.

No

Yes

rectLineType

Line type of the rectangle boundary. The value corresponds to the enumerated values of the OpenCV line type and must be the same as that of fontLineType. For details, see Table 2.

No

Yes

Yes

Pipeline sample:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
"mxpi_class2osdinstances0":{
    "props":{
 "colorMap":"100,100,100|200,200,200|0,128,255|255,128,0",
 "fontFace":"1",
 "fontScale":"0.8",
 "fontThickness":"1",
 "fontLineType":"8",
 "rectThickness":"2",
 "rectLineType":"8",
 "position":"LEFT_TOP_IN",
 "topK":"3",
 "createRect":"1"
    },
    "factory":"mxpi_class2osdinstances",
    "next":"tee1"
},