How convert darknet model to onnx?
See original GitHub issueHi,
Can someone give me instructions how convert my custom darknet model (yolov2-tiny) to ONNX? I know I should convert my darknet model to tensorflow, then to onnx, but I struggle with this for several days.
What I’ve tried: Convert darknet model (weights + cfg) to tensorflow using darkflow -> I got .pb file (SUCCESS)
Then I wanted to convert pb file to onnx:
- Tried to convert pb file to onnx using mmconvert:
mmconvert -sf tensorflow -iw path_to_my_pb_file -df onnx -om yolotfonnx --inNodeName input --dstNodeName output
error:TypeError: can only concatenate list (not "NoneType") to list
- Tried to convert using tf2onnx:
python3 -m tf2onnx.convert --graphdef path_to_my_pb_file --output yolov2-tiny.onnx --inputs input:0 --outputs output:0
error:AssertionError: output is not in graph
this also doesn’t work:
python3 -m tf2onnx.convert --saved-model path_to_my_pb_file --output yolov2-tiny.onnx
error:
RuntimeError: MetaGraphDef associated with tags 'serve' could not be found in SavedModel. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: `saved_model_cli`
available_tags: []
- Tried to convert using onnx-tf:
onnx-tf convert -i path_to_my_pb_file -o path_for_output_onnx_file
error:ValidationError: The model does not have an ir_version set properly.
I think darkflow can be not compatible with yolov2-tiny. I also tried to convert original darknet yolov2 model and have same problems after conversion with darkflow.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
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....
Read more >How to convert Darknet Yolo v3 tiny weights to ONNX?
I can't find a straight answer on how to convert Darknet Yolo v3-tiny weights to ONNX format anywhere, does anyone know how to...
Read more >Part 2: Convert Darknet to yolov3.onnx
This article describe how you can convert a model trained with Darknet using this repo to onnx format. Once you have converted the...
Read more >Yolv3 to onnx format
This article describe how you can convert a model trained with Darknet using this repo to onnx format. Once you have converted the...
Read more >Can't fine source convert darknet image classification to ...
Hello, I build darknet framework on Jetson Nano and test with image It's working. One thing that I really one is build to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, I’m having a hard time converting the darknet yolov2 model to onnx. It has been converted but does not detect anything when running Barracuda. I want to know in detail how you did it, is it possible?
https://github.com/derenlei/Unity_Detection2AR/issues/39
Here’s what I tried.
Hi,
I tried your ‘yolov2-tiny_freeze’ model and I think it works well. Set the INPUT_NAME to yolov2-tiny/net1 and OUTPUT_NAME to yolov2-tiny/convolutional9/BiasAdd. Also, we use different scripts for yolov2 and v3 so make sure the Selected_detector under Camera Image is yolo 2_tiny.