我的版本是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