Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[labels out of bound] #33

Open
supriya-godge opened this issue Sep 11, 2017 · 3 comments
Open

[labels out of bound] #33

supriya-godge opened this issue Sep 11, 2017 · 3 comments

Comments

@supriya-godge
Copy link

supriya-godge commented Sep 11, 2017

I am getting the below error in the testing module.

InvalidArgumentError (see above for traceback): assertion failed: [labels out of bound] [Condition x < y did not hold element-wise:x (mean_iou/confusion_matrix/control_dependency:0) = ] [0 0 0...] [y (mean_iou/ToInt64_2:0) = ] [3] [[Node: mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert = Assert[T=[DT_STRING, DT_STRING, DT_INT64, DT_STRING, DT_INT64], summarize=3, _device="/job:localhost/replica:0/task:0/cpu:0"](mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/data_0, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/data_1, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch_1, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/data_3, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch_2)]]

I only have 2 labels as 255 is not included in the classes.

@supriya-godge supriya-godge changed the title weights not found in checkpoint [labels out of bound] Sep 11, 2017
@zx-code123
Copy link

I met the same problem,did you slove it?

@violet17
Copy link

violet17 commented Mar 19, 2019

My python is 2.7 with tensorflow 1.12.
I added these code before caculating mIoU:

indices = tf.cast(tf.less_equal(annotation_batch_tensor, number_of_classes - 1),tf.uint8)
annotation_batch_tensor = tf.multiply(annotation_batch_tensor,indices)

Because the later version of TF has added the assert:

   labels = control_flow_ops.with_dependencies(
      [check_ops.assert_less(
          labels, num_classes_int64, message='`labels` out of bound')],
      labels)
  predictions = control_flow_ops.with_dependencies(
      [check_ops.assert_less(
          predictions, num_classes_int64,
          message='`predictions` out of bound')],
      predictions)

from the comments of @xxxzhi in https://github.com/tensorflow/models/issues/2239.

And it it so wired in TF 1.12 that I can't use the solution of https://github.com/tensorflow/models/issues/2239. After using tf.gather, the shape of annotation_batch_tensor is wired and is not compatable with the input labels in slim.metrics.streaming_mean_iou .

Then I thought I must ignore all labels greater than or equal to number_of_classes from the comments of @amlarraz https://github.com/DrSleep/tensorflow-deeplab-resnet/issues/107.

@cgxcgxcgxcgx
Copy link

I met the same problem recently, did you solve it?

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

No branches or pull requests

4 participants