【tensorflow2.0】41.通道注意力模块代码(tf2.0).pdfVIP

  • 4
  • 0
  • 约2.21千字
  • 约 1页
  • 2023-06-11 发布于上海
  • 举报

【tensorflow2.0】41.通道注意力模块代码(tf2.0).pdf

【tensorflow2.0】41.通道注意⼒模块代码(tf2.0) 我们知道⼀张图⽚经过⼏个卷积层会得到⼀个特征矩阵,这个矩阵的通道数就是卷积层核的个数。那么,⼀个常见的卷积核经常达到 1024,2048个,并不是每个通道都对于信息传递⾮常有⽤了的。因此,通过对这些通道进⾏过滤,也就是注意,来得到优化后的特征。 主要思路就是:增⼤有效通道权重,减少⽆效通道的权重 实现⽅式 # 1 class ChannelAttention(layers.Layer): def __init__(self, in_planes, ratio=8): super(ChannelAttention, self).__init__() self.avg_out= layers.GlobalAveragePooling2D() self.max_out= layers.GlobalMaxPooling2D() self.fc1 = layers.Dense(in_planes//ratio, kernel_initializer=he_normal, kernel_regularizer=re

文档评论(0)

1亿VIP精品文档

相关文档