[英]Unable to load pre-trained model checkpoint with TensorFlow Object Detection API
Similar to this question:类似于这个问题:
Where can I find model.ckpt in faster_rcnn_resnet50_coco model? 我在哪里可以找到 fast_rcnn_resnet50_coco model 中的 model.ckpt? (this solution doesn't work for me)
(这个解决方案对我不起作用)
I have downloaded the ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8
with the intention of using it as a starting point.我已经下载了
ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8
并打算将其用作起点。 I am using the sample model configuration associated with that model in the TF model zoo.我在 TF model 动物园中使用与 model 关联的示例 model 配置。
I am only changing the num classes and paths for tuning, training and eval.我只是更改调整、训练和评估的 num 类和路径。
With:和:
fine_tune_checkpoint: "C:\\Users\\Peter\\Desktop\\Adv-ML-Project\\models\\research\\object_detection\\test_data\\checkpoint\\model.ckpt"
I get:我得到:
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
With:和:
fine_tune_checkpoint: "C:\\Users\\Peter\\Desktop\\Adv-ML-Project\\models\\research\\object_detection\\test_data\\checkpoint\\ckpt-0.*"
I get:我得到:
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 mag
ic number): perhaps your file is in a different file format and you need to use a different restore operator?
I'm currently using absolute paths because it's easiest, but if it's a problem I can re-organize my project structure.我目前正在使用绝对路径,因为它最简单,但如果这是一个问题,我可以重新组织我的项目结构。
The official documentation from https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_training_and_evaluation.md says to do something like 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-#####").
Is there something I am doing wrong here?我在这里做错了什么吗? I am running this with the following command (also from documentation):
我正在使用以下命令(也来自文档)运行它:
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
Try changing the fine_tune_checkpoint
path in the config file to something like path_to_folder/ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint/ckpt-0
尝试将配置文件中的
fine_tune_checkpoint
路径更改为path_to_folder/ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint/ckpt-0
And in your training command, set the model_dir
flag to just point to the model directory, don't include training
, kind of like --model_dir=<path_to>/ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8
在您的训练命令中,将
model_dir
标志设置为仅指向 model 目录,不包括training
,有点像--model_dir=<path_to>/ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8
Just change the backslashes to forward-slashes, since you're on windows只需将反斜杠更改为正斜杠,因为您使用的是 windows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.