Skip to Content
移动端AI与ML应用开发:基于iOS和Android
book

移动端AI与ML应用开发:基于iOS和Android

by Laurence Moroney
January 2023
Intermediate to advanced
288 pages
6h 6m
Chinese
China Machine Press
Content preview from 移动端AI与ML应用开发:基于iOS和Android
计算机视觉简介
|
27
假设我们的图像是矩形的,大小为 28×28 像素,我们需要用与表示一层中的神经元相
同的方式来表示它,即一维数组,所以我们可以遵循一个称为“展平”图像的过程,使
其变成 784×1 阵列,而不是 28×28。然后,它具有与输入神经元相似的“形状”,因
此我们可以开始输入。具体情况如图 2-12 所示。请注意,由于图 2-10 中的踝靴图像是
Fashion MNIST 中的第“9”类,因此我们将训练它,说它是应该在独热编码中点亮的神
经元。我们从 0 开始计数,因此第 9 类的神经元是图 2-12 中的第 10 个,即最右边的一
个。将术语“密集”赋予此层类型的原因现在应该在视觉上更加明显!
2-12
:使用
Fashion MNIST
训练神经网络
鉴于训练集中有 60 000 张图像,我们在第 1 章中提到的训练循环会发生。首先,网络中
的每个神经元都将被随机初始化。然后,对于 60 000 张标记图像中的每一张,都会进行
分类。这种分类的准确性和损失将帮助优化器调整神经元的值,我们会再试一次,以此
类推。随着时间的推移,神经元的内部权重和偏差将被调整以匹配训练数据。现在让我
们在代码中探索一下。
2.1.4
编写
Fashion MNIST
模型
前面描述的模型架构如下所示:
model = Sequential(
[Flatten(input_shape=(28,28)),
Dense(20, activation=tf.nn.relu),
Dense(10, activation=tf.nn.softmax)]) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能驱动的商业智能

人工智能驱动的商业智能

Tobias Zwingmann
Lua游戏AI开发指南

Lua游戏AI开发指南

Posts & Telecom Press, David Young
人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar

Publisher Resources

ISBN: 9787111713081