与这个问题类似:
在faster_rcnn_resnet50_coco模型中,model.ckpt在哪里可以找到?(这个解决方案对我不起作用)
我已经下载了ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8
,打算将其作为起点。我使用了与该模型在TF模型动物园中关联的样本模型配置。
我只更改了类别数量以及调优、训练和评估的路径。
使用:
fine_tune_checkpoint: "C:\\Users\\Peter\\Desktop\\Adv-ML-Project\\models\\research\\object_detection\\test_data\\checkpoint\\model.ckpt"
我得到:
tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for C:\Users\Pierre\Desktop\Adv-ML-Project\models\research\object_detection\test_data\checkpoint\model.ckpt
使用:
fine_tune_checkpoint: "C:\\Users\\Peter\\Desktop\\Adv-ML-Project\\models\\research\\object_detection\\test_data\\checkpoint\\ckpt-0.*"
我得到:
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file C:\Users\Pierre\Desktop\Adv-ML-Project\models\research\object_detection\test_data\checkpoint\ckpt-0.data-00000-of-00001: 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?
我目前使用绝对路径,因为这样最简单,但如果这是一个问题,我可以重新组织我的项目结构。
来自https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_training_and_evaluation.md的官方文档说应该做类似以下的事情
fine_tune_checkpoint: a path prefix to the pre-existing checkpoint (ie:"/usr/home/username/checkpoint/model.ckpt-#####").
我在这里做错了什么吗?我使用以下命令运行(也来自文档):
python object_detection/model_main_tf2.py \ --pipeline_config_path="C:\\Users\Pierre\\Desktop\\Adv-ML-Project\\models\\my_model\\my_model.config" \ --model_dir="C:\\Users\\Pierre\\Desktop\\Adv-ML-Project\\models\\my_model\\training" \ --alsologtostderr
回答:
尝试在配置文件中将fine_tune_checkpoint
路径更改为类似path_to_folder/ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint/ckpt-0
的路径
在你的训练命令中,设置model_dir
标志只指向模型目录,不要包含training
,类似于--model_dir=<path_to>/ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8
将反斜杠更改为正斜杠,因为你在使用Windows