Cannot change output to image when converting model from TF to CoreML

I am trying to convert a model I found on TensorFlow hub to CoreML so I can use it in an iOS app I'm developing. Converting the model so far has been quite simple except that I get an NotImplementedError when specifying ImageType as output.

This is the code I used:

model = tf.keras.Sequential([
        tf.keras.layers.InputLayer(input_shape=(256, 256, 3)),
        tf_hub.KerasLayer(
          "https://tfhub.dev/rishit-dagli/mirnet-tfjs/1"
        )
])

model.build([1, 256, 256, 3])  # Batch input shape.
mlmodel = ct.convert(model, convert_to="mlprogram",
          inputs=[ct.ImageType()], outputs=[ct.ImageType()])

If only the inputs are specified as ImageType, then no error occurs, but when I include a specification for the outputs as ImageType, I get this error:

NotImplementedError: Image output 'Identity' has symbolic dimensions in its shape

FYI: I'm using TensorFlow version 2.12 and CoreML 6.3

Is there any way around this? Or, am I doing this wrong?

I'm quite new to machine learning and CoreML, so any helpful input is much appreciated. Thanks in advance!

Cannot change output to image when converting model from TF to CoreML
 
 
Q