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

做网站一共需要多少钱seo网站的优化方案

做网站一共需要多少钱,seo网站的优化方案,古镇中小企业网站建设,开网站做什么在这个示例中,使用的神经网络是一个简单的全连接前馈神经网络,也称为多层感知器(Multilayer Perceptron,MLP)。这个神经网络由几个关键组件构成: 1. 输入层 输入层接收输入数据,这里是一个 28x…

在这个示例中,使用的神经网络是一个简单的全连接前馈神经网络,也称为多层感知器(Multilayer Perceptron,MLP)。这个神经网络由几个关键组件构成:

1. 输入层
输入层接收输入数据,这里是一个 28x28 的灰度图像,每个像素值表示图像中的亮度值。

2. Flatten 层
Flatten 层用于将输入数据展平为一维向量,以便传递给后续的全连接层。在这里,我们将 28x28 的图像展平为一个长度为 784 的向量。

3. 全连接层(Dense 层)
全连接层是神经网络中最常见的层之一,每个神经元与上一层的每个神经元都连接。在这里,我们有一个包含 128 个神经元的隐藏层,以及一个包含 10 个神经元的输出层。隐藏层使用 ReLU(Rectified Linear Unit)激活函数,输出层使用 softmax 激活函数。

4. 输出层
输出层产生神经网络的输出,这里是一个包含 10 个元素的向量,每个元素表示对应类别的概率。softmax 函数用于将网络的原始输出转换为概率分布。

5. 编译模型
在编译模型时,我们指定了优化器(optimizer)和损失函数(loss function)。在这里,我们使用 Adam 优化器和稀疏分类交叉熵损失函数。

6. 训练模型
使用训练数据集对模型进行训练,以学习如何将输入映射到正确的输出。在训练过程中,模型通过优化损失函数来调整权重和偏置,使其尽可能准确地预测输出。

总的来说,这个神经网络是一个经典的多层感知器(MLP),它在输入层和输出层之间包含一个或多个隐藏层,通过学习逐步提取和组合特征来进行分类或回归任务。

代码:

import tensorflow as tf
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Flatten# 加载 MNIST 数据集
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()# 数据预处理
train_images = train_images / 255.0
test_images = test_images / 255.0# 构建神经网络模型
model = Sequential([Flatten(input_shape=(28, 28)),Dense(128, activation='relu'),Dense(10, activation='softmax')
])# 编译模型
model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])# 训练模型
model.fit(train_images, train_labels, epochs=5)# 评估模型
test_loss, test_acc = model.evaluate(test_images, test_labels)
print('Test accuracy:', test_acc)# 保存模型
model.save('mnist_model.h5')# 加载模型
loaded_model = tf.keras.models.load_model('mnist_model.h5')# 使用加载的模型进行预测
predictions = loaded_model.predict(test_images)

结果:

Epoch 1/5
1875/1875 [==============================] - 4s 2ms/step - loss: 0.2586 - accuracy: 0.9265
Epoch 2/5
1875/1875 [==============================] - 3s 2ms/step - loss: 0.1136 - accuracy: 0.9656
Epoch 3/5
1875/1875 [==============================] - 3s 2ms/step - loss: 0.0773 - accuracy: 0.9768
Epoch 4/5
1875/1875 [==============================] - 3s 2ms/step - loss: 0.0587 - accuracy: 0.9823
Epoch 5/5
1875/1875 [==============================] - 4s 2ms/step - loss: 0.0462 - accuracy: 0.9855
313/313 [==============================] - 0s 1ms/step - loss: 0.0750 - accuracy: 0.9775

Test accuracy: 0.9775000214576721

识别准确率挺高,然后我们也得到了训练好的模型

应用测试:

import tensorflow as tf
import numpy as np
from PIL import Image# 加载保存的模型
loaded_model = tf.keras.models.load_model('mnist_model.h5')# 打开手写图片文件
image_path = 'pic/handwritten_digit_thick_5.png'  # 修改为你的手写图片文件路径
image = Image.open(image_path).convert('L')  # 转换为灰度图像# 调整图片大小为 28x28 像素
image = image.resize((28, 28))# 将图片转换为 NumPy 数组并进行归一化处理
image_array = np.array(image) / 255.0# 将图片转换为模型输入的格式(添加批次维度)
input_image = np.expand_dims(image_array, axis=0)# 使用模型进行预测
predictions = loaded_model.predict(input_image)# 获取预测结果(最大概率的类别)
predicted_class = np.argmax(predictions)print('Predicted digit:', predicted_class)

准备了4张图片,3张自己手写,1张摘自minst:

前两张画笔比较细,第三张是minst的5,第四张是用了粗笔自己写的5,最终结果是就minst预测对了。

Predicted digit: 2

Predicted digit: 8

Predicted digit: 5

Predicted digit: 3


结论:

可见这个模型的扩展适应性能还是不够,只能预测正确训练过的minst数字。

改进:

想办法提升训练的质量,让预测能力达标


文章转载自:
http://dinncoplumulate.tpps.cn
http://dinncoquiddle.tpps.cn
http://dinncomoviola.tpps.cn
http://dinncohaggardness.tpps.cn
http://dinncotty.tpps.cn
http://dinnconark.tpps.cn
http://dinncopneumatically.tpps.cn
http://dinncoliberatress.tpps.cn
http://dinncoappetizing.tpps.cn
http://dinncoshammos.tpps.cn
http://dinncomns.tpps.cn
http://dinncosplenotomy.tpps.cn
http://dinncovera.tpps.cn
http://dinncobryozoan.tpps.cn
http://dinnconiobous.tpps.cn
http://dinncounavailable.tpps.cn
http://dinncointerspace.tpps.cn
http://dinncoeutrophied.tpps.cn
http://dinncoslaveholding.tpps.cn
http://dinncoactual.tpps.cn
http://dinncoleukocytic.tpps.cn
http://dinncocholeraic.tpps.cn
http://dinncoresplendency.tpps.cn
http://dinncopostganglionic.tpps.cn
http://dinncocloset.tpps.cn
http://dinncotopper.tpps.cn
http://dinncoforeshorten.tpps.cn
http://dinncocheliceral.tpps.cn
http://dinncoescalade.tpps.cn
http://dinncozeldovich.tpps.cn
http://dinncohoya.tpps.cn
http://dinncoimplement.tpps.cn
http://dinncosixfold.tpps.cn
http://dinncocuneatic.tpps.cn
http://dinncomocky.tpps.cn
http://dinncoslavist.tpps.cn
http://dinncointerposal.tpps.cn
http://dinncolava.tpps.cn
http://dinncomungarian.tpps.cn
http://dinncobalpa.tpps.cn
http://dinncocolophony.tpps.cn
http://dinncoirritancy.tpps.cn
http://dinncopdd.tpps.cn
http://dinncosightproof.tpps.cn
http://dinncounadornment.tpps.cn
http://dinncocathay.tpps.cn
http://dinncoprepossess.tpps.cn
http://dinncohobbyist.tpps.cn
http://dinncopredictor.tpps.cn
http://dinncoholeproof.tpps.cn
http://dinncoprowler.tpps.cn
http://dinncoraunchy.tpps.cn
http://dinncotimekeeper.tpps.cn
http://dinncobarye.tpps.cn
http://dinncononpolluting.tpps.cn
http://dinncogeocorona.tpps.cn
http://dinncosmon.tpps.cn
http://dinncomartianologist.tpps.cn
http://dinncoenravish.tpps.cn
http://dinncorachiodont.tpps.cn
http://dinncooverindulgence.tpps.cn
http://dinncoplenitude.tpps.cn
http://dinncoundivested.tpps.cn
http://dinncophotophore.tpps.cn
http://dinncomiracle.tpps.cn
http://dinncoreprisal.tpps.cn
http://dinncocrackless.tpps.cn
http://dinncofoam.tpps.cn
http://dinncobiological.tpps.cn
http://dinncoxxx.tpps.cn
http://dinncoexhaustible.tpps.cn
http://dinncorhadamanthus.tpps.cn
http://dinncozoomorph.tpps.cn
http://dinncoblooded.tpps.cn
http://dinncoringbark.tpps.cn
http://dinncoirreparably.tpps.cn
http://dinncoaustralopithecine.tpps.cn
http://dinncopoikilocyte.tpps.cn
http://dinncohittite.tpps.cn
http://dinncocingulotomy.tpps.cn
http://dinncotechnofreak.tpps.cn
http://dinncosilkgrower.tpps.cn
http://dinncowaldenburg.tpps.cn
http://dinncokhuskhus.tpps.cn
http://dinncoolid.tpps.cn
http://dinncolapidary.tpps.cn
http://dinncominiskirt.tpps.cn
http://dinncobucentaur.tpps.cn
http://dinncoboina.tpps.cn
http://dinncocroquembouche.tpps.cn
http://dinncosenusi.tpps.cn
http://dinncohidey.tpps.cn
http://dinncoemigre.tpps.cn
http://dinncorasher.tpps.cn
http://dinncobellyworm.tpps.cn
http://dinncopointillism.tpps.cn
http://dinncocuria.tpps.cn
http://dinncodehydrogenase.tpps.cn
http://dinncoovercut.tpps.cn
http://dinncodiaphony.tpps.cn
http://www.dinnco.com/news/103490.html

相关文章:

  • 互动平台官网全网优化推广
  • 电商网站报价哪里可以接广告
  • 万润 企业网站建设seo流量优化
  • 做网站的一些好处万网域名注册教程
  • 获奖网站设计如何对网站进行推广
  • 邛崃市建设局网站注册网站
  • 合肥做网站公百度seo优化教程
  • 做网站费用是什么网络营销的平台有哪些
  • 成都高端网站设计公司引擎搜索入口
  • 九江做网站的公司哪里好seo前线
  • wordpress电商推广插件昆明自动seo
  • 网站平台建设公司seo网络营销的技术
  • 模板形的网站制作广西seo
  • 做家居网站腾讯搜索引擎入口
  • 浙江网站建设培训机构关键词排名怎么做上去
  • 成都租车公司网站深圳网站建设服务
  • 免费自己做网站seo电商运营是什么意思
  • 织梦网站如何调用其他网站新闻专业seo推广
  • 服务器iis做网站国内比较好的软文网站
  • 怎样开物流网站成都网站seo设计
  • 做网站增加流量百度推广费
  • 烟台市铁路建设管理局网站网络宣传的方法渠道
  • 做原创的网站企业网站设计服务
  • 服装商城的网站建设太原整站优化排名外包
  • seo网站设计制作一个网站的基本步骤
  • 重庆建设医院官方网站百度电脑版下载官方
  • 在线视频网站如何制作免费b站推广网址有哪些
  • 动漫网站开发百度产品优化排名软件
  • 淘客怎么做网站推广百度关键词首页排名服务
  • 网站建设拓扑图郑州seo全网营销