训练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 Recall (BPR). Current anchors are a good fit to dataset
Image sizes 640 train, 640 val
Using 0 dataloader workers
Logging results to runs\train\exp14
Starting training for 300 epochs...Epoch gpu_mem box obj cls labels img_size
0%| | 0/8 [00:03<?, ?it/s]
Traceback (most recent call last):
File "train.py", line 634, in
main(opt)
File "train.py", line 525, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 320, in train
loss, loss_items = compute_loss(pred, targets.to(device)) # loss scaled by batch_size
File "E:Deeplearn\yolov5\utils\loss.py", line 120, in call
tcls, tbox, indices, anchors = self.build_targets(p, targets) # targets
File "E:Deeplearn\yolov5\utils\loss.py", line 217, in build_targets
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type __int64
在网络上搜索错误,没有找到解决方案,只能尝试自己分析错误原因。
由于学校的电脑可以正常运行,家中电脑就出现了这个问题,两台电脑的环境差别只有pytorch版本不同,故合理怀疑是Pytorch 1.12版本的问题,将pytorch降级为1.11版本,再次运行后问题解决
PS:pytorch降级办法:
用anaconda管理环境的话,直接输入官方上提供的安装1.11的指令,就可以,由于1.12支持11.6版本的cuda,所以很多人因为cuda版本是11.6所以安装的pytorch1.12(比如我),所以降级的时候一定要注意自己的cuda版本与1.11要求的匹配
# CUDA 10.2
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=10.2 -c pytorch# CUDA 11.3
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch# CPU Only
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cpuonly -c pytorch
训练yolo时报错RuntimeError: result type Float can‘t be cast to the desired output type __int64个人解决方案相关推荐
- 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 ...
- 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 ...
- 解决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 ...
- 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. ...
- 【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 ty ...
- Faster rcnn 训练coco2017数据报错 RuntimeError: CUDA error: device-side assert triggered
Faster rcnn 训练coco2017数据报错 RuntimeError: CUDA error: device-side assert triggered 使用faster rcnn训练自己的 ...
- 项目中引用NG-ZORRO,在使用nz-form时报错Can't bind to 'formGroup' since it isn't a known property of 'form'的解决方案
项目中引用NG-ZORRO,在使用nz-form时报错 Can't bind to 'formGroup' since it isn't a known property of 'form' comp ...
- (已解决)多卡训练时报错RuntimeError: grad can be implicitly created only for scalar outputs
背景 博主第一次使用多卡训练,在程序中添加了如下代码 # 包装为并行风格模型 os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID& ...
最新文章
- maven基础概念学习1
- golang sqlite数据库 rows.Close()造成 错误database is locked
- 处理视频小工具 -- ffmpeg
- mysql与redis面试题
- CMU提出「十字绣网络」,自动决定多任务学习的最佳共享层
- 网络 IO 演变过程
- avalon2学习教程04显示隐藏处理
- php中的getdate+函数,PHP中的getdate()函数
- hadoop 单机伪分布式安装步骤
- 市场活动课件:SQL Server 索引优化
- python高端写法_python高级篇:使用元类方式实现单例模式详解
- 黑马程序员-android视频播放器
- 机器人动力学-牛顿-欧拉方程
- python 进制转换
- ae2018怎么打开2019_AE CC 2019新功能全面解析!
- 学习java数组的练习代码
- ybt1359: 围成面积
- python中repeat_Python中的Repeat类方法
- jQuery实现点击文本框弹出热门标签的提示示例
- 遗传算法介绍并附上Matlab代码
热门文章
- 测试并整理的 Airpods Pro 刻字可用的最全特殊符号
- 计算机兴趣小组活动总结,小学生课外阅读兴趣小组活动总结
- asp.net907-图形文件管理系统的设计与开发#毕业设计
- Debian迅雷看看在线播放
- 辐射避难所买了东西显示服务器异常,辐射避难所容易犯的错误汇总 辐射避难所有哪些容易犯的错误 武器装备-游侠网...
- 2019江苏省计算机一级准考证打印,江苏2019年计算机等级准考证打印时间丨入口...
- appserv mysql登录失败
- TIP-LAS 藏语分词工具使用
- event.srcElement.parentElement用法演示
- 【时事摘抄】邵氏弃儿:生命处境的残酷寓言