我遇到了同样的问题。它说model_dir和chechpoint_dir不能相同,但是,如果它们不同,则训练将从头开始。
这是由于最近(5 月 7 日)在文件“research/object_detection/utils/variables_helper.py”末尾添加了一个检查:
if model_dir == checkpoint_path_dir:
raise RuntimeError(
('Checkpoint dir ({}) and model_dir ({}) cannot be same.'.format(
checkpoint_path_dir,model_dir) +
(' Please set model_dir to a different path.')))
我设法通过将其更改为以下内容来修复它:
if model_dir == checkpoint_path_dir:
pass
# raise RuntimeError(
# ('Checkpoint dir ({}) and model_dir ({}) cannot be same.'.format(
# checkpoint_path_dir,model_dir) +
# (' Please set model_dir to a different path.')))
在克隆 Github 存储库之后和之前安装 object_detection 包。
我相信您也可以更改克隆版本,例如(可能需要进行一些编辑才能使其正常工作):
import os
import pathlib
# Clone the tensorflow models repository if it doesn't already exist
if "models" in pathlib.Path.cwd().parts:
while "models" in pathlib.Path.cwd().parts:
os.chdir('..')
elif not pathlib.Path('models').exists():
!git clone --depth 1 https://github.com/tensorflow/models
!git checkout 'master@{2021-05-6 00:00:00}'
,
- 'fine_tune_checkpoint' 应该指向 'pre_trained_model' 文件夹中的检查点;
- 'model_dir' 是您保存新检查点的目录。
无需手动更改文件夹。如果“model_dir”中有任何检查点,则列车将从该点重新开始。如果没有检查点,火车将从'pre_trained_model'文件夹中的检查点开始。
本文链接:https://www.f2er.com/455656.html