FluxML / ONNX.jl

Read ONNX graphs in Julia
Other
139 stars 26 forks source link

Conv.W key not found for yolo onnx models #18

Open IanButterworth opened 5 years ago

IanButterworth commented 5 years ago

I'm trying to convert the tiny-yolo onnx models generated in this blog post, which are hosted here, and I'm getting the following errors:

>using Flux, ONNX
>ONNX.load_model("20180709 TinyYoloV3.onnx")
KeyError: key "Conv.W" not found

>ONNX.load_model("Tiny-YOLOv2.onnx")
KeyError: key "convolution.W" not found

Is this a peculiarity of these ONNX models, or an unsupported ONNX standard? I ask because I know that the tiny-yolov2 onnx model here does convert successfully (but is not accurate due to the asymmetrical padding issue with yolov2, hence why I'm trying to get yolov3 up and running)

ayush1999 commented 5 years ago

@ianshmean There's an error in the onnx model itself: See https://github.com/onnx/models/issues/60.

IanButterworth commented 5 years ago

Ah ok. Is a workaround possible in the interim to just ignore keys that aren’t initialized?

IanButterworth commented 5 years ago

Seems that it's an issue with <1.2 onnx, given the 1.0 version here is the only one that causes this issue. ONNX seems to have moved forward a lot since 1.0 so perhaps the best plan would be to generate newer ONNX models

ayush1999 commented 5 years ago

You could try downloading the pretrained model in some other framework (PyTorch/TensorFlow) and use the newer version of onnx exporters to generate the onnx file, and load it in using this package. (Would also be a great addition for the onnx/models repo)