"tensorflow.python.framework.errors_impl.FailedPreconditionError" 而 运行 "model_main_tf2.py" 用于在 tensorflow 中训练目标检测模型
"tensorflow.python.framework.errors_impl.FailedPreconditionError" while running "model_main_tf2.py" for training object detection model in tensorflow
很多人也遇到过这个问题,但似乎总是因为命令行参数中的一些错误而发生
这是我的命令 运行
!python "/content/drive/My Drive/Tensorflow/models/research/object_detection/model_main_tf2.py" --model_dir="/content/drive/My Drive/Tensorflow/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8" --pipeline_config_path="/content/drive/My Drive/Tensorflow/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8/pipeline.config"
好像没有什么错误。
这是堆栈跟踪
Traceback (most recent call last):
File "/content/drive/My Drive/Tensorflow/models/research/object_detection/model_main_tf2.py", line 113, in <module>
tf.compat.v1.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "/content/drive/My Drive/Tensorflow/models/research/object_detection/model_main_tf2.py", line 110, in main
record_summaries=FLAGS.record_summaries)
File "/usr/local/lib/python3.6/dist-packages/object_detection/model_lib_v2.py", line 630, in train_loop
manager.save()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/checkpoint_management.py", line 819, in save
self._record_state()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/checkpoint_management.py", line 728, in _record_state
save_relative_paths=True)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/checkpoint_management.py", line 248, in update_checkpoint_state_internal
text_format.MessageToString(ckpt))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 570, in atomic_write_string_to_file
rename(temp_pathname, filename, overwrite)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 529, in rename
rename_v2(oldname, newname, overwrite)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 546, in rename_v2
compat.as_bytes(src), compat.as_bytes(dst), overwrite)
错误信息:
tensorflow.python.framework.errors_impl.FailedPreconditionError: /content/drive/My Drive/Tensorflow/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8/checkpoint.tmp91048f3bf67645619be6603094546de1; Is a directory
错误来自 _pywrap_file_io.RenameFile()
,其中 _pywrap_file_io
是从 tensorflow.python
导入的。我试图查看源代码以查找问题,但我找不到任何地方。
问题是否已经出现,因为我在 colab 运行 上?
张量流版本:2.3
Python版本:3.6
有人可以帮我解决这个问题吗?
问题是程序试图创建一个名为“checkpoint”的文件,但下载的模型中有一个同名文件夹。
有两种方法可以解决这个问题,
- 创建一个新文件夹并将其路径设置为 --model_dir
的参数
- 检查是否有名为'checkpoint'的文件夹,如果有,则更改文件夹名称。就我而言,我将其更改为“checkpoint0”。
很多人也遇到过这个问题,但似乎总是因为命令行参数中的一些错误而发生
这是我的命令 运行
!python "/content/drive/My Drive/Tensorflow/models/research/object_detection/model_main_tf2.py" --model_dir="/content/drive/My Drive/Tensorflow/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8" --pipeline_config_path="/content/drive/My Drive/Tensorflow/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8/pipeline.config"
好像没有什么错误。
这是堆栈跟踪
Traceback (most recent call last):
File "/content/drive/My Drive/Tensorflow/models/research/object_detection/model_main_tf2.py", line 113, in <module>
tf.compat.v1.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "/content/drive/My Drive/Tensorflow/models/research/object_detection/model_main_tf2.py", line 110, in main
record_summaries=FLAGS.record_summaries)
File "/usr/local/lib/python3.6/dist-packages/object_detection/model_lib_v2.py", line 630, in train_loop
manager.save()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/checkpoint_management.py", line 819, in save
self._record_state()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/checkpoint_management.py", line 728, in _record_state
save_relative_paths=True)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/checkpoint_management.py", line 248, in update_checkpoint_state_internal
text_format.MessageToString(ckpt))
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 570, in atomic_write_string_to_file
rename(temp_pathname, filename, overwrite)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 529, in rename
rename_v2(oldname, newname, overwrite)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 546, in rename_v2
compat.as_bytes(src), compat.as_bytes(dst), overwrite)
错误信息:
tensorflow.python.framework.errors_impl.FailedPreconditionError: /content/drive/My Drive/Tensorflow/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8/checkpoint.tmp91048f3bf67645619be6603094546de1; Is a directory
错误来自 _pywrap_file_io.RenameFile()
,其中 _pywrap_file_io
是从 tensorflow.python
导入的。我试图查看源代码以查找问题,但我找不到任何地方。
问题是否已经出现,因为我在 colab 运行 上?
张量流版本:2.3 Python版本:3.6
有人可以帮我解决这个问题吗?
问题是程序试图创建一个名为“checkpoint”的文件,但下载的模型中有一个同名文件夹。 有两种方法可以解决这个问题,
- 创建一个新文件夹并将其路径设置为 --model_dir 的参数
- 检查是否有名为'checkpoint'的文件夹,如果有,则更改文件夹名称。就我而言,我将其更改为“checkpoint0”。