簡體   English   中英

無法加載預訓練的 model 檢查點與 TensorFlow Object 檢測 ZDB974238714CA8DE634A7ACE1

[英]Unable to load pre-trained model checkpoint with TensorFlow Object Detection API

類似於這個問題:

我在哪里可以找到 fast_rcnn_resnet50_coco model 中的 model.ckpt? (這個解決方案對我不起作用)

我已經下載了ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8並打算將其用作起點。 我在 TF model 動物園中使用與 model 關聯的示例 model 配置。

我只是更改調整、訓練和評估的 num 類和路徑。

和:

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 mag
ic 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標志設置為僅指向 model 目錄,不包括training ,有點像--model_dir=<path_to>/ssd_resnet152_v1_fpn_1024x1024_coco17_tpu-8

資源

只需將反斜杠更改為正斜杠,因為您使用的是 windows

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM