Traceback (most recent call last): File "/Users/jason/Downloads/yolov5-5.0/detect.py", line 183, in <module> detect() File "/Users/jason/Downloads/yolov5-5.0/detect.py", line 39, in detect model = attempt_load(weights, map_location=device) # load FP32 model File "/Users/jason/Downloads/yolov5-5.0/models/experimental.py", line 118, in attempt_load ckpt = torch.load(w, map_location=map_location) # load File "/Users/jason/Downloads/yolov5-7.0/venv/lib/python3.10/site-packages/torch/serialization.py", line 809, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/Users/jason/Downloads/yolov5-7.0/venv/lib/python3.10/site-packages/torch/serialization.py", line 1172, in _load result = unpickler.load() File "/Users/jason/Downloads/yolov5-7.0/venv/lib/python3.10/site-packages/torch/serialization.py", line 1165, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from '/Users/jason/Downloads/yolov5-5.0/models/common.py'>
时间: 2023-06-07 12:10:16
浏览: 149
这是一个Python[代码]([http](https://geek.csdn.net/educolumn/68f28ca3131d47699e5902c5d3d74d51?spm=1055.2569.3001.10083)s://geek.csdn.net/educolumn/1572ef9b473b4e00f6b2bf6d428b7c27?spm=1055.2569.3001.10083)的错误提示[信息](https://geek.csdn.net/educolumn/4b7516410bb8585d5db30bb2e9a69b47?spm=1055.2569.3001.10083),[显示](https://geek.csdn.net/educolumn/103ca72607c717122e068b9f06a24df6?spm=1055.2569.3001.10083)出错的文件路径是“/Users/jason/Downloads/yolov5-5.0/detect.py”,错误的具体位置在第183行,最近的[调用](https://geek.csdn.net/educolumn/67aac0e278b6ccafb1cca450c4252459?spm=1055.2569.3001.10083)是在第39行。错误原因是在尝试加载模型权重时出现问题。
相关问题
报错Traceback (most recent call last): File "C:\Users\Onlooker\Desktop\yolov5-5.0\yolov5-5.0\train.py", line 12, in <module> import torch.distributed as dist ModuleNotFoundError: No module named 'torch'
这个错误提示表明您的代码中导入了`torch`模块,但是系统找不到该模块。出现这种情况可能是由于以下原因之一:
1. Torch未正确安装:请确保您已经正确安装了torch。您可以使用以下命令通过pip安装torch:
pip install torch
```
Traceback (most recent call last): File "C:\Users\lenovo\Desktop\yolov5-7.0\yolov5-7.0\detect.py", line 35, in <module>
There was an error in the detect.py file on line 35. Without more information, it is difficult to determine the exact cause of the error. Please provide more context or the full error message for further assistance.