-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
The original MAXIM model can accept images of any resolution even though it was trained on 256x256x3 images.
But this doesn't constrain the MAXIM model to accept only 256x256x3 images. As long as the input image's spatial resolutions are divisible by 64, it's all good.
This is how the authors do it:
- https://github.com/google-research/maxim/blob/main/maxim/run_eval.py#L360
- https://github.com/google-research/maxim/blob/main/maxim/run_eval.py#L364
- https://github.com/google-research/maxim/blob/main/maxim/run_eval.py#L384-#L390 (post-processing)
In our case, the model is built with layers.Input((256, 256, 3))
:
maxim-tf/create_maxim_model.py
Line 29 in 12df753
inputs = keras.Input((input_resolution, input_resolution, 3)) |
If we use (None, None, 3)
, it throws:
Traceback (most recent call last):
File "convert_to_tf.py", line 234, in <module>
main(args)
File "convert_to_tf.py", line 192, in main
_, tf_model = port_jax_params(configs, args.ckpt_path)
File "convert_to_tf.py", line 140, in port_jax_params
tf_model = Model(**configs)
File "/Users/sayakpaul/Downloads/maxim-tf/create_maxim_model.py", line 31, in Model
outputs = maxim_model(inputs)
File "/Users/sayakpaul/Downloads/maxim-tf/maxim/maxim.py", line 99, in apply
height=h // (2 ** i),
TypeError: unsupported operand type(s) for //: 'NoneType' and 'int'
From the logs, it might seem obvious that we cannot build the Keras model with (None, None, 3)
since there are calculations inside the model that require us to specify the spatial dimensions.
Do you know of any way to mitigate this problem or any other approach?