Tianxiaomo / pytorch-YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4
Apache License 2.0
4.46k stars 1.49k forks source link

TensorRT conversion from onnx only works for a specific input shape #492

Open Vincentdaniele opened 2 years ago

Vincentdaniele commented 2 years ago

After converting yolov4 models to onnx then TensorRT I found that models with input shape (320,320) were providing correct outputs while other shapes output were not good (really low score so no detections).

I tried it with yolov4 and yolov4-tiny weights, both only worked with (320,320) shape in cfg file. Shapes (608,608) and (416,416) were not working.

For onnx conversion I use demo_darknet2onnx.py

For TensorRT conversion I use trtexec :

/usr/src/tensorrt/bin/trtexec --onnx=yolov4.onnx --saveEngine=tolov4.engine --fp16
devaale commented 2 years ago

@Vincentdaniele Hello, I'm also converting darknet2onnx - was wondering if you have tried dynamic inputs [width, height] ? And had any success with it ?

Vincentdaniele commented 2 years ago

@devaale I can't find a way to have an onnx model with dynamic inputs, I only find the possibility to have a dynamic batch size with darknet2onnx

devaale commented 2 years ago

@Vincentdaniele https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/484#issuecomment-985322539

Maybe this will assists you in some way