DanielHfnr / tensorrt_yolo_ros

C++ ROS Node for TensorRT inference of YOLO object detection network
MIT License
2 stars 0 forks source link

i got problem in image resize #1

Open ImamWahyuda opened 1 year ago

ImamWahyuda commented 1 year ago

i got problem with message "terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.5.4) ../modules/imgproc/src/resize.cpp:4045: error: (-215:Assertion failed) !ssize.empty() in function 'resize'"

DanielHfnr commented 1 year ago

It seems that the input image is empty, that’s why OpenCV cannot resize the image. But there is a check for an empty image before actually, so that should be impossible normally. Can you provide more information how you started everything and show the terminal output log?

ImamWahyuda commented 1 year ago

Alloc CUDA mapped memory for tensor with size (bytes): 400 Successfully initialized model... Max number of detections: 100 Input image empty... [ INFO] [1677576215.731695631]: Failed to run inference... [ INFO] [1677576215.731806160]: Num detections: 0 UKURAN IMAGE: [1920 x 1080] terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.5.4) ../modules/imgproc/src/resize.cpp:4045: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

this is the log of my output, which i print out the image size shown in UKURAN IMAGE: there is 1920 x 1080, but above it shown input image empty

DanielHfnr commented 1 year ago

Which ONNX model are you using? Have you tried it with one of the provided models in this repo? How do you start the ros node (using the launch files?)? I need a bit more information to debug the issue. Can you share your onnx model or open the model in netron (https://netron.app/) and export a png file to post it here? I guess the one that you are using is a different one than the 2 models checked into this repository? The image is resized to the input size of the network. If you have dynamic input sizes for examples, this wont work as dynamic shapes are not yet supported.

If you trained a yolov7 and export it to ONNX in the official yolov7 repo (https://github.com/WongKinYiu/yolov7) you can export it like that: python export.py --weights yolov7-tiny.pt --grid --include-nms. This includes the "efficientNMS" trt layer, with that it should work.

Dynamic shapes likes this are not supported: image

ImamWahyuda commented 1 year ago

yolov7 onnx

im started ros node like this : roslaunch tensorrt_yolo tensorrt_yolo.launch

im done export it python export.py --weights yolov7-tiny.pt --grid --include-nms. like this

ImamWahyuda commented 1 year ago

image

this is my output which error when receiving image from node