YUV400_U8 to Gray

  • Scenario:

    Assume that AIPP inputs a YUV400_U8 image and outputs a gray image. The input image size is 224 x 224, and the valid data region starts from the (0, 0) pixel coordinates in the upper-left corner. For the original network model, C is 1, and H and W are 220.

  • AIPP configurations involved in this scenario:
    • Enable the cropping (crop) function.
    • Set the horizontal and vertical coordinates (load_start_pos_h and load_start_pos_w) of the cropping start position to 0.
    • Do not need to configure the crop_size_w and crop_size_h parameters. In this case, the width and height of the cropped image size (crop_size[W|H]) are obtained from the width and height of the --input_shape option used during model conversion, and the 220 x 220 region is selected starting from the (0, 0) coordinates.
    • Do not need to configure the csc_switch. For the same original network model, if AIPP inputs a YUV420SP_U8 image, the same set of AIPP configurations can be used. In other words, only the data of Y channel is selected.
  • The following is an example of the AIPP configuration file:
    aipp_op{
        aipp_mode: static
        csc_switch: false
        crop: true
        input_format: YUV400_U8
        load_start_pos_h: 0
        load_start_pos_w: 0
        src_image_size_w: 224
        src_image_size_h: 224
        # The normalization parameters are set as required. The following values are examples only.
        mean_chn_0: 128
        min_chn_0: 0.0
        var_reci_chn_0: 0.00390625
    }