remc
remc

Reputation: 161

Darknet model to onnx

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

Answers (2)

Asmita Khaneja
Asmita Khaneja

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

Renan Vilas Novas
Renan Vilas Novas

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

Related Questions