AttributeError: module 'tensorflow' has no attribute 'batch_gather'

希望各路好汉走过路过给点意见!!!
在做Tensorflow Object detection API的时候,想要把训练好的模型转换为.pb文件,在执行转换程序export_inference_graph.py的时候,出现了AttributeError: module 'tensorflow' has no attribute 'batch_gather'这个问题。我的操作系统是WIN10,另外tensorflow-gpu是1.9.0版本的。尝试过更新tensorflow-gpu到1.10.0版本但是结果没用还是有这个错误。

像网上的教程一样。我的export_inference_graph.py文件中修改了3个地方:如下所示

flags.DEFINE_string('pipeline_config_path', 'F:/mask_rcnn-myself/detection/training/mask_rcnn_inception_v2_coco.config',
                    'Path to a pipeline_pb2.TrainEvalPipelineConfig config '
                    'file.')
flags.DEFINE_string('trained_checkpoint_prefix', 'F:/mask_rcnn-myself/detection/saved_model/model1/model.ckpt-63261',
                    'Path to trained checkpoint, typically of the form '
                    'path/to/model.ckpt')
flags.DEFINE_string('output_directory', 'F:/mask_rcnn-myself/detection/saved_model', 'Path to write outputs.')

然后错误如下:

Traceback (most recent call last):
  File "F:/ObjectDetection/models-master/research/object_detection/export_inference_graph.py", line 156, in 
    tf.app.run()
  File "D:\Anacoda\anacoda\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "F:/ObjectDetection/models-master/research/object_detection/export_inference_graph.py", line 152, in main
    write_inference_graph=FLAGS.write_inference_graph)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\exporter.py", line 465, in export_inference_graph
    write_inference_graph=write_inference_graph)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\exporter.py", line 368, in _export_inference_graph
    graph_hook_fn=graph_hook_fn)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\exporter.py", line 335, in build_detection_graph
    output_collection_name=output_collection_name)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\exporter.py", line 312, in _get_outputs_from_inputs
    preprocessed_inputs, true_image_shapes)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 692, in predict
    prediction_dict, true_image_shapes)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 887, in _predict_third_stage
    image_shapes)
  File "D:\Anacoda\anacoda\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\meta_architectures\faster_rcnn_meta_arch.py", line 1644, in _postprocess_box_classifier
    tf.batch_gather(refined_decoded_boxes_batch, class_ids), axis=2)
AttributeError: module 'tensorflow' has no attribute 'batch_gather'

目前没有找到原因,希望大家能给点宝贵意见,感谢!

你可能感兴趣的:(AttributeError: module 'tensorflow' has no attribute 'batch_gather')