Linaom1214/TensorRT-For-YOLO-Series

ValueError: cannot reshape array of size 705600 into shape (1,newaxis,85)

Closed this issue · 2 comments

大佬您好,我在使用YOLOv8导出了onnx文件后,再用您的export导出了engine文件,但是一运行就会报错:
Traceback (most recent call last):
File "/opt/project/TensorRT-For-YOLO-Series/trt.py", line 31, in
origin_img = pred.inference(img_path, conf=0.1, end2end=args.end2end)
File "/opt/project/TensorRT-For-YOLO-Series/utils/utils.py", line 152, in inference
predictions = np.reshape(data[0], (1, -1, int(5+self.n_classes)))[0]
File "<array_function internals>", line 180, in reshape
File "/opt/project/yolov8/.yolov8/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 298, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File "/opt/project/yolov8/.yolov8/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
ValueError: cannot reshape array of size 705600 into shape (1,newaxis,85)

infer返回的data打印出来的shape是(1, 84, 8400),模型精度是fp16
实在不知道怎么整了,求帮忙

我把模型调整为了(1, 8400, 84) 还是不行

大佬您好,我在使用YOLOv8导出了onnx文件后,再用您的export导出了engine文件,但是一运行就会报错: Traceback (most recent call last): File "/opt/project/TensorRT-For-YOLO-Series/trt.py", line 31, in origin_img = pred.inference(img_path, conf=0.1, end2end=args.end2end) File "/opt/project/TensorRT-For-YOLO-Series/utils/utils.py", line 152, in inference predictions = np.reshape(data[0], (1, -1, int(5+self.n_classes)))[0] File "<array_function internals>", line 180, in reshape File "/opt/project/yolov8/.yolov8/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 298, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "/opt/project/yolov8/.yolov8/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc return bound(*args, **kwds) ValueError: cannot reshape array of size 705600 into shape (1,newaxis,85)

infer返回的data打印出来的shape是(1, 84, 8400),模型精度是fp16 实在不知道怎么整了,求帮忙

推理是要添加 -- end2end