WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.99k stars 518 forks source link

detect.py list index out of range error #148

Open lionopen64 opened 2 years ago

lionopen64 commented 2 years ago

I tried to train a custom object detection model, it has only one class object but when I tried to use detect.py to extract predictions after I change a new .names file, I still have a Index error like that.

s += '%g %ss, ' % (n, names[int(c)]) # add to string IndexError: list index out of range ​ When I used a higher confidence threshold(0.1) it doesn't happen but it happens at low confidence thresholds(0.03).

Utkarsh4610 commented 2 years ago

Hey, try giving --img-size parameter. It solved the error for me.

hu324 commented 1 year ago

I used yolov7.pt and my own model to detect, but there is an error like this:

Traceback (most recent call last): File "D:\yolov7\yolov7\detect.py", line 199, in detect() File "D:\yolov7\yolov7\detect.py", line 37, in detect model = attempt_load(weights, map_location=device) # load FP32 model File "D:\yolov7\yolov7\models\experimental.py", line 251, in attempt_load attempt_download(w) File "D:\yolov7\yolov7\utils\google_utils.py", line 31, in attempt_download tag = subprocess.check_output('git tag', shell=True).decode().split()[-1] IndexError: list index out of range

lfk123456 commented 1 year ago

![image](https://user-images.githubusercontent.com/102736687/221760533-764fb46f-2a51-4a33-a191-6446c136fb 运行uolov5 detect文件时,报错。索引超出范围