onnx / tensorflow-onnx

Convert TensorFlow, Keras, Tensorflow.js and Tflite models to ONNX
Apache License 2.0
2.29k stars 434 forks source link

Is it possible to add a decode_predictions layer to converted Keras models? #2257

Open george-synx opened 10 months ago

george-synx commented 10 months ago

Ask a Question

In the example notebook for converting keras CV models (https://github.com/onnx/tensorflow-onnx/blob/main/tutorials/keras-resnet50.ipynb) the keras method decode_predictions is used to translate the outputs of both the keras model and ONNX model. I'm not interested in the gradients and would like the decoded predictions in ONNX without having to import keras, is this possible? My downstream plan is to deploy the ONNX model via TensorRT, and currently it doesn't like the gradient outputs.

Further information

Model opset: 15

Notes

https://github.com/onnx/tensorflow-onnx/blob/main/tutorials/keras-resnet50.ipynb

fatcat-z commented 10 months ago

The mtehod decode_predictions aims to process data while tf2onnx is focusing on convert those tf ops to onnx ops to support the algorithm in model. So we can't convert this method to any ONNX op.