Error occurs when executing trt.Builder() of tensorRT

I want to run tensorrt on darknet_ros, so I’m trying to use trt_yolo_ros.

When I ran the command roslaunch trt_yolo_ros demo.launch, I got an AttributeError. The logs are as follows.
... logging to /home/nvidia/.ros/log/7194ed44-ecee-11ea-b2e1-2a67aa1ada95/roslaunch-nvidia-17905.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://nvidia:34107/


 * /rosdistro: melodic
 * /rosversion: 1.14.6
 * /trt_yolo_ros/config_path: /home/nvidia/catk...
 * /trt_yolo_ros/cuda_device: 0
 * /trt_yolo_ros/label_filename: coco_labels.txt
 * /trt_yolo_ros/nms_threshold: 0.3
 * /trt_yolo_ros/num_cam: 1
 * /trt_yolo_ros/obj_threshold: 0.7
 * /trt_yolo_ros/postprocessor_cfg: yolo_postprocess_...
 * /trt_yolo_ros/publish_image: True
 * /trt_yolo_ros/publish_rate: 10
 * /trt_yolo_ros/publisher/bounding_boxes/topic: /trt_yolo_ros/bou...
 * /trt_yolo_ros/publisher/image/topic: /trt_yolo_ros/bou...
 * /trt_yolo_ros/subscriber/image0/topic: /camera/color/ima...
 * /trt_yolo_ros/weights_path: /home/nvidia/catk...
 * /trt_yolo_ros/yolo_type: yolov3-416

    trt_yolo_ros (trt_yolo_ros/

auto-starting new master
process[master]: started with pid [17916]

setting /run_id to 7194ed44-ecee-11ea-b2e1-2a67aa1ada95
process[rosout-1]: started with pid [17927]
started core service [/rosout]
process[trt_yolo_ros-2]: started with pid [17934]
[INFO] [1599031947.810237]: [trt_yolo_ros] starting the node
Building new trt engine file
Traceback (most recent call last):
  File "/home/nvidia/catkin_ws/src/trt_yolo_ros/trt_yolo_ros/scripts/", line 11, in <module>
    network = YOLORos()
  File "/home/nvidia/catkin_ws/src/trt_yolo_ros/trt_yolo_ros/src/trt_yolo_ros/", line 27, in __init__
  File "/home/nvidia/catkin_ws/src/trt_yolo_ros/trt_yolo/src/trt_yolo/", line 60, in __init__
    self.engine = self.get_engine(weights_path, config_path, yolo_type)
  File "/home/nvidia/catkin_ws/src/trt_yolo_ros/trt_yolo/src/trt_yolo/", line 109, in get_engine
    self.build_trt_from_onnx(weights_path, configs_path, yolo_type)
  File "/home/nvidia/catkin_ws/src/trt_yolo_ros/trt_yolo/src/trt_yolo/", line 125, in build_trt_from_onnx
    with trt.Builder(self.trt_logger) as builder:
AttributeError: __exit__
[trt_yolo_ros-2] process has died [pid 17934, exit code 1, cmd /home/nvidia/catkin_ws/src/trt_yolo_ros/trt_yolo_ros/scripts/ __name:=trt_yolo_ros __log:=/home/nvidia/.ros/log/7194ed44-ecee-11ea-b2e1-2a67aa1ada95/trt_yolo_ros-2.log].
log file: /home/nvidia/.ros/log/7194ed44-ecee-11ea-b2e1-2a67aa1ada95/trt_yolo_ros-2*.log

Please let me know if there is a method that can solve the error.

Hi @kubo1,
Can you share the log file?


I deleted the exact same file, but I share the log file when I get the same error.
trt_yolo_ros-2.log (7.9 KB)

Hi @kubo1,
Looks like this issue belongs more to the repo
Hence request you to raise this on the below link


Yes, this is the repository I am asking. I thought that maybe the person in charge of nvidia might know, so I was listening to both. Thank you as always.