TensorRT – Polygraphy工具的使用
本文作者:StubbornHuang
版权声明:本文为站长原创文章,如果转载请注明原文链接!
原文标题:TensorRT – Polygraphy工具的使用
原文链接:https://www.stubbornhuang.com/1737/
发布于:2021年10月05日 23:04:52
修改于:2021年10月05日 23:04:52
1 切换python虚拟环境
在Anaconda中激活安装了Polygraphy包以及其依赖项的python环境,以下所有的操作都需要在此虚拟环境中操作,Polygraphy的安装可参考:https://www.stubbornhuang.com/1736/
2 使用
2.1 API调用
如果正确安装了polygraphy包,那么在项目正常调用该包即可。
官方仓库提供了较多的api示例可以参考:https://github.com/NVIDIA/TensorRT/tree/master/tools/Polygraphy/polygraphy
或者:https://github.com/NVIDIA/TensorRT/tree/master/tools/Polygraphy/examples/api
2.2 命令行调用
主要的命令行脚本在:https://github.com/NVIDIA/TensorRT/tree/master/tools/Polygraphy/bin 下的polygraphy,本地的位置在: TensorRT-master\tools\Polygraphy\bin 下
在切换到对应的虚拟环境之后,并切换到TensorRT-master\tools\Polygraphy\bin文件夹下,通过以下的命令行调用:
python polygraphy
对于https://github.com/oreo-lp/AlphaPose_TRT下对yolo模型的修正命令
polygraphy surgeon sanitize yolov3_spp_static.onnx --fold-constants --output yolov3_spp_static_folded.onnx
需要调整为:
python polygraphy surgeon sanitize yolov3_spp_static.onnx --fold-constants --output yolov3_spp_static_folded.onnx
这是需要注意的地方,在大多数的调用示例中前面都没有加python,这之前对我产生了很大的困扰。
2.3 集成到python项目中
另外也可以将polygraphy这个文件添加后缀名.py修改为polygraphy.py并加入到pycharm中调用,在pycharm中添加命令行参数调用该文件,这也是一种方式。
当前分类随机文章推荐
- TensorRT - 自带工具trtexec的参数使用说明 阅读4505次,点赞0次
- TensorRT - Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors 阅读253次,点赞0次
- TensorRT - 扩展TensorRT C++API的模型输入维度,增加Dims5,Dims6,Dims7,Dims8 阅读1800次,点赞0次
- TensorRT - 转换onnx模型出现Slice_74 requires bool or uint8 I/O but node can not be handled by Myelin错误 阅读417次,点赞0次
- TensorRT - 使用C++ SDK出现无法解析的外部符号 "class sample::Logger sample::gLogger"错误 阅读373次,点赞0次
- TensorRT - Polygraphy工具的使用 阅读4636次,点赞0次
- TensorRT - onnx_graphsurgeon工具库的安装与API简介 阅读806次,点赞0次
- TensorRT - 解决INVALID_ARGUMENT: getPluginCreator could not find plugin ScatterND version 1,TensorRT找不到ScatterND插件的问题 阅读3894次,点赞0次
- TensorRT - 喜大普奔,TensorRT8.2 EA起开始支持Einsum爱因斯坦求和算子 阅读1690次,点赞0次
- TensorRT - Invalid Node - TopK,This version of TensorRT only supports input K as an initializer 阅读201次,点赞0次
全站随机文章推荐
- 资源分享 - 光线跟踪算法技术 Ray Tracing form the Ground Up中文版PDF下载 阅读1143次,点赞0次
- C++ - std::string输出双引号到字符串 阅读3214次,点赞0次
- 资源分享 - Introduction to 3D Game Programming with DirectX 12 英文高清PDF下载 阅读3253次,点赞1次
- Windows - GDI/GDI+区别、用法总结 阅读108次,点赞0次
- 资源分享 - Speech and Language Processing - An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition , Third Edition draft 英文高清PDF下载 阅读649次,点赞0次
- C++11 - 使用std::thread,std::shared_future,std::promise并行化/多线程化for循环,提升处理速度 阅读1516次,点赞0次
- 资源分享 - GLSL Essentials - Enrich your 3D scenes with the power of GLSL 英文高清PDF下载 阅读2287次,点赞0次
- 资源分享 - 图解机器学习(日 杉山将著 许永伟译)PDF下载 阅读4027次,点赞0次
- C++ - 字节数组byte[]或者unsigned char[]与long的相互转换 阅读937次,点赞0次
- Duilib - 界面出现不可拖动和不可拉伸的问题 阅读270次,点赞0次
评论
169