keras实现调用自己训练的模型,并去掉全连接层


Posted in Python onJune 09, 2020

其实很简单

from keras.models import load_model

base_model = load_model('model_resenet.h5')#加载指定的模型
print(base_model.summary())#输出网络的结构图

这是我的网络模型的输出,其实就是它的结构图

__________________________________________________________________________________________________
Layer (type)          Output Shape     Param #   Connected to           
==================================================================================================
input_1 (InputLayer)      (None, 227, 227, 1) 0                      
__________________________________________________________________________________________________
conv2d_1 (Conv2D)        (None, 225, 225, 32) 320     input_1[0][0]          
__________________________________________________________________________________________________
batch_normalization_1 (BatchNor (None, 225, 225, 32) 128     conv2d_1[0][0]          
__________________________________________________________________________________________________
activation_1 (Activation)    (None, 225, 225, 32) 0      batch_normalization_1[0][0]   
__________________________________________________________________________________________________
conv2d_2 (Conv2D)        (None, 225, 225, 32) 9248    activation_1[0][0]        
__________________________________________________________________________________________________
batch_normalization_2 (BatchNor (None, 225, 225, 32) 128     conv2d_2[0][0]          
__________________________________________________________________________________________________
activation_2 (Activation)    (None, 225, 225, 32) 0      batch_normalization_2[0][0]   
__________________________________________________________________________________________________
conv2d_3 (Conv2D)        (None, 225, 225, 32) 9248    activation_2[0][0]        
__________________________________________________________________________________________________
batch_normalization_3 (BatchNor (None, 225, 225, 32) 128     conv2d_3[0][0]          
__________________________________________________________________________________________________
merge_1 (Merge)         (None, 225, 225, 32) 0      batch_normalization_3[0][0]   
                                 activation_1[0][0]        
__________________________________________________________________________________________________
activation_3 (Activation)    (None, 225, 225, 32) 0      merge_1[0][0]          
__________________________________________________________________________________________________
conv2d_4 (Conv2D)        (None, 225, 225, 32) 9248    activation_3[0][0]        
__________________________________________________________________________________________________
batch_normalization_4 (BatchNor (None, 225, 225, 32) 128     conv2d_4[0][0]          
__________________________________________________________________________________________________
activation_4 (Activation)    (None, 225, 225, 32) 0      batch_normalization_4[0][0]   
__________________________________________________________________________________________________
conv2d_5 (Conv2D)        (None, 225, 225, 32) 9248    activation_4[0][0]        
__________________________________________________________________________________________________
batch_normalization_5 (BatchNor (None, 225, 225, 32) 128     conv2d_5[0][0]          
__________________________________________________________________________________________________
merge_2 (Merge)         (None, 225, 225, 32) 0      batch_normalization_5[0][0]   
                                 activation_3[0][0]        
__________________________________________________________________________________________________
activation_5 (Activation)    (None, 225, 225, 32) 0      merge_2[0][0]          
__________________________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D) (None, 112, 112, 32) 0      activation_5[0][0]        
__________________________________________________________________________________________________
conv2d_6 (Conv2D)        (None, 110, 110, 64) 18496    max_pooling2d_1[0][0]      
__________________________________________________________________________________________________
batch_normalization_6 (BatchNor (None, 110, 110, 64) 256     conv2d_6[0][0]          
__________________________________________________________________________________________________
activation_6 (Activation)    (None, 110, 110, 64) 0      batch_normalization_6[0][0]   
__________________________________________________________________________________________________
conv2d_7 (Conv2D)        (None, 110, 110, 64) 36928    activation_6[0][0]        
__________________________________________________________________________________________________
batch_normalization_7 (BatchNor (None, 110, 110, 64) 256     conv2d_7[0][0]          
__________________________________________________________________________________________________
activation_7 (Activation)    (None, 110, 110, 64) 0      batch_normalization_7[0][0]   
__________________________________________________________________________________________________
conv2d_8 (Conv2D)        (None, 110, 110, 64) 36928    activation_7[0][0]        
__________________________________________________________________________________________________
batch_normalization_8 (BatchNor (None, 110, 110, 64) 256     conv2d_8[0][0]          
__________________________________________________________________________________________________
merge_3 (Merge)         (None, 110, 110, 64) 0      batch_normalization_8[0][0]   
                                 activation_6[0][0]        
__________________________________________________________________________________________________
activation_8 (Activation)    (None, 110, 110, 64) 0      merge_3[0][0]          
__________________________________________________________________________________________________
conv2d_9 (Conv2D)        (None, 110, 110, 64) 36928    activation_8[0][0]        
__________________________________________________________________________________________________
batch_normalization_9 (BatchNor (None, 110, 110, 64) 256     conv2d_9[0][0]          
__________________________________________________________________________________________________
activation_9 (Activation)    (None, 110, 110, 64) 0      batch_normalization_9[0][0]   
__________________________________________________________________________________________________
conv2d_10 (Conv2D)       (None, 110, 110, 64) 36928    activation_9[0][0]        
__________________________________________________________________________________________________
batch_normalization_10 (BatchNo (None, 110, 110, 64) 256     conv2d_10[0][0]         
__________________________________________________________________________________________________
merge_4 (Merge)         (None, 110, 110, 64) 0      batch_normalization_10[0][0]   
                                 activation_8[0][0]        
__________________________________________________________________________________________________
activation_10 (Activation)   (None, 110, 110, 64) 0      merge_4[0][0]          
__________________________________________________________________________________________________
max_pooling2d_2 (MaxPooling2D) (None, 55, 55, 64)  0      activation_10[0][0]       
__________________________________________________________________________________________________
conv2d_11 (Conv2D)       (None, 53, 53, 64)  36928    max_pooling2d_2[0][0]      
__________________________________________________________________________________________________
batch_normalization_11 (BatchNo (None, 53, 53, 64)  256     conv2d_11[0][0]         
__________________________________________________________________________________________________
activation_11 (Activation)   (None, 53, 53, 64)  0      batch_normalization_11[0][0]   
__________________________________________________________________________________________________
max_pooling2d_3 (MaxPooling2D) (None, 26, 26, 64)  0      activation_11[0][0]       
__________________________________________________________________________________________________
conv2d_12 (Conv2D)       (None, 26, 26, 64)  36928    max_pooling2d_3[0][0]      
__________________________________________________________________________________________________
batch_normalization_12 (BatchNo (None, 26, 26, 64)  256     conv2d_12[0][0]         
__________________________________________________________________________________________________
activation_12 (Activation)   (None, 26, 26, 64)  0      batch_normalization_12[0][0]   
__________________________________________________________________________________________________
conv2d_13 (Conv2D)       (None, 26, 26, 64)  36928    activation_12[0][0]       
__________________________________________________________________________________________________
batch_normalization_13 (BatchNo (None, 26, 26, 64)  256     conv2d_13[0][0]         
__________________________________________________________________________________________________
merge_5 (Merge)         (None, 26, 26, 64)  0      batch_normalization_13[0][0]   
                                 max_pooling2d_3[0][0]      
__________________________________________________________________________________________________
activation_13 (Activation)   (None, 26, 26, 64)  0      merge_5[0][0]          
__________________________________________________________________________________________________
conv2d_14 (Conv2D)       (None, 26, 26, 64)  36928    activation_13[0][0]       
__________________________________________________________________________________________________
batch_normalization_14 (BatchNo (None, 26, 26, 64)  256     conv2d_14[0][0]         
__________________________________________________________________________________________________
activation_14 (Activation)   (None, 26, 26, 64)  0      batch_normalization_14[0][0]   
__________________________________________________________________________________________________
conv2d_15 (Conv2D)       (None, 26, 26, 64)  36928    activation_14[0][0]       
__________________________________________________________________________________________________
batch_normalization_15 (BatchNo (None, 26, 26, 64)  256     conv2d_15[0][0]         
__________________________________________________________________________________________________
merge_6 (Merge)         (None, 26, 26, 64)  0      batch_normalization_15[0][0]   
                                 activation_13[0][0]       
__________________________________________________________________________________________________
activation_15 (Activation)   (None, 26, 26, 64)  0      merge_6[0][0]          
__________________________________________________________________________________________________
max_pooling2d_4 (MaxPooling2D) (None, 13, 13, 64)  0      activation_15[0][0]       
__________________________________________________________________________________________________
conv2d_16 (Conv2D)       (None, 11, 11, 32)  18464    max_pooling2d_4[0][0]      
__________________________________________________________________________________________________
batch_normalization_16 (BatchNo (None, 11, 11, 32)  128     conv2d_16[0][0]         
__________________________________________________________________________________________________
activation_16 (Activation)   (None, 11, 11, 32)  0      batch_normalization_16[0][0]   
__________________________________________________________________________________________________
conv2d_17 (Conv2D)       (None, 11, 11, 32)  9248    activation_16[0][0]       
__________________________________________________________________________________________________
batch_normalization_17 (BatchNo (None, 11, 11, 32)  128     conv2d_17[0][0]         
__________________________________________________________________________________________________
activation_17 (Activation)   (None, 11, 11, 32)  0      batch_normalization_17[0][0]   
__________________________________________________________________________________________________
conv2d_18 (Conv2D)       (None, 11, 11, 32)  9248    activation_17[0][0]       
__________________________________________________________________________________________________
batch_normalization_18 (BatchNo (None, 11, 11, 32)  128     conv2d_18[0][0]         
__________________________________________________________________________________________________
merge_7 (Merge)         (None, 11, 11, 32)  0      batch_normalization_18[0][0]   
                                 activation_16[0][0]       
__________________________________________________________________________________________________
activation_18 (Activation)   (None, 11, 11, 32)  0      merge_7[0][0]          
__________________________________________________________________________________________________
conv2d_19 (Conv2D)       (None, 11, 11, 32)  9248    activation_18[0][0]       
__________________________________________________________________________________________________
batch_normalization_19 (BatchNo (None, 11, 11, 32)  128     conv2d_19[0][0]         
__________________________________________________________________________________________________
activation_19 (Activation)   (None, 11, 11, 32)  0      batch_normalization_19[0][0]   
__________________________________________________________________________________________________
conv2d_20 (Conv2D)       (None, 11, 11, 32)  9248    activation_19[0][0]       
__________________________________________________________________________________________________
batch_normalization_20 (BatchNo (None, 11, 11, 32)  128     conv2d_20[0][0]         
__________________________________________________________________________________________________
merge_8 (Merge)         (None, 11, 11, 32)  0      batch_normalization_20[0][0]   
                                 activation_18[0][0]       
__________________________________________________________________________________________________
activation_20 (Activation)   (None, 11, 11, 32)  0      merge_8[0][0]          
__________________________________________________________________________________________________
max_pooling2d_5 (MaxPooling2D) (None, 5, 5, 32)   0      activation_20[0][0]       
__________________________________________________________________________________________________
conv2d_21 (Conv2D)       (None, 3, 3, 64)   18496    max_pooling2d_5[0][0]      
__________________________________________________________________________________________________
batch_normalization_21 (BatchNo (None, 3, 3, 64)   256     conv2d_21[0][0]         
__________________________________________________________________________________________________
activation_21 (Activation)   (None, 3, 3, 64)   0      batch_normalization_21[0][0]   
__________________________________________________________________________________________________
conv2d_22 (Conv2D)       (None, 3, 3, 64)   36928    activation_21[0][0]       
__________________________________________________________________________________________________
batch_normalization_22 (BatchNo (None, 3, 3, 64)   256     conv2d_22[0][0]         
__________________________________________________________________________________________________
activation_22 (Activation)   (None, 3, 3, 64)   0      batch_normalization_22[0][0]   
__________________________________________________________________________________________________
conv2d_23 (Conv2D)       (None, 3, 3, 64)   36928    activation_22[0][0]       
__________________________________________________________________________________________________
batch_normalization_23 (BatchNo (None, 3, 3, 64)   256     conv2d_23[0][0]         
__________________________________________________________________________________________________
merge_9 (Merge)         (None, 3, 3, 64)   0      batch_normalization_23[0][0]   
                                 activation_21[0][0]       
__________________________________________________________________________________________________
activation_23 (Activation)   (None, 3, 3, 64)   0      merge_9[0][0]          
__________________________________________________________________________________________________
conv2d_24 (Conv2D)       (None, 3, 3, 64)   36928    activation_23[0][0]       
__________________________________________________________________________________________________
batch_normalization_24 (BatchNo (None, 3, 3, 64)   256     conv2d_24[0][0]         
__________________________________________________________________________________________________
activation_24 (Activation)   (None, 3, 3, 64)   0      batch_normalization_24[0][0]   
__________________________________________________________________________________________________
conv2d_25 (Conv2D)       (None, 3, 3, 64)   36928    activation_24[0][0]       
__________________________________________________________________________________________________
batch_normalization_25 (BatchNo (None, 3, 3, 64)   256     conv2d_25[0][0]         
__________________________________________________________________________________________________
merge_10 (Merge)        (None, 3, 3, 64)   0      batch_normalization_25[0][0]   
                                 activation_23[0][0]       
__________________________________________________________________________________________________
activation_25 (Activation)   (None, 3, 3, 64)   0      merge_10[0][0]          
__________________________________________________________________________________________________
max_pooling2d_6 (MaxPooling2D) (None, 1, 1, 64)   0      activation_25[0][0]       
__________________________________________________________________________________________________
flatten_1 (Flatten)       (None, 64)      0      max_pooling2d_6[0][0]      
__________________________________________________________________________________________________
dense_1 (Dense)         (None, 256)     16640    flatten_1[0][0]         
__________________________________________________________________________________________________
dropout_1 (Dropout)       (None, 256)     0      dense_1[0][0]          
__________________________________________________________________________________________________
dense_2 (Dense)         (None, 2)      514     dropout_1[0][0]         
==================================================================================================
Total params: 632,098
Trainable params: 629,538
Non-trainable params: 2,560
__________________________________________________________________________________________________

去掉模型的全连接层

from keras.models import load_model

base_model = load_model('model_resenet.h5')
resnet_model = Model(inputs=base_model.input, outputs=base_model.get_layer('max_pooling2d_6').output)
#'max_pooling2d_6'其实就是上述网络中全连接层的前面一层,当然这里你也可以选取其它层,把该层的名称代替'max_pooling2d_6'即可,这样其实就是截取网络,输出网络结构就是方便读取每层的名字。
print(resnet_model.summary())

新输出的网络结构:

__________________________________________________________________________________________________
Layer (type)          Output Shape     Param #   Connected to           
==================================================================================================
input_1 (InputLayer)      (None, 227, 227, 1) 0                      
__________________________________________________________________________________________________
conv2d_1 (Conv2D)        (None, 225, 225, 32) 320     input_1[0][0]          
__________________________________________________________________________________________________
batch_normalization_1 (BatchNor (None, 225, 225, 32) 128     conv2d_1[0][0]          
__________________________________________________________________________________________________
activation_1 (Activation)    (None, 225, 225, 32) 0      batch_normalization_1[0][0]   
__________________________________________________________________________________________________
conv2d_2 (Conv2D)        (None, 225, 225, 32) 9248    activation_1[0][0]        
__________________________________________________________________________________________________
batch_normalization_2 (BatchNor (None, 225, 225, 32) 128     conv2d_2[0][0]          
__________________________________________________________________________________________________
activation_2 (Activation)    (None, 225, 225, 32) 0      batch_normalization_2[0][0]   
__________________________________________________________________________________________________
conv2d_3 (Conv2D)        (None, 225, 225, 32) 9248    activation_2[0][0]        
__________________________________________________________________________________________________
batch_normalization_3 (BatchNor (None, 225, 225, 32) 128     conv2d_3[0][0]          
__________________________________________________________________________________________________
merge_1 (Merge)         (None, 225, 225, 32) 0      batch_normalization_3[0][0]   
                                 activation_1[0][0]        
__________________________________________________________________________________________________
activation_3 (Activation)    (None, 225, 225, 32) 0      merge_1[0][0]          
__________________________________________________________________________________________________
conv2d_4 (Conv2D)        (None, 225, 225, 32) 9248    activation_3[0][0]        
__________________________________________________________________________________________________
batch_normalization_4 (BatchNor (None, 225, 225, 32) 128     conv2d_4[0][0]          
__________________________________________________________________________________________________
activation_4 (Activation)    (None, 225, 225, 32) 0      batch_normalization_4[0][0]   
__________________________________________________________________________________________________
conv2d_5 (Conv2D)        (None, 225, 225, 32) 9248    activation_4[0][0]        
__________________________________________________________________________________________________
batch_normalization_5 (BatchNor (None, 225, 225, 32) 128     conv2d_5[0][0]          
__________________________________________________________________________________________________
merge_2 (Merge)         (None, 225, 225, 32) 0      batch_normalization_5[0][0]   
                                 activation_3[0][0]        
__________________________________________________________________________________________________
activation_5 (Activation)    (None, 225, 225, 32) 0      merge_2[0][0]          
__________________________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D) (None, 112, 112, 32) 0      activation_5[0][0]        
__________________________________________________________________________________________________
conv2d_6 (Conv2D)        (None, 110, 110, 64) 18496    max_pooling2d_1[0][0]      
__________________________________________________________________________________________________
batch_normalization_6 (BatchNor (None, 110, 110, 64) 256     conv2d_6[0][0]          
__________________________________________________________________________________________________
activation_6 (Activation)    (None, 110, 110, 64) 0      batch_normalization_6[0][0]   
__________________________________________________________________________________________________
conv2d_7 (Conv2D)        (None, 110, 110, 64) 36928    activation_6[0][0]        
__________________________________________________________________________________________________
batch_normalization_7 (BatchNor (None, 110, 110, 64) 256     conv2d_7[0][0]          
__________________________________________________________________________________________________
activation_7 (Activation)    (None, 110, 110, 64) 0      batch_normalization_7[0][0]   
__________________________________________________________________________________________________
conv2d_8 (Conv2D)        (None, 110, 110, 64) 36928    activation_7[0][0]        
__________________________________________________________________________________________________
batch_normalization_8 (BatchNor (None, 110, 110, 64) 256     conv2d_8[0][0]          
__________________________________________________________________________________________________
merge_3 (Merge)         (None, 110, 110, 64) 0      batch_normalization_8[0][0]   
                                 activation_6[0][0]        
__________________________________________________________________________________________________
activation_8 (Activation)    (None, 110, 110, 64) 0      merge_3[0][0]          
__________________________________________________________________________________________________
conv2d_9 (Conv2D)        (None, 110, 110, 64) 36928    activation_8[0][0]        
__________________________________________________________________________________________________
batch_normalization_9 (BatchNor (None, 110, 110, 64) 256     conv2d_9[0][0]          
__________________________________________________________________________________________________
activation_9 (Activation)    (None, 110, 110, 64) 0      batch_normalization_9[0][0]   
__________________________________________________________________________________________________
conv2d_10 (Conv2D)       (None, 110, 110, 64) 36928    activation_9[0][0]        
__________________________________________________________________________________________________
batch_normalization_10 (BatchNo (None, 110, 110, 64) 256     conv2d_10[0][0]         
__________________________________________________________________________________________________
merge_4 (Merge)         (None, 110, 110, 64) 0      batch_normalization_10[0][0]   
                                 activation_8[0][0]        
__________________________________________________________________________________________________
activation_10 (Activation)   (None, 110, 110, 64) 0      merge_4[0][0]          
__________________________________________________________________________________________________
max_pooling2d_2 (MaxPooling2D) (None, 55, 55, 64)  0      activation_10[0][0]       
__________________________________________________________________________________________________
conv2d_11 (Conv2D)       (None, 53, 53, 64)  36928    max_pooling2d_2[0][0]      
__________________________________________________________________________________________________
batch_normalization_11 (BatchNo (None, 53, 53, 64)  256     conv2d_11[0][0]         
__________________________________________________________________________________________________
activation_11 (Activation)   (None, 53, 53, 64)  0      batch_normalization_11[0][0]   
__________________________________________________________________________________________________
max_pooling2d_3 (MaxPooling2D) (None, 26, 26, 64)  0      activation_11[0][0]       
__________________________________________________________________________________________________
conv2d_12 (Conv2D)       (None, 26, 26, 64)  36928    max_pooling2d_3[0][0]      
__________________________________________________________________________________________________
batch_normalization_12 (BatchNo (None, 26, 26, 64)  256     conv2d_12[0][0]         
__________________________________________________________________________________________________
activation_12 (Activation)   (None, 26, 26, 64)  0      batch_normalization_12[0][0]   
__________________________________________________________________________________________________
conv2d_13 (Conv2D)       (None, 26, 26, 64)  36928    activation_12[0][0]       
__________________________________________________________________________________________________
batch_normalization_13 (BatchNo (None, 26, 26, 64)  256     conv2d_13[0][0]         
__________________________________________________________________________________________________
merge_5 (Merge)         (None, 26, 26, 64)  0      batch_normalization_13[0][0]   
                                 max_pooling2d_3[0][0]      
__________________________________________________________________________________________________
activation_13 (Activation)   (None, 26, 26, 64)  0      merge_5[0][0]          
__________________________________________________________________________________________________
conv2d_14 (Conv2D)       (None, 26, 26, 64)  36928    activation_13[0][0]       
__________________________________________________________________________________________________
batch_normalization_14 (BatchNo (None, 26, 26, 64)  256     conv2d_14[0][0]         
__________________________________________________________________________________________________
activation_14 (Activation)   (None, 26, 26, 64)  0      batch_normalization_14[0][0]   
__________________________________________________________________________________________________
conv2d_15 (Conv2D)       (None, 26, 26, 64)  36928    activation_14[0][0]       
__________________________________________________________________________________________________
batch_normalization_15 (BatchNo (None, 26, 26, 64)  256     conv2d_15[0][0]         
__________________________________________________________________________________________________
merge_6 (Merge)         (None, 26, 26, 64)  0      batch_normalization_15[0][0]   
                                 activation_13[0][0]       
__________________________________________________________________________________________________
activation_15 (Activation)   (None, 26, 26, 64)  0      merge_6[0][0]          
__________________________________________________________________________________________________
max_pooling2d_4 (MaxPooling2D) (None, 13, 13, 64)  0      activation_15[0][0]       
__________________________________________________________________________________________________
conv2d_16 (Conv2D)       (None, 11, 11, 32)  18464    max_pooling2d_4[0][0]      
__________________________________________________________________________________________________
batch_normalization_16 (BatchNo (None, 11, 11, 32)  128     conv2d_16[0][0]         
__________________________________________________________________________________________________
activation_16 (Activation)   (None, 11, 11, 32)  0      batch_normalization_16[0][0]   
__________________________________________________________________________________________________
conv2d_17 (Conv2D)       (None, 11, 11, 32)  9248    activation_16[0][0]       
__________________________________________________________________________________________________
batch_normalization_17 (BatchNo (None, 11, 11, 32)  128     conv2d_17[0][0]         
__________________________________________________________________________________________________
activation_17 (Activation)   (None, 11, 11, 32)  0      batch_normalization_17[0][0]   
__________________________________________________________________________________________________
conv2d_18 (Conv2D)       (None, 11, 11, 32)  9248    activation_17[0][0]       
__________________________________________________________________________________________________
batch_normalization_18 (BatchNo (None, 11, 11, 32)  128     conv2d_18[0][0]         
__________________________________________________________________________________________________
merge_7 (Merge)         (None, 11, 11, 32)  0      batch_normalization_18[0][0]   
                                 activation_16[0][0]       
__________________________________________________________________________________________________
activation_18 (Activation)   (None, 11, 11, 32)  0      merge_7[0][0]          
__________________________________________________________________________________________________
conv2d_19 (Conv2D)       (None, 11, 11, 32)  9248    activation_18[0][0]       
__________________________________________________________________________________________________
batch_normalization_19 (BatchNo (None, 11, 11, 32)  128     conv2d_19[0][0]         
__________________________________________________________________________________________________
activation_19 (Activation)   (None, 11, 11, 32)  0      batch_normalization_19[0][0]   
__________________________________________________________________________________________________
conv2d_20 (Conv2D)       (None, 11, 11, 32)  9248    activation_19[0][0]       
__________________________________________________________________________________________________
batch_normalization_20 (BatchNo (None, 11, 11, 32)  128     conv2d_20[0][0]         
__________________________________________________________________________________________________
merge_8 (Merge)         (None, 11, 11, 32)  0      batch_normalization_20[0][0]   
                                 activation_18[0][0]       
__________________________________________________________________________________________________
activation_20 (Activation)   (None, 11, 11, 32)  0      merge_8[0][0]          
__________________________________________________________________________________________________
max_pooling2d_5 (MaxPooling2D) (None, 5, 5, 32)   0      activation_20[0][0]       
__________________________________________________________________________________________________
conv2d_21 (Conv2D)       (None, 3, 3, 64)   18496    max_pooling2d_5[0][0]      
__________________________________________________________________________________________________
batch_normalization_21 (BatchNo (None, 3, 3, 64)   256     conv2d_21[0][0]         
__________________________________________________________________________________________________
activation_21 (Activation)   (None, 3, 3, 64)   0      batch_normalization_21[0][0]   
__________________________________________________________________________________________________
conv2d_22 (Conv2D)       (None, 3, 3, 64)   36928    activation_21[0][0]       
__________________________________________________________________________________________________
batch_normalization_22 (BatchNo (None, 3, 3, 64)   256     conv2d_22[0][0]         
__________________________________________________________________________________________________
activation_22 (Activation)   (None, 3, 3, 64)   0      batch_normalization_22[0][0]   
__________________________________________________________________________________________________
conv2d_23 (Conv2D)       (None, 3, 3, 64)   36928    activation_22[0][0]       
__________________________________________________________________________________________________
batch_normalization_23 (BatchNo (None, 3, 3, 64)   256     conv2d_23[0][0]         
__________________________________________________________________________________________________
merge_9 (Merge)         (None, 3, 3, 64)   0      batch_normalization_23[0][0]   
                                 activation_21[0][0]       
__________________________________________________________________________________________________
activation_23 (Activation)   (None, 3, 3, 64)   0      merge_9[0][0]          
__________________________________________________________________________________________________
conv2d_24 (Conv2D)       (None, 3, 3, 64)   36928    activation_23[0][0]       
__________________________________________________________________________________________________
batch_normalization_24 (BatchNo (None, 3, 3, 64)   256     conv2d_24[0][0]         
__________________________________________________________________________________________________
activation_24 (Activation)   (None, 3, 3, 64)   0      batch_normalization_24[0][0]   
__________________________________________________________________________________________________
conv2d_25 (Conv2D)       (None, 3, 3, 64)   36928    activation_24[0][0]       
__________________________________________________________________________________________________
batch_normalization_25 (BatchNo (None, 3, 3, 64)   256     conv2d_25[0][0]         
__________________________________________________________________________________________________
merge_10 (Merge)        (None, 3, 3, 64)   0      batch_normalization_25[0][0]   
                                 activation_23[0][0]       
__________________________________________________________________________________________________
activation_25 (Activation)   (None, 3, 3, 64)   0      merge_10[0][0]          
__________________________________________________________________________________________________
max_pooling2d_6 (MaxPooling2D) (None, 1, 1, 64)   0      activation_25[0][0]       
==================================================================================================
Total params: 614,944
Trainable params: 612,384
Non-trainable params: 2,560
__________________________________________________________________________________________________

以上这篇keras实现调用自己训练的模型,并去掉全连接层就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

Python 相关文章推荐
Python简单实现enum功能的方法
Apr 25 Python
python实现字符串连接的三种方法及其效率、适用场景详解
Jan 13 Python
Python实现可设置持续运行时间、线程数及时间间隔的多线程异步post请求功能
Jan 11 Python
对Python 2.7 pandas 中的read_excel详解
May 04 Python
Python基于递归和非递归算法求两个数最大公约数、最小公倍数示例
May 21 Python
解决python中使用plot画图,图不显示的问题
Jul 04 Python
pyqt5让图片自适应QLabel大小上以及移除已显示的图片方法
Jun 21 Python
Transpose 数组行列转置的限制方式
Feb 11 Python
pycharm快捷键汇总
Feb 14 Python
Keras中 ImageDataGenerator函数的参数用法
Jul 03 Python
Django Form设置文本框为readonly操作
Jul 03 Python
Pycharm2020.1安装无法启动问题即设置中文插件的方法
Aug 07 Python
Python基于os.environ从windows获取环境变量
Jun 09 #Python
新手学习Python2和Python3中print不同的用法
Jun 09 #Python
Python基于wordcloud及jieba实现中国地图词云图
Jun 09 #Python
Python中的__init__作用是什么
Jun 09 #Python
python小白学习包管理器pip安装
Jun 09 #Python
Python小白垃圾回收机制入门
Jun 09 #Python
Python中如何添加自定义模块
Jun 09 #Python
You might like
PHP+JS无限级可伸缩菜单详解(简单易懂)
2007/01/02 PHP
PHP中把stdClass Object转array的几个方法
2014/05/08 PHP
PHP基于单例模式实现的数据库操作基类
2016/01/15 PHP
PHP连接MYSQL数据库实例代码
2016/01/20 PHP
jquery ajax 检测用户注册时用户名是否存在
2009/11/03 Javascript
JavaScript 反科里化 this [译]
2012/09/20 Javascript
js实现页面转发功能示例代码
2013/08/05 Javascript
JS将表单导出成EXCEL的实例代码
2013/11/11 Javascript
Document.location.href和.replace的区别示例介绍
2014/03/04 Javascript
Seajs 简易文档 提供简单、极致的模块化开发体验
2016/04/13 Javascript
javascript设置文本框光标的方法实例小结
2016/11/04 Javascript
JavaScript正则表达式替换字符串中图片地址(img src)的方法
2017/01/13 Javascript
JavaScript中 this 指向问题深度解析
2017/02/21 Javascript
基于JavaScript实现无缝滚动效果
2017/07/21 Javascript
JS沙箱模式实例分析
2017/09/04 Javascript
vue中引用阿里字体图标的方法
2018/02/10 Javascript
js类的继承定义与用法分析
2019/06/21 Javascript
微信小程序获取复选框全选反选选中的值(实例代码)
2019/12/17 Javascript
vue的webcamjs集成方式
2020/11/16 Javascript
[05:08]第一届“网鱼杯”DOTA2比赛精彩集锦
2014/09/05 DOTA
[28:07]完美世界DOTA2联赛PWL S3 Phoenix vs INK ICE 第二场 12.13
2020/12/17 DOTA
Numpy 将二维图像矩阵转换为一维向量的方法
2018/06/05 Python
详解Django中CBV(Class Base Views)模型源码分析
2019/02/25 Python
python输出pdf文档的实例
2020/02/13 Python
canvas绘制树形结构可视图形的实现
2020/04/03 HTML / CSS
HolidayLettings英国:预订最好的度假公寓、别墅和自助式住宿
2019/08/27 全球购物
安全教育实施方案
2014/03/02 职场文书
大学生社团活动总结
2014/04/26 职场文书
优秀员工推荐信
2014/05/10 职场文书
爱心倡议书范文
2014/05/12 职场文书
2015年12.4全国法制宣传日活动总结
2015/03/24 职场文书
2015年中学团委工作总结
2015/07/22 职场文书
小学语文教学反思范文
2016/03/03 职场文书
CSS实现切角+边框+投影+内容背景色渐变效果
2021/11/01 HTML / CSS
Java无向树分析 实现最小高度树
2022/04/09 Javascript
MySQL脏读,幻读和不可重复读
2022/05/11 MySQL