OpenCV exception error running tensorrt_yolov8_seg_onnx

I am currently trying to run the sample found under zed/samples/object detection/custom detector/cpp/tensorrt_yolov8_seg_onnx. I can get the project to build and technically run, but when feeding my own custom yolo engine file and SVO2 using the command

./yolov8_seg_onnx_zed ~/path/to/engine/test.engine /path/to/svo/file/test.svo2

I get the following error:

terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(4.10.0) /home/platform/BuildAgent/work/97aefb3cee87354b/src/opencv/modules/core/src/matrix_expressions.cpp:24: error: (-5:Bad argument) Matrix operand is an empty matrix. in function ‘checkOperandsExist’

Note, I am running this on WSL. I can get tensorrt_yolov5-v6-v8_onnx to build and run through WSL, but not the segmentation version.

Hi @17njensen,

Can you get more debug information about which line in the sample triggers the error?

Hi @mattrouss

No line is reported when running the sample. I just built the sample model through WSL and ran the executable using the command line(s) given in the README. My instance segmentation model was labeled off of Roboflow, and trained using the command:

yolo train data=data.yaml model=yolov8n-seg.pt epochs=100 imgsz=640

Then formatted to .ONNX and .ENGINE the same way it’s mentioned to do so in the README. This is the sample I am referencing:

https://github.com/stereolabs/zed-sdk/tree/master/object%20detection/custom%20detector/cpp/tensorrt_yolov8_seg_onnx

To include, my SVO2 file was recorded using a ZED 2i, HD 720 at 15fps

@mattrouss I believe I have found my solution. The images were not resized to 640x640. I definitely didn’t catch that earlier, so if able to, a check in the sample to warn users would be appreciated!