The resolution and format of the source image or video can be processed to meet the model requirements. The following is an example of a typical scenario.
The input video is in H.264/H.265 encoding format and the resolution is 1920 x 1080. However, the YOLOv3 model for object detection requires an RGB or YUV input image with the resolution of 416 x 416. In this case, you can process the video as follows.
The input image is in JPEG encoding format and the resolution is 1280 x 720. However, the ResNet-50 model for image classification requires an RGB input image with the resolution of 224 x 224. In this case, you can process the image as follows.
The input image is in YUV420SP format and the resolution is 1280 x 720. However, the ResNet-50 model for image classification requires an RGB input image with the resolution of 224 x 224. In this case, you can process the image as follows.
Ascend CANN provides two image/video data processing modes, as described in the following table. This section focuses on DVPP-based image/video data processing.
AIPP and DVPP can be used separately or together. In combined applications, DVPP is used first to decode, crop, and resize images or videos. However, due to DVPP hardware restrictions, the image format and resolution after DVPP may not meet the model requirements. Therefore, AIPP is required to further perform color space conversion (CSC), image cropping, and border making.
For example, in the Ascend 310 AI Processor and Ascend 910 AI Processor, DVPP video decoing supports only the output of YUV images. If the model requires RGB images, AIPP is required to perform CSC.
Function |
Description |
|---|---|
Vision Preprocessing Core (VPC) |
Processes YUV and RGB images, including resizing, cropping, pyramid, and CSC. |
JPEG Decoder (JPEGD) |
Decodes images from JPEG to YUV. |
JPEG Encoder (JPEGE) |
Encodes images from YUV to JPEG. |
Video Decoder (VDEC) |
Decodes video streams from H.264/H.265 to YUV/RGB. |
Video Encoder (VENC) |
Encodes video streams from YUV420SP to H.264/H.265. |
PNG Decoder (PNGD) |
Decodes images from PNG to RGB. |