对Yolov8n.pt转wts后,再序列化构建时,addResize()函数返回值为空,应如何解决?
### Tasks
想把这个仓库的代码,[https://github.com/wang-xinyu/tensorrtx/tree/master/yolov8,修改为支持推理时动态形状,如下图的红框所示:
修改了红框里的三四行代码,第100行就返回为空了,该如何解决呢?
You can upload the code for the two versions before and after here. @retioa11
You can upload the code for the two versions before and after here. @retioa11 different:
code for the two versions before and after: [ yolov8_before.zip ](url) yolov8_after.zip before:
after:
Are your H,W are dynamic shape ?
If H W are dynamic shape, you can ref https://github.com/lix19937/trt-samples-for-hackathon-cn/blob/master/cookbook/02-API/OptimizationProfile/main-TensorInput.py#L28
Oh, thank you. But wondering why my modification is returned empty and how should be modified to serialize Yolov8. Does the code in the link help? Not very understand.
If you use dynamic shape, you should set dynamic binding's shape at each infer.
Like https://github.com/lix19937/trt-samples-for-hackathon-cn/blob/master/cookbook/02-API/OptimizationProfile/main-TensorInput.py#L50
and
https://github.com/NVIDIA/TensorRT/blob/release/10.1/samples/sampleDynamicReshape/sampleDynamicReshape.cpp#L428-L432
As usual, it's caused by not setting the right dynamic shape profile or rt-input shapes.
Thanks, I'll have it a try。
Closing this issue for now but feel free to reopen if you still see the problem!