models icon indicating copy to clipboard operation
models copied to clipboard

Perspective Transformer Nets train_ptn : IndexError

Open ZYCZH opened this issue 7 years ago • 5 comments

System information

  • What is the top-level directory of the model you are using: /ptn
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):NO
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Linux Ubuntu 16.04
  • TensorFlow installed from (source or binary): conda install
  • TensorFlow version (use command below):tensorflow-gpu==1.8.0
  • Bazel version (if compiling from source): 0.5.2
  • CUDA/cuDNN version:10.0/7.4
  • GPU model and memory: 2080TI
  • Exact command to reproduce:CUDA_VISIBLE_DEVICES=0 bazel-bin/train_ptn '--checkpoint_dir=/home/meeso/models/ptn/my_models/' '--inp_dir=/tmp/shapenet_tf/'

Describe the problem

when I run train_ptn,it got one error:

2019-01-06 14:13:22.378242: W tensorflow/core/framework/op_kernel.cc:1306] Unknown: exceptions.IndexError: arrays used as indices must be of integer (or boolean) type

Traceback (most recent call last):

File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 158, in call ret = func(*args)

File "/home/zh/ptn/model_ptn.py", line 132, in write_grid output_voxels=output_voxels)

File "/home/zh/ptn/model_ptn.py", line 218, in _build_image_grid utils.display_voxel(output_voxels[index, :, :, :, 0]), vis_size,

File "/home/zh/ptn/utils.py", line 69, in display_voxel data = visualize_voxel_spectral(points, vis_size)

File "/home/zh/ptn/utils.py", line 80, in visualize_voxel_spectral verts, faces = measure.marching_cubes_classic(points, 0, spacing=(0.1, 0.1, 0.1))

File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/skimage/measure/_marching_cubes_classic.py", line 132, in marching_cubes_classic faces = _correct_mesh_orientation(volume, verts[faces], faces, spacing,

IndexError: arrays used as indices must be of integer (or boolean) type [[Node: PyFunc = PyFunc[Tin=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT64, DT_FLOAT, DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/device:CPU:0"](mul_3, ResizeNearestNeighbor, ResizeNearestNeighbor_1, global_step/read/_751, data_loading_shapenet_chair/val/batching_queues/shapenet_chair/val:1, decoder_1/Conv3d_transpose_2/Sigmoid/_753)]] [[Node: PyFunc/_1462 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5196_PyFunc", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]]

Caused by op u'PyFunc', defined at: File "/home/zh/ptn/bazel-bin/train_ptn.runfiles/main/train_ptn.py", line 230, in app.run() File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "/home/zh/ptn/bazel-bin/train_ptn.runfiles/main/train_ptn.py", line 202, in main output_voxels=val_outputs['voxels_1']) File "/home/zh/ptn/model_ptn.py", line 142, in write_disk_grid ], [tf.uint8], 'write_grid')[0] File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 384, in py_func func=func, inp=inp, Tout=Tout, stateful=stateful, eager=False, name=name) File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/script_ops.py", line 227, in _internal_py_func input=inp, token=token, Tout=Tout, name=name) File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/gen_script_ops.py", line 128, in py_func "PyFunc", input=input, token=token, Tout=Tout, name=name) File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

ZYCZH avatar Jan 06 '19 07:01 ZYCZH

@ZYCZH My guess is that the marching_cubes_classic API changes, so faces becomes empty or something.

File "/home/zh/ptn/utils.py", line 80, in visualize_voxel_spectral verts, faces = measure.marching_cubes_classic(points, 0, spacing=(0.1, 0.1, 0.1))

File "/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/skimage/measure/_marching_cubes_classic.py", line 132, in marching_cubes_classic faces = _correct_mesh_orientation(volume, verts[faces], faces, spacing,

xcyan avatar Jan 06 '19 22:01 xcyan

@ I have changed the version of scikit-image to 0.13.1, but it didn't work. And,the train went to model.ckpt-60, Then it interrupted. the same error: IndexError.

ZYCZH avatar Jan 08 '19 10:01 ZYCZH

@ZYCZH我的猜测是marching_cubes_classic API发生了变化,因此face变为空或者其他东西。

文件“/home/zh/ptn/utils.py”,第80行,在visualize_voxel_spectral verts中,faces = measure.marching_cubes_classic(points,0,spacing =(0.1,0.1,0.1 ))

文件“/home/zh/anaconda2/envs/tensorflow/lib/python2.7/site-packages/skimage/measure/_marching_cubes_classic.py”,第132行,在marching_cubes_classic faces = _correct_mesh_orientation(volume,verts [faces],faces,间距,

And I check the API of marching_cubes_classic, It was OK.

ZYCZH avatar Jan 08 '19 11:01 ZYCZH

@xcyan I don't know the reason. If it can train to get model.ckpt-60, why it can not continue to the end ?

ZYCZH avatar Jan 08 '19 12:01 ZYCZH

Finally,I have to Comment the write_disk_grid,the train continued to the end . I think you are right ,the problem is ''marching_cubes_classic'',but I can not solve it. Thank you very much!.

ZYCZH avatar Jan 09 '19 06:01 ZYCZH