tinyml如何使用TensorFlow Lite构建智能物联网设备

TinyML是使物联网设备在嵌入式系统级别具备智能的技术,允许设备在极低功耗下对传感器输入进行分析。文章介绍了Tensorflow Lite作为实现TinyML的重要工具,它支持在低功耗设备上运行机器学习模型,提供预训练模型,并且可以在无网络连接的情况下部署。此外,还提到了Tensorflow Lite的竞争对手,如CoreML和PyTorch Mobile。
摘要由CSDN通过智能技术生成

If you are new to machine learning, it is a technique of using algorithms to analyze massive amounts of data to draw conclusions. Deep learning is a branch of machine learning that uses an algorithm called neural networks.

如果您不熟悉机器学习,它是一种使用算法来分析大量数据以得出结论的技术。 深度学习是机器学习的一个分支,它使用一种称为神经网络的算法。

When you combine large data sets with high computing power, these neural networks can understand patterns between data.

当您将大型数据集与高计算能力结合在一起时,这些神经网络可以理解数据之间的模式。

Deep learning has given rise to self-driving cars, personal assistants like Siri, and many others. Engineers are adopting deep learning models into their applications to solve complex problems for their customers.

深度学习催生了无人驾驶汽车,Siri等私人助理以及许多其他应用。 工程师正在将深度学习模型应用于其应用程序,以为其客户解决复杂的问题。

Tensorflow is a leading Deep learning library developed by Google. It supports a variety of neural network models like Convolutional and Recurrent Neural Networks.

Tensorflow是Google开发的领先的深度学习库。 它支持各种神经网络模型,例如卷积和递归神经网络。

I recently wrote an article on Machine learning called “Machine Learning For Managers — What You Need To Know”. It should give you all the basics you need.

我最近写了一篇有关机器学习的文章,名为“ 管理者的机器学习-您需要知道的知识 ”。 它应该为您提供所需的所有基础知识。

嵌入式系统 (Embedded Systems)

If hardware scares you, don't worry. I'll make this simple.

如果硬件吓到您,请不要担心。 我将简单说明。

A microprocessor is a small computer similar to your CPU. The difference is that it is really tiny and can only perform low-level operations.

微处理器是类似于您的CPU的小型计算机。 不同之处在于它确实很小,并且只能执行低级操作。

Image for post

These tiny microprocessors are present in devices like your air-conditioner and your refrigerator. But microprocessors alone cannot do much. They need input through sensors and send outputs to perform an action.

这些微型微处理器存在于诸如空调和冰箱之类的设备中。 但是光靠微处理器是无能为力的。 他们需要通过传感器输入并发送输出以执行操作。

When you press a button on your remote and change a channel on your TV, the device takes in an input, understands the command, and performs an operation. The combination of these sensors and the microprocessor is called Embedded Systems. (coz they are embedded together on a circuit board)

当您按遥控器上的按钮并更改电视上的频道时,设备将接受输入,理解命令并执行操作。 这些传感器和微处理器的组合称为嵌入式系统 。 (因为它们被嵌入在一起在电路板上)

Embedded systems are present in devices like your smartphone, electric guitar, and many others we use on a daily basis.

嵌入式系统存在于您的智能手机,电吉他以及我们每天使用的许多其他设备中。

物联网(IoT) (Internet of Things (IoT))

IoT is any device connected to the internet. If your air conditioner is connected to the internet, you can turn it on/off from your office through a mobile app. That makes it an IoT device.

物联网是连接到互联网的任何设备。 如果您的空调已连接到互联网,则可以通过移动应用程序在办公室中打开/关闭空调。 这使其成为物联网设备。

Image for post

IoT devices are usually grouped together to perform various actions. A few examples would be:

IoT设备通常组合在一起以执行各种操作。 一些例子是:

  • Devices on a farm to check weeds and pests using cameras.

    农场中使用照相机检查杂草和害虫的设备。
  • Traffic cameras for real-time monitoring

    用于实时监控的交通摄像机
  • A network of drones to monitor a construction site.

    无人机网络监视施工现场。

There are pre-built embedded systems like Raspberry Pi and Arduino that come packaged with a microcontroller, sensors, support for wifi, and even a USB port. You can connect to them using a keyword and a monitor, just like you would do with a CPU.

有诸如Raspberry Pi和Arduino之类的预构建嵌入式系统,它们与微控制器,传感器,对wifi的支持,甚至USB端口一起打包在一起。 您可以使用关键字和监视器连接到它们,就像使用CPU一样。

Image for post

什么是TinyML (What is TinyML)

Most IoT devices perform a specific task. They take input through a sensor, perform computation, and send the data out or perform an action.

大多数物联网设备执行特定任务。 它们通过传感器获取输入,执行计算,然后发送数据或执行操作。

The usual approach to IoT is to collect data and send it to a centralized logging server. From here, you can use machine learning to draw conclusions.

物联网的常用方法是收集数据并将其发送到集中式日志服务器。 从这里,您可以使用机器学习得出结论。

But why don't we make these devices intelligent at the embedded system level? We can build solutions like smart traffic signals based on traffic density, send you an alert when your refrigerator goes out of stock, or even predict rainfall based on weather data.

但是,为什么我们不使这些设备在嵌入式系统级别上变得智能呢? 我们可以构建基于交通密度的智能交通信号等解决方案,在冰箱缺货时向您发送警报,甚至根据天气数据预测降雨量。

The challenge with embedded systems in that they are tiny. And most of them run on battery power. Since machine learning models consume a lot of processing power, machine learning tools like Tensorflow are not well suited to build models on IoT devices.

嵌入式系统的挑战在于它们很小。 而且大多数都依靠电池供电。 由于机器学习模型会消耗大量处理能力,因此Tensorflow等机器学习工具不太适合在IoT设备上构建模型。

This is where TinyML comes in.

这就是TinyML的用武之地。

TinyML can perform on-device analysis of sensor inputs with extremely low power. With hardware improvements and the advancements in TinyML tools like Tensorflow Lite, it is now possible to install intelligence in these tiny devices.

TinyML可以以极低的功耗对传感器输入进行设备上分析。 随着硬件的改进以及Tensorflow Lite等TinyML工具的发展,现在可以在这些小型设备中安装智能功能。

Tensorflow Lite (Tensorflow Lite)

Image for post

So how do you achieve TinyML? There are a few tools that help us run machine learning models on IoT devices.

那么如何实现TinyML? 有一些工具可以帮助我们在IoT设备上运行机器学习模型。

The most famous one is Tensorflow Lite. With Tensorflow Lite, you can wrap your Tensorflow models to run on embedded systems. Tensorflow Lite will give you small sized binaries capable of running on low powered embedded systems.

最著名的是Tensorflow Lite 。 借助Tensorflow Lite,您可以包装Tensorflow模型以在嵌入式系统上运行。 Tensorflow Lite将为您提供能够在低功耗嵌入式系统上运行的小型二进制文件。

Tensorflow Lite also supports major platforms including Android, iOS, Arduino, and so on.

Tensorflow Lite还支持主要平台,包括Android,iOS,Arduino等。

Python is usually the preferred language to build machine learning models. But with TensorFlow Lite, you can use C, C++ or Java to build machine learning models.

通常,Python是构建机器学习模型的首选语言。 但是使用TensorFlow Lite,您可以使用C,C ++或Java来构建机器学习模型。

Connecting to the network is a power-consuming operation. With Tensorflow Lite, you can deploy machine learning models without the need to connect to the internet. This also solves security concerns since embedded systems are relatively easier to exploit.

连接到网络是一项耗电的操作。 使用Tensorflow Lite,您可以部署机器学习模型而无需连接到互联网。 由于嵌入式系统相对易于利用,因此这也解决了安全问题。

Tensorflow Lite offers pre-trained machine learning models for common use cases. These include:

Tensorflow Lite为常见用例提供了经过预训练的机器学习模型。 这些包括:

  • Object Detection — Recognizes multiple objects within an image. Supports up to 80 different classes of objects.

    对象检测 -识别图像中的多个对象。 支持多达80种不同类别的对象。

  • Smart RepliesGenerates smart replies, similar to interacting with a chatbot.

    智能回复 -生成智能回复,类似于与聊天机器人进行交互。

  • RecommendationsPersonalized recommendation systems based on user behavior.

    推荐 -基于用户行为的个性化推荐系统。

备择方案 (Alternatives)

There are a few alternatives to Tensorflow Lite. Two strong contenders are:

Tensorflow Lite有一些替代方案。 两个有力的竞争者是:

  • CoreML — Apple’s library for building machine learning models on iOS devices.

    CoreML — Apple的库,用于在iOS设备上构建机器学习模型。

  • PyTorch Mobile — Mobile version of Facebook’s deep learning library PyTorch.

    PyTorch Mobile — Facebook的深度学习库PyTorch的移动版本。

摘要 (Summary)

TinyML is still in its early stages. There are improvements being made in Tensorflow Lite and other TinyML frameworks to support complex machine learning models.

TinyML仍处于早期阶段。 Tensorflow Lite和其他TinyML框架进行了改进,以支持复杂的机器学习模型。

It might take a couple of years before we begin to see the mainstream adoption of TinyML. But no mistake, intelligent devices are coming.

我们可能要花几年时间才能开始看到TinyML的主流采用。 但是,毫无疑问,智能设备即将问世。

Loved this article? Join my Newsletter and get a summary of my articles and videos every Monday.

喜欢这篇文章吗? 加入我的时事通讯 并在每个星期一获得我的文章和视频的摘要。

翻译自: https://medium.com/manishmshiva/tinyml-how-to-build-intelligent-iot-devices-with-tensorflow-lite-8cbcd91592db

使用TensorFlow Lite可以快速构建移动端声音分类应用。TensorFlow Lite是一个针对移动设备和嵌入式设备优化的轻量级机器学习框架,它具有高效的推理性能和较小的模型尺寸。 首先,我们需要准备声音分类的训练数据集。可以选择一个合适的公开数据集,例如UrbanSound8K,其中包含了来自不同环境的各种声音样本。然后,我们使用TensorFlow构建和训练一个声音分类模型,可以选择常见的模型架构,如卷积神经网络。 接下来,我们使用TensorFlow提供的工具将训练好的模型转换为TensorFlow Lite的模型格式。这可以通过使用TensorFlow的Converter API实现,其中应用了优化技术来减小模型的尺寸和优化推理性能。 一旦我们获得了TensorFlow Lite模型,我们可以将其集成到移动端应用程序中。可以使用Java或Kotlin编写Android应用,或使用Swift编写iOS应用。在应用程序中,我们使用TensorFlow Lite解析器来加载模型并进行声音分类。该解析器提供了简单的API来输入音频数据并获得分类结果。 最后,为了提高移动端应用的性能,可以考虑对模型进行量化(quantization),将浮点数模型转换为整数模型,以减小内存占用和加速推理速度。TensorFlow Lite还提供了一些优化技术,如模型矩阵压缩和模型分割,进一步提升了性能。 总之,使用TensorFlow Lite可以快速构建高性能、低资源占用的移动端声音分类应用。通过合理选择数据集、训练模型,并应用TensorFlow Lite的优化技术,我们可以在移动设备上实现实时声音分类。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值