DataXujing / YOLO-v5

:art: Pytorch YOLO v5 训练自己的数据集超详细教程!!! :art: (提供PDF训练教程下载)
GNU General Public License v3.0
913 stars 196 forks source link

AttributeError: 'function' object has no attribute 'names' #22

Open DL-Alva opened 3 years ago

DL-Alva commented 3 years ago

您好,非常感谢您提供的项目代码。最近我使用训练好的模型进行检测时,显示如下报错: Traceback (most recent call last): File "detect.py", line 164, in detect() File "detect.py", line 48, in detect names = model.names if hasattr(model, 'names') else model.modules.names AttributeError: 'function' object has no attribute 'names'

但是前几天我用另外一个数据集做训练和检测时,没有发现类似的问题,我在yaml中把相关内容都改成了符合我数据集的参数。而且我发现models/yolov5x.yaml 和 models/score/yolov5x.yaml这两个文件中的参数不一样。我参考了issue9 也没找到答案,请问您知道这是什么原因吗?期待您的回复。☺

DataXujing commented 3 years ago

检查你的检测类别名称的修改,是否正确,这句error提示在获取所有的检测类别的label name时出现了错误

peidongha commented 3 years ago

您好,我遇到了同样的问题,是否解决了这个问题呐,麻烦您回复一下,谢谢了