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 ...
随机推荐
- Golang 语言学习路线
学习Go语言是一个很好的选择,它具有高效的编译速度.强大的并发支持和简洁的语法.适用于初学者的Golang学习路线: 1. 学习基础: 安装Go:从官方网站下载并安装Go语言的最新版本. Hello, ...
- Supergateway:MCP服务器的远程调试与集成工具
Supergateway 是一款专为 MCP(Model Context Protocol)服务器设计的远程调试与集成工具,通过 SSE(Server-Sent Events)或 WebSocket( ...
- 【Linux】5.9 Shell函数
Shell 函数 1. 自定义函数 linux shell 可以用户定义函数,然后在shell脚本中可以随便调用. shell中函数的定义格式如下: [ function ] funname [()] ...
- Sql语句:条件限制语句
where select sname,sdept,sage from student where ssex = '男' or ssex = '女' and sage not between 20 an ...
- 【深度解析】SkyWalking 10.2.0版本安全优化与性能提升实战指南
前言 Apache SkyWalking 作为云原生可观测性领域的佼佼者,在微服务架构监控中扮演着至关重要的角色.然而,官方版本在安全性.镜像体积和功能扩展方面仍有优化空间.本文将分享一套完整的 Sk ...
- public boolean add(E e)的源码分析
public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess ...
- 康谋方案 | ADAS时空融合数据采集方案
自动驾驶技术的飞速发展,正在重新定义未来出行的边界.从感知到决策,从规划到控制,每一个环节都离不开海量.精准的高质量数据支撑.然而,随着传感器数量的增加和数据规模的指数级增长,行业正面临一系列挑战:多 ...
- .net clr 8年才修复的BUG,你让我损失太多了
一.概述 .NET社区修复问题可谓是龟速,一个BUG在.NET 7.0+版本才修复,你让我损失了几万块,我现在还记得客户那种质疑的表情,你了解那种尬尴的气氛吗?你让我一度怀疑dotnetty,我从来不 ...
- js录制系统/麦克风声音(基于electron)
最近想用electron写一个和音视频相关的软件,尽管在写之前都想好了要用哪些技术,但依然写得很艰难,今天对相关知识的个人理解做个记录和整理. 时隔半年,最近发现网上有大神造好的轮子,而且功能强大:h ...
- 三维装箱问题(3D Bin Packing Problem, 3D-BPP)
提出问题 集装箱海运家具, 沙发, 茶几, 椅子等等, 有多少套家具,以及每个家具的长宽高都会告诉你. 把所有的家具都装进集装箱里, 要求通过算法算出一共需要多少集装箱. 1.要考虑怎样装, 需要的集 ...