测试模型:深度学习模型
测试对象:运行时
测试目的:测试运行时的推理性能
功能:
根据用户指定的深度学习模型(可以是自己提供的,也可以是现有测试模型中已有的)和想要测试的运行时,测试运行时的推理性能,主要包括:推理结果,推理速度,推理每张图片的延迟时间。
原有非自动化测试:
现自动化测试:
目前支持的推理模型文件格式:
.pb,.h5,.ckpt, .onnx
目前支持的运行时:
openvino, tensorrt, tensorflow, tensorflow_gpu
推理端client的编写:
推理端client代码的编写可以参考Adlik/benchmark/tests/test_model/client下的代码,编写原则依据Adlik/adlik_serving/apis/predict.proto,用户根据自己的需求编写数据预处理部分以及模型的输入。
编译模型的serving_model.json的编写:
serving_model.json的编写可以参考Adlik/benchmark/test/test_model目录下各模型文件夹中的serving_model.json和Adlik/model_compiler/src/model_compiler/config_schema.json,serving_model.json主要配置编译的运行时类型、模型文件、编译好的模型的输出地址、模型的输入输出信息、最大batch size等信息,在模型编译的时候使用。
自动化测试总体框架:
操作手册:
参数说明:
简称 | 参数 | 类型 | 描述 | 默认值 |
-d | --docker-file-path | str | 测试运行时的dockerfile | |
-s | --serving-type | str | 测试的运行时类型 | choices=("openvino", "tensorrt", "tensorflow", "tensorflow_gpu") |
-b | --build-directory | str | 构建docker镜像的文件夹 | |
-a | --adlik-directory | str | Adlik文件夹 | Adlik |
-m | --model-name | str | 用来测试的模型名称 | |
-c | --client-script | str | 推理端脚本 | client_script.sh |
-ss | --serving-script | str | 运行时起服务脚本 | serving_script.sh |
-ov | --openvino-version | str | OpenVINO版本 | 2019.3.344 |
-tt | --tensorrt-tar | str | TensorRT压缩包 | TensorRT-7.0.0.11.Ubuntu<br>-18.04.x86_64-gnu.cuda-<br>10.0.cudnn7.6.tar.gz |
-tv | --tensorrt-version | str | TensorRT版本 | 7.0.0.11 |
-l | --log-path | str | 日志文件夹 | log |
-tm | --test-model-path | str | 测试模型地址 | |
-sj | --serving-json | str | 模型的json文件 | serving_model.json |
-cis | --client-inference-script | str | 推理脚本 | |
-i | --image-filename | str | 输入图片 | |
-gl | --gpu-label | int | GPU号 | None |
-cs | --compile-script | str | 编译模型的脚本 | compile_script.sh |
如果要使用automatic_test.py测试运行时,则需要执行以下步骤:
python3 benchmark/src/automatic_test.py -d benchmark/tests/docker_test/openvino.Dockerfile -s openvino -b . -a . -m mnist -c benchmark/tests/client_script/client_script.sh -ss benchmark/tests/serving_script/openvino_serving_script.sh -l log的绝对路径 -tm benchmark/tests/test_model/mnist_keras -cis mnist_client.py -i mnist.png -cs benchmark/tests/compile_script/compile_script.sh
注意事项:
官网链接:https://docs.nvidia.com/deeplearning/sdk/tensorrt-install-guide/index.html。