YOLO5+TENSORRT acceleration

YOLO5+TENSORRT acceleration1.Precautions before use2.start using3.Can testing achieve acceleration

1.Precautions before use

If you are using the YAHBOOM version of the image, there is no need to build the environment. If you are building the environment yourself, you need to download the Tensorrt package The version of yoloV5 should correspond to the package of Tensorrt This tutorial uses the YOLO5 V5.0 version, so the Tensorrt acceleration package also needs to use V5.0 This is the Tensorrt download link:https://github.com/wang-xinyu/tensorrtx/tree/master/yolov5

2.start using

  1. Gen under tensorrt/yolov5 Copy gen_wts.py to the folder of yolov5
  2. Execute gen_wts.py build .wts file。
  1. Go to the yolov5 folder under the directory tensorrtx as usual, create a build file, and enter
  1. Classify in yololayer. h_ Modify NUM to yours. The official dataset is Coco, so the default is 80. (This step can be ignored if it is official)
  2. 执行makeFile。(Make once every time it is modified to ClassNUM)
  1. Copy the wts file from the file path of yoloV5 to tensorrtx/yolov5.
  2. build .engine file

3.Can testing achieve acceleration

way1:Enter the folder tensorrtx/yolo5/build and run the command

Can be run in the YOLOv5 folder

By comparison, it can be clearly seen that the addition of Tensorrtx greatly reduces the recognition time of images image-2023040400001

way2:running

It can also be run in the YOLOv5 folder

By comparison, it can be clearly seen that the addition of Tensorrtx greatly reduces the recognition time of images image-2023040400002