ResNet50 Example Code
The NPU ResNet50 example directory (npu_resnet50_sample) mainly includes example code for calling NPU Runtime interfaces, as well as model directories, binary programs: src and models, bin.
Installing ResNet50 Example
sudo apt install es-sdk-sample-npu-resnet50
After installation, the sample is located in the /opt/eswin/sample-code/npu_sample/npu_resnet50_sample directory.
Directory Structure
The detailed directory structure is as follows:
debian@rockos-eswin:/opt/eswin/sample-code/npu_sample/npu_resnet50_sample$ tree
.
├── bin
│ └── sample_npu
├── models
│ └── resnet50
│ ├── es_resnet50_classes.txt
│ ├── es_resnet50_post_process.json
│ ├── es_resnet50_pre_process.json
│ ├── git_resnet50_mix_4x3x224x224_dyn_latency.model
│ ├── git_resnet50_mix_4x3x224x224_dyn_latency.ofmap_order.txt
│ ├── git_resnet50_mix_4x3x224x224_dyn.model
│ ├── git_resnet50_mix_4x3x224x224_dyn_throughput.model
│ ├── git_resnet50_mix_4x3x224x224_dyn_throughput.ofmap_order.txt
│ ├── input
│ │ └── pictures
│ │ └── input0
│ │ ├── ILSVRC2012_val_00003966.JPEG
│ │ ├── ILSVRC2012_val_00009032.JPEG
│ │ ├── ILSVRC2012_val_00011712.JPEG
│ │ ├── ILSVRC2012_val_00016098.JPEG
│ │ ├── ILSVRC2012_val_00017212.JPEG
│ │ ├── ILSVRC2012_val_00017773.JPEG
│ │ ├── ILSVRC2012_val_00021709.JPEG
│ │ ├── ILSVRC2012_val_00022662.JPEG
│ │ ├── ILSVRC2012_val_00025785.JPEG
│ │ ├── ILSVRC2012_val_00026363.JPEG
│ │ ├── ILSVRC2012_val_00027830.JPEG
│ │ ├── ILSVRC2012_val_00030734.JPEG
│ │ ├── ILSVRC2012_val_00031637.JPEG
│ │ ├── ILSVRC2012_val_00033024.JPEG
│ │ ├── ILSVRC2012_val_00033154.JPEG
│ │ ├── ILSVRC2012_val_00033435.JPEG
│ │ ├── ILSVRC2012_val_00034978.JPEG
│ │ ├── ILSVRC2012_val_00040463.JPEG
│ │ └── ILSVRC2012_val_00049043.JPEG
│ └── model.json
└── src
├── build.sh
├── CMakeLists.txt
├── README.md
├── sample_npu_comm.cpp
├── sample_npu_comm.h
├── sample_npu.cpp
└── utils
├── json
│ ├── cJSON.cpp
│ └── cJSON.h
├── postprocess
│ ├── EsPostProcess.cpp
│ └── EsPostProcess.h
├── preprocess
│ ├── EsHwPreProcess.cpp
│ ├── EsHwPreProcess.h
│ └── IPreprocess.h
├── sample_npu_utils.cpp
├── sample_npu_utils.h
└── vdec
├── common
│ ├── sample_comm.h
│ ├── sample_comm_sys.cpp
│ ├── sample_comm_vdec.cpp
│ └── sample_comm_vps.cpp
├── EsVdec.cpp
├── EsVdec.h
├── IVdec.h
└── MemoryPool.h
src Directory
The entry point for the NPU ResNet50 example code is the es_ai_inference.cpp file. The README.md document includes the compilation method for the ResNet50 sample code and the command to run it.
The utils directory mainly contains auxiliary utility libraries. For example, it includes pre-processing for images and post-processing for inference results.