jkjung-avt / tensorrt_demos

TensorRT MODNet, YOLOv4, YOLOv3, SSD, MTCNN, and GoogLeNet
https://jkjung-avt.github.io/
MIT License
1.74k stars 545 forks source link

assert size % 7 == 0 AssertionError #512

Closed dexception closed 2 years ago

dexception commented 2 years ago
root@asd-TUF-GAMING-FX504GM-FX80GM:/opt/github/tensorrt_demos# python3 trt_yolo.py --image dog.jpg -m yolov3-tiny-416
[TensorRT] WARNING: TensorRT was linked against cuBLAS 10.2.0 but loaded cuBLAS 10.1.0
<tensorrt.tensorrt.ICudaEngine object at 0x7f44d0dca848>
[TensorRT] WARNING: TensorRT was linked against cuBLAS 10.2.0 but loaded cuBLAS 10.1.0
Traceback (most recent call last):
  File "/opt/github/tensorrt_demos/utils/yolo_with_plugins.py", line 296, in __init__
    allocate_buffers(self.engine)
  File "/opt/github/tensorrt_demos/utils/yolo_with_plugins.py", line 221, in allocate_buffers
    assert size % 7 == 0
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "trt_yolo.py", line 108, in <module>
    main()
  File "trt_yolo.py", line 96, in main
    trt_yolo = TrtYOLO(args.model, args.category_num, args.letter_box)
  File "/opt/github/tensorrt_demos/utils/yolo_with_plugins.py", line 298, in __init__
    raise RuntimeError('fail to allocate CUDA resources') from e
RuntimeError: fail to allocate CUDA resources
Exception ignored in: <bound method TrtYOLO.__del__ of <utils.yolo_with_plugins.TrtYOLO object at 0x7f44d0dc2f28>>
Traceback (most recent call last):
  File "/opt/github/tensorrt_demos/utils/yolo_with_plugins.py", line 305, in __del__
    del self.outputs
AttributeError: outputs
dexception commented 2 years ago

Any update ?

jkjung-avt commented 2 years ago

Did you see any error when you built the TensorRT ("yolov3-tiny-416.trt") engine?

Otherwise, what are the shapes and sizes of the TensorRT output tensors?

dexception commented 2 years ago

image

utils/yolo_with_plugins.py is giving the following output:

image

jkjung-avt commented 2 years ago

From your screenshot,

But the expected output tensor size should be:

I'm guessing that: (a) you are using a custom model with classes=1; (b) the TensorRT model (yolov4-tiny-416.trt) is missing the yolo_layer plugins ("YoloLayer_TRT" layers).

Are you using the latest code in this repo? What code modification have you done?

dexception commented 2 years ago

Using the latest repo and also the default model with 80 classes.

Edit: No modifications done.

jkjung-avt commented 2 years ago

Using the latest repo and also the default model with 80 classes.

I'm not able to reproduce this problem. I ran the code on several difference platforms (Jetson and x86). It all worked OK. So I don't know what the problem is for you...

jkjung-avt commented 2 years ago

Closed as of "not reproducible".