moberweger / deep-prior

Fast and accurate 3D hand pose estimation from single depth images
GNU General Public License v3.0
63 stars 23 forks source link

TypeError: Cannot convert Type TensorType(float32, 4D) ... #1

Closed shimiaoli closed 7 years ago

shimiaoli commented 7 years ago

Hi, Thank @moberweger for sharing the code .

I have got the following error while trying to run the code: TypeError: Cannot convert Type TensorType(float32, 4D) (of Variable Subtensor{int64:int64:}.0) into Type TensorType(float64, 4D). You can try to manually convert Subtensor{int64:int64:}.0 into a TensorType(float64, 4D).

The error occurs on both ICVL and NYU dataet.

Any idea how to fix it?

Thank you very much !

shimiaoli commented 7 years ago

I was running test_realtimepipleline.py

shimiaoli commented 7 years ago

Traceback (most recent call last): File "test_realtimepipeline.py", line 78, in rtp = RealtimeHandposePipeline(poseNet, config, di, comrefNet) File "/home/shimiao_li/deep_hand_pose_author/deep-prior/src/util/realtimehandposepipeline.py", line 89, in init self.poseNet.computeOutput(numpy.zeros(self.poseNet.cfgParams.inputDim, dtype='float32')) File "/home/shimiao_li/deep_hand_pose_author/deep-prior/src/net/netbase.py", line 263, in computeOutput mode='FAST_RUN', on_unused_input='warn') File "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", line 320, in function output_keys=output_keys) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 442, in pfunc no_default_updates=no_default_updates) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 218, in rebuild_collect_shared cloned_v = clone_v_get_shared_updates(v, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 92, in clone_v_get_shared_updates clone_v_get_shared_updates(i, copy_inputs_over) File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", line 95, in clone_v_get_shared_updates [clone_d[i] for i in owner.inputs], strict=rebuild_strict) File "/usr/local/lib/python2.7/dist-packages/theano/gof/graph.py", line 242, in clone_with_new_inputs new_inputs[i] = curr.type.filter_variable(new) File "/usr/local/lib/python2.7/dist-packages/theano/tensor/type.py", line 233, in filter_variable self=self))

shimiaoli commented 7 years ago

I solved the problem after changing all float32 in /src/util/realtimehandposepipeline.py to float64.

moberweger commented 7 years ago

Hi, thanks for using the code. You can set the relevant theano flags by running the program with THEANO_FLAGS=device=gpu,floatX=float32 python test_realtimepipeline.py Setting device and floatX explicitly should prevent errors like this.

BurtonMan commented 6 years ago

Add the following at the beginning of the test_realtimepipeline.py import os os.environ["THEANO_FLAGS"] = "device=gpu,floatX=float32"

Light-- commented 4 years ago

Add the following at the beginning of the test_realtimepipeline.py import os os.environ["THEANO_FLAGS"] = "device=gpu,floatX=float32"

@moberweger @BurtonMan It didn't work.

Traceback (most recent call last):
  File "rep_train_main.py", line 279, in <module>
    train_rep()
  File "rep_train_main.py", line 170, in train_rep
    y: valid_set_y[index * batch_size: (index + 1) * batch_size]})
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/function.py", line 317, in function
    output_keys=output_keys)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 449, in pfunc
    no_default_updates=no_default_updates)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 219, in rebuild_collect_shared
    cloned_v = clone_v_get_shared_updates(v, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 93, in clone_v_get_shared_updates
    clone_v_get_shared_updates(i, copy_inputs_over)
  File "/home/user/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 96, in clone_v_get_shared_updates
    [clone_d[i] for i in owner.inputs], strict=rebuild_strict)
  File "/home/user/.local/lib/python2.7/site-packages/theano/gof/graph.py", line 242, in clone_with_new_inputs
    new_inputs[i] = curr.type.filter_variable(new)
  File "/home/user/.local/lib/python2.7/site-packages/theano/tensor/type.py", line 234, in filter_variable
    self=self))
TypeError: Cannot convert Type TensorType(float64, 4D) (of Variable Subtensor{int64:int64:}.0) into Type TensorType(float64, matrix). You can try to manually convert Subtensor{int64:int64:}.0 into a TensorType(float64, matrix).
moberweger commented 4 years ago

Did you try to convert all your data tensors, such as valid_set_y , to np.float32 explicitly before using it for the network?