【问题标题】:Some Python objects were not bound to checkpointed values一些 Python 对象未绑定到检查点值
【发布时间】:2020-12-12 13:41:10
【问题描述】:

我正在尝试开始使用 Tensorflow 2.0 Object Detection API。我已经按照the official tutorial 进行了安装,并且通过了所有测试。但是,当我尝试运行主模块时,我不断收到一条我不理解的错误消息。这就是我运行它的方式:

python model_main_tf2.py --model_dir=ssd_resnet50_v1_fpn_640x640_coco17_tpu-8 --pipeline_config_path=ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/pipeline.config

这是错误信息的开头:

Traceback (most recent call last):
  File "model_main_tf2.py", line 113, in <module>
    tf.compat.v1.app.run()
  File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "model_main_tf2.py", line 110, in main
    record_summaries=FLAGS.record_summaries)
  File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/object_detection/model_lib_v2.py", line 569, in train_loop
    unpad_groundtruth_tensors)
  File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/object_detection/model_lib_v2.py", line 383, in load_fine_tune_checkpoint
    ckpt.restore(checkpoint_path).assert_existing_objects_matched()
  File "/home/hd/hd_hd/hd_rs239/.conda/envs/jan_tf2/lib/python3.7/site-packages/tensorflow/python/training/tracking/util.py", line 791, in assert_existing_objects_matched
    (list(unused_python_objects),))
AssertionError: Some Python objects were not bound to checkpointed values, likely due to changes in the Python program: [SyncOnReadVariable:{
  0: <tf.Variable 'conv2_block1_0_bn/moving_variance:0' shape=(256,) dtype=float32, numpy=
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,

在 pipeline.config 中,我指定了一个这样的检查点:

  fine_tune_checkpoint: "ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint/ckpt-0" 

这些是ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint/的内容:

checkpoint  
ckpt-0.data-00000-of-00001  
ckpt-0.index

我搜索了谷歌,但找不到任何答案。在this issue 中,建议的解决方案已过时(他们建议替换的代码不再存在)。

问题:问题是什么,我该如何解决?

我正在使用 CentOS Linux 7 的服务器上执行此操作。我使用的是 Python 3.7。我是 Tensorflow 的新手,所以如果我遗漏了任何重要信息,请告诉我。

【问题讨论】:

  • 很可能是最新的 tensorflow 2.3.0 中的一个错误
  • 在导出自定义模型时,我在 TensorFlow 2.2.0 中遇到了同样的错误。

标签: python tensorflow deep-learning tensorflow2.0 object-detection-api


【解决方案1】:

根据您提供的文件名 (ssd_resnet50_v1_fpn_640x640_coco17_tpu-8),我可以看到您正在尝试执行对象检测任务。因此,在您的 pipeline.config 文件中更改此行:

fine_tune_checkpoint_type: "classification"

收件人:

fine_tune_checkpoint_type: "detection"

这应该可以解决您的问题。

【讨论】:

    【解决方案2】:

    对我来说,检查特征提取器的类型很有用。我在 pipeline.config 中将type: "mobilenet_v2" 更改为type: "mobilenet_v2_fpn_sep_conv"。它开始工作了。

    【讨论】:

      猜你喜欢
      • 2023-01-03
      • 1970-01-01
      • 2020-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多