python - tensorflow object detection 从现有检查点微调模型

标签 python machine-learning tensorflow object-detection

我正在尝试从现有检查点训练模型,遵循这些 instructions .

我有configured使用 faster_rcnn_resnet101_voc07.config 的对象检测训练管道配置。

在检查点部分,我设置了预训练模型的检查点文件所在的目录 faster_rcnn_resnet101_coco.tar.gz

根据这个issue fine_tune_checkpoint 可以是包含以下三个文件的目录的路径:(.data-00000-of-00001, .index, .meta)。

所以我将路径设置为目录“/home/docs/car_dataset/models/model/train

gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint: "/home/docs/car_dataset/models/model/train"
  from_detection_checkpoint: true
  num_steps: 800000
  data_augmentation_options {
    random_horizontal_flip {
    }
  }

但是当我执行训练脚本时:

python object_detection/train.py     --logtostderr\
--pipeline_config_path=/home/docs/car_dataset/models/model/faster_rcnn_resnet101_voc07.config\
--train_dir=/home/docs/car_dataset/models/model/train\
--num_gpus=2

我得到了错误:

tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/docs/car_dataset/models/model/train: Failed precondition: /home/docs/car_dataset/models/model/train: perhaps your file is in a different file format and you need to use a different restore operator?

我也试过设置目录中每个文件的路径

fine_tune_checkpoint: "/home/docs/car_dataset/models/model/train/model.ckpt.meta"

但是我得到了错误:

tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/docs/car_dataset/models/model/train/model.ckpt.meta: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?

在具有以下三个文件的管道配置中定义预训练模型的正确方法是什么:(.data-00000-of-00001、.index、.meta)。

Tensorflow 版本:1.2.1

最佳答案

您需要做的是指定没有“.meta”、“.index”和“.data-00000-of-00001”扩展名的整个路径。在您的情况下,这看起来是: “/home/docs/car_dataset/models/model/train/model.ckpt”(您会注意到它比目录更具体)。

关于python - tensorflow object detection 从现有检查点微调模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45685887/

相关文章:

python - "Pillow was built without XCB support"

python - 如何导入包含重复信息行( block )的 csv 文件,例如以 'T' 开头的行指的是时间等

python - 一维数据中的阈值

python - 使用堆栈通过单列索引多列

python - 如何将 .csv 训练数据提供给 mxnet 中的卷积神经网络?

machine-learning - 是否有必要为卡住层定义后向函数?

php - 日志文件与数据库在哪里保存用户事件数据以供分析?

c - 使用 TF_SessionRun 在 C(而非 C++)中运行 TensorFlow 图形时出现段错误

python - 具有两个输入的 Tensorflow 运算,返回两个输入之一并覆盖梯度

python-3.x - 遇到以下问题 : build_tensor_flow is not supported in Eager Mode