我正在尝试开始使用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的新手,所以如果我遗漏了任何重要信息,请告诉我。
3条答案
按热度按时间inn6fuwd1#
从您提供的文件名(ssd_resnet50_v1_fpn_640x640_coco17_tpu-8)中,我可以看到您正在尝试使用对象检测任务。因此,在您的pipeline.config文件中更改此行:
收件人:
这应该能解决你的问题。
rdrgkggo2#
对我来说,检查特征提取器的类型是有用的。我在pipeline.config中将
type: "mobilenet_v2"
更改为type: "mobilenet_v2_fpn_sep_conv"
。它开始工作了。yhuiod9q3#
我有同样的错误,但对我来说,这是一个简单的复制粘贴错误。我的
fine_tune_checkpoint
指向faster_rcnn_inception_resnet_v2_640x640_coco17_tpu-8/checkpoint/ckpt-0
而不是faster_rcnn_resnet50_v1_640x640_coco17_tpu-8/checkpoint/ckpt-0