Convert Darknet/YOLO .cfg and .weights files to .onnx files. More...

Convert Darknet/YOLO .cfg and .weights files to .onnx files.
Over time, I'm hoping other people will show up to help shine light in the dark corners, or provide me with more configurations and weights that are broken to help make this tool work better. As you'll no doubt see in the code below, there are many places where I've left some "todo" comments in an attempt to document code that needs to be fixed.
Stephane Charette, 2025-08-18.
Update:
Post-processing for YOLO layers was added for Darknet v5.1. ONNX is still a beast, but I'm feeling much more confident about the export tool than I was a few months ago. I would no longer say "this code should not be trusted" but instead would caution readers and debuggers to not assume the code is doing the right thing in all cases since many assumptions have been made. If you find a problem, please let me know or submit a PR.
Stephane Charette, 2025-11-24.