Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

InvalidArgumentError (see above for traceback): assertion failed: [] [Condition x == y did not hold element-wise:] [x (losses/fast_rcnn_cls_loss/SparseSoftmaxCrossEntropyWithLogits/Shape_1:0) = ] [101 1] [y (losses/fast_rcnn_cls_loss/SparseSoftmaxCrossEntropyWithLogits/strided_slice:0) = ] [101] #31

Open
longzeyilang opened this issue May 23, 2018 · 8 comments

Comments

@longzeyilang
Copy link

longzeyilang commented May 23, 2018

Hi,
I'm trying to train clutteredMNIST of gray images with ResNet 50 V1 model, using the command "python faster_rcnn_conv5.py -n 10 -e 20 -y 'clutteredMNIST.yml' ",however the error below occured
"InvalidArgumentError (see above for traceback): assertion failed: [] [Condition x == y did not hold element-wise:] [x (losses/fast_rcnn_cls_loss/SparseSoftmaxCrossEntropyWithLogits/Shape_1:0) = ] [101 1] [y (losses/fast_rcnn_cls_loss/SparseSoftmaxCrossEntropyWithLogits/strided_slice:0) = ] [101]"

@longzeyilang
Copy link
Author

waiting online

@Linggeng
Copy link

Linggeng commented Aug 8, 2018

have you solved this issue?

@fbiying87
Copy link

I have the same problem by using faster_rcnn_conv5.py -n 0 -e 5 as given in the example. Has anyone else solved this issue yet? Thanks.

@zyfccc
Copy link

zyfccc commented Oct 26, 2018

Me 2. Running example on MacOS Mojave and python 3.6.4.

@binhmuc
Copy link

binhmuc commented Dec 10, 2018

I also got this problem. I run in python 3.5.2, tensorflow-gpu 1.8.0, My ubuntu version is 16.04

@Ien001
Copy link

Ien001 commented Jan 30, 2019

find
fast_rcnn_cross_entropy=tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=tf.squeeze(fast_rcnn_cls_score), labels=labels)) in loss_functions.py
change to
fast_rcnn_cross_entropy=tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=tf.squeeze(fast_rcnn_cls_score), labels=tf.argmax(labels, 1)))

Would u plz tell us why it works? it truly works! Thanks!

@Rorschaaaach
Copy link

Rorschaaaach commented Jan 30, 2019


loss_functions.py中找到fast_rcnn_cross_entropy = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits = tf.squeeze(fast_rcnn_cls_score),labels = labels))
更改为
fast_rcnn_cross_entropy = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits = tf.squeeze) (fast_rcnn_cls_score),labels = tf.argmax(labels,1)))

你能告诉我们它为什么有效吗?它确实有效!谢谢!

不好意思,刚刚看了下这好像是个错误的方法我等会会删除,你可以看一下labels的输出,可能是因为这方面的原因。

@zrfan
Copy link

zrfan commented Mar 19, 2019


loss_functions.py中找到fast_rcnn_cross_entropy = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits = tf.squeeze(fast_rcnn_cls_score),labels = labels))
更改为
fast_rcnn_cross_entropy = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits = tf.squeeze) (fast_rcnn_cls_score),labels = tf.argmax(labels,1)))

你能告诉我们它为什么有效吗?它确实有效!谢谢!

不好意思,刚刚看了下这好像是个错误的方法我等会会删除,你可以看一下labels的输出,可能是因为这方面的原因。

应该是:
fast_rcnn_cross_entropy = tf.reduce_mean(
tf.nn.sparse_softmax_cross_entropy_with_logits(logits=tf.squeeze(fast_rcnn_cls_score),
labels=tf.squeeze(labels)))
吧,因为sparse_softmax_cross_entropy_with_logits要求标签的维度是[batch_size]大小,这里需要把label的形状reshape一下

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants