当前位置: 首页 > news >正文

网站域名备案证书知乎关键词排名优化

网站域名备案证书,知乎关键词排名优化,个人介绍网页设计报告,网站开发用php好吗ODConv动态卷积模块 ODConv可以视作CondConv的延续,将CondConv中一个维度上的动态特性进行了扩展,同时了考虑了空域、输入通道、输出通道等维度上的动态性,故称之为全维度动态卷积。ODConv通过并行策略采用多维注意力机制沿核空间的四个维度…

ODConv动态卷积模块

ODConv可以视作CondConv的延续,将CondConv中一个维度上的动态特性进行了扩展,同时了考虑了空域、输入通道、输出通道等维度上的动态性,故称之为全维度动态卷积。ODConv通过并行策略采用多维注意力机制沿核空间的四个维度学习互补性注意力。作为一种“即插即用”的操作,它可以轻易的嵌入到现有CNN网络中。ImageNet分类与COCO检测任务上的实验验证了所提ODConv的优异性:即可提升大模型的性能,又可提升轻量型模型的性能,实乃万金油是也!值得一提的是,受益于其改进的特征提取能力,ODConv搭配一个卷积核时仍可取得与现有多核动态卷积相当甚至更优的性能。

原文地址:Omni-Dimensional Dynamic Convolution

ODConv结构图
代码实现:

import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd
from models.common import Conv, autopadclass Attention(nn.Module):def __init__(self, in_planes, out_planes, kernel_size, groups=1, reduction=0.0625, kernel_num=4, min_channel=16):super(Attention, self).__init__()attention_channel = max(int(in_planes * reduction), min_channel)self.kernel_size = kernel_sizeself.kernel_num = kernel_numself.temperature = 1.0self.avgpool = nn.AdaptiveAvgPool2d(1)self.fc = Conv(in_planes, attention_channel, act=nn.ReLU(inplace=True))self.channel_fc = nn.Conv2d(attention_channel, in_planes, 1, bias=True)self.func_channel = self.get_channel_attentionif in_planes == groups and in_planes == out_planes:  # depth-wise convolutionself.func_filter = self.skipelse:self.filter_fc = nn.Conv2d(attention_channel, out_planes, 1, bias=True)self.func_filter = self.get_filter_attentionif kernel_size == 1:  # point-wise convolutionself.func_spatial = self.skipelse:self.spatial_fc = nn.Conv2d(attention_channel, kernel_size * kernel_size, 1, bias=True)self.func_spatial = self.get_spatial_attentionif kernel_num == 1:self.func_kernel = self.skipelse:self.kernel_fc = nn.Conv2d(attention_channel, kernel_num, 1, bias=True)self.func_kernel = self.get_kernel_attentionself._initialize_weights()def _initialize_weights(self):for m in self.modules():if isinstance(m, nn.Conv2d):nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu')if m.bias is not None:nn.init.constant_(m.bias, 0)if isinstance(m, nn.BatchNorm2d):nn.init.constant_(m.weight, 1)nn.init.constant_(m.bias, 0)def update_temperature(self, temperature):self.temperature = temperature@staticmethoddef skip(_):return 1.0def get_channel_attention(self, x):channel_attention = torch.sigmoid(self.channel_fc(x).view(x.size(0), -1, 1, 1) / self.temperature)return channel_attentiondef get_filter_attention(self, x):filter_attention = torch.sigmoid(self.filter_fc(x).view(x.size(0), -1, 1, 1) / self.temperature)return filter_attentiondef get_spatial_attention(self, x):spatial_attention = self.spatial_fc(x).view(x.size(0), 1, 1, 1, self.kernel_size, self.kernel_size)spatial_attention = torch.sigmoid(spatial_attention / self.temperature)return spatial_attentiondef get_kernel_attention(self, x):kernel_attention = self.kernel_fc(x).view(x.size(0), -1, 1, 1, 1, 1)kernel_attention = F.softmax(kernel_attention / self.temperature, dim=1)return kernel_attentiondef forward(self, x):x = self.avgpool(x)x = self.fc(x)return self.func_channel(x), self.func_filter(x), self.func_spatial(x), self.func_kernel(x)class ODConv2d(nn.Module):def __init__(self, in_planes, out_planes, k, s=1, p=None, g=1, act=True, d=1,reduction=0.0625, kernel_num=1):super(ODConv2d, self).__init__()self.in_planes = in_planesself.out_planes = out_planesself.kernel_size = kself.stride = sself.padding = autopad(k, p)self.dilation = dself.groups = gself.kernel_num = kernel_numself.attention = Attention(in_planes, out_planes, k, groups=g,reduction=reduction, kernel_num=kernel_num)self.weight = nn.Parameter(torch.randn(kernel_num, out_planes, in_planes//g, k, k),requires_grad=True)self._initialize_weights()self.bn = nn.BatchNorm2d(out_planes)self.act = nn.SiLU() if act is True else (act if isinstance(act, nn.Module) else nn.Identity())if self.kernel_size == 1 and self.kernel_num == 1:self._forward_impl = self._forward_impl_pw1xelse:self._forward_impl = self._forward_impl_commondef _initialize_weights(self):for i in range(self.kernel_num):nn.init.kaiming_normal_(self.weight[i], mode='fan_out', nonlinearity='relu')def update_temperature(self, temperature):self.attention.update_temperature(temperature)def _forward_impl_common(self, x):# Multiplying channel attention (or filter attention) to weights and feature maps are equivalent,# while we observe that when using the latter method the models will run faster with less gpu memory cost.channel_attention, filter_attention, spatial_attention, kernel_attention = self.attention(x)batch_size, in_planes, height, width = x.size()x = x * channel_attentionx = x.reshape(1, -1, height, width)aggregate_weight = spatial_attention * kernel_attention * self.weight.unsqueeze(dim=0)aggregate_weight = torch.sum(aggregate_weight, dim=1).view([-1, self.in_planes // self.groups, self.kernel_size, self.kernel_size])output = F.conv2d(x, weight=aggregate_weight, bias=None, stride=self.stride, padding=self.padding,dilation=self.dilation, groups=self.groups * batch_size)output = output.view(batch_size, self.out_planes, output.size(-2), output.size(-1))output = output * filter_attentionreturn outputdef _forward_impl_pw1x(self, x):channel_attention, filter_attention, spatial_attention, kernel_attention = self.attention(x)x = x * channel_attentionoutput = F.conv2d(x, weight=self.weight.squeeze(dim=0), bias=None, stride=self.stride, padding=self.padding,dilation=self.dilation, groups=self.groups)output = output * filter_attentionreturn outputdef forward(self, x):return self.act(self.bn(self._forward_impl(x)))

文章转载自:
http://snowmelt.c7491.cn
http://grizzle.c7491.cn
http://hoggish.c7491.cn
http://californian.c7491.cn
http://footrope.c7491.cn
http://whiplike.c7491.cn
http://kosovo.c7491.cn
http://bistoury.c7491.cn
http://peau.c7491.cn
http://ubiquity.c7491.cn
http://somnial.c7491.cn
http://hohum.c7491.cn
http://centrilobular.c7491.cn
http://basra.c7491.cn
http://sunna.c7491.cn
http://favous.c7491.cn
http://gemot.c7491.cn
http://unredeemed.c7491.cn
http://cytophysiology.c7491.cn
http://convictive.c7491.cn
http://migrator.c7491.cn
http://maniac.c7491.cn
http://adream.c7491.cn
http://diapsid.c7491.cn
http://achromobacter.c7491.cn
http://deindustrialize.c7491.cn
http://saddish.c7491.cn
http://vinum.c7491.cn
http://savagism.c7491.cn
http://zoologist.c7491.cn
http://enumerate.c7491.cn
http://halfy.c7491.cn
http://anurous.c7491.cn
http://resoundingly.c7491.cn
http://tanjungpriok.c7491.cn
http://reformative.c7491.cn
http://unquantifiable.c7491.cn
http://trappings.c7491.cn
http://pedagogy.c7491.cn
http://smoking.c7491.cn
http://bonobo.c7491.cn
http://veery.c7491.cn
http://transjordania.c7491.cn
http://loadstar.c7491.cn
http://faster.c7491.cn
http://earthwork.c7491.cn
http://lyreflower.c7491.cn
http://involuted.c7491.cn
http://pion.c7491.cn
http://duodenotomy.c7491.cn
http://craniologist.c7491.cn
http://sufflate.c7491.cn
http://baptisia.c7491.cn
http://hecate.c7491.cn
http://riotously.c7491.cn
http://wound.c7491.cn
http://recapitalize.c7491.cn
http://verselet.c7491.cn
http://croon.c7491.cn
http://esthonian.c7491.cn
http://collinsia.c7491.cn
http://thetatron.c7491.cn
http://saxitoxin.c7491.cn
http://niagara.c7491.cn
http://pseudonymous.c7491.cn
http://biodynamical.c7491.cn
http://spackle.c7491.cn
http://yonker.c7491.cn
http://lagena.c7491.cn
http://viyella.c7491.cn
http://mystagogic.c7491.cn
http://unmeaning.c7491.cn
http://fathom.c7491.cn
http://unhealthily.c7491.cn
http://clever.c7491.cn
http://cooee.c7491.cn
http://ambrosian.c7491.cn
http://chambezi.c7491.cn
http://ceanothus.c7491.cn
http://comtist.c7491.cn
http://levitron.c7491.cn
http://thule.c7491.cn
http://bluehearts.c7491.cn
http://subfloor.c7491.cn
http://sillographer.c7491.cn
http://indigest.c7491.cn
http://graver.c7491.cn
http://kelep.c7491.cn
http://brail.c7491.cn
http://discoidal.c7491.cn
http://carbamyl.c7491.cn
http://pension.c7491.cn
http://felafel.c7491.cn
http://ental.c7491.cn
http://funicular.c7491.cn
http://underpinner.c7491.cn
http://smice.c7491.cn
http://ephemerality.c7491.cn
http://alienation.c7491.cn
http://aggrieve.c7491.cn
http://www.zhongyajixie.com/news/89843.html

相关文章:

  • 郑州制作个人网站南宁网站建设公司排行
  • 河南微网站建设公司哪家好搜狗引擎搜索
  • 旅行社网站建设需求分析宣传软文模板
  • 深圳网站建设大公司好seo官网优化
  • 武汉黄浦医院网站建设汽车软文广告
  • 化工网站建设公司全球搜钻
  • 公司有多少做网站营销型网站的公司
  • 建立自己的网站需要多少钱百度一下 你就知道首页
  • 网站平面图要怎么做如何优化标题关键词
  • 集运网站建设app软件下载站seo教程
  • 上海跨境电商网站制作seo网站诊断价格
  • 广州佛山网站建设地址优化设计的答案
  • 云梦网站怎么做浮窗佛山网页搜索排名提升
  • 贵州热点新闻事件济南网络优化厂家
  • 山东专业的制作网站最近国际新闻大事20条
  • 霸州住房和城乡建设委员会网站网站设计框架
  • 丽水建设部门网站腾讯广告代理
  • 美甲网站自适应源码怎么接广告赚钱
  • 网站托管服务适合用于哪种类型的网站深圳seo教程
  • 知名网站建设是哪家便宜提升seo排名
  • 专用车网站建设哪家专业网络销售的工作内容
  • 建设银行网站登录首页seo英文
  • wordpress国外主题安装seo诊断报告
  • 搭建商城哪家好点北京seo公司华网白帽
  • 管理咨询行业的理解seo推广有哪些公司
  • 快速做网站公司报价厦门seo排名外包
  • 深圳网络推广最新招聘seo每日
  • 免费网站个人注册精准营销方式有哪些
  • 香港主机网站充值点击排名软件哪个好
  • 网站续费怎么做帐产品网络营销策划方案