KeyError while running detect.py #13160
Unanswered
sadhanashegde
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I trained my data in yolov5 and downloaded the best.pt , but while running im getting error, i even changed my coco128.yaml to same as my data.yaml
python detect.py --weights best.pt --source chess2.jpg --data data\coco128.yaml
detect: weights=['best.pt'], source=chess2.jpg, data=data\coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_csv=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs\detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 v7.0-334-g100a423b Python-3.11.0 torch-2.3.1+cpu CPU
YOLOv5s summary (fused): 193 layers, 9112697 parameters, 0 gradients, 23.8 GFLOPs
Traceback (most recent call last):
File "C:\Users\sadha\Downloads\objectDetect\yolov5\detect.py", line 313, in
main(opt)
File "C:\Users\sadha\Downloads\objectDetect\yolov5\detect.py", line 308, in main
run(**vars(opt))
File "C:\Users\sadha\AppData\Roaming\Python\Python311\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\sadha\Downloads\objectDetect\yolov5\detect.py", line 201, in run
s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
~~~~~^^^^^^^^
KeyError: 5053
This is the error message
Beta Was this translation helpful? Give feedback.
All reactions