某些Python对象未绑定到检查点值 [英] Some Python objects were not bound to checkpointed values
问题描述
我正在尝试使用Tensorflow 2.0 对象检测API .我已经按照官方教程进行了安装并且我通过了所有测试.但是,当我尝试运行主模块时,我不断收到不理解的错误消息.这是我的运行方式:
I am trying to get started with Tensorflow 2.0 Object Detection API. I have gone through the installation following the official tutorial and I pass all the tests. However, I keep getting an error message that I don't understand when I try to run the main module. This is how I run it:
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中,我这样指定一个检查点:
In the pipeline.config, I specify a checkpoint like this:
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
我已经搜索过Google,但找不到任何答案.在此问题中,建议的解决方案已过时(他们建议替换的代码不是还有).
I have searched Google but couldn't find any answer. In this issue, the suggested solution is outdated (the code they suggest to replace is not there anymore).
问题:问题出在哪里,我该如何解决?
Question: What is the problem and how can I solve it?
我正在使用CentOS Linux 7的服务器上执行此操作.我正在使用Python 3.7.我是Tensorflow的新手,所以如果我缺少任何重要信息,请告诉我.
I am doing this on a server with CentOS Linux 7. I am using Python 3.7. I am new to Tensorflow so please if I am missing any important information, let me know.
推荐答案
从您提供的文件名(ssd_resnet50_v1_fpn_640x640_coco17_tpu-8),我可以看到您正在尝试使用对象检测任务.因此,在您的pipeline.config文件中更改以下行:
From the file name you provided (ssd_resnet50_v1_fpn_640x640_coco17_tpu-8), I can see you are trying to work with an object detection task. Therefore, in your pipeline.config file change this line:
fine_tune_checkpoint_type: "classification"
收件人:
fine_tune_checkpoint_type: "detection"
这应该可以解决您的问题.
This should solve your problem.
这篇关于某些Python对象未绑定到检查点值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!