InvalidArgumentError (see above for traceback): indices[0,7] = -1 is not in [0, 157)
When I downloaded the ShapeNet.tar file, I decompressed it according to the document prompt. But because of my computer performance problems, I did not use ShapeNet.tar to perform Python train.py operations. I only took part of the extracted content of ShapeNet.tar for training. But when I executed Python train.py, I encountered the following error, which has been bothering me. If you can, please help me.
Model restored from file: utils/checkpoint/gcn.ckpt
Traceback (most recent call last):
File "train.py", line 101, in
Caused by op u'GatherV2_12', defined at:
File "train.py", line 47, in
InvalidArgumentError (see above for traceback): indices[0,7] = -1 is not in [0, 157) [[Node: GatherV2_12 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](concat_2, strided_slice_15, gradients/graphconvolution_1/SparseTensorDenseMatMul/SparseTensorDenseMatMul_grad/GatherV2/axis)]]
I have the same issue, have you fixed it?
@hguomin https://github.com/nywang16/Pixel2Mesh/issues/23
@hguomin #23
@abadcd Thank you!!!
I met the same problem and installed the version of GPU.However,it is still not work.Any one can help me?
try restarting your machine after installing the GPU drivers. it might help.
Thank you for replying.I did what you said,but it didn't work at all.Do you still have other ways?Or can you send me you code?
------------------ 原始邮件 ------------------ 发件人: "gopikrishnachaganti"[email protected]; 发送时间: 2019年5月19日(星期天) 凌晨1:13 收件人: "nywang16/Pixel2Mesh"[email protected]; 抄送: "If you,if I"[email protected];"Comment"[email protected]; 主题: Re: [nywang16/Pixel2Mesh] InvalidArgumentError (see above fortraceback): indices[0,7] = -1 is not in [0, 157) (#39)
try restarting your machine after installing the GPU drivers. it might help.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@Weipeilang I just install end the GPU version of tensorflow,but it still having this problem. Have you solved it yet?
As is explained in the tensorflow document:Note that on CPU, if an out of bound index is found, an error is returned. On GPU, if an out of bound index is found, a 0 is stored in the corresponding output value.
And it also discuss on this issue .
One solution of this problem is changing the function project in the layers.py as follows:
def project(img_feat, x, y, dim):
x1 = tf.floor(x)
x2 = tf.ceil(x)
y1 = tf.floor(y)
y2 = tf.ceil(y)
# add a padding to img_feat
paddings = tf.constant([[0, 1], [0, 1], [0, 0]])
img_feat = tf.pad(img_feat, paddings, 'CONSTANT')
Q11 = tf.gather_nd(img_feat, tf.stack([tf.cast(x1, tf.int32), tf.cast(y1, tf.int32)], 1))
Q12 = tf.gather_nd(img_feat, tf.stack([tf.cast(x1, tf.int32), tf.cast(y2, tf.int32)], 1))
Q21 = tf.gather_nd(img_feat, tf.stack([tf.cast(x2, tf.int32), tf.cast(y1, tf.int32)], 1))
Q22 = tf.gather_nd(img_feat, tf.stack([tf.cast(x2, tf.int32), tf.cast(y2, tf.int32)], 1))
weights = tf.multiply(tf.subtract(x2, x), tf.subtract(y2, y))
Q11 = tf.multiply(tf.tile(tf.reshape(weights, [-1, 1]), [1, dim]), Q11)
weights = tf.multiply(tf.subtract(x, x1), tf.subtract(y2, y))
Q21 = tf.multiply(tf.tile(tf.reshape(weights, [-1, 1]), [1, dim]), Q21)
weights = tf.multiply(tf.subtract(x2, x), tf.subtract(y, y1))
Q12 = tf.multiply(tf.tile(tf.reshape(weights, [-1, 1]), [1, dim]), Q12)
weights = tf.multiply(tf.subtract(x, x1), tf.subtract(y, y1))
Q22 = tf.multiply(tf.tile(tf.reshape(weights, [-1, 1]), [1, dim]), Q22)
outputs = tf.add_n([Q11, Q21, Q12, Q22])
return outputs
I think may be the projection of mesh vertex onto feature maps is out of the index of feature maps. And the GPU would fill zero automatically,while the CPU throw an error.
Solved it thanks to tensorflow gpu. Here is what I did:
conda create --name pixmesh tensorflow-gpu=1 python=2.7
then pip install tflearn
Hi, I am trying to run this on colab, and when I use python2 -m pip install tensorflow==1.3.0, I got the same issue, and when I tried to use python2 -m pip install tensorflow-gpu==1.3.0, I got a new error like the following, so does anyone succeeded in training this model and know how to solve this problem, or what version of TensorFlow I should use, thanks:
Traceback (most recent call last):
File "train.py", line 17, in
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
@lzw365-code I run into the same issue and was able to resolve it by install cudnn6 (below is the only direct download link i found):
!wget https://developer.download.nvidia.com/compute/redist/cudnn/v6.0/libcudnn6_6.0.20-1+cuda7.5_amd64.deb !sudo apt install ./libcudnn6_6.0.20-1+cuda7.5_amd64.deb
After installing cudnn I run into the same problem again. The solution is to remove the 22th line in the train.py file which selects the cuda device
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
The line caused cuda to not find a valid device and therefore fall back to cpu functionality.