rishizek / tensorflow-deeplab-v3-plus

DeepLabv3+ built in TensorFlow
MIT License
834 stars 307 forks source link

Error with using inference.py #7

Closed newip closed 6 years ago

newip commented 6 years ago

run

python3 inference.py --data_dir '/home/nvidia/dev/dev_dataset/data_dir' --infer_data_list '/home/nvidia/dev/dev_dataset/infer_data_list' --model_dir '/home/nvidia/dev/pretrainedmodels/deeplabv3plus_ver1'

with error of

TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.

Error shows as below:

INFO:tensorflow:Using default config. INFO:tensorflow:Using config: {'_global_id_in_cluster': 0, '_is_chief': True, '_log_step_count_steps': 100, '_save_summary_steps': 100, '_save_checkpoints_secs': 600, '_save_checkpoints_steps': None, '_task_type': 'worker', '_num_worker_replicas': 1, '_task_id': 0, '_session_config': None, '_model_dir': '/home/nvidia/dev/pretrainedmodels/deeplabv3plus_ver1', '_keep_checkpoint_max': 5, '_evaluation_master': '', '_keep_checkpoint_every_n_hours': 10000, '_master': '', '_cluster_spec': , '_num_ps_replicas': 0, '_tf_random_seed': None, '_service': None} Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 510, in _apply_op_helper preferred_dtype=default_dtype) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1040, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 883, in _TensorTensorConversionFunction (dtype.name, t.dtype.name, str(t))) ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("arg0:0", shape=(), dtype=float32)' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "inference.py", line 100, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "inference.py", line 84, in main for pred_dict, image_path in zip(predictions, image_files): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/estimator.py", line 486, in predict input_fn, model_fn_lib.ModeKeys.PREDICT) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/estimator.py", line 662, in _get_features_from_input_fn result = self._call_input_fn(input_fn, mode) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/estimator.py", line 772, in _call_input_fn return input_fn(**kwargs) File "inference.py", line 77, in input_fn=lambda: preprocessing.eval_input_fn(image_files), File "/home/nvidia/dev/github/tensorflow-deeplab-v3-plus/utils/preprocessing.py", line 256, in eval_input_fn dataset = dataset.map(lambda x: _parse_function(x, False)) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 838, in map return MapDataset(self, map_func) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1826, in __init__ self._map_func.add_to_graph(ops.get_default_graph()) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/function.py", line 488, in add_to_graph self._create_definition_if_needed() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/function.py", line 321, in _create_definition_if_needed self._create_definition_if_needed_impl() File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/function.py", line 338, in _create_definition_if_needed_impl outputs = self._func(*inputs) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 1791, in tf_map_func ret = map_func(nested_args) File "/home/nvidia/dev/github/tensorflow-deeplab-v3-plus/utils/preprocessing.py", line 256, in dataset = dataset.map(lambda x: _parse_function(x, False)) File "/home/nvidia/dev/github/tensorflow-deeplab-v3-plus/utils/preprocessing.py", line 232, in _parse_function image_string = tf.read_file(image_filename) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 527, in read_file "ReadFile", filename=filename, name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 533, in _apply_op_helper (prefix, dtypes.as_dtype(input_arg.type).name)) TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.
newip commented 6 years ago

infer_data_list should be a file. Not intended to be a folder.

newip commented 6 years ago

Duplicate with #3