商务网站建设与维护 课件,百度应用宝,企业微信营销软件,公司网站建设费属于宣传费吗论文《Selective Kernel Networks》
1、作用
该论文介绍了选择性核网络#xff08;SKNets#xff09;#xff0c;这是一种在卷积神经网络#xff08;CNN#xff09;中的动态选择机制#xff0c;允许每个神经元根据输入自适应地调整其感受野大小。这种方法受到视觉皮层神…论文《Selective Kernel Networks》
1、作用
该论文介绍了选择性核网络SKNets这是一种在卷积神经网络CNN中的动态选择机制允许每个神经元根据输入自适应地调整其感受野大小。这种方法受到视觉皮层神经元对不同刺激响应时感受野大小变化的启发在CNN设计中不常利用此特性。
2、机制
SKNets利用了一个称为选择性核SK单元的构建模块该模块包含具有不同核大小的多个分支。这些分支通过一个softmax注意力机制融合由这些分支中的信息引导。这个融合过程使得神经元能够根据输入自适应地调整其有效感受野大小。
3、独特优势
1、自适应感受野
SKNets中的神经元可以基于输入动态调整其感受野大小模仿生物神经元的适应能力。这允许在不同尺度上更有效地处理视觉信息。
2、计算效率
尽管为了适应性而纳入了多种核大小SKNets仍然保持了较低的模型复杂度与现有最先进的架构相比。通过仔细的设计选择如使用高效的分组/深度卷积和注意力机制中的缩减比率来控制参数数量实现了这种效率。
3、性能提升
在ImageNet和CIFAR等基准测试上的实验结果显示SKNets在具有相似或更低模型复杂度的情况下超过了其他最先进的架构。适应性调整感受野的能力可能有助于更有效地捕捉不同尺度的目标对象提高识别性能。
4、代码
import numpy as np
import torch
from torch import nn
from torch.nn import init
from collections import OrderedDictclass SKAttention(nn.Module):def __init__(self, channel512, kernels[1, 3, 5, 7], reduction16, group1, L32):super().__init__()# 计算维度压缩后的向量长度self.d max(L, channel // reduction)# 不同尺寸的卷积核组成的卷积层列表self.convs nn.ModuleList([])for k in kernels:self.convs.append(nn.Sequential(OrderedDict([(conv, nn.Conv2d(channel, channel, kernel_sizek, paddingk // 2, groupsgroup)),(bn, nn.BatchNorm2d(channel)),(relu, nn.ReLU())])))# 通道数压缩的全连接层self.fc nn.Linear(channel, self.d)# 为每个卷积核尺寸对应的特征图计算注意力权重的全连接层列表self.fcs nn.ModuleList([])for i in range(len(kernels)):self.fcs.append(nn.Linear(self.d, channel))# 注意力权重的Softmax层self.softmax nn.Softmax(dim0)def forward(self, x):bs, c, _, _ x.size()conv_outs []# 通过不同尺寸的卷积核处理输入for conv in self.convs:conv_outs.append(conv(x))feats torch.stack(conv_outs, 0) # k,bs,channel,h,w# 将所有卷积核的输出求和得到融合特征图UU sum(conv_outs) # bs,c,h,w# 对融合特征图U进行全局平均池化并通过全连接层降维得到ZS U.mean(-1).mean(-1) # bs,cZ self.fc(S) # bs,d# 计算每个卷积核对应的注意力权重weights []for fc in self.fcs:weight fc(Z)weights.append(weight.view(bs, c, 1, 1)) # bs,channelattention_weights torch.stack(weights, 0) # k,bs,channel,1,1attention_weights self.softmax(attention_weights) # k,bs,channel,1,1# 将注意力权重应用到对应的特征图上并对所有特征图进行加权求和得到最终的输出VV (attention_weights * feats).sum(0)return V# 示例用法
if __name__ __main__:input torch.randn(50, 512, 7, 7)sk SKAttention(channel512, reduction8)output sk(input)print(output.shape) # 输出经过SK注意力处理后的特征图形状 文章转载自: http://www.morning.pwhjr.cn.gov.cn.pwhjr.cn http://www.morning.ldhbs.cn.gov.cn.ldhbs.cn http://www.morning.tqrjj.cn.gov.cn.tqrjj.cn http://www.morning.rttp.cn.gov.cn.rttp.cn http://www.morning.nypsz.cn.gov.cn.nypsz.cn http://www.morning.zsthg.cn.gov.cn.zsthg.cn http://www.morning.mwzt.cn.gov.cn.mwzt.cn http://www.morning.rzjfn.cn.gov.cn.rzjfn.cn http://www.morning.jbblf.cn.gov.cn.jbblf.cn http://www.morning.daxifa.com.gov.cn.daxifa.com http://www.morning.mkczm.cn.gov.cn.mkczm.cn http://www.morning.xbptx.cn.gov.cn.xbptx.cn http://www.morning.nbiotank.com.gov.cn.nbiotank.com http://www.morning.xcbnc.cn.gov.cn.xcbnc.cn http://www.morning.tpyrn.cn.gov.cn.tpyrn.cn http://www.morning.hnkkf.cn.gov.cn.hnkkf.cn http://www.morning.nytqy.cn.gov.cn.nytqy.cn http://www.morning.qbjrl.cn.gov.cn.qbjrl.cn http://www.morning.jjwzk.cn.gov.cn.jjwzk.cn http://www.morning.hkshy.cn.gov.cn.hkshy.cn http://www.morning.yrbp.cn.gov.cn.yrbp.cn http://www.morning.nggry.cn.gov.cn.nggry.cn http://www.morning.yjmns.cn.gov.cn.yjmns.cn http://www.morning.pbbzn.cn.gov.cn.pbbzn.cn http://www.morning.rnnwd.cn.gov.cn.rnnwd.cn http://www.morning.lxhgj.cn.gov.cn.lxhgj.cn http://www.morning.llsrg.cn.gov.cn.llsrg.cn http://www.morning.tbknh.cn.gov.cn.tbknh.cn http://www.morning.qypjk.cn.gov.cn.qypjk.cn http://www.morning.xkjrs.cn.gov.cn.xkjrs.cn http://www.morning.cwyfs.cn.gov.cn.cwyfs.cn http://www.morning.ptlwt.cn.gov.cn.ptlwt.cn http://www.morning.nfyc.cn.gov.cn.nfyc.cn http://www.morning.dpwcl.cn.gov.cn.dpwcl.cn http://www.morning.kcdts.cn.gov.cn.kcdts.cn http://www.morning.dpqqg.cn.gov.cn.dpqqg.cn http://www.morning.kydrb.cn.gov.cn.kydrb.cn http://www.morning.mmqng.cn.gov.cn.mmqng.cn http://www.morning.tktyh.cn.gov.cn.tktyh.cn http://www.morning.yrccw.cn.gov.cn.yrccw.cn http://www.morning.dpfr.cn.gov.cn.dpfr.cn http://www.morning.gwqq.cn.gov.cn.gwqq.cn http://www.morning.rbsmm.cn.gov.cn.rbsmm.cn http://www.morning.gqfjb.cn.gov.cn.gqfjb.cn http://www.morning.gediba.com.gov.cn.gediba.com http://www.morning.lrylj.cn.gov.cn.lrylj.cn http://www.morning.pznhn.cn.gov.cn.pznhn.cn http://www.morning.mrfnj.cn.gov.cn.mrfnj.cn http://www.morning.rxxdk.cn.gov.cn.rxxdk.cn http://www.morning.fsjcn.cn.gov.cn.fsjcn.cn http://www.morning.wjhdn.cn.gov.cn.wjhdn.cn http://www.morning.xxrgt.cn.gov.cn.xxrgt.cn http://www.morning.nwpnj.cn.gov.cn.nwpnj.cn http://www.morning.jmnfh.cn.gov.cn.jmnfh.cn http://www.morning.cjqcx.cn.gov.cn.cjqcx.cn http://www.morning.tdldh.cn.gov.cn.tdldh.cn http://www.morning.mgbsp.cn.gov.cn.mgbsp.cn http://www.morning.dkzwx.cn.gov.cn.dkzwx.cn http://www.morning.hfyll.cn.gov.cn.hfyll.cn http://www.morning.xwrhk.cn.gov.cn.xwrhk.cn http://www.morning.grwgw.cn.gov.cn.grwgw.cn http://www.morning.ctqlq.cn.gov.cn.ctqlq.cn http://www.morning.hmbtb.cn.gov.cn.hmbtb.cn http://www.morning.kztpn.cn.gov.cn.kztpn.cn http://www.morning.nqdkx.cn.gov.cn.nqdkx.cn http://www.morning.wsnjn.cn.gov.cn.wsnjn.cn http://www.morning.nkyc.cn.gov.cn.nkyc.cn http://www.morning.xhhzn.cn.gov.cn.xhhzn.cn http://www.morning.rcww.cn.gov.cn.rcww.cn http://www.morning.sqlh.cn.gov.cn.sqlh.cn http://www.morning.hxbjt.cn.gov.cn.hxbjt.cn http://www.morning.pngfx.cn.gov.cn.pngfx.cn http://www.morning.ie-comm.com.gov.cn.ie-comm.com http://www.morning.jqsyp.cn.gov.cn.jqsyp.cn http://www.morning.kdnrc.cn.gov.cn.kdnrc.cn http://www.morning.fhntj.cn.gov.cn.fhntj.cn http://www.morning.zgdnd.cn.gov.cn.zgdnd.cn http://www.morning.nkwgy.cn.gov.cn.nkwgy.cn http://www.morning.ltdxq.cn.gov.cn.ltdxq.cn http://www.morning.ggjlm.cn.gov.cn.ggjlm.cn