KhronosGroup / NNEF-Tools

The NNEF Tools repository contains tools to generate and consume NNEF documents
https://www.khronos.org/nnef
222 stars 58 forks source link

Converting SSD From onnx to tensorflow-pb #95

Closed idenc closed 5 years ago

idenc commented 5 years ago

I am trying to convert this ONNX model to a Tensorflow PB and the slices are not being converted correctly I believe. The size attribute for the slices in the tensorflow pb look like [-1, -1, -2] which is invalid. Any help on this would be appreciated.

idenc commented 5 years ago

I believe I found a bug in nnef_to_tf.py at line 1372 the list comprehension should be changed to: size = [ -1 if e == -1 or e == 0 else e - b for b, e in zip(begin, end) ] based on the NNEF specs The model converts correctly after this change.

gyenesvi commented 5 years ago

You are right, that is a bug, thanks for catching this. Actually, there were more problems in that conversion function, not handling all cases properly. I have posted some fixes, can you try again if it converts properly now?

By the way, the model that you are testing with is a detector without the bbox non-max suppression in the end right? Otherwise (with the nms on it) it should not be convertible. Can I ask where you got this model from? I have been looking for a simple detector for testing purposes.

idenc commented 5 years ago

I got it from here and used the convert_to_caffe2_models script to save the model from PyTorch to ONNX.

gyenesvi commented 5 years ago

Thanks, that's a useful source! Btw, can the issue be closed?

idenc commented 5 years ago

Yep, thanks!