hellochick / PSPNet-tensorflow

TensorFlow-based implementation of "Pyramid Scene Parsing Network".
326 stars 123 forks source link

Evaluation failed with cityscapes #40

Closed sunggukcha closed 6 years ago

sunggukcha commented 6 years ago

I followed the tutorial, and evaluated ade20k successfully. However, for cityscapes, it does not work.

Followings are the tracekbacks

Traceback (most recent call last): File "evaluate.py", line 148, in main() File "evaluate.py", line 143, in main _ = sess.run(update_op, feed_dict={image_filename: f1, anno_filename: f2}) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 889, in run run_metadata_ptr) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1120, in _run feed_dict_tensor, options, run_metadata) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1317, in _do_run options, run_metadata) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1336, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [labels out of bound] [Condition x < y did not hold element-wise:x (mean_iou/confusion_matrix/control_dependency:0) = ] [3 3 3...] [y (mean_iou/ToInt64_2:0) = ] [19] [[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/device:CPU:0"](mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch/_1253, 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/_1255, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/data_3, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch_2/_1257)]] [[Node: mean_iou/confusion_matrix/ones_like/Shape/_1373 = _HostRecv[client_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_3693_mean_iou/confusion_matrix/ones_like/Shape", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

Caused by op 'mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert', defined at: File "evaluate.py", line 148, in main() File "evaluate.py", line 113, in main mIoU, update_op = tf.contrib.metrics.streaming_mean_iou(pred, gt, num_classes=num_classes) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/metrics/python/ops/metric_ops.py", line 2246, in streaming_mean_iou updates_collections=updates_collections, name=name) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/metrics_impl.py", line 944, in mean_iou num_classes, weights) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/metrics_impl.py", line 284, in _streaming_confusion_matrix labels, predictions, num_classes, weights=weights, dtype=dtypes.float64) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/confusion_matrix.py", line 176, in confusion_matrix labels, num_classes_int64, message='labels out of bound')], File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/check_ops.py", line 403, in assert_less return control_flow_ops.Assert(condition, data, summarize=summarize) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 107, in wrapped return _add_should_use_warning(fn(*args, *kwargs)) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 134, in Assert condition, no_op, true_assert, name="AssertGuard") File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 316, in new_func return func(args, **kwargs) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1864, in cond orig_res_f, res_f = context_f.BuildCondBranch(false_fn) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1725, in BuildCondBranch original_result = fn() File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 132, in true_assert condition, data, summarize, name="Assert") File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/gen_logging_ops.py", line 47, in _assert name=name) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2956, in create_op op_def=op_def) File "/home/navinad/apps/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

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) = ] [3 3 3...] [y (mean_iou/ToInt64_2:0) = ] [19] [[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/device:CPU:0"](mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch/_1253, 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/_1255, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/data_3, mean_iou/confusion_matrix/assert_less/Assert/AssertGuard/Assert/Switch_2/_1257)]] [[Node: mean_iou/confusion_matrix/ones_like/Shape/_1373 = _HostRecv[client_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_3693_mean_iou/confusion_matrix/ones_like/Shape", tensor_type=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

Can anyone help me?

sunggukcha commented 6 years ago

I think it is due to different input. I gave cityscapes lists modified from 'gtFine%^& trainid' to 'gtFine%^& id', but the author intended https://github.com/hellochick/PSPNet-tensorflow/issues/6. I will try it ahead.

sunggukcha commented 6 years ago

After making gtFine_trainid, problem solved. Closed.