mxpi_imagenormalize

Function

Implements image normalization or standardization. It can be described by using the following formula: x' = (x - alpha)/beta.

Synchronous/Asynchronous (Status)

Asynchronous

Constraints

Currently, only the input data types UINT8 and FLOAT32 and the input image formats RGB888 and BGR888 are supported.

Plugin Base Class (Factory)

mxpi_imagenormalize

Input/Output

Input: buffer (data type: MxpiBuffer) and metadata (data type: MxpiVisionList)

Output: buffer (data type: MxpiBuffer) and metadata (data type: MxpiVisionList)

Port Format (Caps)

Static input: {"ANY"}

Static output: {"ANY"}

Property

For details, see Table 1.

Table 1 mxpi_imagenormalize plugin properties

Property Name

Description

Mandatory or Not

Modifiable or Not

deviceId

Ascend device ID, which is specified by the deviceId property in the stream_config field. You do not need to set the ID.

No

Yes

dataSource

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

No

Yes

alpha

Alpha value in x' = (x - alpha)/beta. The default value is 0,0,0. Enter the R, G, and B values in sequence.

No

Yes

beta

beta value in x' = (x - alpha)/beta. The default value is 1,1,1. Enter the R, G, and B values in sequence.

No

Yes

format

Output image format. Currently, only RGB888, BGR888, and auto (consistent with the input) are supported. The default value is auto.

No

Yes

dataType

Output image data type. Currently, only UINT8, FLOAT32, and auto (consistent with the input) are supported. The default value is auto.

No

Yes

processType

Image data normalization or standardization. The value is of the int type.

  • 0: Normalization
  • 1 (default): Standardization

No

Yes

The mxpi_imagenormalize plugin is used in the following scenarios:

  • Normalization: A series of data changes are fixed in a range. Generally, the range is [0, 1].

    In this case, alpha = min(x), beta = max(x) – min(x).

  • Standardization: Data is converted into a distribution with a mean value of 0 and a standard deviation of 1.

    In this case, alpha = mean, beta = std.

  • In other scenarios, the formulas can be changed accordingly.