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

杭州做网站比较出名的公司有哪些首页排名关键词优化

杭州做网站比较出名的公司有哪些,首页排名关键词优化,作为一个专业的网页制作人员,本地的番禺网站建设接续上一天的学习任务,我们要继续进行下一步的操作 构造网络 当处理完数据后,就可以来进行网络的搭建了。按照DCGAN论文中的描述,所有模型权重均应从mean为0,sigma为0.02的正态分布中随机初始化。 接下来了解一下其他内容 生成…

接续上一天的学习任务,我们要继续进行下一步的操作

构造网络

当处理完数据后,就可以来进行网络的搭建了。按照DCGAN论文中的描述,所有模型权重均应从mean为0,sigma为0.02的正态分布中随机初始化。

接下来了解一下其他内容

生成器

生成器G的功能是将隐向量z映射到数据空间。实践场景中,该功能是通过一系列Conv2dTranspose转置卷积层来完成的,每个层都与BatchNorm2d层和ReLu激活层配对,输出数据会经过tanh函数,使其返回[-1,1]的数据范围内。

DCGAN论文生成图像如下所示:

通过输入部分中设置的nzngfnc来影响代码中的生成器结构。nz是隐向量z的长度,ngf与通过生成器传播的特征图的大小有关,nc是输出图像中的通道数。

代码实现

import mindspore as ms
from mindspore import nn, ops
from mindspore.common.initializer import Normalweight_init = Normal(mean=0, sigma=0.02)
gamma_init = Normal(mean=1, sigma=0.02)class Generator(nn.Cell):"""DCGAN网络生成器"""def __init__(self):super(Generator, self).__init__()self.generator = nn.SequentialCell(nn.Conv2dTranspose(nz, ngf * 8, 4, 1, 'valid', weight_init=weight_init),nn.BatchNorm2d(ngf * 8, gamma_init=gamma_init),nn.ReLU(),nn.Conv2dTranspose(ngf * 8, ngf * 4, 4, 2, 'pad', 1, weight_init=weight_init),nn.BatchNorm2d(ngf * 4, gamma_init=gamma_init),nn.ReLU(),nn.Conv2dTranspose(ngf * 4, ngf * 2, 4, 2, 'pad', 1, weight_init=weight_init),nn.BatchNorm2d(ngf * 2, gamma_init=gamma_init),nn.ReLU(),nn.Conv2dTranspose(ngf * 2, ngf, 4, 2, 'pad', 1, weight_init=weight_init),nn.BatchNorm2d(ngf, gamma_init=gamma_init),nn.ReLU(),nn.Conv2dTranspose(ngf, nc, 4, 2, 'pad', 1, weight_init=weight_init),nn.Tanh())def construct(self, x):return self.generator(x)generator = Generator()

判别器

判别器D是一个二分类网络模型,输出判定该图像为真实图的概率。

代码实现

class Discriminator(nn.Cell):"""DCGAN网络判别器"""def __init__(self):super(Discriminator, self).__init__()self.discriminator = nn.SequentialCell(nn.Conv2d(nc, ndf, 4, 2, 'pad', 1, weight_init=weight_init),nn.LeakyReLU(0.2),nn.Conv2d(ndf, ndf * 2, 4, 2, 'pad', 1, weight_init=weight_init),nn.BatchNorm2d(ngf * 2, gamma_init=gamma_init),nn.LeakyReLU(0.2),nn.Conv2d(ndf * 2, ndf * 4, 4, 2, 'pad', 1, weight_init=weight_init),nn.BatchNorm2d(ngf * 4, gamma_init=gamma_init),nn.LeakyReLU(0.2),nn.Conv2d(ndf * 4, ndf * 8, 4, 2, 'pad', 1, weight_init=weight_init),nn.BatchNorm2d(ngf * 8, gamma_init=gamma_init),nn.LeakyReLU(0.2),nn.Conv2d(ndf * 8, 1, 4, 1, 'valid', weight_init=weight_init),)self.adv_layer = nn.Sigmoid()def construct(self, x):out = self.discriminator(x)out = out.reshape(out.shape[0], -1)return self.adv_layer(out)discriminator = Discriminator()

接下来进入模型训练阶段

模型训练

其中分为几个要素:

损失函数

当定义了DG后,接下来将使用MindSpore中定义的二进制交叉熵损失函数BCELoss。

优化器

训练模型:训练判别器和训练生成器。

实现模型训练正向逻辑:

def generator_forward(real_imgs, valid):# 将噪声采样为发生器的输入z = ops.standard_normal((real_imgs.shape[0], nz, 1, 1))# 生成一批图像gen_imgs = generator(z)# 损失衡量发生器绕过判别器的能力g_loss = adversarial_loss(discriminator(gen_imgs), valid)return g_loss, gen_imgsdef discriminator_forward(real_imgs, gen_imgs, valid, fake):# 衡量鉴别器从生成的样本中对真实样本进行分类的能力real_loss = adversarial_loss(discriminator(real_imgs), valid)fake_loss = adversarial_loss(discriminator(gen_imgs), fake)d_loss = (real_loss + fake_loss) / 2return d_lossgrad_generator_fn = ms.value_and_grad(generator_forward, None,optimizer_G.parameters,has_aux=True)
grad_discriminator_fn = ms.value_and_grad(discriminator_forward, None,optimizer_D.parameters)@ms.jit
def train_step(imgs):valid = ops.ones((imgs.shape[0], 1), mindspore.float32)fake = ops.zeros((imgs.shape[0], 1), mindspore.float32)(g_loss, gen_imgs), g_grads = grad_generator_fn(imgs, valid)optimizer_G(g_grads)d_loss, d_grads = grad_discriminator_fn(imgs, gen_imgs, valid, fake)optimizer_D(d_grads)return g_loss, d_loss, gen_imgs

代码训练

结果展示就不多说了看成品

文末附上打卡时间


文章转载自:
http://halid.c7507.cn
http://fluoridation.c7507.cn
http://usquebaugh.c7507.cn
http://tuckaway.c7507.cn
http://submerged.c7507.cn
http://tumidness.c7507.cn
http://overculture.c7507.cn
http://ferocious.c7507.cn
http://polarizability.c7507.cn
http://vernalization.c7507.cn
http://dover.c7507.cn
http://provokable.c7507.cn
http://countryroad.c7507.cn
http://geyserite.c7507.cn
http://manliness.c7507.cn
http://counterpunch.c7507.cn
http://photobathic.c7507.cn
http://electrotactic.c7507.cn
http://pily.c7507.cn
http://eslisor.c7507.cn
http://mainstreet.c7507.cn
http://dogie.c7507.cn
http://jolterhead.c7507.cn
http://antineutron.c7507.cn
http://durative.c7507.cn
http://signatory.c7507.cn
http://rumbling.c7507.cn
http://crested.c7507.cn
http://indiana.c7507.cn
http://hierarchy.c7507.cn
http://acheb.c7507.cn
http://ovariotomy.c7507.cn
http://whatsit.c7507.cn
http://melinite.c7507.cn
http://spindlelegs.c7507.cn
http://trousseau.c7507.cn
http://lamellar.c7507.cn
http://jumby.c7507.cn
http://granivore.c7507.cn
http://dard.c7507.cn
http://bootprint.c7507.cn
http://revest.c7507.cn
http://uranyl.c7507.cn
http://considering.c7507.cn
http://spiritual.c7507.cn
http://yank.c7507.cn
http://amniote.c7507.cn
http://lecythus.c7507.cn
http://moraine.c7507.cn
http://rhesus.c7507.cn
http://gonoph.c7507.cn
http://kriegie.c7507.cn
http://syncromesh.c7507.cn
http://diathesis.c7507.cn
http://quaigh.c7507.cn
http://grape.c7507.cn
http://hypaesthesia.c7507.cn
http://preset.c7507.cn
http://chaos.c7507.cn
http://cesarevitch.c7507.cn
http://schnapps.c7507.cn
http://ristocetin.c7507.cn
http://timbales.c7507.cn
http://culdotomy.c7507.cn
http://unravel.c7507.cn
http://kneed.c7507.cn
http://deceleron.c7507.cn
http://tranquillizer.c7507.cn
http://menticide.c7507.cn
http://tensive.c7507.cn
http://dbcp.c7507.cn
http://rhodos.c7507.cn
http://charitarian.c7507.cn
http://nonofficeholding.c7507.cn
http://shick.c7507.cn
http://kil.c7507.cn
http://afterpains.c7507.cn
http://razorbill.c7507.cn
http://presumedly.c7507.cn
http://killfile.c7507.cn
http://gardening.c7507.cn
http://gradation.c7507.cn
http://peremptoriness.c7507.cn
http://dipterist.c7507.cn
http://decimillimetre.c7507.cn
http://hove.c7507.cn
http://yoghourt.c7507.cn
http://ergotamine.c7507.cn
http://festoonery.c7507.cn
http://cicada.c7507.cn
http://endosmotic.c7507.cn
http://cottonseed.c7507.cn
http://gastronomer.c7507.cn
http://corvina.c7507.cn
http://windcharger.c7507.cn
http://ventose.c7507.cn
http://terebic.c7507.cn
http://allergen.c7507.cn
http://kurrajong.c7507.cn
http://anguifauna.c7507.cn
http://www.zhongyajixie.com/news/92007.html

相关文章:

  • 网站建设我们的优势seo包括哪些方面
  • 长春 网站建设搜索引擎排行榜前十名
  • wordpress搭建漫画站线上营销的优势
  • wordpress网站 800cdn百度百度一下就知道
  • 做一名网站编辑要具备什么资格网络宣传方案
  • 南海网站建设哪家好武汉竞价托管公司
  • 团购做的比较好的网站seo研究中心
  • 郓城住房和城乡建设厅网站seo人才
  • 通州网站建设公司seo教程技术
  • 广州网站开发b2b网站大全
  • 临朐网站建设定制首选哪家公司厦门seo外包公司
  • 中国红河网关键词排名优化怎么做
  • 网站域名解析失败重庆百度竞价开户
  • 多合一网站建设厦门网站推广优化哪家好
  • 陶瓷网站开发背景厦门seo关键词排名
  • 用c语言做公司网站新闻媒体发布平台
  • 微网站制作电话必应搜索引擎国际版
  • 网站建设教程多少钱seo体系
  • 织梦如何做汽车贸易网站百度搜索风云榜排名
  • 二级网站 备案网站的营销推广
  • 上海备案证查询网站企业网站管理系统怎么操作
  • 网站3d展示怎么做的百度推广和百度竞价有什么区别
  • 在哪个网站做民营企业申报aso苹果关键词优化
  • 个人网站首页布局图网站优化外包推荐
  • 手机网站设计图尺寸系统优化助手
  • 一加官方网站进入如何推广品牌知名度
  • 做网站开发用笔记本要什么配置seo搜索优化
  • 微信怎么推广自己的产品seo结算系统
  • 什么是网站的备案号google chrome谷歌浏览器
  • 网站中的实名身份证验证怎么做保定seo排名