简体   繁体   English

无法加载预训练的 model 检查点与 TensorFlow Object 检测 ZDB974238714CA8DE634A7ACE1

[英]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.我目前正在使用绝对路径,因为它最简单,但如果这是一个问题,我可以重新组织我的项目结构。

Checkpoint Folder检查点文件夹

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

Source 资源

Just change the backslashes to forward-slashes, since you're on windows只需将反斜杠更改为正斜杠,因为您使用的是 windows

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 改进预训练的 tensorflow object 检测 model - Improving a pre-trained tensorflow object detection model 如何评估预训练的 model Tensorflow Object 检测 ZDB974238714CA38DE634A7CE1ZF0 - How can I evaluate pre-trained model Tensorflow Object Detection API 预训练 Object 检测 API model 用于灰度图像(1通道) - Pre-trained Object Detection API model for greyscale images (1 channel) 恢复预训练模型的Tensorflow检查点文件 - Restoring Tensorflow checkpoint files of a pre-trained model 如何将预训练的张量流模型加载并预测到Java代码中? - How to load and predict a pre-trained tensorflow model into Java code? TensorFlow 2.0 C++ - 加载预训练 model - TensorFlow 2.0 C++ - Load pre-trained model 无法加载 tensorflow BERT 预训练模型 - Failed to load tensorflow BERT pre-trained model 如何加载由 Google 命名为 inception 的预训练张量流模型? - How to load pre-trained tensorflow model named inception by Google? 运行 run_squad.py 以微调 Google BERT 模型(官方 tensorflow 预训练模型)时无法加载(恢复)TensorFlow 检查点 - Failed to load(restore) TensorFlow checkpoint when running run_squad.py to fine-tune the Google BERT model(official tensorflow pre-trained model) 如何使用Github和CheckPoint文件中预先训练的Tensorflow模型进行推理 - How to run inference using pre-trained Tensorflow model from their Github and CheckPoint file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM