我正在尝试使用张量流对象检测api训练自定义对象检测模型。出于训练目的,我使用了腌制的图像数据集进行训练,并作为模型使用了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]


我该如何解决?

最佳答案

Solution经过测试的解决方案

fine_tune_checkpoint_type: "detection"添加到train_config: { ... }文件中的*.config部分。

⭐样品

train_config: {
  ...
  fine_tune_checkpoint: "./pre_trained_model/model.ckpt"
  fine_tune_checkpoint_type:  "detection"
  ...
}



on在ssd_mobilenet_v1_quantized_300x300_coco14_sync模型上测试。

08-25 00:11