Tensorflow:由于检查点fi,无法训练我的模型

2024-09-24 00:35:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试设置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格式路径\型号.ckpt')

^{pr2}$

Linux格式路径/型号.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版
  • tensorflow 1.3.0版

Tags: ofinpyinfoobjecttensorflowlinetrain
1条回答
网友
1楼 · 发布于 2024-09-24 00:35:41

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

即使在gitbash中,我也使用标准的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_...,而不是{}。这是因为\f表示转义序列:

^{pr2}$

相关问题 更多 >