I need to convert a Super Resolution model to a mlmodel, but the input shape of the model is designed in the format [batch_size, height, width, 3]. Then I will convert with the following code
model = hub.load("https://tfhub.dev/captain-pool/esrgan-tf2/1")
tf.saved_model.save(model, "esrgan_saved_model")
input_type = ct.ImageType(shape=(1 , 192, 192, 3),color_layout=ct.colorlayout.RGB)
output_type = ct.ImageType(color_layout=ct.colorlayout.RGB)
mlmodel = ct.convert(
'./esrgan_saved_model',
inputs=[input_type],
outputs=[output_type],
source="tensorflow")
mlmodel.save('esrgan.mlmodel')
I got an error
Shape of the RGB/BGR image output, must be of kind (1, 3, H, W), i.e., first two dimensions must be (1, 3)
ImageType only seems to support input and output from [batch_size, 3, height, width]. What should I do to convert the model of format [batch_size, height, width, 3] to mlmodel?