I had a segnet model I converted to ONNX using the most simple following python line:
onnx_model, _ = tf2onnx.convert.from_keras(model, [tf.TensorSpec([1,125,500,1], tf.float32)], output_path=out_path)
the ONNX works well, BUT I get an almost binary image [yes, I tested stretching issues, the ONNX output values were already in the range of 0-1, which means after multiplying by 255 I got the attached image].
Attached also Netron inspection of both [ends] of models:
Found the answer!
This link helped: https://github.com/onnx/tensorflow-onnx/issues/495
So I had a dropout layer in my Tensorflow model. for any reason my tf2onnx was VERY old, and since it didn't handle correctly the 0.5 value in that layer. Anyway - updating opset to 15 [not even 16] solved the problem