AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from 'D:\\yolo5-face\\yolov5-face-master\\models\\common.py'>
时间: 2023-10-31 11:19:52 浏览: 125
你遇到的错误信息是AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from 'D:\\PyCharmProject\\yolov5-5.0\\yolov5-5.0\\models\\common.py'>。这个错误通常是由于在models.common文件中缺少SPPF方法引起的。根据你提供的参考资料,网上的解决方法是从6.1版本中将SPPF方法复制过来以解决这个问题。然而,你提到在继续运行时仍然报错,错误信息为RuntimeError: The size of tensor a (52) must match the size of tensor b (56) at non-singleton dimension 3 。这个错误可能是由于权重文件和源代码版本不匹配引起的。为了解决这个问题,你可以从yolov5仓库下载与你的代码版本对应的yolov5s.pt文件,并将其放入models文件夹下。然后,你需要修改detect.py文件中的weights路径以指向新的yolov5s.pt文件。这样,你应该能够解决AttributeError和RuntimeError的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [运行YOLOv5出现报错找不到SPPF错误,进行解决AttributeError: Can‘t get attribute ‘SPPF‘ on <module ...](https://blog.csdn.net/m0_50004939/article/details/126739291)[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_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/home/yolov5/...](https://blog.csdn.net/qq_42257666/article/details/125605265)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文