1+ ##
12## B站同步视频讲解
23- https://www.bilibili.com/video/BV1Xw411f7FW
34- 相关PPTX下载:http://zifuture.com:1556/fs/sxai/tensorRT.pptx
14153 . TensorRT.vcxproj文件中,修改` <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 10.0.targets" /> ` 为你配置的CUDA路径
15164 . TensorRT.vcxproj文件中,修改` <CodeGeneration>compute_61,sm_61</CodeGeneration> ` 为你显卡配备的计算能力
1617 - 根据型号参考这里:https://developer.nvidia.com/zh-cn/cuda-gpus#compute
17- 5 . 配置依赖,或者下载依赖到lean中 。配置VC++目录->包含目录和引用目录
18+ 5 . 配置依赖或者下载依赖到lean中 。配置VC++目录->包含目录和引用目录
18196 . 配置环境,调试->环境,设置PATH路径
19207 . 编译并运行案例
2021
@@ -27,7 +28,7 @@ image = cv2.imread("inference/car.jpg")
2728bboxes = yolo.commit(image).get()
2829```
2930
30- - Pytorch无缝对接
31+ - Pytorch的无缝对接
3132``` python
3233model = models.resnet18(True ).eval().to(device)
3334trt_model = tp.convert_torch_to_trt(model, input )
@@ -122,6 +123,7 @@ cd tensorRT_cpp
122123make yolo - j32
123124```
124125
126+
125127# # YoloX的支持
126128- https:// github.com/ Megvii- BaseDetection/ YOLOX
127129- 你可以选择直接make run,会从镜像地址下载onnx并推理运行看到效果。不需要自行导出
@@ -166,6 +168,7 @@ model.head.decode_in_inference = True
166168
1671693 . 导出onnx模型
168170```bash
171+
169172# 下载模型,或许你需要翻墙
170173# wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_m.pth
171174
@@ -311,6 +314,7 @@ auto int8process = [](int current, int count, vector<string>& images, shared_ptr
311314 }
312315};
313316
317+
314318// 编译模型指定为INT8
315319auto model_file = " yolov5m.int8.trtmodel" ;
316320TRT ::compile (
@@ -339,11 +343,11 @@ engine->print();
339343// 加载图像
340344auto image = imread(" demo.jpg" );
341345
342- // 获取模型的输入和输出tensor节点,可以根据名字或者索引获取第几个
346+ // 获取模型的输入和输出tensor节点,可以根据名字或者索引获取具体第几个
343347auto input = engine-> input (0 );
344348auto output = engine-> output(0 );
345349
346- // 把图像塞到input tensor中,这里是减去均值,除以标准差
350+ // 把图像塞到input tensor中,这里是减去均值,并除以标准差
347351float mean[] = {0 , 0 , 0 };
348352float std[] = {1 , 1 , 1 };
349353input -> set_norm_mat(i, image, mean, std);
@@ -385,6 +389,7 @@ int HSwish::enqueue(const std::vector<GTensor>& inputs, std::vector<GTensor>& ou
385389 return 0 ;
386390}
387391
392+
388393RegisterPlugin(HSwish);
389394```
390395
@@ -437,9 +442,9 @@ Engine 0x23dd7780 detail
437442[2021 - 07 - 22 14 :37 :42 ][info][_main.cpp:124 ]:outputs[0 ].size = 2
438443[2021 - 07 - 22 14 :37 :42 ][info][_main.cpp:124 ]:outputs[1 ].size = 5
439444[2021 - 07 - 22 14 :37 :42 ][info][_main.cpp:124 ]:outputs[2 ].size = 1
440- ```
441445
446+ ```
442447
443448# # 关于
444449- 我们的博客地址:http:// www.zifuture.com:8090 /
445- - 我们的B站地址:https:// space.bilibili.com/ 1413433465
450+ - 我们的B站地址:https:// space.bilibili.com/ 1413433465
0 commit comments