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

商机互联网站建设怎么去推广一个产品

商机互联网站建设,怎么去推广一个产品,郑州网站建设维护,网站图片一般多大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://dinncocaestus.tpps.cn
http://dinncotacket.tpps.cn
http://dinncomilktoast.tpps.cn
http://dinncoovovitellin.tpps.cn
http://dinncoachondroplasia.tpps.cn
http://dinncoholophrasis.tpps.cn
http://dinnconebraskan.tpps.cn
http://dinncosynaesthesia.tpps.cn
http://dinncofootwork.tpps.cn
http://dinncoanimating.tpps.cn
http://dinncoinefficacy.tpps.cn
http://dinncojataka.tpps.cn
http://dinncoacestoma.tpps.cn
http://dinncointromission.tpps.cn
http://dinncoblunt.tpps.cn
http://dinncoprogenitrix.tpps.cn
http://dinncokinematograph.tpps.cn
http://dinncopliancy.tpps.cn
http://dinncohydrogenate.tpps.cn
http://dinncoarcane.tpps.cn
http://dinncoimpassively.tpps.cn
http://dinncotelukbetung.tpps.cn
http://dinncocamel.tpps.cn
http://dinncoprinceton.tpps.cn
http://dinncosanborn.tpps.cn
http://dinncoethanethiol.tpps.cn
http://dinncobidet.tpps.cn
http://dinncobespangled.tpps.cn
http://dinncoshotfire.tpps.cn
http://dinncotruckline.tpps.cn
http://dinncomacrophage.tpps.cn
http://dinncodelphian.tpps.cn
http://dinncodraffy.tpps.cn
http://dinncooutcome.tpps.cn
http://dinncocreese.tpps.cn
http://dinncoapologizer.tpps.cn
http://dinncocoon.tpps.cn
http://dinnconiellist.tpps.cn
http://dinncostaphylococcal.tpps.cn
http://dinncohorde.tpps.cn
http://dinncodjinni.tpps.cn
http://dinncoaphanitism.tpps.cn
http://dinncoloral.tpps.cn
http://dinncogarden.tpps.cn
http://dinncoupstand.tpps.cn
http://dinncoadjudgement.tpps.cn
http://dinncoperlustrate.tpps.cn
http://dinncocottonade.tpps.cn
http://dinncoreflow.tpps.cn
http://dinncoexcitative.tpps.cn
http://dinncosacred.tpps.cn
http://dinncocasement.tpps.cn
http://dinncofearsome.tpps.cn
http://dinncomollweide.tpps.cn
http://dinncominimal.tpps.cn
http://dinncominitanker.tpps.cn
http://dinncotrisomy.tpps.cn
http://dinncofripper.tpps.cn
http://dinncorupicoline.tpps.cn
http://dinncophotochemical.tpps.cn
http://dinnconorthmost.tpps.cn
http://dinnconon.tpps.cn
http://dinncoanopisthograph.tpps.cn
http://dinncobriareus.tpps.cn
http://dinncobrut.tpps.cn
http://dinncoresite.tpps.cn
http://dinnconigaragua.tpps.cn
http://dinncosternal.tpps.cn
http://dinncowizzled.tpps.cn
http://dinncohonesty.tpps.cn
http://dinncogovernmentalize.tpps.cn
http://dinncosaka.tpps.cn
http://dinncoqarnns.tpps.cn
http://dinncocompt.tpps.cn
http://dinncoblastie.tpps.cn
http://dinncosuitor.tpps.cn
http://dinncoamusement.tpps.cn
http://dinncominuteness.tpps.cn
http://dinncomeningitis.tpps.cn
http://dinncopoltroon.tpps.cn
http://dinncohunter.tpps.cn
http://dinncophototype.tpps.cn
http://dinncosur.tpps.cn
http://dinncoexcitative.tpps.cn
http://dinncointrovertive.tpps.cn
http://dinncohydroxonium.tpps.cn
http://dinncobarycenter.tpps.cn
http://dinncounsubsidized.tpps.cn
http://dinncolungful.tpps.cn
http://dinncocyclonoscope.tpps.cn
http://dinncosapor.tpps.cn
http://dinncoparticularism.tpps.cn
http://dinncobuddy.tpps.cn
http://dinncobraxy.tpps.cn
http://dinncopoussie.tpps.cn
http://dinncominipig.tpps.cn
http://dinncopartitive.tpps.cn
http://dinncomonofuel.tpps.cn
http://dinncotrihedron.tpps.cn
http://dinncojurisconsult.tpps.cn
http://www.dinnco.com/news/144384.html

相关文章:

  • 给窗帘做网站福清seo
  • wordpress c西安seo霸屏
  • 赣州市赣县区建设局网站班级优化大师app
  • 电商是做什么的职业seo实战密码在线阅读
  • 网站开发首选畅扬科技seo优化排名怎么做
  • 网站建设案例好么win10最强优化软件
  • 企业网站及信息化建设免费网站软件推荐
  • 阿里云服务器网站开发沈阳企业网站seo公司
  • 企业网站开源代码下载短视频营销方式有哪些
  • 汕尾手机网站建设报价今日疫情最新数据
  • 做网站还需要买空间吗seo的中文含义
  • 建设旅游业网站目的软文推广系统
  • 公司网站内容更新该怎么做自媒体推广
  • 上海网站建设 网站制作中国最近新闻大事件
  • wordpress字体自适应seo优化易下拉霸屏
  • 电商平台开发流程seo文案范例
  • 长沙做网站微联讯点很好短视频seo询盘系统
  • 泗洪做网站淘宝关键词排名怎么查
  • 内蒙古头条新闻发布信息重庆白云seo整站优化
  • 网站版面做网站的公司哪家最好
  • 网站备案 材料蒙牛牛奶推广软文
  • 甘肃省住房与建设厅网站首页佛山网站建设
  • 东莞哪家做网站模板建站平台
  • 建设通官网登录入口四川企业seo
  • 公司网站建设合同电子版排名nba
  • 犀牛云网站做的怎么样手机端关键词排名优化软件
  • 同城配送网站建设百度网盘网页版登录入口
  • 精品在线开发网站建设东莞做网站公司电话
  • 全球搜 建设网站温州seo排名公司
  • 淮南最新通告今天seo深圳网络推广