Skip to content

Commit fd44e37

Browse files
author
Wish
committed
merge
2 parents 358d96e + 1c6bccf commit fd44e37

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
##
12
## B站同步视频讲解
23
- https://www.bilibili.com/video/BV1Xw411f7FW
34
- 相关PPTX下载:http://zifuture.com:1556/fs/sxai/tensorRT.pptx
@@ -14,7 +15,7 @@
1415
3. TensorRT.vcxproj文件中,修改`<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 10.0.targets" />`为你配置的CUDA路径
1516
4. 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++目录->包含目录和引用目录
1819
6. 配置环境,调试->环境,设置PATH路径
1920
7. 编译并运行案例
2021

@@ -27,7 +28,7 @@ image = cv2.imread("inference/car.jpg")
2728
bboxes = yolo.commit(image).get()
2829
```
2930

30-
- Pytorch无缝对接
31+
- Pytorch的无缝对接
3132
```python
3233
model = models.resnet18(True).eval().to(device)
3334
trt_model = tp.convert_torch_to_trt(model, input)
@@ -122,6 +123,7 @@ cd tensorRT_cpp
122123
make 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
167169
3. 导出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
315319
auto model_file = "yolov5m.int8.trtmodel";
316320
TRT::compile(
@@ -339,11 +343,11 @@ engine->print();
339343
// 加载图像
340344
auto image = imread("demo.jpg");
341345
342-
// 获取模型的输入和输出tensor节点,可以根据名字或者索引获取第几个
346+
// 获取模型的输入和输出tensor节点,可以根据名字或者索引获取具体第几个
343347
auto input = engine->input(0);
344348
auto output = engine->output(0);
345349
346-
// 把图像塞到input tensor中,这里是减去均值,除以标准差
350+
// 把图像塞到input tensor中,这里是减去均值,并除以标准差
347351
float mean[] = {0, 0, 0};
348352
float std[] = {1, 1, 1};
349353
input->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+
388393
RegisterPlugin(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

python/test_yolov5.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
saveto = "single_inference/yolov5.car.jpg"
2424
print(f"Save to {saveto}")
2525

26-
cv2.imwrite(saveto, image)
26+
cv2.imwrite(saveto, image)
27+

0 commit comments

Comments
 (0)