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

这篇具有很好参考价值的文章主要介绍了AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

原因

pytorch版本问题

解决办法

顺着路径找到文件upsampling.py并打开,修改里面的代码即可解决, 这个方式不需要重新安装pytorch

YOLOV5 训练好模型测试时出现问题:AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘的解决方法​blog.csdn.net/qq_40280673/article/details/125095353​编辑

找到forward方法, 去掉后传参后面的这句话:

recompute_scale_factor=self.recompute_scale_factor

AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘,深度学习,机器学习,人工智能

  • 成功运行

AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘,深度学习,机器学习,人工智能

其他:

 此问题还可发生在

1、模型转onnx的export.py脚本中pytorch版本问题, 模型转换报错

2、另外就是使用到训练好的模型进行推理时候报错。文章来源地址https://www.toymoban.com/news/detail-689105.html

到了这里,关于AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • AttributeError: ‘OptionEngine‘ object has no attribute ‘execute‘

    背景 pandas:1.5.2 sqlalchemy:2.0.4 报错 解决 https://github.com/pandas-dev/pandas/issues/40686 在这篇文章中看到,sqlalchemy的1.4和2.0两种不同的语法,pandas暂时还不支持2.0,所以将sqlalchemy回退到1.4.45即可。

    2024年02月16日
    浏览(17)
  • AttributeError: ‘NoneType‘ object has no attribute ‘shape‘

    AttributeError: ‘NoneType‘ object has no attribute ‘shape‘

    1.图片不存在或已损坏无法打开(路径不存在, 路径包含中文无法识别 ) 2.读取的图片内容和默认读取时参数匹配不匹配。(默认读取的是3通道的彩色图)例如读取到的图片是灰度图,就会返回None。 3.也可能是路径中有中文 在采集完新数据重新训练模型时抛异常,Attribut

    2024年02月12日
    浏览(18)
  • AttributeError: ‘str‘ object has no attribute ‘word‘

    AttributeError: ‘str‘ object has no attribute ‘word‘

    各位大佬怎么搞啊这个

    2024年02月07日
    浏览(13)
  • AttributeError: ‘list‘ object has no attribute ‘seek‘

    完整的报错为: 初步断定是 torch.load 出了问题。 通过 You can only torch.load from a file that is seekable 这句话可知torch只能load那些seekable的对象,而从 \\\'list\\\' object has no attribute \\\'seek\\\' 可以看出列表是没有seek属性的,于是猜想 torch.load 中传入的参数是列表(一般是传字符串)而导致了这

    2024年02月15日
    浏览(19)
  • 解决AttributeError: ‘Namespace‘ object has no attribute ‘arch‘

    在运行ACmix-ResNet模型时出现问题 很简单的一个错误,没有添加参数 使用parser添加相应参数即可

    2024年02月08日
    浏览(16)
  • 报错AttributeError: ‘NoneType‘ object has no attribute ‘shape‘

    环境: python3.6.4 opencv3.4.1.15 运行目标跟踪object_tracking文件夹中的mean函数时报错且不显示视频结果 查找原因基本上看见三个 1.图片不存在(路径不存在, 路径包含中文无法识别) 2.读取的图片内容和默认读取时参数匹配不匹配。(默认读取的是3通道的彩色图)例如读取到的

    2023年04月27日
    浏览(11)
  • 解决AttributeError: ‘DataFrame‘ object has no attribute ‘append‘

    解决AttributeError: ‘DataFrame‘ object has no attribute ‘append‘

    自然语言处理执行 train_data = pd.DataFrame()... contents = pd.DataFrame(content)... 再执行train_data = train_data.append(contents[:400])出现错误AttributeError: \\\'DataFrame\\\' object has no attribute \\\'append\\\' 估计是pandas版本升级弃用了 老版本\\\'DataFrame\\\'的append方法。由于pandas与众多的第三方软件包捆绑,一般不宜轻易

    2024年02月11日
    浏览(14)
  • 已解决AttributeError: ‘str‘ object has no attribute ‘read‘

    已解决AttributeError: ‘str‘ object has no attribute ‘read‘

    已解决(json.load()读取json文件报错)AttributeError: ‘str‘ object has no attribute ‘read‘ 粉丝群里面的一个粉丝在用Python读取json文件的时候,出现了报错(跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇到这个bug不会解决的小伙伴),报错信息和代码

    2024年02月12日
    浏览(17)
  • Python 中 AttributeError: Int object Has No Attribute 错误

    Python 中 AttributeError: Int object Has No Attribute 错误

    int 数据类型是最基本和最原始的数据类型之一,它不仅在 Python 中,而且在其他几种编程语言中都用于存储和表示整数。 只要没有小数点,int 数据类型就可以存储任何正整数或负整数。 本篇文章重点介绍并提供了一种解决方案,以应对我们在 Python 中使用 int 数据类型时可能

    2024年02月04日
    浏览(13)
  • 已解决AttributeError: ‘list‘ object has no attribute ‘text‘

    已解决AttributeError: ‘list‘ object has no attribute ‘text‘

    已解决AttributeError: ‘list’ object has no attribute ‘text’ 粉丝群里面的一个小伙伴遇到问题跑来私信我,想用selenium操作浏览器自动化,但是发生了报错(当时他心里瞬间凉了一大截,跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇到这个bug不会解决

    2023年04月17日
    浏览(43)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包