一文带你用可视化理解卷积神经网络( 九 )

#creating a mapping of layer name ot layer details 
#we will create a dictionary layers_info which maps a layer name to its charcteristics
layers_info = {
for i in model.layers:
layers_info[i.name
= i.get_config()

#here the layer_weights dictionary will map every layer_name to its corresponding weights
layer_weights = {
for i in model.layers:
layer_weights[i.name
= i.get_weights()

print(layers_info['block5_conv1'
)

上面的代码给出了以下输出 , 它由block5_conv1层的不同参数组成:

{'name': 'block5_conv1'
'trainable': True
'filters': 512
'kernel_size': (3 3)
'strides': (1 1)
'padding': 'same'
'data_format': 'channels_last'
'dilation_rate': (1 1)
'activation': 'relu'
'use_bias': True
'kernel_initializer': {'class_name': 'VarianceScaling'
'config': {'scale': 1.0
'mode': 'fan_avg'
'distribution': 'uniform'
'seed': None

推荐阅读