简体   繁体   English

使用 tensorflow 运行预训练的 model 的奇怪问题

[英]Weird issue with running pretrained model with tensorflow

(tensorflow) C:\tensorflow\workspace\training_demo>python model_main_tf2.py --model_dir=C:/tensorflow/workspace/models/my_ssd_resnet50_v1_fpn --pipeline_config_path=C:/tensorflow/workspace/models/my_ssd_resnet50_v1_fpn/pipeline.config
From C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py:522: StrategyBase.experimental_distribute_datasets_from_function (from tensorflow.python.distribute.distribute_lib) is deprecated and will be removed in a future version.
Instructions for updating:
rename to distribute_datasets_from_function
Traceback (most recent call last):
  File "model_main_tf2.py", line 113, in <module>
    tf.compat.v1.app.run()
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\absl\app.py", line 300, in run
    _run_main(main, args)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\absl\app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "model_main_tf2.py", line 104, in main
    model_lib_v2.train_loop(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 522, in train_loop
    train_input = strategy.experimental_distribute_datasets_from_function(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\util\deprecation.py", line 340, in new_func
    return func(*args, **kwargs)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\distribute_lib.py", line 1143, in experimental_distribute_datasets_from_function
    return self.distribute_datasets_from_function(dataset_fn, options)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\distribute_lib.py", line 1134, in distribute_datasets_from_function
    return self._extended._distribute_datasets_from_function(  # pylint: disable=protected-access
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\mirrored_strategy.py", line 545, in _distribute_datasets_from_function
    return input_lib.get_distributed_datasets_from_function(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 161, in get_distributed_datasets_from_function
    return DistributedDatasetsFromFunction(dataset_fn, input_workers,
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 1272, in __init__
    _create_datasets_from_function_with_input_context(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\distribute\input_lib.py", line 1936, in _create_datasets_from_function_with_input_context
    dataset = dataset_fn(ctx)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\model_lib_v2.py", line 513, in train_dataset_fn
    train_input = inputs.train_input(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\inputs.py", line 870, in train_input
    dataset = INPUT_BUILDER_UTIL_MAP['dataset_build'](
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\builders\dataset_builder.py", line 195, in build
    decoder = decoder_builder.build(input_reader_config)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\builders\decoder_builder.py", line 52, in build
    decoder = tf_example_decoder.TfExampleDecoder(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 391, in __init__
    _ClassTensorHandler(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 88, in __init__
    name_to_id = label_map_util.get_label_map_dict(
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\utils\label_map_util.py", line 201, in get_label_map_dict
    label_map = load_labelmap(label_map_path_or_proto)
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\object_detection\utils\label_map_util.py", line 168, in load_labelmap
    label_map_string = fid.read()
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 117, in read
    self._preread_check()
  File "C:\Users\bigbootytx\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 79, in _preread_check
    self._read_buf = _pywrap_file_io.BufferedInputStream(
tensorflow.python.framework.errors_impl.InvalidArgumentError: NewRandomAccessFile failed to Create/Open: C:     ensorflow\workspacennotations\labelmap.pbtxt : The filename, directory name, or volume label syntax is incorrect.
; no protocol option

So im getting this weird issue where its changing the path of the file its looking for on its own.所以我遇到了这个奇怪的问题,它改变了它自己寻找的文件的路径。

C: ensorflow\workspacennotations\labelmap.pbtxt should be C:tensorflow\workspace\annotations\labelmap.pbtxt C:ensorflow\workspacennotations\labelmap.pbtxt 应该是 C:tensorflow\workspace\annotations\labelmap.pbtxt

Been stuck on this issue for quite a while now, tried several things including changing to forward slashes and stuff.已经在这个问题上停留了很长一段时间,尝试了几件事,包括更改为正斜杠和其他东西。 Any idea what to do here?知道在这里做什么吗? I followed this guide: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html我遵循了本指南: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html

\t in your path automatically replaces by tab.路径中的\t会自动替换为制表符。 For prevent this on Windows, you need use double backslash ( \\ ) as path delimiter: C:\\tensorflow\\...为了防止 Windows 出现这种情况,您需要使用双反斜杠 ( \\ ) 作为路径分隔符: C:\\tensorflow\\...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM