YOLO-v5 icon indicating copy to clipboard operation
YOLO-v5 copied to clipboard

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

Open DL-Alva opened this issue 4 years ago • 2 comments

您好,非常感谢您提供的项目代码。最近我使用训练好的模型进行检测时,显示如下报错: 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 也没找到答案,请问您知道这是什么原因吗?期待您的回复。☺

DL-Alva avatar Nov 05 '20 07:11 DL-Alva

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

DataXujing avatar Nov 17 '20 00:11 DataXujing

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

peidongha avatar May 28 '21 06:05 peidongha