AxisCommunications / onnx-to-keras

Convert onnx models exported from pytorch to tensorflow keras models with focus on performace and highleve compatibility.
MIT License
25 stars 13 forks source link

Fix slice for TFLite quantization #42

Closed FilipJergleAlmquist closed 2 years ago

FilipJergleAlmquist commented 2 years ago

I have used this project to convert YOLOX to Keras and then to TFLite, but TFLite post training quantization fails due to an error related to the slice operation. When exporting a slice with no end, PyTorch sets end to INT_MAX as recommended. This small change omits the end position when end is equal to INT_MAX, which fixes the error.

I also added a test with the Focus module used in YOLOX that contains the slice operations of interest.

95hali74 commented 2 years ago

Nice work! I would prefer if you renamed the test case to something like test_yolox_focus_module so it is a bit more clear what the test is testing.

FilipJergleAlmquist commented 2 years ago

No problem, I renamed it to test_yolox_focus_module as suggested.