WXinlong / ASIS

Associatively Segmenting Instances and Semantics in Point Clouds, CVPR 2019

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Failed to convert object of type <type 'list'> to Tensor.

linhaojia13 opened this issue · comments

Hello, when I run the train.sh, I meet the error :
TypeError: Failed to convert object of type <type 'list'> to Tensor.
Any advice will be appreciated deeply.

Here is the traceback:
Traceback (most recent call last):
File "train.py", line 256, in
train()
File "train.py", line 132, in train
loss, sem_loss, disc_loss, l_var, l_dist, l_reg = get_loss(pred_ins, labels_pl, pred_sem_label, pred_sem, sem_labels_pl)
File "/home/juzhi/temp/ASIS/models/ASIS/model.py", line 89, in get_loss
delta_v, delta_d, param_var, param_dist, param_reg)
File "/home/juzhi/temp/ASIS/utils/loss.py", line 150, in discriminative_loss
0])
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2770, in while_loop
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2599, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2549, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/home/juzhi/temp/ASIS/utils/loss.py", line 121, in body
delta_v, delta_d, param_var, param_dist, param_reg)
File "/home/juzhi/temp/ASIS/utils/loss.py", line 26, in discriminative_loss_single
reshaped_pred = tf.reshape(prediction, [-1, feature_dim])
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2451, in reshape
name=name)
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 493, in apply_op
raise err
TypeError: Failed to convert object of type <type 'list'> to Tensor. Contents: [-1, Dimension(5)]. Consider casting elements to a supported type.
[56409. 74039. 9895. 10639. 5923. 6255. 7588. 7744. 3566. 7615.
6183. 5024. 2581.]
cp: cannot stat 'inference_merge.py': No such file or directory
Traceback (most recent call last):
File "test.py", line 260, in
test()
File "test.py", line 83, in test
loss, sem_loss, disc_loss, l_var, l_dist, l_reg = get_loss(pred_ins, labels_pl, pred_sem_label, pred_sem, sem_labels_pl)
File "/home/juzhi/temp/ASIS/models/ASIS/model.py", line 89, in get_loss
delta_v, delta_d, param_var, param_dist, param_reg)
File "/home/juzhi/temp/ASIS/utils/loss.py", line 150, in discriminative_loss
0])
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2770, in while_loop
result = context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2599, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2549, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/home/juzhi/temp/ASIS/utils/loss.py", line 121, in body
delta_v, delta_d, param_var, param_dist, param_reg)
File "/home/juzhi/temp/ASIS/utils/loss.py", line 26, in discriminative_loss_single
reshaped_pred = tf.reshape(prediction, [-1, feature_dim])
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2451, in reshape
name=name)
File "/home/juzhi/anaconda3/envs/python27/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 493, in apply_op
raise err
TypeError: Failed to convert object of type <type 'list'> to Tensor. Contents: [-1, Dimension(5)]. Consider casting elements to a supported type.

Hi, which tf version did you use?
You could try modifying Line81 of model.py:
feature_dim = pred.get_shape()[-1] => feature_dim = pred.get_shape().as_list()[-1]

Thank you very much!
After modifying the code as your suggestion, I run the file "train.sh" successfully.
I use tf1.2 , Python2.7.
It seems that the bug is caused by the version difference.Thank you once again.