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

在线绘制流程图的网站全景网站开发多少钱

在线绘制流程图的网站,全景网站开发多少钱,买一台服务器需要多少钱,显示网站运行时间代码一、要点 ResNeXt是ResNet的小幅升级#xff0c;更新了block 左边#xff08;ResNet的block/50/101/152层#xff09;#xff1a; 对于输入通道为256的特征矩阵#xff0c;首先使用64个11的卷积核进行降维#xff0c;再通过64个33的卷积核处理#xff0c;再通过256个1…一、要点 ResNeXt是ResNet的小幅升级更新了block 左边ResNet的block/50/101/152层 对于输入通道为256的特征矩阵首先使用64个1×1的卷积核进行降维再通过64个3×3的卷积核处理再通过256个1×1的卷积核升维输出将输出与输入进行相加得到最终的输出。 使用右边的结构替代左边的结构下面解释。 一论文中的性能参数指标 二关于ResNet和ResNeXt在ImageNet上top-1 的错误率计算量相同 三组卷积 Group Convolution 当分组的个数与输入特征矩阵的channel是一致的并且输入特征矩阵的channel也和输出特征矩阵的channel一致的话就相当于对我们输入特征矩阵的每一个channel分配了一个channel为1的卷积核进行卷积。即DW卷积。 四ResNeXt的block结构 c最简形式:输入通道为256维首先通过128个1×1的卷积核降维处理再通过group卷积卷积核3×3group数为32得到的特征矩阵的通道是128维再通过256个1×1的卷积核升维得到输出。再将输出和输入的特征矩阵进行相加得到最终的输出。 b和c等价 a和b等价 举例假设path为2对每个path采用1×1的卷积核来进行卷积 五 网络结构 二、使用pytorch搭建 代码是包括ResNet和ResNeXt的 import torch.nn as nn import torch# 18层/34层 对应的残差结构既要有实线残差结构的功能又要有虚线残差结构的功能 class BasicBlock(nn.Module):expansion 1 #残差结构的主分支卷积核的个数有无发生变化def __init__(self, in_channel, out_channel, stride1, downsampleNone, **kwargs): # downsample对应残差结构的虚线shortcut分支super(BasicBlock, self).__init__()# stride1,对应着实线的残差结构因为并没有改变输入特征矩阵的高和宽# output (input -3 2 * 1) / 1 1 input# stride2,对应着虚线的残差结构在第一个卷积层需要将特征矩阵的高和宽缩减为原来的一半# output (input -3 2 * 1) / 2 1 input / 2 0.5 input / 2 向下取整self.conv1 nn.Conv2d(in_channelsin_channel, out_channelsout_channel,kernel_size3, stridestride, padding1, biasFalse) # biasFalse,不使用偏置项因为下面用到BatchNormalizationself.bn1 nn.BatchNorm2d(out_channel)self.relu nn.ReLU()self.conv2 nn.Conv2d(in_channelsout_channel, out_channelsout_channel,kernel_size3, stride1, padding1, biasFalse)self.bn2 nn.BatchNorm2d(out_channel)self.downsample downsampledef forward(self, x):identity x # shorcut上的输出值if self.downsample is not None:identity self.downsample(x)out self.conv1(x)out self.bn1(out)out self.relu(out)out self.conv2(out)out self.bn2(out)out identityout self.relu(out)return out# 50层/101层/152层 对应的残差结构 class Bottleneck(nn.Module):注意原论文中在虚线残差结构的主分支上第一个1x1卷积层的步距是2第二个3x3卷积层步距是1。但在pytorch官方实现过程中是第一个1x1卷积层的步距是1第二个3x3卷积层步距是2这么做的好处是能够在top1上提升大概0.5%的准确率。可参考Resnet v1.5 https://ngc.nvidia.com/catalog/model-scripts/nvidia:resnet_50_v1_5_for_pytorchexpansion 4 #每个残差结构的最后一层卷积核的个数都是前两层的4倍def __init__(self, in_channel, out_channel, stride1, downsampleNone,groups1, width_per_group64):super(Bottleneck, self).__init__()width int(out_channel * (width_per_group / 64.)) * groupsself.conv1 nn.Conv2d(in_channelsin_channel, out_channelswidth,kernel_size1, stride1, biasFalse) # squeeze channelsself.bn1 nn.BatchNorm2d(width)# -----------------------------------------self.conv2 nn.Conv2d(in_channelswidth, out_channelswidth, groupsgroups,kernel_size3, stridestride, biasFalse, padding1)self.bn2 nn.BatchNorm2d(width)# -----------------------------------------self.conv3 nn.Conv2d(in_channelswidth, out_channelsout_channel*self.expansion,kernel_size1, stride1, biasFalse) # unsqueeze channelsself.bn3 nn.BatchNorm2d(out_channel*self.expansion)self.relu nn.ReLU(inplaceTrue)self.downsample downsampledef forward(self, x):identity xif self.downsample is not None:identity self.downsample(x)out self.conv1(x)out self.bn1(out)out self.relu(out)out self.conv2(out)out self.bn2(out)out self.relu(out)out self.conv3(out)out self.bn3(out)out identityout self.relu(out)return outclass ResNet(nn.Module):def __init__(self,block, # 对应18/34层或者50/101/152层的残差结构blocks_num, # 残差结构的个数是个列表以34层为例就是[3,4,6,3]num_classes1000, # 训练集的分类个数include_topTrue, # 方便以后在ResNet网络上去搭建更复杂的网络groups1,width_per_group64):super(ResNet, self).__init__()self.include_top include_topself.in_channel 64self.groups groupsself.width_per_group width_per_groupself.conv1 nn.Conv2d(3, self.in_channel, kernel_size7, stride2,padding3, biasFalse)# 为了让特征矩阵的宽和高缩减为原来的一半所以这里padding3self.bn1 nn.BatchNorm2d(self.in_channel)self.relu nn.ReLU(inplaceTrue)self.maxpool nn.MaxPool2d(kernel_size3, stride2, padding1)# 为了让特征矩阵的宽和高缩减为原来的一半所以这里padding1self.layer1 self._make_layer(block, 64, blocks_num[0]) # conv2_x 对于50/101/152层来说第一个残差结构的第一层只改变特征矩阵的深度没有改变宽高所以没有传入stride默认为1self.layer2 self._make_layer(block, 128, blocks_num[1], stride2) # conv3_xself.layer3 self._make_layer(block, 256, blocks_num[2], stride2) # conv4_xself.layer4 self._make_layer(block, 512, blocks_num[3], stride2) # conv5_xif self.include_top:self.avgpool nn.AdaptiveAvgPool2d((1, 1)) # output size (1, 1)self.fc nn.Linear(512 * block.expansion, num_classes)for m in self.modules():if isinstance(m, nn.Conv2d):nn.init.kaiming_normal_(m.weight, modefan_out, nonlinearityrelu)def _make_layer(self, block, channel, block_num, stride1):downsample None# 对于18/34层第一个残差结构跳过这句if stride ! 1 or self.in_channel ! channel * block.expansion:downsample nn.Sequential(nn.Conv2d(self.in_channel, channel * block.expansion, kernel_size1, stridestride, biasFalse),nn.BatchNorm2d(channel * block.expansion))layers []# 残差结构的第一层虚线残差结构layers.append(block(self.in_channel,channel,downsampledownsample,stridestride,groupsself.groups,width_per_groupself.width_per_group))self.in_channel channel * block.expansionfor _ in range(1, block_num):layers.append(block(self.in_channel,channel,groupsself.groups,width_per_groupself.width_per_group))return nn.Sequential(*layers)def forward(self, x):x self.conv1(x)x self.bn1(x)x self.relu(x)x self.maxpool(x)x self.layer1(x)x self.layer2(x)x self.layer3(x)x self.layer4(x)if self.include_top:x self.avgpool(x)x torch.flatten(x, 1)x self.fc(x)return xdef resnet34(num_classes1000, include_topTrue):# https://download.pytorch.org/models/resnet34-333f7ec4.pthreturn ResNet(BasicBlock, [3, 4, 6, 3], num_classesnum_classes, include_topinclude_top)def resnet50(num_classes1000, include_topTrue):# https://download.pytorch.org/models/resnet50-19c8e357.pthreturn ResNet(Bottleneck, [3, 4, 6, 3], num_classesnum_classes, include_topinclude_top)def resnet101(num_classes1000, include_topTrue):# https://download.pytorch.org/models/resnet101-5d3b4d8f.pthreturn ResNet(Bottleneck, [3, 4, 23, 3], num_classesnum_classes, include_topinclude_top)def resnext50_32x4d(num_classes1000, include_topTrue):# https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pthgroups 32width_per_group 4return ResNet(Bottleneck, [3, 4, 6, 3],num_classesnum_classes,include_topinclude_top,groupsgroups,width_per_groupwidth_per_group)def resnext101_32x8d(num_classes1000, include_topTrue):# https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pthgroups 32width_per_group 8return ResNet(Bottleneck, [3, 4, 23, 3],num_classesnum_classes,include_topinclude_top,groupsgroups,width_per_groupwidth_per_group)
http://www.pierceye.com/news/103003/

相关文章:

  • cms网站后台模版惠州网站设计哪家好
  • 海南智能网站建设设计湘潭学校网站建设 x磐石网络
  • 网站建设的入门书籍表格我做视频网站
  • 数据库跟网站内容青岛公司做网站的价格
  • 成都市金牛区建设和交通局网站营销专业网站
  • 免费的视频网站如何赚钱wordpress推广系统
  • 上海酒店团购网站建设网站建设风险分析
  • 做网站的抬头怎么做南昌app定制
  • 深圳市企业网站建设企业品牌设计
  • 做图网站有哪些内容惠州抖音推广
  • 郑州中原区建设局网站公司网站建设素材
  • 企业手机网站源码下载企查查网页版
  • 金科网站建设ps做网站难吗
  • 如何在年报网站上做遗失公告wordpress默认摘要
  • 中国网站服务器哪个好有哪些做公司网站
  • 做宠物的网站有哪些如何做电商生意
  • 具有品牌的常州做网站关于网站建设的广告词
  • 孝感网站推广品牌策划公司都有哪些
  • 保洁公司用哪些网站做推广wordpress aj提交评论
  • 互联网金融p2p网站建设模板简历模板免费下载网站
  • 绍兴建设网站制作3免费做网站
  • 东莞运营推广网站建设费用wordpress 单栏 主题
  • 律师事务所网站制作WordPress 经典博客
  • 建立网站功能wordpress微博头条
  • 多就能自己做网站取名网站怎么做
  • 网站域名百度云网站环境建设国家城乡建设规划部网站
  • 网站设计的实例wordpress 微博备份
  • 网络推销黑河网站seo
  • 天津市建设工程管理总队网站wordpress 自媒体模版
  • 用网站做宣传的方案郴州买房网站