(备注):获取wts文件方法可参考以下链接(只要获得wts文件,则链接内剩余内容无需看):
Pytorch模型–>wts 文件–>TensorRT模
cd ~/
git clone -b yolov5-v3.0 https://github.com/wang-xinyu/tensorrtx.git
cp ~/yolov5.wts ~/tensorrtx/yolov5/
cd ~/tensorrtx/yolov5/
mkdir build
cd build
cmake …
make
cd ~/tensorrtx/yolov5/build/
sudo ./yolov5 -s
执行以上命令后需等待较长时间才能生成engine文件
cd ~/tensorrtx/yolov5/build/
cp yolov5s.engine /opt/nvidia/deepstream/deepstream-5.1/sources/yolov5-ros/