python - Tensorflow- 属性错误 : 'KeepAspectRatioResizer' object has no attribute 'per_channel_pad_value'

标签 python tensorflow

所以,我训练了一个对象检测模型,现在我想导出 .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/

相关文章:

python - 将包含 pandas 对象(系列/数据帧)的 python 元组、列表、字典转换为 json

Python:在外循环中继续下一次迭代

python - 如何将 Azure Function 绑定(bind)到 Python 中的 blob 容器?

c++ - 如何在没有 ARM 处理器的 Linux 上安装 TensorflowLite C++?

python - 如何使用 cdist 或 tensorflow 加速最近点比较?

python - 如何在 tensorflow 中并行加载数据?

在多列上运行的 Python pandas groupby 转换/应用函数

python - 使用 cv2 时如何 'mirror' 实时网络摄像头视频?

java - Android TensorFlow Lite 解释器 : How to fix "DataType error: cannot resolve DataType of java.lang.Float"

python - 在 Tensorflow 中使用字符串标签