tensorrt

TensorRT and Tensorflow 2

扶醉桌前 提交于 2020-02-24 10:06:49
问题 I am trying to speed up the inference of yolov3 TF2 with TensorRT. I am using the TrtGraphConverter function in tensorflow 2. My code is essentially this: from tensorflow.python.compiler.tensorrt import trt_convert as trt tf.keras.backend.set_learning_phase(0) converter = trt.TrtGraphConverter( input_saved_model_dir="./tmp/yolosaved/", precision_mode="FP16", is_dynamic_op=True) converter.convert() saved_model_dir_trt = "./tmp/yolov3.trt" converter.save(saved_model_dir_trt) And this generates

【TensorRT】使用记录 —— TensorRTv6

删除回忆录丶 提交于 2020-02-01 02:46:55
TensorRT使用记录 版本号 TensorRT 6 万恶之源——TensorRT Release Notes,有不同版本的文档供你阅读 TensorRT Developer Guide 官方手册:Python user guide 官方手册:C++ TensorRT Documentation 不想看英文版的可以看看中文博客的介绍:高性能深度学习支持引擎实战——TensorRT 安装教程: 推荐 框架介绍 TensorRT的流程 :输入是一个预先训练好的FP32的模型和网络,将模型通过parser等方式输入到TensorRT中,TensorRT可以生成一个Serialization,也就是说将输入串流到内存或文件中,形成一个优化好的engine,执行的时候可以调取它来执行推断(Inference)。只要理解框架的运作方式,就很容易利用官方给的samples和手册进行代码的魔改了。 插件支持Plugin: 首先TensorRT是支持插件(Plugin)的,或者前面提到的Customer layer的形式,也就是说我们在 某些层TensorRT不支持的情况下 ,最主要是做一些检测的操作的时候,很多层是该网络专门定义的,TensorRT没有支持,需要通过Plugin的形式自己去实现。 推荐阅读: TensorRT优化原理和TensorRT Plguin总结 Python API

TensorRT安装和Hello World

人走茶凉 提交于 2020-01-14 10:51:49
安装 1. 官网下载tensorRT的安装包,解压即可,使用时在CMakeLists里指定头文件和库文件位置即可。不推荐使用deb文件安装,因为它要求配置文件也是deb文件安装。 2. 下载对应的cuda版本和cudnn版本,cuda版本一定要严格对应。 我的配置是ubuntu16.04,cuda9.0,cudnn7.3 cudnn版本我没使用官网指定的7.6,虽然会警告,程序还是可以运行。 Hello World 运行sample里的mnist程序。 在sample/sampleMNIST下编译后在根目录bin文件夹下执行即可 cd /TensorRT-6.0.1.5/samples/sampleMNIST/ make cd ../../bin/ ./sample 运行结果: $ ./sample_mnist &&&& RUNNING TensorRT.sample_mnist # ./sample_mnist [09/29/2019-15:46:14] [I] Building and running a GPU inference engine for MNIST [09/29/2019-15:46:14] [W] [TRT] TensorRT was linked against cuDNN 7.6.3 but loaded cuDNN 7.3.0 [09/29/2019

Error converting TF model for Jetson Nano using tf.trt

流过昼夜 提交于 2020-01-06 05:34:08
问题 I am trying to convert a TF 1.14.0 saved_model to tensorRT on the Jetson Nano. I have saved my model via tf.saved_model.save and am trying to convert it on the Nano. However, I get the following error: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/importer.py", line 427, in import_graph_def graph._c_graph, serialized, options) # pylint: disable=protected-access tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 1

Run Tensorflow with NVIDIA TensorRT Inference Engine

主宰稳场 提交于 2020-01-01 03:09:28
问题 I would like to use NVIDIA TensorRT to run my Tensorflow models. Currenly, TensorRT supports Caffe prototxt network descriptor files. I was not able to find source code to convert Tensorflow models to Caffe models. Are there any workarounds? 回答1: TensorRT 3.0 supports import/conversion of TensorFlow graphs via it's UFF (universal framework format). Some layer implementations are missing and will require custom implementations via IPlugin interface. Previous versions didn't support native

牵手大企,关于图形计算、HPC与AI,NVIDIA言有尽而意无穷!

空扰寡人 提交于 2019-12-25 13:48:14
在黄仁勋看来,随着摩尔定律消亡,GPU加速才是撬动未来高性能计算发展的有力杠杆。有数据显示,目前NVIDIA已经销售了超过15亿块GPU,而这些GPU由于采用了同一架构,均能兼容CUDA。 不仅仅如此,身着经典皮衣的黄教主更认为硬件的“登峰造极”不仅仅局限于芯片,只有软件得到相应性能的完整优化,未来的多GPU才能彰显最出色的处理能力。 基于此,NVIDIA在CUDA平台上配置了相当丰富的软件库,并且选择在去年一整年推出了超过500个相应的SDK以及库来不断改进NVIDIA的软件栈。有数据显示,通过这些专门的SKU,NVIDIA的产品在过去三年的深度学习性能提升了4倍,而深度学习推理性能也相应提升了2倍。 列举如此多样的软件升级,要说目前实在硬核的NVIDIA软件创新,当属最新一代推理软件开发套件NVIDIA TensorRT 7编译器的推出。 晶少了解到,TensorRT作为一种计算图优化编译器能够优化推理实现实时AI会话,将TensorFlow的输出结果进行优化,简单理解位可以高效寻找计算途中可以融合的节点,从而减少计算和内容的访问来进行CUDA码的优化,值得提及的是可以运行在任何GPU上。 “去年我们在中国发布了TensorRT 5,可以处理CNN,而且是在图形的同一层将边缘与节点融合;此外还支持自动检测以及自动低精度推理,将FP32模型转换成FP16或INT8模型

Jetson Nano TensorRt sampleSSD例程

最后都变了- 提交于 2019-12-25 13:20:52
1 平台: jetson Nano + 128gtf卡+ jetpack:jetson-nano-sd-r32.1-2019-03-18 .zip sampleSSD目录:/usr/src/tensorrt/sample/sampleSSD/ 使用的data文件在“:/usr/src/tensorrt/data/ssd/ 编译之后的可执行文件在:/usr/src/tensorrt/bin/ 2 环境准备: 2.1 主要为了装上pillow sudo apt-get -y install cmake sudo apt-get install python3 sudo apt-get install python3-pip sudo apt-get install python3-dev sudo apt install libopenblas-dev libatlas-dev liblapack-dev sudo apt install liblapacke-dev checkinstall sudo pip3 install numpy scipy sudo pip3 install pyyaml sudo pip3 install scikit-build sudo apt install libffi-dev sudo pip3 install cffi sudo apt

Swap a TensorFlow Dataset input pipeline with a placeholder after training

久未见 提交于 2019-12-18 16:56:09
问题 I'm working with the new tf.data.Dataset API and I can't seem to figure out how to perform inference. Ultimately, I want to convert my model to a TensorRT graph and run it on the TX2, and all of the examples I have found assume you have a tf.placeholder for the input. Here is pseudocode for how I am training. The [...] is just meant to be a placeholder since I didn't actually run the code. Let's not debate the model, as it is just suppose to give an example: import tensorflow as tf # Setup

C++ Tensorflow API with TensorRT

谁说胖子不能爱 提交于 2019-12-09 07:13:19
问题 My goal is to run a tensorrt optimized tensorflow graph in a C++ application. I am using tensorflow 1.8 with tensorrt 4. Using the python api I am able to optimize the graph and see a nice performance increase. Trying to run the graph in c++ fails with the following error: Not found: Op type not registered 'TRTEngineOp' in binary running on e15ff5301262. Make sure the Op and Kernel are registered in the binary running in this process. Other, non tensorrt graphs work. I had a similar error

Failed to import 'tensorflow.contrib.tensorrt' in tensorflow r1.14

家住魔仙堡 提交于 2019-12-08 05:43:55
问题 I have installed the Tensorflow r1.14 and want to use TF-TRT . However, the following error occurs: "ModuleNotFoundError: No module named 'tensorflow.contrib.tensorrt'" when running the sample code. The same error occurs with Tensorflow r1.13 . So my question is do I need to install the tensorflow.contrib.tensorrt library separately? If yes, how? Additionally, I can run the sample code of the TensorRT , e.g. sampleINT8 , successfully. Click here to see my successful sample code run. This