Reputation: 161
I am currently working with Darknet on Yolov4, with 1 class.
I need to export those weights to onnx format, for tensorRT inference. I've tried multiple technics, using ultralytics to convert or going from tensorflow to onnx. But none seems to work. Is there a direct way to do it?
Upvotes: 6
Views: 16926
Reputation: 355
The following repo exports yolov3 models from darknet to onnx, for tensorRT inference. You can use this as reference for your model.
https://github.com/jkjung-avt/tensorrt_demos/tree/master/yolo
Upvotes: 2
Reputation: 1270
Check this GitHub repo: https://github.com/Tianxiaomo/pytorch-YOLOv4
Running the demo_darknet2onnx.py
script you'll be able to generate the ONNX model from the .cfg
and .weights
darknet files.
Usage example:
python demo_darknet2onnx.py <cfgFile> <weightFile> <imageFile> <batchSize>
You can also decide the batch size for the inference calls of the converted model.
Upvotes: 5