YOLOv5报错:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘ 的解决方案
YOLOv5报错:AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor' 的解决方案
错误代码:
File "E:/PycharmProjects/yolo-flask-html/detect.py", line 182, in <module>
detect()
File "E:/PycharmProjects/yolo-flask-html/detect.py", line 61, in detect
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "E:\PycharmProjects\yolo-flask-html\models\yolo.py", line 123, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "E:\PycharmProjects\yolo-flask-html\models\yolo.py", line 139, in forward_once
x = m(x) # run
File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\upsampling.py", line 154, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1185, in __getattr__
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
解决方案:
降低PyTorch的版本到1.9.0,PyTorch的历史版本Previous PyTorch Versions | PyTorch
# CUDA 10.2
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=10.2 -c pytorch
# CUDA 11.3
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=11.3 -c pytorch -c conda-forge
# CPU Only
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cpuonly -c pytorch
YOLOv5报错:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘ 的解决方案的更多相关文章
- py+selenium 明明定位不到元素,但却不报错或是报错AttributeError: 'list' object has no attribute 'click'【已解决】
问题:定位不到元素,但却不报错或者出现报错AttributeError: 'list' object has no attribute 'click' 如图 或者 解决方法: 将”driver ...
- dnspython模块报错 AttributeError: 'CNAME' object has no attribute 'address'
有时候用到这个模块的时候会报错 AttributeError: 'CNAME' object has no attribute 'address' 如下所示 [root@ansible ch01]# ...
- 关于flask登录视图报错AttributeError: '_AppCtxGlobals' object has no attribute 'user'
在一个小程序中写了一个登录视图函数,代码如下: @app.route('/login',methods = ['GET','POST']) @oid.loginhandler def login(): ...
- Django2.2报错 AttributeError: 'str' object has no attribute 'decode'
准备将 Django 连接到 MySQL,在命令行输入命令 python manage.py makemigrations 后报错: AttributeError: 'str' object has ...
- python文件名不要跟模块名相同,报错AttributeError: 'module' object has no attribute 'Differ'
python中的文件都会生成pyc文件,包括模块也是这样,所以调用模块的时候,实际上会调用模块.pyc文件:在这个前提下,如果将文件名命名成跟模块名一样,在同一目录下就会生成一个跟模块名一样的pyc文 ...
- 机器学习实战:KNN代码报错“AttributeError: 'dict' object has no attribute 'iteritems'”
报错代码: sortedClassCount = sorted(classCount.iteritems(), key=operator.itemgetter(1), reverse=True) 解决 ...
- 运行pytest,报错"AttributeError: 'module' object has no attribute 'xxx'"
最近学习pytest被此问题困扰,敲脑壳,实在是不该.百度解决方法一大堆,我的问题怎么也解决不了,来看一下,我是怎么解决的,各位大佬勿喷,只是自己做笔记用,谢谢. 报错信息如下: 网上解决方法是这样的 ...
- python报错“AttributeError: 'set' object has no attribute 'items'“
作为才开始学爬虫的萌新,遇到了一个这样的错,很懵逼 后面到网络到处查看大佬的解决方法,才发现headers的请求头部信息有错误,headers是一个字典,不是字符串,所以报错了 原代码 headers ...
- [已解决]报错:报错AttributeError: 'int' object has no attribute 'upper'
原因:openpyxl版本低,需升级 pip install --upgrade openpyxl
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
随机推荐
- rabbitmq学习与总结
一.rabbitmq的使用场景 1.高并发的流量削峰 举个例子,假设某订单系统每秒最多能处理一万次订单,也就是最多承受的10000qps,这个处理能力应付正常时段的下单时绰绰有余,正常时段我们下单一秒 ...
- 康谋方案 | BEV感知技术:多相机数据采集与高精度时间同步方案
随着自动驾驶技术的快速发展,车辆准确感知周围环境的能力变得至关重要.BEV(Bird's-Eye-View,鸟瞰图)感知技术,以其独特的视角和强大的数据处理能力,正成为自动驾驶领域的一大研究热点. 一 ...
- React项目报错:Element type is invalid: expected a string可能的原因
React项目报错:Element type is invalid: expected a string 起因:React使用Antd组件库,因为某些原因实在用不下去了,代码不变直接改成Tdesig ...
- 解决MySQL数据库中1045错误[1045 Access denied for user 'root'@'localhost' (using password:YES)]
数据库连接异常 1045 Access denied for user 'root'@'localhost' (using password:YES) 这种问题的本质是用户密码出现错误 解决方案 1. ...
- nim 语言使用 concept 实现 c# 的interface
nim简介 nim语言兼顾C#等高级语言语义表达的丰富性,又有 C 语言的灵活性,以及超强的性能.下面是中文站对他的总结,我抄下来: Nim 是一种静态类型的.编译型.系统编程语言.它结合了其他成熟语 ...
- EFCore与List的随机算法
IQurable<T>,数据库层面的随机,OrderBy(x => EF.Functions.Random()); _coreDbContext.org.OrderBy(x => ...
- quartz——Corn表达式
摘录:quartz Cron表达式一分钟教程 - 简书 (jianshu.com) Quartz学习之Cron表达式详解_five-five的博客-CSDN博客_quartz cron表达式 每隔5秒 ...
- python_pyinstall打包exe后文件找不到(路径不对),包括配置文件找不到,excel文件找不到等等
运行路劲和当前文件真实路径不是一个!! 解决 real_dir = os.path.dirname(os.path.realpath(sys.executable))
- 想让鸿蒙应用快的“飞起”,来HarmonyOS开发者官网“最佳实践-性能专区”
在鸿蒙应用开发过程中,应用侧流畅运行体验是开发者非常关注的部分.为此,华为HarmonyOS开发者官网推出了"最佳实践-性能专区"(以下简称"性能专区"),通过 ...
- 架构哲学与游戏工业化:策划x程序x抽象x复用x易用=降本增效
(一)前言 策划 x 程序 x 抽象 x 复用 x 易用 = 降本增效 公式为什么是乘法而不是加法? 如果是加法,任何一个维度的数据为0时结果可能还是正数:如果是乘法,任何一个维度数据都不能为0否则结 ...