在运行object_detection模型以评估现有检查点时 来自tensorflow模型库的ssd_mobilent_v2_coco_2018_03_29,我得到一个错误,即在检查点中找不到变量:
HERE=`pwd`
#MODEL_DIR=$HERE/models/model
cd ~/tf-models/research
#setting a CKPT dir will cause model_main to only eval the model, not train
CONFIG=${HERE}/models/pipeline.config
CKPT=${HERE}/models/ssd_mobilenet_v2_coco_2018_03_29/model.ckpt
python object_detection/model_main.py \
--pipeline_config_path=$CONFIG \
--model_dir=${HERE}/eval_dir2 \
--alsologtostderr \
--checkpoint_dir= $CKPT \
--number_eval_steps=1 \
--run_once
输出:
tensorflow.python.framework.errors_impl.NotFoundError: Key
FeatureExtractor/MobilenetV2/layer_19_2_Conv2d_2_3x3_s2_512_depthwise/BatchNorm/beta
not found in checkpoint
但是,当我在检查点上运行inspect_checkpoint.py时,我发现该变量存在。
python inspect_checkpoint.py --file_name models/ssd_mobilenet_v2_coco_2018_03_29/model.ckpt
输出:
...lots of vars...
FeatureExtractor/MobilenetV2/layer_19_2_Conv2d_2_3x3_s2_512_depthwise/BatchNorm/beta (DT_FLOAT) [256]
...more...
什么使它抱怨文件中显然缺少变量?该pipeline.config文件是模型随附的文件,其中的路径已适当编辑。 batch_norm_trainable配置行已删除(在其他论坛上以及该模型中不存在变量的事实)。
答案 0 :(得分:0)
我的错误是--checkpoint_dir =参数后面的空格导致它看不到checkpoint_dir。现在一切都好了...