我的版本是tensorflow-gpu 1.2 然后就会报错,我的输出为:

whsyxt@whsyxt:~/Downloads/gaoshengwu/models/research/object_detection$ python3 export_inference_graph.py \
>     --input_type image_tensor \
>     --pipeline_config_path training/ssd_mobilenet_v1_pets.config \
>     --trained_checkpoint_prefix training/model.ckpt-155568 \
>     --output_directory mac_n_cheese_inference_graph
Traceback (most recent call last):
  File "export_inference_graph.py", line 96, in <module>
    tf.app.flags.mark_flag_as_required('pipeline_config_path')
AttributeError: module 'tensorflow.python.platform.flags' has no attribute 'mark_flag_as_required'

然后查资料发现,mark_flag_as_required是tensorflow gpu 1.4版本的,升级到1.4版本就行了。我这里本身下载好了一个tensorflow gpu 1.4版本,然后就直接装了,命令为:

sudo pip3 install tensorflow_gpu-1.4.0rc0-cp35-cp35m-manylinux1_x86_64.whl 


装完之后,再运行就没问题了。

参考文献

[1].AttributeError: module 'tensorflow.python.platform.flags' has no attribute 'mark_flag_as_required'.https://github.com/tensorflow/models/issues/2777
Logo

昇腾计算产业是基于昇腾系列(HUAWEI Ascend)处理器和基础软件构建的全栈 AI计算基础设施、行业应用及服务,https://devpress.csdn.net/organization/setting/general/146749包括昇腾系列处理器、系列硬件、CANN、AI计算框架、应用使能、开发工具链、管理运维工具、行业应用及服务等全产业链

更多推荐