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
Android
中使用自定义模型
|
189
10.4
使用语言模型
在构建使用语言的模型时,该模式与你在图 10-1 中看到的非常相似,具体情况如图 10-7
所示。
一个主要区别是,你的应用程序使用基于自然语言处理(NLP)的模型,需要与训练底
层模型相同的单词词典。回忆第 9 章,句子被分成单词列表,单词被赋予数字标记。为
这些标记学习向量,为该词建立情绪。例如,单词“ dog”可能被赋予标记 4,并且可
以为标记 4 学习像 [0, 1, 0, 1] 这样的多维向量。然后在你的应用程序中可以使用字典来
映射单词“ dog”到 4。该模型还在固定长度的句子上进行训练,你的应用程序还需要
知道该数据。
包装代码
字典 元数据
模型
张量 张量
Android 数据
例如
字符串
Android 数据
例如
字符串
10-7
:在
NLP
应用程序中使用模型
如果你使用 TensorFlow Lite Model Maker 构建模型,那么元数据和字典实际上会编译到
.tflite
文件中,让你的生活更轻松。
对于本节的其余部分,我假设你有一个 NLP 模型,使用 Model Maker 进行训练,就像
9 章中演示的情绪分类器一样。你也可以在本章的代码库中找到已为你实现的,其中
完整的应用程序,包括模型。
10.5
创建用于语言分类的
Android
应用程序
使用 Android Studio 创建一个新的 Android 应用程序。只需让它成为一个带有空活动的
简单活动。完成后,编辑 build.gradle ...
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