运行train.py或model_main.py时发生未知错误

时间:2019-11-28 18:46:48

标签: python-3.x windows tensorflow gpu object-detection

自从我使用ssdlite_mobilenet_v2_coco模型以来,我一直在github上进行本指南的更改,并且遇到了未知错误。

https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

消息:

**Traceback (most recent call last):
  File "model_main.py", line 109, in <module>
    tf.app.run()
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
    _sys.exit(main(argv))
  File "model_main.py", line 105, in main
    tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\training.py", line 439, in train_and_evaluate
    executor.run()
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\training.py", line 518, in run
    self.run_local()
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\training.py", line 650, in run_local
    hooks=train_hooks)
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\estimator.py", line 363, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\estimator.py", line 843, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\estimator.py", line 853, in _train_model_default
    input_fn, model_fn_lib.ModeKeys.TRAIN))
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\estimator.py", line 691, in _get_features_and_labels_from_input_fn
    result = self._call_input_fn(input_fn, mode)
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\estimator\estimator.py", line 798, in _call_input_fn
    return input_fn(**kwargs)
  File "C:\tensorflow\models\research\object_detection\inputs.py", line 504, in _train_input_fn
    params=params)
  File "C:\tensorflow\models\research\object_detection\inputs.py", line 607, in train_input
    batch_size=params['batch_size'] if params else train_config.batch_size)
  File "C:\tensorflow\models\research\object_detection\builders\dataset_builder.py", line 130, in build
    num_additional_channels=input_reader_config.num_additional_channels)
  File "C:\tensorflow\models\research\object_detection\data_decoders\tf_example_decoder.py", line 319, in __init__
    default_value=''),
  File "C:\tensorflow\models\research\object_detection\data_decoders\tf_example_decoder.py", line 64, in __init__
    label_map_proto_file, use_display_name=False)
  File "C:\tensorflow\models\research\object_detection\utils\label_map_util.py", line 172, in get_label_map_dict
    label_map = load_labelmap(label_map_path_or_proto)
  File "C:\tensorflow\models\research\object_detection\utils\label_map_util.py", line 139, in load_labelmap
    label_map_string = fid.read()
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 120, in read
    self._preread_check()
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 80, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "C:\Users\luke9\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in __exit__
    c_api.TF_GetCode(self.status.status))
esearch\object_detection        raining\labelmap.pbtxt : The filename, directory name, or volume label syntax is incorrect.odels
; Unknown error**

当我通过anaconda在tensorflow-gpu 1.8上运行时,我已经尝试了train.py和model_main.py。

培训文件夹中的labelmap.pbtxt确实存在,我不确定为什么要尝试找到“ raining \ labelmap.pbtxt”

2 个答案:

答案 0 :(得分:0)

您应尝试指定labelmap.pbtxt文件的绝对路径,否则您当前目录中的路径不正确

答案 1 :(得分:0)

在您指定的文件路径中用反斜杠(\)替换正斜杠(/)。它对我有用。