CNN: 查看tensorflow Pb模型所有层的名字
tensorflow的keras沒有外部可視化配置文件,需要使用netron查看模型參數,或者從程序中打印出來,
打印代碼:
def get_all_layernames():"""get all layers name"""model_dir = os.path.join(ROOT_DIR, 'stru/')pb_file_path = os.path.join(ROOT_DIR, 'ModelTF/IncepV2MaskFrozen.pb')from tensorflow.python.platform import gfilesess = tf.Session()# with gfile.FastGFile(pb_file_path + 'model.pb', 'rb') as f:with gfile.FastGFile(pb_file_path, 'rb') as f:graph_def = tf.GraphDef()graph_def.ParseFromString(f.read())sess.graph.as_default()tf.import_graph_def(graph_def, name='')tensor_name_list = [tensor.name for tensor in tf.get_default_graph().as_graph_def().node]for tensor_name in tensor_name_list:print(tensor_name, '\n')""""---------------------作者:醉雨軒Y來源:CSDN原文:https: // blog.csdn.net / miao0967020148 / article / details / 89434253版權聲明:本文為博主原創(chuàng)文章,轉載請附上博文鏈接!"""return顯示結果:
2019-05-28 14:28:50.036031: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4941 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
Const
ToFloat
Const_1
ToFloat_1
Const_2
ToFloat_2
image_tensor? #輸入層名稱
ToFloat_3
Preprocessor/map/Shape
Preprocessor/map/strided_slice/stack
Preprocessor/map/strided_slice/stack_1
......................
add_1/y
add_1
detection_boxes
detection_scores
detection_classes
num_detections
detection_masks#最后輸出層
?
?
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的CNN: 查看tensorflow Pb模型所有层的名字的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: slide是什么意思
- 下一篇: 一、小米开源监控平台open-falco