Tensorflow Object Detection API ValueError: No variables to save
Tensorflow Object Detection API ValueError: No variables to save
我正在尝试使用 tensorflow 对象检测来训练自定义对象检测模型 api。出于训练目的,我使用 pickled 图像数据集进行训练,并作为模型使用 ssd_mobilenet_v1_coco
。当我开始训练时,它给了我这个错误。
Traceback (most recent call last):
File "train.py", line 184, in <module>
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "/content/models/research/object_detection/trainer.py", line 381, in train
init_saver = tf.train.Saver(available_var_map)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py", line 1338, in __init__
self.build()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py", line 1347, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py", line 1372, in _build
raise ValueError("No variables to save")
ValueError: No variables to save
完整的错误代码可以在这里找到...
[https://gist.github.com/mpgovinda/1f59f7de7873f6ec4c4426b79dc6827a][1]
我该如何解决这个问题?
我在尝试使用 inception v2 训练 faster-rcnn 时遇到了同样的错误。原来我的模型配置文件中有错误的微调检查点。在我链接到模型的适当检查点后,错误消失了。
最新机型有此问题,解决办法:
转到模型的“.config”文件并在训练部分进行更改
from_detection_checkpoint: true
为假
它会起作用。
快乐编码:)
我有同样的错误。使用不同的检查点解决。
您应该使用检查点或从 slim.learning.train 参数中删除 "init_fn=init_fn" 并从训练器中删除 "initializer_fn" 变量。
你可以在 trainer
的第 393 行左右访问所有这些
测试解决方案
将 fine_tune_checkpoint_type: "detection"
添加到 *.config
文件的 train_config: { ... }
部分。
⭐ 样本
train_config: {
...
fine_tune_checkpoint: "./pre_trained_model/model.ckpt"
fine_tune_checkpoint_type: "detection"
...
}
Tested on ssd_mobilenet_v1_quantized_300x300_coco14_sync
model.
正在训练这个模型http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_coco_2018_03_29.tar.gz
运行进入同样的错误。不太喜欢别人的解决方案设置from_detection_checkpoint: false
.
已通过在模型附带的 pipeline.config
的 train_config
中添加 load_all_detection_checkpoint_vars: true
字段来修复。
我还添加了 from_detection_checkpoint: true
,因为它不存在,不确定它是否与解决方案相关。
fine_tune_checkpoint: "path_to_model_ckpt/model.ckpt"
from_detection_checkpoint: true
load_all_detection_checkpoint_vars: true # this here fixed it
num_steps: 200000 # irrelevant
fine_tune_checkpoint_type: "detection"
我正在尝试使用 tensorflow 对象检测来训练自定义对象检测模型 api。出于训练目的,我使用 pickled 图像数据集进行训练,并作为模型使用 ssd_mobilenet_v1_coco
。当我开始训练时,它给了我这个错误。
Traceback (most recent call last):
File "train.py", line 184, in <module>
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train.py", line 180, in main
graph_hook_fn=graph_rewriter_fn)
File "/content/models/research/object_detection/trainer.py", line 381, in train
init_saver = tf.train.Saver(available_var_map)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py", line 1338, in __init__
self.build()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py", line 1347, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py", line 1372, in _build
raise ValueError("No variables to save")
ValueError: No variables to save
完整的错误代码可以在这里找到...
[https://gist.github.com/mpgovinda/1f59f7de7873f6ec4c4426b79dc6827a][1]
我该如何解决这个问题?
我在尝试使用 inception v2 训练 faster-rcnn 时遇到了同样的错误。原来我的模型配置文件中有错误的微调检查点。在我链接到模型的适当检查点后,错误消失了。
最新机型有此问题,解决办法:
转到模型的“.config”文件并在训练部分进行更改
from_detection_checkpoint: true
为假
它会起作用。
快乐编码:)
我有同样的错误。使用不同的检查点解决。
您应该使用检查点或从 slim.learning.train 参数中删除 "init_fn=init_fn" 并从训练器中删除 "initializer_fn" 变量。 你可以在 trainer
的第 393 行左右访问所有这些测试解决方案
将 fine_tune_checkpoint_type: "detection"
添加到 *.config
文件的 train_config: { ... }
部分。
⭐ 样本
train_config: {
...
fine_tune_checkpoint: "./pre_trained_model/model.ckpt"
fine_tune_checkpoint_type: "detection"
...
}
Tested on
ssd_mobilenet_v1_quantized_300x300_coco14_sync
model.
正在训练这个模型http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_coco_2018_03_29.tar.gz
运行进入同样的错误。不太喜欢别人的解决方案设置from_detection_checkpoint: false
.
已通过在模型附带的 pipeline.config
的 train_config
中添加 load_all_detection_checkpoint_vars: true
字段来修复。
我还添加了 from_detection_checkpoint: true
,因为它不存在,不确定它是否与解决方案相关。
fine_tune_checkpoint: "path_to_model_ckpt/model.ckpt"
from_detection_checkpoint: true
load_all_detection_checkpoint_vars: true # this here fixed it
num_steps: 200000 # irrelevant
fine_tune_checkpoint_type: "detection"