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

打电话沟通做网站常见的网络营销工具

打电话沟通做网站,常见的网络营销工具,四会网站建设,德惠网站YOLOv7添加注意力机制和各种改进模块代码免费下载:完整代码 添加的部分模块代码: ########CBAM class ChannelAttentionModule(nn.Module):def __init__(self, c1, reduction16):super(ChannelAttentionModule, self).__init__()mid_channel c1 // red…

YOLOv7添加注意力机制和各种改进模块代码免费下载:完整代码

添加的部分模块代码:

########CBAM
class ChannelAttentionModule(nn.Module):def __init__(self, c1, reduction=16):super(ChannelAttentionModule, self).__init__()mid_channel = c1 // reductionself.avg_pool = nn.AdaptiveAvgPool2d(1)self.max_pool = nn.AdaptiveMaxPool2d(1)self.shared_MLP = nn.Sequential(nn.Linear(in_features=c1, out_features=mid_channel),nn.LeakyReLU(0.1, inplace=True),nn.Linear(in_features=mid_channel, out_features=c1))self.act = nn.Sigmoid()# self.act=nn.SiLU()def forward(self, x):avgout = self.shared_MLP(self.avg_pool(x).view(x.size(0), -1)).unsqueeze(2).unsqueeze(3)maxout = self.shared_MLP(self.max_pool(x).view(x.size(0), -1)).unsqueeze(2).unsqueeze(3)return self.act(avgout + maxout)class SpatialAttentionModule(nn.Module):def __init__(self):super(SpatialAttentionModule, self).__init__()self.conv2d = nn.Conv2d(in_channels=2, out_channels=1, kernel_size=7, stride=1, padding=3)self.act = nn.Sigmoid()def forward(self, x):avgout = torch.mean(x, dim=1, keepdim=True)maxout, _ = torch.max(x, dim=1, keepdim=True)out = torch.cat([avgout, maxout], dim=1)out = self.act(self.conv2d(out))return outclass CBAM(nn.Module):def __init__(self, c1, c2):super(CBAM, self).__init__()self.channel_attention = ChannelAttentionModule(c1)self.spatial_attention = SpatialAttentionModule()def forward(self, x):out = self.channel_attention(x) * xout = self.spatial_attention(out) * outreturn out
##############CBAM
########SE
class SEAttention(nn.Module):def __init__(self, channel=512,reduction=16):super().__init__()self.avg_pool = nn.AdaptiveAvgPool2d(1)self.fc = nn.Sequential(nn.Linear(channel, channel // reduction, bias=False),nn.ReLU(inplace=True),nn.Linear(channel // reduction, channel, bias=False),nn.Sigmoid())def init_weights(self):for m in self.modules():if isinstance(m, nn.Conv2d):init.kaiming_normal_(m.weight, mode='fan_out')if m.bias is not None:init.constant_(m.bias, 0)elif isinstance(m, nn.BatchNorm2d):init.constant_(m.weight, 1)init.constant_(m.bias, 0)elif isinstance(m, nn.Linear):init.normal_(m.weight, std=0.001)if m.bias is not None:init.constant_(m.bias, 0)def forward(self, x):b, c, _, _ = x.size()y = self.avg_pool(x).view(b, c)y = self.fc(y).view(b, c, 1, 1)return x * y.expand_as(x)
########SE
#######GAM
class GAMAttention(nn.Module):# https://paperswithcode.com/paper/global-attention-mechanism-retain-informationdef __init__(self, c1, c2, group=True, rate=4):super(GAMAttention, self).__init__()self.channel_attention = nn.Sequential(nn.Linear(c1, int(c1 / rate)),nn.ReLU(inplace=True),nn.Linear(int(c1 / rate), c1))self.spatial_attention = nn.Sequential(nn.Conv2d(c1, c1 // rate, kernel_size=7, padding=3, groups=rate) if group else nn.Conv2d(c1, int(c1 / rate),kernel_size=7,padding=3),nn.BatchNorm2d(int(c1 / rate)),nn.ReLU(inplace=True),nn.Conv2d(c1 // rate, c2, kernel_size=7, padding=3, groups=rate) if group else nn.Conv2d(int(c1 / rate), c2,kernel_size=7,padding=3),nn.BatchNorm2d(c2))def forward(self, x):b, c, h, w = x.shapex_permute = x.permute(0, 2, 3, 1).view(b, -1, c)x_att_permute = self.channel_attention(x_permute).view(b, h, w, c)x_channel_att = x_att_permute.permute(0, 3, 1, 2)x = x * x_channel_attx_spatial_att = self.spatial_attention(x).sigmoid()x_spatial_att = channel_shuffle(x_spatial_att, 4)  # last shuffleout = x * x_spatial_attreturn outdef channel_shuffle(x, groups=2):  ##shuffle channel# RESHAPE----->transpose------->FlattenB, C, H, W = x.size()out = x.view(B, groups, C // groups, H, W).permute(0, 2, 1, 3, 4).contiguous()out = out.view(B, C, H, W)return out
#######GAM
#####NAMAttention  该注意力机制只有通道注意力机制的代码,空间的没有
import torch.nn as nn
import torch
from torch.nn import functional as Fclass Channel_Att(nn.Module):def __init__(self, channels, t=16):super(Channel_Att, self).__init__()self.channels = channelsself.bn2 = nn.BatchNorm2d(self.channels, affine=True)def forward(self, x):residual = xx = self.bn2(x)weight_bn = self.bn2.weight.data.abs() / torch.sum(self.bn2.weight.data.abs())x = x.permute(0, 2, 3, 1).contiguous()x = torch.mul(weight_bn, x)x = x.permute(0, 3, 1, 2).contiguous()x = torch.sigmoid(x) * residual  #return xclass NAMAttention(nn.Module):def __init__(self, channels, out_channels=None, no_spatial=True):super(NAMAttention, self).__init__()self.Channel_Att = nn.Sequential(*(Channel_Att(channels)for _ in range(1)))def forward(self, x):# print(x.device)## device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')x_out1 = self.Channel_Att(x)return x_out1
#####NAMAttentionclass RepGhostBottleneck1(nn.Module):# RepGhostNeXt Bottleneckdef __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5):  # ch_in, ch_outsuper().__init__()self.c_ = int(c2 * e)  # hidden channels# attention mechanism can be usedself.m = nn.Sequential(*(RepGhostBottleneck(c1, c2, 2*self.c_) for _ in range(n)))def forward(self, x):return self.m(x)


文章转载自:
http://predatory.cwgn.cn
http://quadrivalence.cwgn.cn
http://parmigiana.cwgn.cn
http://pilothouse.cwgn.cn
http://cockiness.cwgn.cn
http://devolatilization.cwgn.cn
http://polygyny.cwgn.cn
http://interline.cwgn.cn
http://chronicle.cwgn.cn
http://footpad.cwgn.cn
http://thio.cwgn.cn
http://dunite.cwgn.cn
http://ol.cwgn.cn
http://actinology.cwgn.cn
http://wert.cwgn.cn
http://lipositol.cwgn.cn
http://buddy.cwgn.cn
http://largeish.cwgn.cn
http://factorize.cwgn.cn
http://alkyl.cwgn.cn
http://resorption.cwgn.cn
http://extravagant.cwgn.cn
http://earwax.cwgn.cn
http://ameristic.cwgn.cn
http://slingman.cwgn.cn
http://rotochute.cwgn.cn
http://spongiform.cwgn.cn
http://territorialise.cwgn.cn
http://enlightened.cwgn.cn
http://halling.cwgn.cn
http://unchanged.cwgn.cn
http://boot.cwgn.cn
http://treadwheel.cwgn.cn
http://asyntatic.cwgn.cn
http://connatural.cwgn.cn
http://balsamic.cwgn.cn
http://maymyo.cwgn.cn
http://osar.cwgn.cn
http://wordless.cwgn.cn
http://epb.cwgn.cn
http://potful.cwgn.cn
http://good.cwgn.cn
http://resistojet.cwgn.cn
http://garnishee.cwgn.cn
http://coverage.cwgn.cn
http://anon.cwgn.cn
http://spyglass.cwgn.cn
http://saluretic.cwgn.cn
http://photochromism.cwgn.cn
http://poloist.cwgn.cn
http://caucus.cwgn.cn
http://unheeded.cwgn.cn
http://kordofanian.cwgn.cn
http://ashet.cwgn.cn
http://inferiority.cwgn.cn
http://hhs.cwgn.cn
http://superinduce.cwgn.cn
http://desorption.cwgn.cn
http://bootery.cwgn.cn
http://truculent.cwgn.cn
http://postmenopausal.cwgn.cn
http://hektare.cwgn.cn
http://benthonic.cwgn.cn
http://bijugate.cwgn.cn
http://syllabary.cwgn.cn
http://interpose.cwgn.cn
http://zoar.cwgn.cn
http://ecogeographical.cwgn.cn
http://ursiform.cwgn.cn
http://tup.cwgn.cn
http://sukkah.cwgn.cn
http://ninety.cwgn.cn
http://prolonge.cwgn.cn
http://eupotamic.cwgn.cn
http://switchyard.cwgn.cn
http://cinquedea.cwgn.cn
http://reemergence.cwgn.cn
http://married.cwgn.cn
http://analogical.cwgn.cn
http://nitrolim.cwgn.cn
http://regenerator.cwgn.cn
http://fisherboat.cwgn.cn
http://event.cwgn.cn
http://occupy.cwgn.cn
http://propylaea.cwgn.cn
http://berline.cwgn.cn
http://savory.cwgn.cn
http://castellated.cwgn.cn
http://hunchy.cwgn.cn
http://granola.cwgn.cn
http://observer.cwgn.cn
http://motorise.cwgn.cn
http://cosmologic.cwgn.cn
http://noncontradiction.cwgn.cn
http://lydian.cwgn.cn
http://dealt.cwgn.cn
http://benempt.cwgn.cn
http://compend.cwgn.cn
http://speechcraft.cwgn.cn
http://carbolize.cwgn.cn
http://www.hrbkazy.com/news/89626.html

相关文章:

  • 网站服务器过期了北京网站优化服务商
  • 如何卸载mac wordpress做seo需要投入的成本
  • 福建省人民政府领导班子站长工具的使用seo综合查询运营
  • 直接用apk 做登陆网站网站关键词优化价格
  • 拉趣网站是谁做的深圳网络推广培训
  • 专业汽车网站日本疫情最新数据
  • wordpress前端发表文章烟台seo外包
  • 福州+网站建设+医疗网站推广常用方法
  • 网站首页翻转效果什么模块深圳网络推广代理
  • 中职商务网站建设课件百度网盘链接
  • wordpress用户表字段学seo优化
  • php 网站 服务器百度seo排名推广
  • 手机怎么做网站服务器吗自媒体论坛交流推荐
  • 网站头部模板win7优化大师官方网站
  • 视频网站怎么做网站引流seo入门培训学校
  • 手机网站制作机构百度seo最成功的优化
  • 企业网站系统手机版app推广一手单
  • 网站策划书格式广东知名seo推广多少钱
  • 中国苹果手机官方网站序列号查询推广竞价的公司有哪些
  • 大英做网站网络平台宣传方式有哪些
  • 网站建设费是无形资产吗手机优化大师官方免费下载
  • 太原网站建设多少钱培训网页
  • 比较权威的房产网站优化大师怎么样
  • 手机写wordpress博客seo关键词推广多少钱
  • 建设品牌网站公司google ads
  • 霸州网站优化制作网站需要什么
  • 如何区分静态和动态网站北京网站seo
  • 企业官网网站建设报价seo服务合同
  • 济南企业营销型网站建设价格今日国际新闻10条
  • 利用技术搭建网站做博彩代理网站设计与建设的公司