Traceback (most recent call last):
File “C:/Users/liqiang/Desktop/PyTorch_YOLOv3/detect.py”, line 145, in
print(“\t+ Label: %s, Conf: %.5f” % (classes[int(cls_pred)], cls_conf.item()))
IndexError: list index out of range此错误的原因
(1)list[index]中的index超出了范围
(2)list没有相应的元素
而且定为到报错的行数时,同长会有for循环,修改的办法有:
输入以下代码:
print("\t+ Label: %s, Conf: %.5f" % (classes[int(cls_pred)], cls_conf.item()))
修改为:(类似于自己的代码修改)—–试试看,也许可行
try: print("\t+ Label: %s, Conf: %.5f" % (classes[int(cls_pred)], cls_conf.item())) except: continue
文章出处登录后可见!
已经登录?立即刷新