所以,我训练了一个对象检测模型,现在我想导出 .ckpt 文件。 当我尝试导出 .ckpt 文件时:
python export_inference_graph.py --input_type image_tensor --pipeline_config_path training/faster_rcnn_inception_v2_pets.config --trained_checkpoint_prefix training3/model.ckpt-47816 --output_directory inference_graph
我明白了:
Traceback (most recent call last):
File "export_inference_graph.py", line 147, in <module>
tf.app.run()
File "/home/ubuntu/anaconda3/envs/tensorflow1/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "export_inference_graph.py", line 143, in main
FLAGS.output_directory, input_shape)
File "/home/ubuntu/tensorflow1/models/research/object_detection/exporter.py", line 454, in export_inference_graph
is_training=False)
File "/home/ubuntu/anaconda3/envs/tensorflow1/lib/python3.6/site-packages/object_detection-0.1-py3.6.egg/object_detection/builders/model_builder.py", line 101, in build
add_summaries)
File "/home/ubuntu/anaconda3/envs/tensorflow1/lib/python3.6/site-packages/object_detection-0.1-py3.6.egg/object_detection/builders/model_builder.py", line 274, in _build_faster_rcnn_model
image_resizer_fn = image_resizer_builder.build(frcnn_config.image_resizer)
File "/home/ubuntu/anaconda3/envs/tensorflow1/lib/python3.6/site-packages/object_detection-0.1-py3.6.egg/object_detection/builders/image_resizer_builder.py", line 83, in build
if keep_aspect_ratio_config.per_channel_pad_value:
AttributeError: 'KeepAspectRatioResizer' object has no attribute 'per_channel_pad_value'
似乎每个人都可以正常工作并且对此没有任何问题。 谁能告诉我这是怎么回事?
最佳答案
我知道这是几个月后的事了,但我也刚遇到这个问题!
image_resizer.proto 似乎缺少 per_channel_pad_value 属性。 从这里更新 proto 文件以包含该属性: https://github.com/tensorflow/models/blob/master/research/object_detection/protos/image_resizer.proto 重新编译,然后重试。
这次应该可以了。
关于python - Tensorflow- 属性错误 : 'KeepAspectRatioResizer' object has no attribute 'per_channel_pad_value' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50897646/