no attribute 'outside_compilation'错误

记下当前跑
python export_inference_graph.py --input_type image_tensor --pipeline_config_path data/ssdlite_mobilenet_v1_coco.config --trained_checkpoint_prefix training/model.ckpt-20000 --output_directory inference_graph

准备将已训练到ckpt阶段的文件转成pb文件。结果报
Traceback (most recent call last):
File "export_inference_graph.py", line 150, in <module>
tf.app.run()
File "D:\PycharmProjects\OpenCV_Tensor_Env\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "export_inference_graph.py", line 146, in main
write_inference_graph=FLAGS.write_inference_graph)
File "D:\PycharmProjects\models-master\research\object_detection\exporter.py", line 497, in export_inference_graph
write_inference_graph=write_inference_graph)
File "D:\PycharmProjects\models-master\research\object_detection\exporter.py", line 400, in _export_inference_graph
graph_hook_fn=graph_hook_fn)
File "D:\PycharmProjects\models-master\research\object_detection\exporter.py", line 367, in build_detection_graph
output_collection_name=output_collection_name)
File "D:\PycharmProjects\models-master\research\object_detection\exporter.py", line 346, in _get_outputs_from_inputs
output_tensors, true_image_shapes)
File "D:\PycharmProjects\models-master\research\object_detection\meta_architectures\ssd_meta_arch.py", line 802, in postprocess
prediction_dict.get('mask_predictions')
File "D:\PycharmProjects\models-master\research\object_detection\meta_architectures\ssd_meta_arch.py", line 785, in _non_max_suppression_wrapper
return tf.contrib.tpu.outside_compilation(
AttributeError: module 'tensorflow.contrib.tpu' has no attribute 'outside_compilation'

现在还未解。不过看错误信息,分析如下
meta_architectures\ssd_meta_arch.py 看样子可能和架构相关(有architectures)
tensorflow.contrib.tpu 看tpu可能是和google的TPU架构相关。
本人的机器是普通PC就是GPU训练而已,那为什么会引导到用TPU 转换呢?
当前训练配置用的是ssdlite_mobilenet_v1_coco.config,本来以为会更lite些。
回头还是老老实实跑下ssd_mobilenet_v1_coco.config看看吧,有结果会更新。

结论:大家训练时可以用些网上其他伙伴跑通过的模型先学习,回头熟练了再更进一步尝试其它网络。
笔者换了model的版本,改model-1.13.0不报no attribute 'outside_compilation'(model-master作为主开发分支,已经加入Tensorflow2.x支持。可能代码上还不够稳定吧。)

MARK下
Software Env: win10 64位+procobuf新版+COCOAPI新版+VS2017+model 1.13.0+Tensorflow-gpu 1.11.0+CUDA9+cudnn7
Hardware: I7-4710qm+GT940M 2G

猜你喜欢

转载自blog.51cto.com/cfy10/2447456
今日推荐