princeton-vl / DeepV2D

BSD 3-Clause "New" or "Revised" License
653 stars 93 forks source link

Problem running KITTI demo #3

Closed cgebbe closed 5 years ago

cgebbe commented 5 years ago

After installing the requirements, entering "python demos/kitti_demo.py --cfg cfgs/kitti.yaml --sequence demo_videos/kitti_demos/032/" yields ...

Traceback (most recent call last):
  File "demos/kitti_demo.py", line 67, in <module>
    main(args)
  File "demos/kitti_demo.py", line 44, in main
    depths = net.forward(data_blob)
  File "lib/deepv2d.py", line 113, in forward
    output = self.sess.run(self.outputs, feed_dict=feed_dict)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
    run_metadata)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[3,47,271] = [3, 47, 272] does not index into param shape [4,48,272,64]
     [[node motion/GatherNd_1 (defined at lib/utils/bilinear_sampler.py:50) ]]

Caused by op 'motion/GatherNd_1', defined at:
  File "demos/kitti_demo.py", line 67, in <module>
    main(args)
  File "demos/kitti_demo.py", line 38, in main
    net = DeepV2D(INPUT_DIMS, cfg)
  File "lib/deepv2d.py", line 38, in __init__
    poses_pred = motion.forward(images[:, 1:], image_star, depth, intrinsics)
  File "lib/networks/motion.py", line 84, in forward
    G = self.flowse3(feat1, feat2, depth1, intrinsics/SC, G=G, reuse=i>0)
  File "lib/networks/motion.py", line 108, in flowse3
    featw = bilinear_sampler.bilinear_sampler(feat2, coords)
  File "lib/utils/bilinear_sampler.py", line 88, in bilinear_sampler
    output = bilinear_sampler_general(imgs, coords)
  File "lib/utils/bilinear_sampler.py", line 50, in bilinear_sampler_general
    img01 = tf.gather_nd(imgs, coords01)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3647, in gather_nd
    "GatherNd", params=params, indices=indices, name=name)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
    op_def=op_def)
  File "/home/cgebbe/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1801, in __init__
    self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): indices[3,47,271] = [3, 47, 272] does not index into param shape [4,48,272,64]
     [[node motion/GatherNd_1 (defined at lib/utils/bilinear_sampler.py:50) ]]
cgebbe commented 5 years ago

Solved it! At first, I installed the requisites in conda, where I had to choose slightly different versions. Thought it didn't matter, but it actually did...

Reinstalled the exact same versions (probably most important exact tensorflow version) in a python virtualenv and now it runs. Thanks!

zachteed commented 5 years ago

Hi, thanks for the info! I've updated the readme to use a virtualenv.