跑YOLOv5遇到的问题

一、RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation

解决办法:在第148行下添加一行with torch.no_grad():

参考文章:RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation_一起变胖吧的博客-CSDN博客

二、RuntimeError: No such operator torchvision::nms

解决办法:pytorch和torchvision的版本不匹配,查找相对应的版本并重装

参考文章:RuntimeError: No such operator torchvision::nms问题解决方法_StrongerTang的博客-CSDN博客

arm64下安装pytorch,torchvision,torchaudio以及它们之间的版本对应关系_SimonLiu009的博客-CSDN博客_arm64 pytorch

三、TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.

解决办法:根据提示在tensor.py中第678行添加.cpu()

参考文章:Pycharm中运行yolov5-pytorch出现错误“TypeError: can‘t convert cuda:0 device type tensor to numpy....“_明德zhuang的博客-CSDN博客四、AttributeError: 'Hardswish' object has no attribute 'inplace'

解决办法:根据提示定位到activation.py 中第475行,将input后的删掉

 参考文章:yolov5报错:AttributeError: ‘Hardswish‘ object has no attribute ‘inplace‘_长沙有肥鱼的博客-CSDN博客

五、AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘

解决办法:在detect.py运行过程中报错,根据提示定位到upsampling.py中的153行,将代码改成如下

参考文章: AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘_阳光不锈@的博客-CSDN博客

六、UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 357: invalid continuation byte

解决办法:在…/yolov5-master/train.py中把with open(opt.hyp) as f:改为with open(opt.hyp, encoding='gb2312') as f:
 

参考文章:

YOLOv5中‘utf-8‘ codec can‘t decode编码问题-CSDN博客

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值