uzh-rpg / sips2_open

Succinct Interest Points from Unsupervised Inlierness Probability Learning
GNU General Public License v3.0
37 stars 9 forks source link

Unsure which tensorflow version is used #1

Open MarviB16 opened 5 years ago

MarviB16 commented 5 years ago

Hi,

I get this error message when i am trying to run SIPs (with python infer_folder.py --in_dir=INPUT_DIR and python render_matching.py --ds=kt --val_best --testing)

Traceback (most recent call last): File "sips2_open/render_matching.py", line 52, in fps = [forward_passer(im) for im in pair.im] File "/home/parallels/sips_ws/src/sips2_open/python/sips2/system.py", line 184, in call self._graph.ff_output, feed_dict={self._graph.ff_input: batch}) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1370, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.UnimplementedError: Generic conv implementation only supports NHWC tensor format for now. [[node sips2/conv2d/Conv2D (defined at /tmp/tmp6HT9tk.py:12) ]]

Errors may have originated from an input operation. Input Source operations connected to node sips2/conv2d/Conv2D: sips2/conv2d/kernel/read (defined at /home/parallels/sips_ws/src/sips2_open/python/sips2/graph.py:61)
ExpandDims (defined at /home/parallels/sips_ws/src/sips2_open/python/sips2/graph.py:31)

Original stack trace for u'sips2/conv2d/Conv2D': File "sips2_open/render_matching.py", line 47, in graph, sess = hyperparams.modelFromCheckpoint() File "/home/parallels/sips_ws/src/sips2_open/python/sips2/hyperparams.py", line 197, in modelFromCheckpoint g = graph.Graph() File "/home/parallels/sips_ws/src/sips2_open/python/sips2/graph.py", line 119, in init raw_out = singleScaleNet(self.ff_input) File "/home/parallels/sips_ws/src/sips2_open/python/sips2/graph.py", line 78, in singleScaleNet return tf.squeeze(net(centerAndExpand(image_batch)), axis=1) File "/home/parallels/sips_ws/src/sips2_open/python/sips2/graph.py", line 61, in net data_format='channels_first') File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 324, in new_func return func(*args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/convolutional.py", line 424, in conv2d return layer.apply(inputs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 1479, in apply return self.call(inputs, *args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/base.py", line 537, in call outputs = super(Layer, self).call(inputs, args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 634, in call outputs = call_fn(inputs, *args, *kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/autograph/impl/api.py", line 146, in wrapper ), args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/autograph/impl/api.py", line 450, in converted_call result = converted_f(effective_args, kwargs) File "/tmp/tmp6HT9tk.py", line 12, in tfcall outputs = ag.converted_call('_convolution_op', self, ag.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (inputs, self.kernel), None) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/autograph/impl/api.py", line 356, in converted_call return _call_unconverted(f, args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/autograph/impl/api.py", line 255, in _call_unconverted return f(*args) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 1079, in call return self.conv_op(inp, filter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 635, in call return self.call(inp, filter) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 234, in call__ name=self.name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 1953, in conv2d name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 1071, in conv2d data_format=data_format, dilations=dilations, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2005, in init self._traceback = tf_stack.extract_stack()

From tensorflow.python.framework.errors_impl.UnimplementedError: Generic conv implementation only supports NHWC tensor format for now. i would guess that i use the wrong tensorflow version, though i tried 1.4.0, 1.14.0 and 2.0-nightly, but non work.

Could you maybe specify which tensorflow version was used? Thanks.

tcies commented 5 years ago

Hi, yes I also ran into that the other day. This seems to be a very unfortunate thing that only happens with CPU. At some point, I have optimized the code for CuDNN, which can be done by switching the format from NHWC to NCHW, see https://jhui.github.io/2017/03/07/TensorFlow-Perforamnce-and-advance-topics/ . Unfortunately, I only found out recently that NCHW does not work on CPU. If you have a GPU, you can solve this problem by switching to tensorflow-gpu.

Otherwise, the problem can be solved by switching the SIPS code back to NHWC. Shouldn't be too complicated, but I won't have time to do this in the foreseeable future. Also, I don't know if this wouldn't break the pretrained weights, though it's not too complicated to re-train them. If you or anyone else would like to help with that and create a pull request, you're very welcome!