赞
踩
Squeeze-and-Excitation (SE) 块通过显式建模其卷积特征的通道之间的相互依赖性来提高网络质量 ,它可以学习使用全局信息来选择性地强调信息特征并抑制不太有用的特征。
(左)ResNet-50 [13]。 (中)SE-ResNet-50。 (右)带有 32×4d 模板的 SE-ResNeXt-50。 括号内列出了残差积木的特定参数设置的形状和操作,而在外列出了一个阶段中堆叠的积木数量。 fc后面的内括号表示SE模块中两个全连接层的输出维度。
实验所得:SENet增加了参数和计算量,同时也降低了错误率
from keras.models import Model from keras import layers def se_block(x,filter,r): x = layers.Conv2D(filters=filter,kernel_size=3,strides=2,padding='same',activation='relu')(x) x_ = layers.GlobalAveragePooling2D()(x) x_ = layers.Dense(units=int(r*filter),activation='relu')(x_) x_ = layers.Dense(units=filter,activation='sigmoid')(x_) x = layers.Multiply()([x,x_]) return x if __name__ == "__main__": input = layers.Input(shape=[224,224,3]) x = se_block(x=input,filter=60,r=0.5) model = Model(input,x) model.summary() ''' __________________________________________________________________________________________________ Layer (type) Output Shape Param # Connected to ================================================================================================== input_1 (InputLayer) (None, 224, 224, 3) 0 __________________________________________________________________________________________________ conv2d_1 (Conv2D) (None, 112, 112, 60) 1680 input_1[0][0] __________________________________________________________________________________________________ global_average_pooling2d_1 (Glo (None, 60) 0 conv2d_1[0][0] __________________________________________________________________________________________________ dense_1 (Dense) (None, 30) 1830 global_average_pooling2d_1[0][0] __________________________________________________________________________________________________ dense_2 (Dense) (None, 60) 1860 dense_1[0][0] __________________________________________________________________________________________________ multiply_1 (Multiply) (None, 112, 112, 60) 0 conv2d_1[0][0] dense_2[0][0] ================================================================================================== Total params: 5,370 Trainable params: 5,370 Non-trainable params: 0 __________________________________________________________________________________________________ Process finished with exit code 0 '''
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。