@@ -61,19 +61,6 @@ def inception_layer(conv_11_size, conv_33_reduce_size, conv_33_size,
6161 convpool = L .conv (filter_size = 1 , out_dim = pool_size ,
6262 name = '{}_pool_proj' .format (name ))
6363
64- # conv_11 = conv(inputs, 1, conv_11_size, '{}_1x1'.format(name))
65-
66- # conv_33_reduce = conv(inputs, 1, conv_33_reduce_size,
67- # '{}_3x3_reduce'.format(name))
68- # conv_33 = conv(conv_33_reduce, 3, conv_33_size, '{}_3x3'.format(name))
69-
70- # conv_55_reduce = conv(inputs, 1, conv_55_reduce_size,
71- # '{}_5x5_reduce'.format(name))
72- # conv_55 = conv(conv_55_reduce, 5, conv_55_size, '{}_5x5'.format(name))
73-
74- # pool = max_pool(inputs, '{}_pool'.format(name), stride=1,
75- # padding='SAME', filter_size=3)
76- # convpool = conv(pool, 1, pool_size, '{}_pool_proj'.format(name))
7764 output = tf .concat ([conv_11 , conv_33 , conv_55 , convpool ], 3 ,
7865 name = '{}_concat' .format (name ))
7966 layer_dict ['cur_input' ] = output
@@ -143,7 +130,7 @@ def inception_layers(layer_dict, inputs=None, pretrained_dict=None,
143130
144131 return layer_dict ['cur_input' ]
145132
146- def inception_fc (layer_dict , n_class , keep_prob , inputs = None ,
133+ def inception_fc (layer_dict , n_class , keep_prob = 1. , inputs = None ,
147134 pretrained_dict = None , is_training = True ,
148135 bn = False , init_w = None , trainable = True , wd = 0 ):
149136
@@ -161,36 +148,29 @@ def inception_fc(layer_dict, n_class, keep_prob, inputs=None,
161148
162149 return layer_dict ['cur_input' ]
163150
151+ def auxiliary_classifier (layer_dict , n_class , keep_prob = 1. , inputs = None ,
152+ pretrained_dict = None , is_training = True ,
153+ bn = False , init_w = None , trainable = True , wd = 0 ):
154+
155+ if inputs is not None :
156+ layer_dict ['cur_input' ] = inputs
164157
165- # with arg_scope([inception_layer],
166- # trainable=self._trainable,
167- # data_dict=data_dict):
168- # # inception3a = inception_layer(
169- # # pool2_lrn, 64, 96, 128, 16, 32, 32, name='inception_3a')
170- # # inception3b = inception_layer(
171- # # inception3a, 128, 128, 192, 32, 96, 64, name='inception_3b')
172- # # pool3 = max_pool(
173- # # inception3b, 'pool3', padding='SAME', filter_size=3, stride=2)
174-
175- # # inception4a = inception_layer(
176- # # pool3, 192, 96, 208, 16, 48, 64, name='inception_4a')
177- # # inception4b = inception_layer(
178- # # inception4a, 160, 112, 224, 24, 64, 64, name='inception_4b')
179- # # inception4c = inception_layer(
180- # # inception4b, 128, 128, 256, 24, 64, 64, name='inception_4c')
181- # # inception4d = inception_layer(
182- # # inception4c, 112, 144, 288, 32, 64, 64, name='inception_4d')
183- # # inception4e = inception_layer(
184- # # inception4d, 256, 160, 320, 32, 128, 128, name='inception_4e')
185- # # pool4 = max_pool(
186- # # inception4e, 'pool4', padding='SAME', filter_size=3, stride=2)
187-
188- # inception5a = inception_layer(
189- # pool4, 256, 160, 320, 32, 128, 128, name='inception_5a')
190- # inception5b = inception_layer(
191- # inception5a, 384, 192, 384, 48, 128, 128, name='inception_5b')
192-
193-
158+ layer_dict ['cur_input' ] = tf .layers .average_pooling2d (
159+ inputs = layer_dict ['cur_input' ],
160+ pool_size = 5 , strides = 3 ,
161+ padding = 'valid' , name = 'averagepool' )
194162
163+ arg_scope = tf .contrib .framework .arg_scope
164+ with arg_scope ([L .conv ], layer_dict = layer_dict , pretrained_dict = pretrained_dict ,
165+ bn = bn , init_w = init_w , trainable = trainable ,
166+ is_training = is_training , wd = wd , add_summary = False ):
195167
168+ L .conv (1 , 128 , name = 'conv' , stride = 1 , nl = tf .nn .relu )
169+ L .conv (4 , 1024 , name = 'fc_1' , stride = 1 , padding = 'VALID' )
170+ L .drop_out (layer_dict , is_training , keep_prob = keep_prob )
171+ L .conv (1 , 1024 , name = 'fc_2' , stride = 1 , padding = 'VALID' , nl = tf .nn .relu )
172+ L .drop_out (layer_dict , is_training , keep_prob = keep_prob )
173+ L .conv (1 , n_class , name = 'classifier' , stride = 1 , padding = 'VALID' )
174+ layer_dict ['cur_input' ] = tf .squeeze (layer_dict ['cur_input' ], [1 , 2 ])
175+ return layer_dict ['cur_input' ]
196176
0 commit comments