Sample Overview
Sample Obtaining
Click image decoding+cropping and resizing+image encoding+synchronous inference to obtain the sample.
Function Usage
This sample shows how to classify images based on the Caffe ResNet-50 network (single input with batch size = 1).
According to the arguments of the app, the following functions can be implemented:
- Decode a .jpg image into an input image in YUV420SP (NV12) format, resize the image, and perform model inference. Then process the inference result and output the top 5 confidence values.
- Crop an input image in YUV420SP (NV12) format and perform model inference. Then process the inference result and output the top 5 confidence values.
- Crop and paste an input image in YUV420SP (NV12) format and perform model inference. Then process the inference result and output the top 5 confidence values.
- Encode an input image in YUV420SP (NV12) format into a .jpg image.
- Resize the 8192 x 8192 input image in YUV420SP (NV12) format to obtain a 4000 x 4000 subimage.
- Crop the input images in YUV420SP (NV12) format in batches.
- Crop and paste the input images in YUV420SP (NV12) format in batches.
Main APIs
The following table lists the main APIs.
Directory Structure
The directory structure is as follows:
vpc_jpeg_resnet50_imagenet_classification ├──scripts │ ├── host_version.conf // Version number configuration file. │ └── testcase_300.sh // Run script. ├──src │ ├── acl_dvpp_process.py // Media data processing. │ ├── acl_model_process.py // Model running file. │ ├── constant.py // Constant definition. │ └── main.py // Running file for process logic control. ├── data │ ├── fusion_result.json // File generated after atc conversion, which records the fused operator information. │ └── vdec_h265_1frame_rabbit_1280x720.h265 // Video file to be processed by the user, which is obtained by the user. ├── caffe_model // Model deployed by users. │ ├── aipp.cfg // Model configuration data. │ ├── resnet50.caffemodel // ResNet-50 model │ └── resnet50.prototxt // ResNet-50 network file └── model // Directory generated after the inference model is converted. └── resnet50_aipp.om // Model file generated after conversion.