jetson TX2运行yolov5并用tensorrt加速,make出现问题

参考教程:yolov5笔记(3)——移动端部署自己的模型(随5.0更新)

一//在进行到

2.build这步

mkdir build
cd build
cmake ..
make -j6
sudo ./yolov5 -s ../yolov5s.wts yolov5s.engine s 
#sudo ./yolov5 -s [.wts] [.engine] [s/m/l/x/s6/m6/l6/x6 or c/c6 gd gw]
#模型引擎生成的命令解释如上          

make -j6时,出现错误: 

********/yololayer.h(54:)error:member function declared with "override" does not override a base class member.

*********

CMakeFiles/myplugins.dir/build.make:63: recipe for target 'CMakeFiles/myplugins.dir/myplugins_generated_yololayer.cu.o' failed
make[2]: *** [CMakeFiles/myplugins.dir/myplugins_generated_yololayer.cu.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/myplugins.dir/all' failed
make[1]: *** [CMakeFiles/myplugins.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

查阅好多天发现是版本问题,一直以为我使用的是v4.0的yolov5, 所以下载tensorrtx时也是选择v4.0,然后重新下载了tensorrtx-yolov5-v5.0,再次按照教程走一遍,发现到

二// 生成.wts文件时发生错误:'-w', '--weights'

v5.0版本的gen_wts.py中的程序与v4.0及以前的都不一样,我又特地找到了v6.0版本的gen_wts.py,发现与4.0及以前的版本相同,于是果断把v5.0版本的gen_wts.py换成v4.0版本的,然后便运行成功了。下载地址:https://github.com/wang-xinyu/tensorrtx.git

成功显示如图:

三// 又遇到了一个问题:下一步生成engine时报错:

[03/14/2022-09:41:08] [E] [TRT] 3: (Unnamed Layer* 17) [Convolution]:kernel weights has count 18432 but 2048 was expected
[03/14/2022-09:41:08] [E] [TRT] 4: (Unnamed Layer* 17) [Convolution]: count of 18432 weights in kernel, but kernel dimensions (1,1) with 64 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 64 * 1*1 * 32 / 1 = 2048
[03/14/2022-09:41:08] [E] [TRT] 4: [convolutionNode.cpp::computeOutputExtents::28] Error Code 4: Internal Error ((Unnamed Layer* 17) [Convolution]: number of kernel weights does not match tensor dimensions)
[03/14/2022-09:41:08] [E] [TRT] 3: [network.cpp::addScale::616] Error Code 3: Internal Error (Parameter check failed at: optimizer/api/network.cpp::addScale::616, condition: shift.count > 0 ? (shift.values != nullptr) : (shift.values == nullptr)
)
yolov5: /home/lzj/lixinxin/yolov5_pen/tensorrtx-yolov5-v5.0/yolov5/common.hpp:155: nvinfer1::IScaleLayer* addBatchNorm2d(nvinfer1::INetworkDefinition*, std::map<std::__cxx11::basic_string<char>, nvinfer1::Weights>&, nvinfer1::ITensor&, std::__cxx11::string, float): Assertion `scale_1' failed.
已放弃

参考类似错误:yolov5模型转到TensorRT中推理(踩坑踩到吐血)

目前已解决,根据上面那个链接中作者说是由于yolov5的版本问题,我重新下载了5.0版的yolov5,重新运行一遍之后成功检测了,速度比不加tensorrt快了将近一倍。

四//但出现了新的问题:

1//位于第一张位置的图片,检测结果不受tensorrt添加的影响。

2//检测结果图中只能框出物体,但不再表明物体名称,也不再显示准确概率值。

具体如图:框的左上角显示的都为0 

有解决的小伙伴可以分享一下具体解决方法吗?非常感谢!!!

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值