alxmamaev / jetson_yolov5_tensorrt

Docker image and wrapper for converting and inference YOLO-v5 model
GNU General Public License v3.0
39 stars 4 forks source link

AttributeError: 'NoneType' object has no attribute 'create_execution_context' #3

Open Daryatnt opened 2 years ago

Daryatnt commented 2 years ago

HI any idea what is the problem


  File "test.py", line 8, in <module>
    for image, bboxes in wrapper.detect_from_webcam(0): # Gets detection and image from the usb camera with id 0
  File "/home/jetson/jetson_yolov5_tensorrt/yolov5_trt/trt_wrapper.py", line 158, in detect_from_webcam
    for image, bboxes in self.detect_from_video(cap):
  File "/home/jetson/jetson_yolov5_tensorrt/yolov5_trt/trt_wrapper.py", line 146, in detect_from_video
    with self.create_session() as session:
  File "/home/jetson/jetson_yolov5_tensorrt/yolov5_trt/trt_wrapper.py", line 44, in __enter__
    self.context = self.engine.create_execution_context()
AttributeError: 'NoneType' object has no attribute 'create_execution_context'
alxmamaev commented 2 years ago

Probably something is wrong with the model deserialization, that's happening here. You may check TensorRT docs for this method, I think that is a problem with the model conversion.

danielzhangau commented 1 year ago

Add ctypes.CDLL(plugin_lib_path) solved my case.

After you build your engine file, there will be a libmyplugins.so file generated as well.