Can't get attribute 'SPPF' on <module 'models.common' from 'E:\\tudui_learnlearn\\yolov5-5.0\\models\\common.py'>
时间: 2023-10-09 12:14:32 浏览: 88
报错信息中的"Can't get attribute 'SPPF' on <module 'models.common' from 'E:\\tudui_learnlearn\\yolov5-5.0\\models\\common.py'>" 表示在模块"models.common"中无法获取属性"SPPF"。
解决此问题的方法是在common.py文件的class SPP上方添加一个名为class SPPF的类。具体操作如下:
1. 打开common.py文件。
2. 找到class SPP的位置,大概在文件的160行左右。
3. 在class SPP上方添加以下代码:
```
class SPPF():
def __init__(self):
...
```
注意:在添加代码之前,请确保已导入warnings包,即在文件开头添加`import warnings`。
添加完class SPPF类之后,保存文件并重新运行程序,应该就能解决报错了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Yolov5-5.0 解决报错:AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common](https://blog.csdn.net/m0_62949566/article/details/127465740)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [yolov5-v0.3模型.zip](https://download.csdn.net/download/peach_orange/12717589)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文