一步真實解決AttributeError:‘Upsample‘?object?has?no?attribute‘recompute_scale_factor‘的問題
你是不是在Pycharm等編譯器和Colab等服務器上運行yolov5的detect.py出現(xiàn)下面的這個問題
那么我們跟著錯誤去上面的提示信息找方法
可以發(fā)現(xiàn)是關于"Upsample“和 'recompute_scale_factor',相關的提示是在這里
緊接著 ,按著提示文件路徑一步一步的打開usampling.py,找到第155行附近
這是發(fā)現(xiàn)在,154行有我們剛才提到的關鍵信息
然后把第154行還有153行最后的逗號","刪掉,再保存一下子
最后的效果如下
或者你把剛才提到的哪一行加個注釋,注釋掉也是可以的。
def forward(self, input: Tensor) -> Tensor: return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)
然后運行下detect.py,發(fā)現(xiàn)問題解決~
到此這篇關于一步真實解決AttributeError: ‘Upsample‘ object has no attribute ‘recompute_scale_factor‘的問題的文章就介紹到這了,更多相關Upsample object has no attribute內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
- 關于pycharm 切換 python3.9 報錯 ‘HTMLParser‘ object has no attribute ‘unescape‘ 的問題
- python報錯: ''list'' object has no attribute ''shape''的解決
- 解決運行出現(xiàn)''dict'' object has no attribute ''has_key''問題
- 解決運行django程序出錯問題 ''str''object has no attribute''_meta''
- Python3下錯誤AttributeError: ‘dict’ object has no attribute’iteritems‘的分析與解決
- python錯誤:AttributeError: ''module'' object has no attribute ''setdefaultencoding''問題的解決方法
相關文章
Python3 sort和sorted用法+cmp_to_key()函數(shù)詳解
這篇文章主要介紹了Python3 sort和sorted用法+cmp_to_key()函數(shù)詳解,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-07-07python web應用程序之Django數(shù)據(jù)庫詳解
這篇文章主要介紹了python web應用程序之Django數(shù)據(jù)庫,本文通過實例代碼給大家介紹的非常詳細,需要的朋友可以參考下2024-06-06pytorch之torchvision.transforms圖像變換實例
今天小編就為大家分享一篇pytorch之torchvision.transforms圖像變換實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-12-12