geekchen007 / trt-samples-for-hackathon-cn

Simple samples for TensorRT programming
Apache License 2.0
0 stars 0 forks source link

[TensorRT|特征穿越]部署推理场景错误FAQ #2

Open geekchen007 opened 1 year ago

geekchen007 commented 1 year ago

quickstart

TensorRT/quickstart/IntroNotebooks at main · NVIDIA/TensorRT https://github.com/NVIDIA/TensorRT/tree/main/quickstart/IntroNotebooks

geekchen007 commented 1 year ago
  1. Understanding TensorRT Runtimes.ipynb

Python api

https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#perform_inference_python:~:text=on%20the%20stream.-,4.%C2%A0The%20Python%20API,-This%20chapter%20illustrates

geekchen007 commented 1 year ago

TensorRT使用流程如下图所示,分为两个阶段:预处理阶段和推理阶段。 其部署大致流程如下: 1.导出网络定义以及相关权重; 2.解析网络定义以及相关权重; 3.根据显卡算子构造出最优执行计划; 4.将执行计划序列化存储; 5.反序列化执行计划; 6.进行推理 TensorRT(二)TensorRT使用教程(Python版)_ZhouJianGuos的博客-CSDN博客_tensorrt python https://blog.csdn.net/JianguoChow/article/details/122684310

geekchen007 commented 1 year ago

clip-as-service/clip_trt.py at f4eed3bcbf5757571365159582d09f22c0ca8ed2 · jina-ai/clip-as-service https://github.com/jina-ai/clip-as-service/blob/f4eed3bcbf/server/clip_server/model/clip_trt.py

geekchen007 commented 1 year ago

要将yolov7的torch模型转换成tensorRT,你需要以下几个步骤:

  1. 通过export.py脚本将torch模型导出为onnx模型,注意要使用--simplify和--grid参数进行模型简化和输出合并,还要指定输入图片的尺寸和batch size的大小。
  2. 通过yolov7_trt项目将onnx模型转换为tensorRT模型,注意要修改config.yaml文件中的相关配置,如batch size,图像的size,strides和num_anchors等。
  3. 通过yolov7_trt项目进行推理测试,可以看到推理结果。

如果你遇到了问题或者想了解更多细节,你可以参考以下链接:

¹: https://blog.csdn.net/linghu8812/article/details/125741951 ²: https://zhuanlan.zhihu.com/p/556570703

源: 与必应的对话, 2023/4/20 (1) yolov7 PyTorch模型转TensorRT_yolov7 tensorrt_令狐傻笑的博客-CSDN博客. https://blog.csdn.net/linghu8812/article/details/125741951. (2) YOLOv7 部署到 TensorRT(C++ ) - 知乎 - 知乎专栏. https://zhuanlan.zhihu.com/p/556570703. (3) 复杂模型的Pytorch到Tensorrt转换以及Plugin编写 - CSDN博客. https://blog.csdn.net/xuanwu_yan/article/details/111463822. (4) 一文掌握Pytorch-onnx-tensorrt模型转换_onnx转tensorrt_菜鸟滚滚的博客-CSDN博客. https://blog.csdn.net/m0_38043555/article/details/114479282.

geekchen007 commented 1 year ago

AI算法模型中的特征穿越问题:原理篇 - 知乎

https://zhuanlan.zhihu.com/p/402812843

geekchen007 commented 10 months ago

TensorRT对CUDA的版本特别敏感,10.1和10.0的小版本都是有区别的。