Full-resolution depthmaps: Errors with certain specific image sizes
I've been trying to apply inference_mega_tensorflow.py to my own images. It works well, until I try to generate full-resolution depth maps.
The error can be reproduced even with the stock docs/demo.jpg. I'm changing the following lines in the above file:
input_height = 240
input_width = 320
Changing this to 2316X3099 results in the following error:
File "inference_mega_tensorflow.py", line 214, in <module>
main()
File "inference_mega_tensorflow.py", line 114, in main
mega_out = build_mega_model(imag_pl)
File "inference_mega_tensorflow.py", line 72, in build_mega_model
prediction_1 = HourglassModel().fridaymodel(input_image_ph, is_training=False)
File "/home/xxxx/EclipseWorkspace1/MegaDepth_TensorFlow/src/hourglass_mega_tf_resize_bilinear_tflayer_prepost.py", line 202, in fridaymodel
conv2a = self.Channels4(conv1a_relu, is_training=is_training)
File "/home/xxxx/EclipseWorkspace1/MegaDepth_TensorFlow/src/hourglass_mega_tf_resize_bilinear_tflayer_prepost.py", line 159, in Channels4
conv4b = self.Channels3(conv3b, is_training=is_training)
File "/home/xxxx/EclipseWorkspace1/MegaDepth_TensorFlow/src/hourglass_mega_tf_resize_bilinear_tflayer_prepost.py", line 134, in Channels3
conv4b = self.Channels2(conv3b, is_training=is_training)
File "/home/xxxx/EclipseWorkspace1/MegaDepth_TensorFlow/src/hourglass_mega_tf_resize_bilinear_tflayer_prepost.py", line 114, in Channels2
conv4b = self.Channels1(conv3b, is_training=is_training)
File "/home/xxxx/EclipseWorkspace1/MegaDepth_TensorFlow/src/hourglass_mega_tf_resize_bilinear_tflayer_prepost.py", line 95, in Channels1
output = conv2a + uconv4b
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1181, in binary_op_wrapper
raise e
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1165, in binary_op_wrapper
return func(x, y, name=name)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 206, in wrapper
return target(*args, **kwargs)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1487, in _add_dispatch
return gen_math_ops.add_v2(x, y, name=name)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 482, in add_v2
"AddV2", x=x, y=y, name=name)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 750, in _apply_op_helper
attrs=attr_protos, op_def=op_def)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3539, in _create_op_internal
op_def=op_def)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2019, in __init__
control_input_ops, op_def)
File "/home/xxxx/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1859, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 289 and 288 for '{{node module/3/0/0/3/0/0/3/0/1/3/add}} = AddV2[T=DT_FLOAT](module/3/0/0/3/0/0/3/0/1/3/0/0/1/concat, module/3/0/0/3/0/0/3/0/1/3/0/1/4/resize/ResizeNearestNeighbor)' with input shapes: [1,289,387,256], [1,288,386,256].
Curiously, I only get this error for certain image sizes. For example, I find that 2304X3072 works fine, whereas 2316X3099 results in the above error.
Question
How do I remove the need to specify image size, so that I automatically get a depthmap in the exact same resolution as the input image?
Short answer is that this model's input size is restrict in (320, 240). So there is not a simple way to do that (automatically get a depth map in the exact same resolution as the input image).