def classifier_layers(x, input_shape, stage_num, trainable=False):
# compile times on theano tend to be very high, so we use smaller ROI pooling regions to workaround
# (hence a smaller stride in the region that follows the ROI pool)
if K.backend() == 'tensorflow':
x = conv_block_td(x, 3, [512, 512, 1024], stage=stage_num, block='a', input_shape=input_shape, strides=(1, 2), trainable=trainable)
elif K.backend() == 'theano':
x = conv_block_td(x, 3, [512, 512, 1024], stage=stage_num, block='a', input_shape=input_shape, strides=(1, 1), trainable=trainable)
print 'INFO: Classifier layers x block a: ', x
x = identity_block_td(x, 3, [512, 512, 1024], stage=stage_num, block='c', trainable=trainable)
print 'INFO: Classifier layers x block b: ', x
x = identity_block_td(x, 3, [512, 512, 1024], stage=stage_num, block='d', trainable=trainable)
print 'INFO: Classifier layers x block c: ', x
#x = TimeDistributed(AveragePooling2D((2, 1)), name='avg_pool')(x)
return x
评论列表
文章目录