Skip to content

is there some error with dynamic export for TensorRT? #8866

@hdnh2006

Description

@hdnh2006

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Export

Bug

Hi, I was trying the new feature of dynamic size for TensorRT. I exported yolov5s.pt to TensorRT using the following command:

python export.py --include engine --device 0 --workspace 8 --dynamic --batch-size 8

According to this the max batch size is set as 8, so I tried with a couple of ip cameras I have for testing and I got the following:

python detect.py --weights yolov5s.engine --source streams1.txt

Traceback (most recent call last):
  File "detect.py", line 257, in <module>
    main(opt)
  File "detect.py", line 252, in main
    run(**vars(opt))
  File "/home/henry/.virtualenvs/yolov5/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 138, in run
    p, im0, frame = path[i], im0s[i].copy(), dataset.count
IndexError: list index out of range
terminate called without an active exception
terminate called recursively
Aborted

I have to tell that the normal yolov5s.pt works perfectly, so it is not a proble of my ip cameras:

python detect.py --weights yolov5s.pt --source streams1.txt 
detect: weights=['yolov5s.pt'], source=streams1.txt, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 🚀 v6.1-359-g628c05ca Python-3.8.10 torch-1.11.0+cu102 CUDA:0 (NVIDIA GeForce RTX 2060 SUPER, 7974MiB)

Fusing layers... 
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients
[hevc @ 0x685bf80] PPS id out of range: 0
[hevc @ 0x685bf80] PPS id out of range: 0
[hevc @ 0x7638a00] Could not find ref with POC 30
1/2: rtsp://XXXXXXXXXXX@XXXXXXXXXXXXX/Streaming/Channels/601...  Success (inf frames 1920x1080 at 40.00 FPS)
[hevc @ 0x765d2c0] PPS id out of range: 0
[hevc @ 0x765d2c0] PPS id out of range: 0
[hevc @ 0x707bc40] Could not find ref with POC 31
2/2: rtsp://XXXXXXXXXXX@XXXXXXXXXXXXX/Streaming/Channels/701...  Success (inf frames 1920x1080 at 40.00 FPS)

0: 384x640 3 motorcycles, 1: 384x640 Done. (0.345s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)
0: 384x640 3 motorcycles, 1: 384x640 Done. (0.006s)

Environment

No response

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions