TensorRT的环境搭建及使用

本文主要简要介绍TensorRT的环境搭建及如何使用。

环境安装

我这里使用的是TensorRT-5.1.5.0版本,其他版本可能会有一些出入。
安装好的TensorRT环境的docker镜像(docker pull 857470845/hvd_trt_apex_torch:v1)可供下载使用。

示例运行

主要测试两种示例:1、利用安装好的convert_to_uff.py脚本将tensorflow的pb模型文件(lenet)转成uff格式文件,并测试mnist数据;
将TensorRT-5.1.5.0项目所在路径挂载到/mnt下

##cd /mnt/TensorRT-5.1.5.0/samples/python/end_to_end_tensorflow_mnist
mkdir models
python model.py
##convert_to_uff.py脚本在镜像中的路径:/opt/conda/lib/python3.6/site-packages/uff/bin/convert_to_uff.py
python /opt/conda/lib/python3.6/site-packages/uff/bin/convert_to_uff.py --input_file models/lenet5.pb

trt_1

2、直接测试samples/sampleMNIST程序
可以直接在samples下make,产生所有的示例的bin;不过我这里是只单独编译测试samples/sampleMNIST示例。

trt-2

trt

root@gpuserver002:/mnt/TensorRT-5.1.5.0/bin# ./sample_mnist --int8
&&&& RUNNING TensorRT.sample_mnist # ./sample_mnist --int8
[I] Building and running a GPU inference engine for MNIST
[W] [TRT] Calibrator is not being used. Users must provide dynamic range for all tensors that are not Int32.
[W] [TRT] Warning: no implementation of (Unnamed Layer* 9) [Constant] obeys the requested constraints, using a higher precision type
[W] [TRT] Warning: no implementation of ip2 obeys the requested constraints, using a higher precision type
[W] [TRT] Warning: no implementation of prob obeys the requested constraints, using a higher precision type
[I] Input:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@%+-:  =@@@@@@@@@@@@
@@@@@@@%=      -@@@**@@@@@@@
@@@@@@@   :%#@-#@@@. #@@@@@@
@@@@@@*  +@@@@:*@@@  *@@@@@@
@@@@@@#  +@@@@ @@@%  @@@@@@@
@@@@@@@.  :%@@.@@@. *@@@@@@@
@@@@@@@@-   =@@@@. -@@@@@@@@
@@@@@@@@@%:   +@- :@@@@@@@@@
@@@@@@@@@@@%.  : -@@@@@@@@@@
@@@@@@@@@@@@@+   #@@@@@@@@@@
@@@@@@@@@@@@@@+  :@@@@@@@@@@
@@@@@@@@@@@@@@+   *@@@@@@@@@
@@@@@@@@@@@@@@: =  @@@@@@@@@
@@@@@@@@@@@@@@ :@  @@@@@@@@@
@@@@@@@@@@@@@@ -@  @@@@@@@@@
@@@@@@@@@@@@@# +@  @@@@@@@@@
@@@@@@@@@@@@@* ++  @@@@@@@@@
@@@@@@@@@@@@@*    *@@@@@@@@@
@@@@@@@@@@@@@#   =@@@@@@@@@@
@@@@@@@@@@@@@@. +@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@

[I] Output:
0:
1:
2:
3:
4:
5:
6:
7:
8: **********
9:

&&&& PASSED TensorRT.sample_mnist # ./sample_mnist --int8

推荐工程:
https://github.com/NVIDIA/object-detection-tensorrt-example
https://github.com/NVIDIA/healthcare-on-tap-TRT-TRITON-demo

References

下载链接: https://developer.nvidia.com/nvidia-tensorrt-download
trt工程: https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html
项目地址: https://github.com/NVIDIA/TensorRT
参考博客: https://blog.csdn.net/zong596568821xp/article/details/86077553
Triton(tensorrt inference server): https://github.com/triton-inference-server/server

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值