ValueError: Ошибка преобразования тензорного потока Tensorflow - PullRequest
0 голосов
/ 07 ноября 2019

Я создаю tfrecord файлы и помещаю их в правильный каталог C:\Users\Admin\Desktop\models\research\object_detection\data

, а затем запускаю train.py, после чего появляется эта ошибка

Traceback (most recent call last):
File "legacy/train.py", line 184, in <module>
tf.app.run()
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "legacy/train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\object_detection\legacy\trainer.py", line 280, in train
train_config.prefetch_queue_capacity, data_augmentation_options)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\object_detection\legacy\trainer.py", line 59, in create_input_queue
tensor_dict = create_tensor_dict_fn()
File "legacy/train.py", line 121, in get_next
dataset_builder.build(config)).get_next()
File "C:\Users\Jayson\Anaconda3\lib\site-packages\object_detection\builders\dataset_builder.py", line 135, in build
config.input_path[:], input_reader_config)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\object_detection\builders\dataset_builder.py", line 80, in read_dataset
sloppy=config.shuffle))
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py", line 1990, in apply
return DatasetV1Adapter(super(DatasetV1, self).apply(transformation_func))
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py", line 1378, in apply
dataset = transformation_func(self)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\experimental\ops\interleave_ops.py", line 94, in _apply_fn
buffer_output_elements, prefetch_input_elements)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\ops\readers.py", line 226, in __init__
map_func, self._transformation_name(), dataset=input_dataset)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py", line 2713, in __init__
self._function = wrapper_fn._get_concrete_function_internal()
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\eager\function.py", line 1853, in _get_concrete_function_internal
*args, **kwargs)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\eager\function.py", line 1847, in _get_concrete_function_internal_garbage_collected
graph_function, _, _ = self._maybe_define_function(args, kwargs)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\eager\function.py", line 2147, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\eager\function.py", line 2038, in _create_graph_function
capture_by_value=self._capture_by_value),
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\framework\func_graph.py", line 915, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py", line 2707, in wrapper_fn
ret = _wrapper_helper(*args)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py", line 2652, in _wrapper_helper
ret = autograph.tf_convert(func, ag_ctx)(*nested_args)
File "C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python\autograph\impl\api.py", line 237, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in converted code:
relative to C:\Users\Jayson\Anaconda3\lib\site-packages\tensorflow_core\python:

data\ops\readers.py:336 __init__
    filenames, compression_type, buffer_size, num_parallel_reads)
data\ops\readers.py:296 __init__
    filenames = _create_or_validate_filenames_dataset(filenames)
data\ops\readers.py:56 _create_or_validate_filenames_dataset
    filenames = ops.convert_to_tensor(filenames, dtype=dtypes.string)
framework\ops.py:1184 convert_to_tensor
    return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
framework\ops.py:1242 convert_to_tensor_v2
    as_ref=False)
framework\ops.py:1273 internal_convert_to_tensor
    (dtype.name, value.dtype.name, value))

ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: <tf.Tensor 'args_0:0' shape=() dtype=float32>

Как решитьэта проблема?

Я попробовал несколько советов, которые нашел в Интернете, и в некоторых ответах говорилось, что нужно поместить tfrecord в правильный каталог, я пробовал, и это не помогло, и

ЧтоЯ ожидаю внутри tfrecord файла? потому что когда я открываю его, это в основном случайные символы.

...