【Error Logs】YoloV5出现RuntimeError: result type Float can‘t be cast to the desired output
问题描述
在训练 yolov5
做简单的识别的时候出现,错误:RuntimeError: result type Float can‘t be cast to the desired output type long int
。下面对解决方案进行记录。
问题分析
所有的操作都是按照官网的教程来实施的,但是还是出现了错误,官网的yolov5-master
版本可以正常运行,但是yolov5-5.0/yolov5-6.1
等版本就是不可以运行, 想着是不是由于master版本和其他分支等版本下的utils的loss.py文件是不一样的。我估计是版本更新的时候出现了问题。
问题解决
修改utils/loss.py
文件中的两处内容:
第一处:
- 在
loss.py
中,找到for i in range(self.nl):anchors = self.anchors[i]
把上面的代码改成
for i in range(self.nl):anchors, shape = self.anchors[i], p[i].shape
- 在改了上面的内容之后,在找到控制点的
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid
改成:
indices.append((b, a, gj.clamp_(0, shape[2] - 1), gi.clamp_(0, shape[3] - 1))) # image, anchor, grid
之后就可以开始训练了:
总结
其实我也玩不明白,也是网上东抄抄,西看看,就纯记录。
参考
https://blog.csdn.net/qq_42835363/article/details/127753543
pudn.com/news/6321667af0cde61357537e80.html
【Error Logs】YoloV5出现RuntimeError: result type Float can‘t be cast to the desired output相关推荐
- 解决Yolov5的RuntimeError: result type Float can‘t be cast to the desired output type long int 问题
在yolov5中,直接下载github上的代码可能出现无法运行的情况,会报错 RuntimeError: result type Float can't be cast to the desired ...
- YOLOV5报错:RuntimeError: result type Float can‘t be cast to the desired output type long int
YOLOV5训练时报错: Traceback (most recent call last): File "train.py", line 626, in <module ...
- 训练yolo时报错RuntimeError: result type Float can‘t be cast to the desired output type __int64个人解决方案
运行YOLOv5 6.1和yolor的时候,训练都没能正常运行,均出现了如下错误: AutoAnchor: 5.00 anchors/target, 1.000 Best Possible Recal ...
- RuntimeError: result type Float can‘t be cast to the desired output type __int64
yolo问题:RuntimeError: result type Float can't be cast to the desired output type __int64 解决办法: loss.p ...
- 解决错误:RuntimeError: result type Float can‘t be cast to the desired output type __int64
在运行yolov5 train.py时出现了这个错误 解决方式: 将loss.py中gain = torch.ones(7, device=targets.device)改为gain = torch. ...
- YOLOv5训练报错:result type Float can‘t be cast to the desired output type __int64
记录一个报错: 因为把Pytorch版本从1.8.0更新到1.13.1,YOLOv5-6.1版本的训练代码报错: RuntimeError: result type Float can't be ca ...
- 成功解决Type Error: can‘t multiply sequence by non-int of type ‘float‘
成功解决Type Error: can't multiply sequence by non-int of type 'float' 目录 解决问题 解决思路 解决方法 解决问题 File " ...
- 使用PyTorch前向运算时出现“RuntimeError: Expected object of scalar type Long but got scalar type Float for ……”
1 问题描述 今天在使用PyTorch搭建模型时,出现了一个问题: RuntimeError: Expected object of scalar type Long but got scalar t ...
- Runtime error: expected scalar type Float but found Double
错误:Runtime error: expected scalar type Float but found Double w_true=torch.tensor([2,-3.4]).T b_true ...
最新文章
- c# 垃圾回收是引用类型而言的
- Windows下启动停止SQL Server 2005服务
- 02 基本序列以及序列表示
- 最好的android one手机,最高配置的Android One手机登场 LG推出G7 One与G7 F
- c语言春考题目,PAT 2017年春考乙级真题(1066. 图像过滤)(C语言)
- 信息学奥赛一本通 1188:菲波那契数列(2) | OpenJudge NOI 2.3 1760:菲波那契数列(2)
- Java I/O体系之OutputStream和InputStream详细讲解
- 提取字符串中字母数字方法
- windows server 2008配置之AD域服务器 1
- 浅谈tcpwrapper的基本使用方法
- 【Spark重点难点08】Spark3.0中的AQE和DPP小总结
- mysql怎么实现表的复制粘贴_如何对MySQL数据表进行复制、表结构复制
- 英语音标、发音技巧、浊化规则
- (半翻译)篡改mac应用后,如何resign签名,重新获得mac系统的信任?
- sklearn学习之Spectral Clustering
- Java虚拟机部分知识点
- Revit导出PDF格式图纸流程及“批量导出图纸”
- (二) 数据挖掘之分类
- 正则表达式(Regular Expression)——入门笔记(常用正则表达式符号、正则表达式在线调试工具)
- RK3399平台开发系列讲解(内核驱动外设篇)6.17、VOP驱动解析