You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I could run your code with TensorRT 10 on images, but when running on video file I got this error:
Traceback (most recent call last):
File "D:\study\yolov10\TensorRT-For-YOLO-Series-cuda-python\trt.py", line 35, in
pred.detect_video(video, conf=0.1, end2end=args.end2end) # set 0 use a webcam
File "D:\study\yolov10\TensorRT-For-YOLO-Series-cuda-python\utils\utils.py", line 118, in detect_video
dets = np.concatenate([np.array(final_boxes)[:int(num[0])], np.array(final_scores)[:int(num[0])], np.array(final_cls_inds)[:int(num[0])]], axis=-1)
File "<array_function internals>", line 200, in concatenate
ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 300 and the array at index 1 has size 1
Could anyone encountered this error and knew how to fix it? Thank you.
The text was updated successfully, but these errors were encountered:
I had the same problem with the detect_video function for YOLOv8! I tried this code for end2end section and problem resolved:
ifend2end:
num, final_boxes, final_scores, final_cls_inds=datafinal_boxes=np.reshape(final_boxes/ratio, (-1, 4))
# Check if final_scores and final_cls_inds are emptyiffinal_scores.size==0orfinal_cls_inds.size==0:
print("No detections found or output arrays are empty.")
dets=final_boxes# or set to an empty list/array if preferredelse:
# Ensure final_scores and final_cls_inds have shape (num_detections, 1)final_scores=np.array(final_scores).reshape(-1, 1) # Shape: (num_detections, 1)final_cls_inds=np.array(final_cls_inds).reshape(-1, 1) # Shape: (num_detections, 1)# Ensure that the number of detections is consistentiflen(final_boxes) !=len(final_scores) orlen(final_boxes) !=len(final_cls_inds):
print("Mismatch in detection counts!")
dets=final_boxes# or set to an empty list/array if preferredelse:
# Concatenate final_boxes, final_scores, and final_cls_inds along the last axisdets=np.concatenate([final_boxes, final_scores, final_cls_inds], axis=-1)
I could run your code with TensorRT 10 on images, but when running on video file I got this error:
Traceback (most recent call last):
File "D:\study\yolov10\TensorRT-For-YOLO-Series-cuda-python\trt.py", line 35, in
pred.detect_video(video, conf=0.1, end2end=args.end2end) # set 0 use a webcam
File "D:\study\yolov10\TensorRT-For-YOLO-Series-cuda-python\utils\utils.py", line 118, in detect_video
dets = np.concatenate([np.array(final_boxes)[:int(num[0])], np.array(final_scores)[:int(num[0])], np.array(final_cls_inds)[:int(num[0])]], axis=-1)
File "<array_function internals>", line 200, in concatenate
ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 300 and the array at index 1 has size 1
Could anyone encountered this error and knew how to fix it? Thank you.
The text was updated successfully, but these errors were encountered: