yolov8-plate icon indicating copy to clipboard operation
yolov8-plate copied to clipboard

problem with onnx inference

Open fadsamo opened this issue 1 year ago • 0 comments

Hello, thank you for the excellent work. I have an issue when I try to convert it to ONNX and then run it using examples/YOLOv8-OpenCV-ONNX-Python/main.py . I use the following command to convert to ONNX:

yolo export model=best_640_2_2.pt imgsz=640 format=onnx opset=12.

After running your code for inference, I encounter the following error:

outputs = np.array([cv2.transpose(outputs[0])]) cv2.error: OpenCV(4.9.0) /io/opencv/modules/core/src/matrix_transform.cpp:249: error: (-215:Assertion failed) _src.dims() <= 2 && esz <= 32 in function 'transpose'

What do you think the problem is, and what should I do? Also, the exported model output is as follows:

[PyTorch: starting from best_640_2_2.pt with input shape (1, 3, 640, 640) BCHW and output shape(s) ((1, 73, 80, 80), (1, 73, 40, 40), (1, 73, 20, 20)) (5.1 MB)

ONNX: starting export with onnx 1.15.0 opset 12... ONNX: export success ✅ 2.4s, saved as best_640_2_2.onnx (2.3 MB)](url)

fadsamo avatar Feb 07 '24 09:02 fadsamo