Estimator 的 model_fn 包含 params 参数,但 params 不会传递给 Estimator [英] Estimator's model_fn includes params argument, but params are not passed to Estimator

查看:130
本文介绍了Estimator 的 model_fn 包含 params 参数,但 params 不会传递给 Estimator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地运行对象检测 API.

I'm trying to run Object Detection API locally.

我相信我已经按照 TensorFlow 对象检测 API 文档,但是,当我尝试运行 model_main.py 时,会显示此警告并且模型无法训练.(我真的无法判断模型是否正在训练,因为该过程并未终止,但不会出现更多日志)

I believe I have everything set up as described in the TensorFlow Object Detection API documents, however, when I'm trying to run model_main.py, this warning shows and model doesn't train. (I can't really tell if model is training or not, because the process isn't terminated, but no further logs appear)

警告:tensorflow:Estimator 的 model_fn (.model_fn at 0x0000024BDBB3D158>) 包括params 参数,但 params 不会传递给 Estimator.

WARNING:tensorflow:Estimator's model_fn (.model_fn at 0x0000024BDBB3D158>) includes params argument, but params are not passed to Estimator.

我传入的代码是:

python tensorflow-models/research/object_detection/model_main.py \
--model_dir=training \
--pipeline_config_path=ssd_mobilenet_v1_coco.config \
--checkpoint_dir=ssd_mobilenet_v1_coco_2017_11_17/model.ckpt \
--num_tain_steps=2000 \
--num_eval_steps=200 \
--alsologtostderr

是什么导致了这个警告?

What could be causing this warning?

为什么代码看起来卡住了?

Why would the code seem stuck?

请帮忙!

推荐答案

我遇到了同样的问题,我发现这个警告与模型不起作用的问题无关.我可以让模型像这个警告显示的那样工作.

I met the same problem, and I found that this warning has nothing to do with the problem that the model doesn't work. I can make the model work as this warning showing.

我的错误是我误解了running_locally.md文档中的那一行

My mistake was that I misunderstood the line in the document of running_locally.md

${MODEL_DIR} 指向将写入训练检查点和事件的目录"

"${MODEL_DIR} points to the directory in which training checkpoints and events will be written to"

我把MODEL_DIR改成了{project directory}/models/model,目录结构如下:

I changed the MODEL_DIR to the {project directory}/models/model where the structure of the directory is:

+data
  -label_map file
  -train TFRecord file
  -eval TFRecord file
+models
  + model
    -pipeline config file
    +train
    +eval

它奏效了.希望可以帮到你.

And it worked. Hoping this can help you.

虽然这可能有效,但在这种情况下 model_dir 不包含任何保存的检查点文件,如果您在保存一些检查点文件后停止训练并重新启动,仍会跳过培训.doc 指定了推荐 目录结构,但不必和tfrecord的所有路径结构相同,可以在配置文件中配置预训练的检查点.

while this may work, in this case model_dir does not contain any saved checkpoint files, if you stop the training after some checkpoint files are saved and restart again, the training would still be skipped. The doc specifies the recommended directory structure, but it is not necessary to be the same structure as all paths to tfrecord, pretrained checkpoints can be configured in the config file.

实际原因是当model_dir 包含已经到达NUM_TRAIN_STEP 的检查点文件时,脚本将假定训练已完成并退出.删除检查点文件并重新开始训练即可.

The actual reason is when model_dir contains checkpoint files which already reached the NUM_TRAIN_STEP, the script will assume the training is finished and exit. Remove the checkpoint files and restart training will work.

这篇关于Estimator 的 model_fn 包含 params 参数,但 params 不会传递给 Estimator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆