tensorflow - Error in 'ValidationMonitor' when passing 'metrics' parameter -


i'm using following code log accuracy validation measure (tensorflow 0.10):

  validation_metrics = {"accuracy": tf.contrib.metrics.streaming_accuracy}   validation_monitor = tf.contrib.learn.monitors.validationmonitor(                        input_fn=input_fn_eval,                        every_n_steps=flags.eval_every,                        # metrics=validation_metrics,                        early_stopping_rounds=500,                        early_stopping_metric="loss",                        early_stopping_metric_minimize=true) 

after running, in 'every_n_steps', see following lines in output:

info:tensorflow:validation (step 1000): loss = 1.04875, global_step = 900 

the problem when 'metrics=validation_metrics' parameter uncomment in above code, following error in validation phase:

info:tensorflow:error reported coordinator: <type 'exceptions.typeerror'>, input 'y' of 'equal' op has type int64 not match type float32 of argument 'x'. e tensorflow/core/client/tensor_c_api.cc:485] enqueue operation cancelled      [[node: read_batch_features_train/file_name_queue/file_name_queue_enqueuemany = queueenqueuemany[tcomponents=[dt_string], _class=["loc:@read_batch_features_train/file_name_queue"], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](read_batch_features_train/file_name_queue, read_batch_features_train/file_name_queue/randomshuffle)]] e tensorflow/core/client/tensor_c_api.cc:485] enqueue operation cancelled      [[node: read_batch_features_train/random_shuffle_queue_enqueuemany = queueenqueuemany[tcomponents=[dt_string, dt_string], _class=["loc:@read_batch_features_train/random_shuffle_queue"], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](read_batch_features_train/random_shuffle_queue, read_batch_features_train/read/readerreadupto, read_batch_features_train/read/readerreadupto:1)]] traceback (most recent call last):   file "udc_train.py", line 74, in <module>     tf.app.run()   file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run     sys.exit(main(sys.argv))   file "udc_train.py", line 70, in main     estimator.fit(input_fn=input_fn_train, steps=none, monitors=[validation_monitor])   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 240, in fit     max_steps=max_steps)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 578, in _train_model     max_steps=max_steps)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/graph_actions.py", line 280, in _supervised_train     none)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/supervised_session.py", line 270, in run     run_metadata=run_metadata)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/recoverable_session.py", line 54, in run     run_metadata=run_metadata)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/coordinated_session.py", line 70, in run     self._coord.join(self._coordinated_threads_to_join)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/coordinator.py", line 357, in join     six.reraise(*self._exc_info_to_raise)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/coordinated_session.py", line 66, in run     return self._sess.run(*args, **kwargs)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/monitored_session.py", line 107, in run     induce_stop = monitor.step_end(monitors_step, monitor_outputs)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 396, in step_end     return self.every_n_step_end(step, output)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 687, in every_n_step_end     steps=self.eval_steps, metrics=self.metrics, name=self.name)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 356, in evaluate     name=name)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 630, in _evaluate_model     eval_dict = self._get_eval_ops(features, targets, metrics)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 877, in _get_eval_ops     result[name] = metric(predictions, targets)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/metrics/python/ops/metric_ops.py", line 432, in streaming_accuracy     is_correct = math_ops.to_float(math_ops.equal(predictions, labels))   file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 708, in equal     result = _op_def_lib.apply_op("equal", x=x, y=y, name=name)   file "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 468, in apply_op     inferred_from[input_arg.type_attr])) typeerror: input 'y' of 'equal' op has type int64 not match type float32 of argument 'x'. 

this looks problem input_fn , estimator, returning different types label.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -