TF之DD:实现输出Inception模型内的某个卷积层或者所有卷积层的形状

TF之DD:实现输出Inception模型内的某个卷积层或者所有卷积层的形状


输出结果

整体思路架构

实现(部分)代码

#TF之DD:实现输出Inception模型内的某个卷积层或者所有卷积层的形状
# 导入要用到的基本模块。
from __future__ import print_function
import numpy as np
import tensorflow as tf

graph = tf.Graph()
sess = tf.InteractiveSession(graph=graph)
……

# 找到所有卷积层
layers = [op.name for op in graph.get_operations() if op.type == 'Conv2D' and 'import/' in op.name]

# 输出卷积层层数
print('Number of layers', len(layers))

name = 'mixed4d_3x3_bottleneck_pre_relu'
print('shape of %s: %s' % (name, str(graph.get_tensor_by_name('import/' + name + ':0').get_shape())))
(0)

相关推荐