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

时间:2022-02-24 13:40:55

其实很简单

?
1
2
3
4
from keras.models import load_model
 
base_model = load_model('model_resenet.h5')#加载指定的模型
print(base_model.summary())#输出网络的结构图

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
__________________________________________________________________________________________________
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, 640      activation_10[0][0]      
__________________________________________________________________________________________________
conv2d_11 (Conv2D)       (None, 53, 53, 6436928    max_pooling2d_2[0][0]     
__________________________________________________________________________________________________
batch_normalization_11 (BatchNo (None, 53, 53, 64256     conv2d_11[0][0]        
__________________________________________________________________________________________________
activation_11 (Activation)   (None, 53, 53, 640      batch_normalization_11[0][0]  
__________________________________________________________________________________________________
max_pooling2d_3 (MaxPooling2D) (None, 26, 26, 640      activation_11[0][0]      
__________________________________________________________________________________________________
conv2d_12 (Conv2D)       (None, 26, 26, 6436928    max_pooling2d_3[0][0]     
__________________________________________________________________________________________________
batch_normalization_12 (BatchNo (None, 26, 26, 64256     conv2d_12[0][0]        
__________________________________________________________________________________________________
activation_12 (Activation)   (None, 26, 26, 640      batch_normalization_12[0][0]  
__________________________________________________________________________________________________
conv2d_13 (Conv2D)       (None, 26, 26, 6436928    activation_12[0][0]      
__________________________________________________________________________________________________
batch_normalization_13 (BatchNo (None, 26, 26, 64256     conv2d_13[0][0]        
__________________________________________________________________________________________________
merge_5 (Merge)         (None, 26, 26, 640      batch_normalization_13[0][0]  
                                 max_pooling2d_3[0][0]     
__________________________________________________________________________________________________
activation_13 (Activation)   (None, 26, 26, 640      merge_5[0][0]         
__________________________________________________________________________________________________
conv2d_14 (Conv2D)       (None, 26, 26, 6436928    activation_13[0][0]      
__________________________________________________________________________________________________
batch_normalization_14 (BatchNo (None, 26, 26, 64256     conv2d_14[0][0]        
__________________________________________________________________________________________________
activation_14 (Activation)   (None, 26, 26, 640      batch_normalization_14[0][0]  
__________________________________________________________________________________________________
conv2d_15 (Conv2D)       (None, 26, 26, 6436928    activation_14[0][0]      
__________________________________________________________________________________________________
batch_normalization_15 (BatchNo (None, 26, 26, 64256     conv2d_15[0][0]        
__________________________________________________________________________________________________
merge_6 (Merge)         (None, 26, 26, 640      batch_normalization_15[0][0]  
                                 activation_13[0][0]      
__________________________________________________________________________________________________
activation_15 (Activation)   (None, 26, 26, 640      merge_6[0][0]         
__________________________________________________________________________________________________
max_pooling2d_4 (MaxPooling2D) (None, 13, 13, 640      activation_15[0][0]      
__________________________________________________________________________________________________
conv2d_16 (Conv2D)       (None, 11, 11, 3218464    max_pooling2d_4[0][0]     
__________________________________________________________________________________________________
batch_normalization_16 (BatchNo (None, 11, 11, 32128     conv2d_16[0][0]        
__________________________________________________________________________________________________
activation_16 (Activation)   (None, 11, 11, 320      batch_normalization_16[0][0]  
__________________________________________________________________________________________________
conv2d_17 (Conv2D)       (None, 11, 11, 329248    activation_16[0][0]      
__________________________________________________________________________________________________
batch_normalization_17 (BatchNo (None, 11, 11, 32128     conv2d_17[0][0]        
__________________________________________________________________________________________________
activation_17 (Activation)   (None, 11, 11, 320      batch_normalization_17[0][0]  
__________________________________________________________________________________________________
conv2d_18 (Conv2D)       (None, 11, 11, 329248    activation_17[0][0]      
__________________________________________________________________________________________________
batch_normalization_18 (BatchNo (None, 11, 11, 32128     conv2d_18[0][0]        
__________________________________________________________________________________________________
merge_7 (Merge)         (None, 11, 11, 320      batch_normalization_18[0][0]  
                                 activation_16[0][0]      
__________________________________________________________________________________________________
activation_18 (Activation)   (None, 11, 11, 320      merge_7[0][0]         
__________________________________________________________________________________________________
conv2d_19 (Conv2D)       (None, 11, 11, 329248    activation_18[0][0]      
__________________________________________________________________________________________________
batch_normalization_19 (BatchNo (None, 11, 11, 32128     conv2d_19[0][0]        
__________________________________________________________________________________________________
activation_19 (Activation)   (None, 11, 11, 320      batch_normalization_19[0][0]  
__________________________________________________________________________________________________
conv2d_20 (Conv2D)       (None, 11, 11, 329248    activation_19[0][0]      
__________________________________________________________________________________________________
batch_normalization_20 (BatchNo (None, 11, 11, 32128     conv2d_20[0][0]        
__________________________________________________________________________________________________
merge_8 (Merge)         (None, 11, 11, 320      batch_normalization_20[0][0]  
                                 activation_18[0][0]      
__________________________________________________________________________________________________
activation_20 (Activation)   (None, 11, 11, 320      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
__________________________________________________________________________________________________

去掉模型的全连接层

?
1
2
3
4
5
6
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())

新输出的网络结构:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
__________________________________________________________________________________________________
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, 640      activation_10[0][0]      
__________________________________________________________________________________________________
conv2d_11 (Conv2D)       (None, 53, 53, 6436928    max_pooling2d_2[0][0]     
__________________________________________________________________________________________________
batch_normalization_11 (BatchNo (None, 53, 53, 64256     conv2d_11[0][0]        
__________________________________________________________________________________________________
activation_11 (Activation)   (None, 53, 53, 640      batch_normalization_11[0][0]  
__________________________________________________________________________________________________
max_pooling2d_3 (MaxPooling2D) (None, 26, 26, 640      activation_11[0][0]      
__________________________________________________________________________________________________
conv2d_12 (Conv2D)       (None, 26, 26, 6436928    max_pooling2d_3[0][0]     
__________________________________________________________________________________________________
batch_normalization_12 (BatchNo (None, 26, 26, 64256     conv2d_12[0][0]        
__________________________________________________________________________________________________
activation_12 (Activation)   (None, 26, 26, 640      batch_normalization_12[0][0]  
__________________________________________________________________________________________________
conv2d_13 (Conv2D)       (None, 26, 26, 6436928    activation_12[0][0]      
__________________________________________________________________________________________________
batch_normalization_13 (BatchNo (None, 26, 26, 64256     conv2d_13[0][0]        
__________________________________________________________________________________________________
merge_5 (Merge)         (None, 26, 26, 640      batch_normalization_13[0][0]  
                                 max_pooling2d_3[0][0]     
__________________________________________________________________________________________________
activation_13 (Activation)   (None, 26, 26, 640      merge_5[0][0]         
__________________________________________________________________________________________________
conv2d_14 (Conv2D)       (None, 26, 26, 6436928    activation_13[0][0]      
__________________________________________________________________________________________________
batch_normalization_14 (BatchNo (None, 26, 26, 64256     conv2d_14[0][0]        
__________________________________________________________________________________________________
activation_14 (Activation)   (None, 26, 26, 640      batch_normalization_14[0][0]  
__________________________________________________________________________________________________
conv2d_15 (Conv2D)       (None, 26, 26, 6436928    activation_14[0][0]      
__________________________________________________________________________________________________
batch_normalization_15 (BatchNo (None, 26, 26, 64256     conv2d_15[0][0]        
__________________________________________________________________________________________________
merge_6 (Merge)         (None, 26, 26, 640      batch_normalization_15[0][0]  
                                 activation_13[0][0]      
__________________________________________________________________________________________________
activation_15 (Activation)   (None, 26, 26, 640      merge_6[0][0]         
__________________________________________________________________________________________________
max_pooling2d_4 (MaxPooling2D) (None, 13, 13, 640      activation_15[0][0]      
__________________________________________________________________________________________________
conv2d_16 (Conv2D)       (None, 11, 11, 3218464    max_pooling2d_4[0][0]     
__________________________________________________________________________________________________
batch_normalization_16 (BatchNo (None, 11, 11, 32128     conv2d_16[0][0]        
__________________________________________________________________________________________________
activation_16 (Activation)   (None, 11, 11, 320      batch_normalization_16[0][0]  
__________________________________________________________________________________________________
conv2d_17 (Conv2D)       (None, 11, 11, 329248    activation_16[0][0]      
__________________________________________________________________________________________________
batch_normalization_17 (BatchNo (None, 11, 11, 32128     conv2d_17[0][0]        
__________________________________________________________________________________________________
activation_17 (Activation)   (None, 11, 11, 320      batch_normalization_17[0][0]  
__________________________________________________________________________________________________
conv2d_18 (Conv2D)       (None, 11, 11, 329248    activation_17[0][0]      
__________________________________________________________________________________________________
batch_normalization_18 (BatchNo (None, 11, 11, 32128     conv2d_18[0][0]        
__________________________________________________________________________________________________
merge_7 (Merge)         (None, 11, 11, 320      batch_normalization_18[0][0]  
                                 activation_16[0][0]      
__________________________________________________________________________________________________
activation_18 (Activation)   (None, 11, 11, 320      merge_7[0][0]         
__________________________________________________________________________________________________
conv2d_19 (Conv2D)       (None, 11, 11, 329248    activation_18[0][0]      
__________________________________________________________________________________________________
batch_normalization_19 (BatchNo (None, 11, 11, 32128     conv2d_19[0][0]        
__________________________________________________________________________________________________
activation_19 (Activation)   (None, 11, 11, 320      batch_normalization_19[0][0]  
__________________________________________________________________________________________________
conv2d_20 (Conv2D)       (None, 11, 11, 329248    activation_19[0][0]      
__________________________________________________________________________________________________
batch_normalization_20 (BatchNo (None, 11, 11, 32128     conv2d_20[0][0]        
__________________________________________________________________________________________________
merge_8 (Merge)         (None, 11, 11, 320      batch_normalization_20[0][0]  
                                 activation_18[0][0]      
__________________________________________________________________________________________________
activation_20 (Activation)   (None, 11, 11, 320      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实现调用自己训练的模型,并去掉全连接层就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。

原文链接:https://blog.csdn.net/qq_29462849/article/details/83010854