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

自建网站怎么做后台管理系统免费的网站程序哪里好

自建网站怎么做后台管理系统,免费的网站程序哪里好,wordpress文章rss,轻量级wordpress主题1.特征图可视化#xff0c;这种方法是最简单#xff0c;输入一张照片#xff0c;然后把网络中间某层的输出的特征图按通道作为图片进行可视化展示即可。 2.特征图可视化代码如下#xff1a; def featuremap_visual(feature, out_dirNone, # 特征图保存路径文件save_feat…1.特征图可视化这种方法是最简单输入一张照片然后把网络中间某层的输出的特征图按通道作为图片进行可视化展示即可。 2.特征图可视化代码如下 def featuremap_visual(feature, out_dirNone, # 特征图保存路径文件save_featureTrue, # 是否以图片形式保存特征图show_featureTrue, # 是否使用plt显示特征图feature_titleNone, # 特征图名字默认以shape作为titlenum_ch-1, # 显示特征图前几个通道-1 or None 都显示nrow8, # 每行显示多少个特征图通道padding10, # 特征图之间间隔多少像素值pad_value1 # 特征图之间的间隔像素):import matplotlib.pylab as pltimport torchvisionimport os# feature feature.detach().cpu()b, c, h, w feature.shapefeature feature[0]feature feature.unsqueeze(1)if c num_ch 0:feature feature[:num_ch]img torchvision.utils.make_grid(feature, nrownrow, paddingpadding, pad_valuepad_value)img img.detach().cpu()img img.numpy()images img.transpose((1, 2, 0))# title str(images.shape) if feature_title is None else str(feature_title)title str(hwc-) str(h) - str(w) - str(c) if feature_title is None else str(feature_title)plt.title(title)plt.imshow(images)if save_feature:# rootrC:\Users\Administrator\Desktop\CODE_TJ\123# plt.savefig(os.path.join(root,1.jpg))out_root title .jpg if out_dir or out_dir is None else os.path.join(out_dir, title .jpg)plt.savefig(out_root)if show_feature: plt.show()3.结合resnet网络整体可视化(主要将其featuremap_visual函数插入forward中即可)整体代码如下 resnet网络结构在我博客 残差网络ResNet(超详细代码解析) :你必须要知道backbone模块成员之一 - tangjunjun - 博客园 author: tangjun contact: 511026664qq.com time: 2020/12/7 22:48 desc: 残差ackbone改写用于构建特征提取模块 import torch.nn as nn import torch from collections import OrderedDictdef Conv(in_planes, out_planes, **kwargs):3x3 convolution with paddingpadding kwargs.get(padding, 1)bias kwargs.get(bias, False)stride kwargs.get(stride, 1)kernel_size kwargs.get(kernel_size, 3)out nn.Conv2d(in_planes, out_planes, kernel_sizekernel_size, stridestride, paddingpadding, biasbias)return outclass BasicBlock(nn.Module):expansion 1def __init__(self, inplanes, planes, stride1, downsampleNone):super(BasicBlock, self).__init__()self.conv1 Conv(inplanes, planes, stridestride)self.bn1 nn.BatchNorm2d(planes)self.relu nn.ReLU(inplaceTrue)self.conv2 Conv(planes, planes)self.bn2 nn.BatchNorm2d(planes)self.downsample downsampleself.stride stridedef forward(self, x):residual xout self.conv1(x)out self.bn1(out)out self.relu(out)out self.conv2(out)out self.bn2(out)if self.downsample is not None:residual self.downsample(x)out residualout self.relu(out)return outclass Bottleneck(nn.Module):expansion 4def __init__(self, inplanes, planes, stride1, downsampleNone):super(Bottleneck, self).__init__()self.conv1 nn.Conv2d(inplanes, planes, kernel_size1, biasFalse)self.bn1 nn.BatchNorm2d(planes)self.conv2 nn.Conv2d(planes, planes, kernel_size3, stridestride,padding1, biasFalse)self.bn2 nn.BatchNorm2d(planes)self.conv3 nn.Conv2d(planes, planes * 4, kernel_size1, biasFalse)self.bn3 nn.BatchNorm2d(planes * 4)self.relu nn.ReLU(inplaceTrue)self.downsample downsampleself.stride stridedef forward(self, x):residual xout 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)if self.downsample is not None:residual self.downsample(x)out residualout self.relu(out)return outclass Resnet(nn.Module):arch_settings {18: (BasicBlock, (2, 2, 2, 2)),34: (BasicBlock, (3, 4, 6, 3)),50: (Bottleneck, (3, 4, 6, 3)),101: (Bottleneck, (3, 4, 23, 3)),152: (Bottleneck, (3, 8, 36, 3))}def __init__(self,depth50,in_channelsNone,pretrainedNone,frozen_stages-1# num_classesNone):super(Resnet, self).__init__()self.inplanes 64self.inchannels in_channels if in_channels is not None else 3 # 输入通道# self.num_classesnum_classesself.block, layers self.arch_settings[depth]self.frozen_stages frozen_stagesself.conv1 nn.Conv2d(self.inchannels, 64, kernel_size7, stride2, padding3, biasFalse)self.bn1 nn.BatchNorm2d(64)self.relu nn.ReLU(inplaceTrue)self.maxpool nn.MaxPool2d(kernel_size3, stride2, padding1)self.layer1 self._make_layer(self.block, 64, layers[0], stride1)self.layer2 self._make_layer(self.block, 128, layers[1], stride2)self.layer3 self._make_layer(self.block, 256, layers[2], stride2)self.layer4 self._make_layer(self.block, 512, layers[3], stride2)# self.avgpool nn.AvgPool2d(7)# self.fc nn.Linear(512 * self.block.expansion, self.num_classes)self._freeze_stages() # 冻结函数if pretrained is not None:self.init_weights(pretrainedpretrained)def _freeze_stages(self):if self.frozen_stages 0:self.norm1.eval()for m in [self.conv1, self.norm1]:for param in m.parameters():param.requires_grad Falsefor i in range(1, self.frozen_stages 1):m getattr(self, layer{}.format(i))m.eval()for param in m.parameters():param.requires_grad Falsedef init_weights(self, pretrainedNone):if isinstance(pretrained, str):self.load_checkpoint(pretrained)elif pretrained is None:for m in self.modules():if isinstance(m, nn.Conv2d):nn.init.kaiming_normal_(m.weight, a0, modefan_out, nonlinearityrelu)if hasattr(m, bias) and m.bias is not None: # m包含该属性且m.bias非None # hasattr(对象属性)表示对象是否包含该属性nn.init.constant_(m.bias, 0)elif isinstance(m, nn.BatchNorm2d):m.weight.data.fill_(1)m.bias.data.zero_()def load_checkpoint(self, pretrained):checkpoint torch.load(pretrained)if isinstance(checkpoint, OrderedDict):state_dict checkpointelif isinstance(checkpoint, dict) and state_dict in checkpoint:state_dict checkpoint[state_dict]if list(state_dict.keys())[0].startswith(module.):state_dict {k[7:]: v for k, v in checkpoint[state_dict].items()}unexpected_keys [] # 保存checkpoint不在module中的keymodel_state self.state_dict() # 模型变量for name, param in state_dict.items(): # 循环遍历pretrained的权重if name not in model_state:unexpected_keys.append(name)continueif isinstance(param, torch.nn.Parameter):# backwards compatibility for serialized parametersparam param.datatry:model_state[name].copy_(param) # 试图赋值给模型except Exception:raise RuntimeError(While copying the parameter named {}, whose dimensions in the model are {} not equal whose dimensions in the checkpoint are {}..format(name, model_state[name].size(), param.size()))missing_keys set(model_state.keys()) - set(state_dict.keys())print(missing_keys:, missing_keys)def _make_layer(self, block, planes, num_blocks, stride1):downsample Noneif stride ! 1 or self.inplanes ! planes * block.expansion:downsample nn.Sequential(nn.Conv2d(self.inplanes, planes * block.expansion, kernel_size1, stridestride, biasFalse),nn.BatchNorm2d(planes * block.expansion),)layers []layers.append(block(self.inplanes, planes, stride, downsample))self.inplanes planes * block.expansionfor i in range(1, num_blocks):layers.append(block(self.inplanes, planes))return nn.Sequential(*layers)def forward(self, x):outs []x self.conv1(x)x self.bn1(x)x self.relu(x)x self.maxpool(x)x self.layer1(x)outs.append(x)featuremap_visual(x)x self.layer2(x)outs.append(x)featuremap_visual(x)x self.layer3(x)outs.append(x)featuremap_visual(x)x self.layer4(x)outs.append(x)# x self.avgpool(x)# x x.view(x.size(0), -1)# x self.fc(x)return tuple(outs)def featuremap_visual(feature,out_dirNone, # 特征图保存路径文件save_featureTrue, # 是否以图片形式保存特征图show_featureTrue, # 是否使用plt显示特征图feature_titleNone, # 特征图名字默认以shape作为titlenum_ch-1, # 显示特征图前几个通道-1 or None 都显示nrow8, # 每行显示多少个特征图通道padding10, # 特征图之间间隔多少像素值pad_value1 # 特征图之间的间隔像素):import matplotlib.pylab as pltimport torchvisionimport os# feature feature.detach().cpu()b, c, h, w feature.shapefeature feature[0]feature feature.unsqueeze(1)if c num_ch 0:feature feature[:num_ch]img torchvision.utils.make_grid(feature, nrownrow, paddingpadding, pad_valuepad_value)img img.detach().cpu()img img.numpy()images img.transpose((1, 2, 0))# title str(images.shape) if feature_title is None else str(feature_title)title str(hwc-) str(h) - str(w) - str(c) if feature_title is None else str(feature_title)plt.title(title)plt.imshow(images)if save_feature:# rootrC:\Users\Administrator\Desktop\CODE_TJ\123# plt.savefig(os.path.join(root,1.jpg))out_root title .jpg if out_dir or out_dir is None else os.path.join(out_dir, title .jpg)plt.savefig(out_root)if show_feature: plt.show()import cv2 import numpy as npdef imnormalize(img,mean[123.675, 116.28, 103.53],std[58.395, 57.12, 57.375],to_rgbTrue):if to_rgb:img cv2.cvtColor(img, cv2.COLOR_BGR2RGB)img img.astype(np.float32)return (img - mean) / stdif __name__ __main__:import matplotlib.pylab as pltimg cv2.imread(1.jpg) # 读取图片img imnormalize(img)img torch.from_numpy(img)img torch.unsqueeze(img, 0)img img.permute(0, 3, 1, 2)img torch.tensor(img, dtypetorch.float32)img img.to(cuda:0)model Resnet(depth50)model.init_weights(pretrained./resnet50.pth) # 可以使用也可以注释model model.cuda()out model(img)运行结果 参考 PyTorch模型训练特征图可视化 - tangjunjun - 博客园 (cnblogs.com)
文章转载自:
http://www.morning.jzlkq.cn.gov.cn.jzlkq.cn
http://www.morning.fnrkh.cn.gov.cn.fnrkh.cn
http://www.morning.rfmzc.cn.gov.cn.rfmzc.cn
http://www.morning.hqwtm.cn.gov.cn.hqwtm.cn
http://www.morning.ruyuaixuexi.com.gov.cn.ruyuaixuexi.com
http://www.morning.mhmsn.cn.gov.cn.mhmsn.cn
http://www.morning.wpwyx.cn.gov.cn.wpwyx.cn
http://www.morning.ltkms.cn.gov.cn.ltkms.cn
http://www.morning.lnbcx.cn.gov.cn.lnbcx.cn
http://www.morning.gbyng.cn.gov.cn.gbyng.cn
http://www.morning.knswz.cn.gov.cn.knswz.cn
http://www.morning.fhyhr.cn.gov.cn.fhyhr.cn
http://www.morning.leeong.com.gov.cn.leeong.com
http://www.morning.kzrbd.cn.gov.cn.kzrbd.cn
http://www.morning.ysnbq.cn.gov.cn.ysnbq.cn
http://www.morning.mltsc.cn.gov.cn.mltsc.cn
http://www.morning.mrfbp.cn.gov.cn.mrfbp.cn
http://www.morning.wqmpd.cn.gov.cn.wqmpd.cn
http://www.morning.dhxnr.cn.gov.cn.dhxnr.cn
http://www.morning.wrkhf.cn.gov.cn.wrkhf.cn
http://www.morning.pqkyx.cn.gov.cn.pqkyx.cn
http://www.morning.gwqkk.cn.gov.cn.gwqkk.cn
http://www.morning.kfbth.cn.gov.cn.kfbth.cn
http://www.morning.rwcw.cn.gov.cn.rwcw.cn
http://www.morning.tftw.cn.gov.cn.tftw.cn
http://www.morning.hypng.cn.gov.cn.hypng.cn
http://www.morning.gmswp.cn.gov.cn.gmswp.cn
http://www.morning.gslz.com.cn.gov.cn.gslz.com.cn
http://www.morning.jnoegg.com.gov.cn.jnoegg.com
http://www.morning.zfcfx.cn.gov.cn.zfcfx.cn
http://www.morning.dqrhz.cn.gov.cn.dqrhz.cn
http://www.morning.smdnl.cn.gov.cn.smdnl.cn
http://www.morning.wjrq.cn.gov.cn.wjrq.cn
http://www.morning.pngfx.cn.gov.cn.pngfx.cn
http://www.morning.thwcg.cn.gov.cn.thwcg.cn
http://www.morning.gdgylp.com.gov.cn.gdgylp.com
http://www.morning.rfxw.cn.gov.cn.rfxw.cn
http://www.morning.mfnjk.cn.gov.cn.mfnjk.cn
http://www.morning.snlxb.cn.gov.cn.snlxb.cn
http://www.morning.gsjw.cn.gov.cn.gsjw.cn
http://www.morning.rbrhj.cn.gov.cn.rbrhj.cn
http://www.morning.zqbrd.cn.gov.cn.zqbrd.cn
http://www.morning.pljxz.cn.gov.cn.pljxz.cn
http://www.morning.trsmb.cn.gov.cn.trsmb.cn
http://www.morning.wjplr.cn.gov.cn.wjplr.cn
http://www.morning.yqrgq.cn.gov.cn.yqrgq.cn
http://www.morning.hxbjt.cn.gov.cn.hxbjt.cn
http://www.morning.nwfpl.cn.gov.cn.nwfpl.cn
http://www.morning.jggr.cn.gov.cn.jggr.cn
http://www.morning.mymz.cn.gov.cn.mymz.cn
http://www.morning.mrfjr.cn.gov.cn.mrfjr.cn
http://www.morning.ndpwg.cn.gov.cn.ndpwg.cn
http://www.morning.qqrqb.cn.gov.cn.qqrqb.cn
http://www.morning.syfty.cn.gov.cn.syfty.cn
http://www.morning.lylkh.cn.gov.cn.lylkh.cn
http://www.morning.lmyq.cn.gov.cn.lmyq.cn
http://www.morning.sypzg.cn.gov.cn.sypzg.cn
http://www.morning.pmdzd.cn.gov.cn.pmdzd.cn
http://www.morning.dglszn.com.gov.cn.dglszn.com
http://www.morning.lcxzg.cn.gov.cn.lcxzg.cn
http://www.morning.ngmjn.cn.gov.cn.ngmjn.cn
http://www.morning.spsqr.cn.gov.cn.spsqr.cn
http://www.morning.ywrt.cn.gov.cn.ywrt.cn
http://www.morning.zyytn.cn.gov.cn.zyytn.cn
http://www.morning.qpsft.cn.gov.cn.qpsft.cn
http://www.morning.mwns.cn.gov.cn.mwns.cn
http://www.morning.jxltk.cn.gov.cn.jxltk.cn
http://www.morning.wkcl.cn.gov.cn.wkcl.cn
http://www.morning.lgnrl.cn.gov.cn.lgnrl.cn
http://www.morning.fqlxg.cn.gov.cn.fqlxg.cn
http://www.morning.nzwp.cn.gov.cn.nzwp.cn
http://www.morning.dwztj.cn.gov.cn.dwztj.cn
http://www.morning.csnch.cn.gov.cn.csnch.cn
http://www.morning.rrwft.cn.gov.cn.rrwft.cn
http://www.morning.jxfsm.cn.gov.cn.jxfsm.cn
http://www.morning.yskhj.cn.gov.cn.yskhj.cn
http://www.morning.hclqy.cn.gov.cn.hclqy.cn
http://www.morning.kvzvoew.cn.gov.cn.kvzvoew.cn
http://www.morning.mkzdp.cn.gov.cn.mkzdp.cn
http://www.morning.qswws.cn.gov.cn.qswws.cn
http://www.tj-hxxt.cn/news/243844.html

相关文章:

  • 个人建设门户网站 如何备案深圳罗湖医疗集团网站建设
  • 网站开发与制作中期报告wordpress 删除线
  • 适合做浏览器主页的网站怎样做互联网推广
  • 重庆网站首页排名公司做网站推广的价格
  • 旅游网站设计方案wordpress换模板 seo
  • 注销备案号 网站平面设计广告设计培训班
  • 电子商务网站建设 教材淘客网站备案
  • 永春网站开发网站认证必须做吗
  • 自己怎么做网站视频赚钱吗锦州建设银行网站
  • 如何向百度提交网站国家建设部网站官网证件查询
  • 济宁网站求建设网站微信群
  • 网站内置字体php调用wordpress函数
  • 网站建设方案产业c asp.net 做网站
  • 网络推广网站建设软件定制河南郑州
  • 上海营销型网站建设平台wordpress主题 搜索
  • 建筑工程类网站平顶山哪里做网站
  • 基于ASP与Access数据库的网站开发wordpress广告从哪获取
  • 四川省建设厅申报网站成都网站优化常识
  • 摄影师网站推荐建设厅网站上保存键看不见
  • 企业网站的做h5产品是什么意思
  • 单位网站设计流程步骤seo刷排名软件
  • 扁平化企业网站代理公司的经营范围
  • 长沙网站制作首页合肥专业做淘宝网站推广
  • 学校网站建设的背景谷歌网站优化
  • 网页制作与设计发展现状百度手机网站优化指南
  • 找最新游戏做视频网站有哪些阜宁网站制作具体报价
  • 网络营销ppt怎么做标题优化seo
  • 做羞羞事免费网站百度下载文章转wordpress
  • 网站开发二级域名导视设计ppt
  • 信息网站开发合同网站建设客户管理系统