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 代码性能优化技巧分享
Aug 07 Python
Python对列表排序的方法实例分析
May 16 Python
python方法生成txt标签文件的实例代码
May 10 Python
用Python解决x的n次方问题
Feb 08 Python
Python实现钉钉发送报警消息的方法
Feb 20 Python
python opencv实现图像边缘检测
Apr 29 Python
远程部署工具Fabric详解(支持Python3)
Jul 04 Python
Python 中@property的用法详解
Jan 15 Python
TensorFlow2.X结合OpenCV 实现手势识别功能
Apr 08 Python
超全Python图像处理讲解(多模块实现)
Apr 13 Python
Python-jenkins模块获取jobs的执行状态操作
May 12 Python
通过代码实例了解Python3编程技巧
Oct 13 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
造势之举?韩国总统候选人发布《星际争霸》地图
2017/04/22 星际争霸
SONY ICF-F10中波修复记
2021/03/02 无线电
PHP语法速查表
2007/01/02 PHP
phpExcel导出大量数据出现内存溢出错误的解决方法
2013/02/28 PHP
php实现下载限制速度示例分享
2014/02/13 PHP
destoon安全设置中需要设置可写权限的目录及文件
2014/06/21 PHP
PHP 5.6.11 访问SQL Server2008R2的几种情况详解
2016/08/08 PHP
PHP实现的数独求解问题示例
2017/04/18 PHP
JS去除字符串的空格增强版(可以去除中间的空格)
2009/08/26 Javascript
javascript中创建对象的三种常用方法
2010/12/30 Javascript
Javascript的&&和||的另类用法
2014/07/23 Javascript
javascript三元运算符用法实例
2015/04/16 Javascript
详解JavaScript的回调函数
2015/11/20 Javascript
Javascript中的迭代、归并方法详解
2016/06/14 Javascript
JavaScript 字符串常用操作小结(非常实用)
2016/11/30 Javascript
详解Jquery Easyui的验证扩展
2017/01/09 Javascript
vue全局组件与局部组件使用方法详解
2018/03/29 Javascript
微信小程序调用微信支付接口的实现方法
2019/04/29 Javascript
JQuery获得内容和属性方法解析
2020/05/30 jQuery
[55:03]完美世界DOTA2联赛PWL S2 LBZS vs FTD.C 第二场 11.20
2020/11/20 DOTA
Python入门篇之字典
2014/10/17 Python
对比Python中__getattr__和 __getattribute__获取属性的用法
2016/06/21 Python
Python开发中爬虫使用代理proxy抓取网页的方法示例
2017/09/26 Python
python 实现登录网页的操作方法
2018/05/11 Python
对python添加模块路径的三种方法总结
2018/10/16 Python
python判断文件夹内是否存在指定后缀文件的实例
2019/06/10 Python
linux面试题参考答案(7)
2012/10/29 面试题
家具厂厂长岗位职责
2014/01/01 职场文书
优秀教导主任事迹材料
2014/05/09 职场文书
团日活动总结报告
2014/06/25 职场文书
杭州黄龙洞导游词
2015/02/10 职场文书
征求意见函
2015/06/05 职场文书
2016年5月份红领巾广播稿
2015/12/21 职场文书
JavaScript文档对象模型DOM
2021/11/20 Javascript
详细聊一聊mysql的树形结构存储以及查询
2022/04/05 MySQL
vue中this.$http.post()跨域和请求参数丢失的解决
2022/04/08 Vue.js