Deepstream 自定义检测Yolo v5模型吞吐量测试
主要参考:
https://zhuanlan.zhihu.com/p/365191541
在步骤六已经在tensorrtx/yolov5/build目录下编译生成best.engine文件,接下来将原始文件car/JPEGImages/复制到对应文件夹内,这里我放置在dataset/文件夹下。
在build文件夹内测试代码:
输出结果直接保存在build文件夹内。
使用python代码测试
测试前需要安装pycuda包:
报错error: cuda.h: No such file or directory aarch64-linux-gnu-gcc failed
仍然出错error: cuda.h: No such file or directory
参考:https://cloud-atlas.readthedocs.io/zh_CN/latest/machine_learning/jetson/develop/jetson_pycuda.html
尝试:
仍然失败error: cuda.h: No such file or directory
参考:https://forums.developer.nvidia.com/t/pycuda-installation-failure-on-jetson-nano/77152
尝试:
仍然失败error: cuda.h: No such file or directory
尝试:
安装成功,退出root模式,python yolov5_trt.py运行成功。
尝试视频检测:
Compile nvdsinfer_custom_impl_Yolo
- Run command
- Donwload my external/yolov5-5.0 folder and move files to created yolo folder
- Compile lib
- x86 platform
- Jetson platform
修改labels.txt为一个类 car
将测试用的car.mp4放在samples streams下面,然后修改deepstream_app_config.txt中的视频位置。
Testing model
Use my edited deepstream_app_config.txt and config_infer_primary.txt files available in my external/yolov5-5.0 folder
Run command
吞吐量测试结果:
测试数据:20190729-113131 south port 12.6km.mp4
batchsize | FPS(Avg) |
1 | 20 |
2 | 19.5 |
4 | 21 |
8 | 17 |
参考操作步骤:
1.修改tensorrtx/yolov5/yolov5.cpp中的BATCH_SIZE
2.Build tensorrtx/yolov5
3.Move generated yolov5s.wts file to tensorrtx/yolov5 folder (example for YOLOv5s)
4.Convert to TensorRT model (yolov5s.engine file will be generated in tensorrtx/yolov5/build folder)
5.删除nvdsinfer_custom_impl_Yolo中之前生成的三个文件,复制best_BS2.engine到/opt/nvidia/deepstream/deepstream-5.1/sources/yolov5文件夹
修改config_infer_primary.txt文件
- model-engine-file=best_BS2.engine
- num-detected-classes=1
修改deepstream_app_config.txt文件
- batch-size=2
修改labels.txt为一个类 car
将测试用的car.mp4放在samples streams下面,然后修改deepstream_app_config.txt中的视频位置。
Testing model
Use my edited deepstream_app_config.txt and config_infer_primary.txt files available in my external/yolov5-5.0 folder
Run command