onnx / tensorflow-onnx

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

Support CTCBeamSearchDecoder #2302

Open CaptainDario opened 9 months ago

CaptainDario commented 9 months ago

New Operator

Describe the operator

Basic BeamSearch decoder as described here

Do you know this operator be constructed using existing ONNX operators?

I think so but I am not sure

Is this operator used by any model currently? Which one?

Many models use beam search for decoding the bare output such as CRNN.

Are you willing to contribute it? (Y/N)

N

Notes

I am trying to convert a CRNN model from TensorFlow that uses beam search. I am fairly new to ONNX and I am getting this error when trying to convert it.

Tensorflow op [crnn/CTCBeamSearchDecoder: CTCBeamSearchDecoder] is not supported
Unsupported ops: Counter({'CTCBeamSearchDecoder': 1})

When looking at the operator kernel list beam search is listed, therefore I assumed it would be supported. Am I doing something wrong?

fatcat-z commented 8 months ago

Yes, it is highly possible that BeamSearch op in ORT could be mapped to CTCBeamSearchDecoder op directly.

To make the conversion happen, we need to add a mapping and set the attributes/inputs accordingly. One example is TensorScatterAdd op and adding relative tests.

And if possible, your contributions are definitely welcome!

CaptainDario commented 6 months ago

Thank you for your response! I am interested in this but need to put down my research for the next months. If nobody adds this maybe I will work on it in a few months but currently I am unsure.