question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

resize Assertion failed

See original GitHub issue

I got the following error when ran it on the host with cpp TensorRT.

scorpion@scorpion-Alienware-15-R2:~/ros2_ws$  ros2 launch yolox_ros_cpp yolox_tensorrt.launch.py     model_path:=install/yolox_ros_cpp/share/yolox_ros_cpp/weights/tensorrt/yolox_nano_480x640.trt     model_version:="0.1.0" 
[INFO] [launch]: All log files can be found below /home/scorpion/.ros/log/2022-11-24-16-40-08-932533-scorpion-Alienware-15-R2-339792
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [339805]
[component_container-1] [INFO] [1669326009.316779835] [yolox_container]: Load Library: /opt/ros/foxy/lib/libv4l2_camera.so
[component_container-1] [INFO] [1669326009.325636382] [yolox_container]: Found class: rclcpp_components::NodeFactoryTemplate<v4l2_camera::V4L2Camera>
[component_container-1] [INFO] [1669326009.325722473] [yolox_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<v4l2_camera::V4L2Camera>
[component_container-1] [INFO] [1669326009.336747397] [v4l2_camera]: Driver: uvcvideo
[component_container-1] [INFO] [1669326009.336786022] [v4l2_camera]: Version: 331580
[component_container-1] [INFO] [1669326009.336796181] [v4l2_camera]: Device: Integrated_Webcam_HD: Integrate
[component_container-1] [INFO] [1669326009.336804645] [v4l2_camera]: Location: usb-0000:00:14.0-7
[component_container-1] [INFO] [1669326009.336812451] [v4l2_camera]: Capabilities:
[component_container-1] [INFO] [1669326009.336820553] [v4l2_camera]:   Read/write: NO
[component_container-1] [INFO] [1669326009.336828098] [v4l2_camera]:   Streaming: YES
[component_container-1] [INFO] [1669326009.336840005] [v4l2_camera]: Current pixel format: YUYV @ 640x480
[component_container-1] [INFO] [1669326009.336998684] [v4l2_camera]: Available pixel formats: 
[component_container-1] [INFO] [1669326009.337010794] [v4l2_camera]:   YUYV - YUYV 4:2:2
[component_container-1] [INFO] [1669326009.337019023] [v4l2_camera]:   MJPG - Motion-JPEG
[component_container-1] [INFO] [1669326009.337026625] [v4l2_camera]: Available controls: 
[component_container-1] [INFO] [1669326009.337038769] [v4l2_camera]:   Brightness (1) = 0
[component_container-1] [INFO] [1669326009.337049786] [v4l2_camera]:   Contrast (1) = 0
[component_container-1] [INFO] [1669326009.337060041] [v4l2_camera]:   Saturation (1) = 64
[component_container-1] [INFO] [1669326009.337846170] [v4l2_camera]:   Hue (1) = 0
[component_container-1] [INFO] [1669326009.337880268] [v4l2_camera]:   White Balance Temperature, Auto (2) = 1
[component_container-1] [INFO] [1669326009.337893778] [v4l2_camera]:   Gamma (1) = 100
[component_container-1] [INFO] [1669326009.337905088] [v4l2_camera]:   Power Line Frequency (3) = 2
[component_container-1] [INFO] [1669326009.338695580] [v4l2_camera]:   White Balance Temperature (1) = 4600
[component_container-1] [INFO] [1669326009.338726639] [v4l2_camera]:   Sharpness (1) = 2
[component_container-1] [INFO] [1669326009.338739338] [v4l2_camera]:   Backlight Compensation (1) = 3
[component_container-1] [INFO] [1669326009.338750403] [v4l2_camera]:   Exposure, Auto (3) = 3
[component_container-1] [INFO] [1669326009.339624995] [v4l2_camera]:   Exposure (Absolute) (1) = 156
[component_container-1] [INFO] [1669326009.339655825] [v4l2_camera]:   Exposure, Auto Priority (2) = 1
[component_container-1] [INFO] [1669326009.339665697] [v4l2_camera]: Time-per-frame support: YES
[component_container-1] [INFO] [1669326009.339673897] [v4l2_camera]:   Current time per frame: 1/30 s
[component_container-1] [INFO] [1669326009.339682343] [v4l2_camera]:   Available intervals:
[component_container-1] [INFO] [1669326009.339699280] [v4l2_camera]:     MJPG 848x480: 1/30
[component_container-1] [INFO] [1669326009.339712384] [v4l2_camera]:     MJPG 960x540: 1/30
[component_container-1] [INFO] [1669326009.339721262] [v4l2_camera]:     MJPG 1280x720: 1/30
[component_container-1] [INFO] [1669326009.339730045] [v4l2_camera]:     MJPG 1920x1080: 1/30
[component_container-1] [INFO] [1669326009.339738841] [v4l2_camera]:     YUYV 160x120: 1/30
[component_container-1] [INFO] [1669326009.339747385] [v4l2_camera]:     YUYV 320x180: 1/30
[component_container-1] [INFO] [1669326009.339755745] [v4l2_camera]:     YUYV 320x240: 1/30
[component_container-1] [INFO] [1669326009.339763888] [v4l2_camera]:     YUYV 424x240: 1/30
[component_container-1] [INFO] [1669326009.339772153] [v4l2_camera]:     YUYV 640x360: 1/30
[component_container-1] [INFO] [1669326009.339780395] [v4l2_camera]:     YUYV 640x480: 1/30 1/30
[component_container-1] [ERROR] [1669326009.364024554] [v4l2_camera]: Failed setting value for control White Balance Temperature to 4600: Input/output error (5)
[component_container-1] [ERROR] [1669326009.370262533] [v4l2_camera]: Failed setting value for control Exposure (Absolute) to 156: Input/output error (5)
[component_container-1] [INFO] [1669326009.371367868] [v4l2_camera]: Starting camera
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/v4l2_camera' in container '/yolox_container'
[component_container-1] [INFO] [1669326009.381502264] [yolox_container]: Load Library: /home/scorpion/ros2_ws/install/yolox_ros_cpp/lib/libyolox_ros_cpp_components.so
[component_container-1] [INFO] [1669326009.509412548] [yolox_container]: Found class: rclcpp_components::NodeFactoryTemplate<yolox_ros_cpp::YoloXNode>
[component_container-1] [INFO] [1669326009.509461932] [yolox_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<yolox_ros_cpp::YoloXNode>
[component_container-1] [INFO] [1669326009.513420278] [yolox_ros_cpp]: initialize
[component_container-1] [INFO] [1669326009.514141089] [yolox_ros_cpp]: Set parameter imshow_isshow: 1
[component_container-1] [INFO] [1669326009.514170270] [yolox_ros_cpp]: Set parameter model_path: 'install/yolox_ros_cpp/share/yolox_ros_cpp/weights/tensorrt/yolox_nano_480x640.trt'
[component_container-1] [INFO] [1669326009.514198985] [yolox_ros_cpp]: Set parameter class_labels_path: ''
[component_container-1] [INFO] [1669326009.514240051] [yolox_ros_cpp]: Set parameter num_classes: 80
[component_container-1] [INFO] [1669326009.514256483] [yolox_ros_cpp]: Set parameter conf: 0.300000
[component_container-1] [INFO] [1669326009.514283430] [yolox_ros_cpp]: Set parameter nms: 0.450000
[component_container-1] [INFO] [1669326009.514321736] [yolox_ros_cpp]: Set parameter tensorrt/device: 0
[component_container-1] [INFO] [1669326009.514336711] [yolox_ros_cpp]: Set parameter openvino/device: CPU
[component_container-1] [INFO] [1669326009.514348913] [yolox_ros_cpp]: Set parameter onnxruntime/use_cuda: 1
[component_container-1] [INFO] [1669326009.514360754] [yolox_ros_cpp]: Set parameter onnxruntime/device_id: 0
[component_container-1] [INFO] [1669326009.514372519] [yolox_ros_cpp]: Set parameter onnxruntime/use_parallel: 0
[component_container-1] [INFO] [1669326009.514384381] [yolox_ros_cpp]: Set parameter model_type: 'tensorrt'
[component_container-1] [INFO] [1669326009.514412877] [yolox_ros_cpp]: Set parameter model_version: '0.1.0'
[component_container-1] [INFO] [1669326009.514426783] [yolox_ros_cpp]: Set parameter src_image_topic_name: '/image_raw'
[component_container-1] [INFO] [1669326009.514450895] [yolox_ros_cpp]: Set parameter publish_image_topic_name: '/yolox/image_raw'
[component_container-1] [INFO] [1669326009.612488226] [yolox_ros_cpp]: Model Type is TensorRT
[component_container-1] [INFO] [1669326009.635604500] [v4l2_camera]: using default calibration URL
[component_container-1] [INFO] [1669326009.635723008] [v4l2_camera]: camera calibration URL: file:///home/scorpion/.ros/camera_info/integrated_webcam_hd:_integrate.yaml
[component_container-1] [ERROR] [1669326009.635866041] [camera_calibration_parsers]: Unable to open camera calibration file [/home/scorpion/.ros/camera_info/integrated_webcam_hd:_integrate.yaml]
[component_container-1] [WARN] [1669326009.635908438] [v4l2_camera]: Camera calibration file /home/scorpion/.ros/camera_info/integrated_webcam_hd:_integrate.yaml not found
[component_container-1] invalid arguments path_to_engine: install/yolox_ros_cpp/share/yolox_ros_cpp/weights/tensorrt/yolox_nano_480x640.trt
[component_container-1] [INFO] [1669326009.651568464] [yolox_ros_cpp]: model loaded
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/yolox_ros_cpp' in container '/yolox_container'
[component_container-1] terminate called after throwing an instance of 'cv::Exception'
[component_container-1]   what():  OpenCV(4.2.0) ../modules/imgproc/src/resize.cpp:4048: error: (-215:Assertion failed) inv_scale_x > 0 in function 'resize'
[component_container-1] 
[ERROR] [component_container-1]: process has died [pid 339805, exit code -6, cmd '/opt/ros/foxy/lib/rclcpp_components/component_container --ros-args -r __node:=yolox_container -r __ns:=/'].

Ubuntu: 20.04 OpenCV: 4.2.0

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
13randNEWcommented, Nov 27, 2022

Is TRT engine file path correct? After converting to TRT Engine, the link will not be generated in the install directory unless colcon build.

Log invalid arguments path_to_engine indicates that the engine file path is incorrect. If engine path is specified correctly and successfully loaded, INPUT_HEIGHT and INPUT_WIDTH should be logged.

I found the TRT engine named “yolo_nano.trt” but I specified it as yolo_nano480x640.trt. It works now! Thank you so much for the help!

By the way, do I need to worry about warning like below?

[component_container-1] [11/26/2022-22:57:30] [W] [TRT] The enqueue() method has been deprecated when used with engines built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. Please use enqueueV2() instead.
2reactions
fateshelledcommented, Nov 26, 2022

Is TRT engine file path correct? After converting to TRT Engine, the link will not be generated in the install directory unless colcon build.

Log invalid arguments path_to_engine indicates that the engine file path is incorrect. If engine path is specified correctly and successfully loaded, INPUT_HEIGHT and INPUT_WIDTH should be logged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C++, OpenCV : Assertion failed in Resize - Stack Overflow
Now, I'm trying to : open images of different sizes, resize them to a certain lower size, and apply the previous code to...
Read more >
error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
error : (-215: Assertion failed ) !ssize.empty() in function 'cv:: resize ' | cv2. error.
Read more >
Error: (-215:Assertion failed) !dsize.empty() in function 'resize'
Hello! I'm trying to use OpenCV's contouring methods to detect a hand and identify the ASL sign it is portraying (real time ASL-translator)....
Read more >
PYTHON cv2.resize Error “(-215:Assertion failed) !dsize.empty()”
I am trying to resize an image with cv2.resize function in PYTHON3 and I get the following error: error: OpenCV(4.5.1) ...
Read more >
error: (-215:assertion failed) !ssize.empty() in function 'cv ...
Error cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3718: error: (-215:Assertion failed) !ssize.empty() in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found