tensorflow 输出pre_trained模型网络层名称以及数据
在模型训练或者模型使用过程中,往往要获取相关层的名称或者特征,下面介绍如何读取pre_trained model的各层数据以及各层的命名,以inception-v3模型为例。
- 1、预训练模型下载
import numpy as np
import tensorflow as tf
import download
from cache import cache
import os
import sys
########################################################################
# 压缩包地址.
data_url = "http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz"
# 数据保存地址.
data_dir = "inception/"
# ImageNet 各个分类的名称. (Downloaded)
path_uid_to_cls = "imagenet_2012_challenge_label_map_proto.pbtxt"
# File containing the mappings between uid and string. (Downloaded)
path_uid_to_name = "imagenet_synset_to_human_label_map.txt"
# 网络层定义. (Downloaded)
path_graph_def =