【问题标题】:Tensorflow: Not able to train my model because of checkpoint fileTensorflow:由于检查点文件,无法训练我的模型
【发布时间】:2017-08-23 16:15:23
【问题描述】:

我正在尝试设置 Tensorflow 的 Object Detection API 并关注 this doc

我在训练我的模型时遇到以下错误(它抱怨未找到检查点文件但它存在):

 python object_detection/train.py --logtostderr --pipeline_config_path=/c/ObjectDetection/models/model/faster_rcnn_resnet101_voc07_2.config --train_dir=/c/ObjectDetection/models/model/train
 INFO:tensorflow:Scale of 0 disables regularizer.
 INFO:tensorflow:Scale of 0 disables regularizer.
 INFO:tensorflow:Scale of 0 disables regularizer.
 INFO:tensorflow:Scale of 0 disables regularizer.
 INFO:tensorflow:Scale of 0 disables regularizer.
 INFO:tensorflow:Scale of 0 disables regularizer.
 INFO:tensorflow:Summary name Learning Rate is illegal; using Learning_Rate instead.
 Traceback (most recent call last):
   File "object_detection/train.py", line 198, in <module>
tf.app.run()
   File "C:\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
   File "object_detection/train.py", line 194, in main
worker_job_name, is_chief, FLAGS.train_dir)
   File "C:\ObjectDetection\models\object_detection\trainer.py", line 218, in train
var_map, train_config.fine_tune_checkpoint))
   File "C:\ObjectDetection\models\object_detection\utils\variables_helper.py", line 122, in get_variables_available_in_checkpoint
ckpt_reader = tf.train.NewCheckpointReader(checkpoint_path)
   File "C:\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 118, in NewCheckpointReader
return CheckpointReader(compat.as_bytes(filepattern), status)
   File "C:\Python\Python35\lib\contextlib.py", line 66, in __exit__
next(self.gen)
   File "C:\Python\Python35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
 tensorflow.python.framework.errors_impl.InvalidArgumentError: Unsuccessful TensorSliceReader constructor: Failed to get matching files on /c/ObjectDetection/faster_rcnn_resnet101_coco_11_06_2017/model.ckpt: Not found: FindFirstFile failed for: /c/ObjectDetection/faster_rcnn_resnet101_coco_11_06_2017 : The system cannot find the path specified.

我尝试过 Windows 和 Linux 格式的检查点文件路径,但出现以下错误:

Windows 格式路径('C:\ObjectDetectionaster_rcnn_resnet101_coco_11_06_2017\model.ckpt')

tensorflow.python.framework.errors_impl.InvalidArgumentError: Unsuccessful TensorSliceReader constructor: 
Failed to get matching files on C:\ObjectDetection
                          aster_rcnn_resnet101_coco_11_06_2017\model.ckpt: Invalid argument: 
FindFirstFile failed for: C:/ObjectDetection
           aster_rcnn_resnet101_coco_11_06_2017 : The filename, directory name, or volume label syntax is incorrect.

Linux 格式路径 ('/c/ObjectDetection/faster_rcnn_resnet101_coco_11_06_2017/model.ckpt')

tensorflow.python.framework.errors_impl.InvalidArgumentError: Unsuccessful TensorSliceReader constructor: 
Failed to get matching files on /c/ObjectDetection/faster_rcnn_resnet101_coco_11_06_2017/model.ckpt: Not found: 
FindFirstFile failed for: /c/ObjectDetection/faster_rcnn_resnet101_coco_11_06_2017 : The system cannot find the path specified.

  • 操作系统:Windows 10
  • Git bash 命令提示符
  • Python 3.5.2
  • 张量流 1.3.0

【问题讨论】:

    标签: python tensorflow object-detection


    【解决方案1】:

    正如您的错误消息所说,这是路径的问题,而不是 TensorFlow 函数的问题。

    即使在 Git Bash 中,我也使用标准的 windows 样式路径,即“C:\”而不是“/c/”。此外,您需要转义 \ 或将其设为原始字符串。如:

    'C:\\ObjectDetection\\faster_rcnn_resnet101_coco_11_06_2017\\model.ckpt'
    # or
    r'C:\ObjectDetection\\faster_rcnn_resnet101_coco_11_06_2017\\model.ckpt'
    

    请注意,在您粘贴的路径中,它显示的是 C:\ObjectDetectionaster_rcnn_... 而不是 C:\ObjectDetection\faster_rcnn_...。那是因为\f 指的是转义序列:

    >>> print('\f')
    
    
    >>> ord('\f')
    12
    >>> print('\\f')  # escape the slash
    \f
    >>> print(r'\f')  # or use raw strings with the 'r' prefix
    \f
    

    【讨论】:

      猜你喜欢
      • 2018-02-16
      • 2020-01-03
      • 1970-01-01
      • 1970-01-01
      • 2021-07-11
      • 2016-09-29
      • 2018-05-08
      • 2019-01-20
      • 1970-01-01
      相关资源
      最近更新 更多