小程序
传感搜
传感圈

TinyML: Continual Learning with LwM2M

2023-04-23 21:47:56
关注

Illustration: © IoT For All

While MCUs are becoming more powerful, machine learning models can be designed to utilize fewer resources. This enables the implementation of TinyML; deep learning models which can run on resource-constrained IoT devices. TinyML can be used to analyze raw sensor data locally which reduces or removes the need to send data to the cloud, lowers battery consumption, and preserves data privacy.

Nevertheless, implementing intelligent IoT solutions does not solely rely on the ML model itself. It involves challenges such as implementing continual learning, enabling low-power wireless communication, managing devices remotely, ensuring secure communication, updating the firmware (over the air), and enabling device interoperability.

“TinyML can be used to analyze raw sensor data locally which reduces or removes the need to send data to the cloud, lowers battery consumption, and preserves data privacy.”

-AVSystem

TinyML & LwM2M Complement Each Other

LwM2M is an application-layer communication standard that simplifies messaging and device management for IoT devices. The protocol dictates a data format and defines device management mechanisms and standardized processes for firmware-over-the-air updates (FOTA). The protocol is well-suited for LPWAN standards such as NB-IoT and LTE-M.

While TinyML provides the device intelligence (using tools such as Edge Impulse or Cartesiam.ai), the LwM2M protocol provides connectivity, standardized communication, and device management. When combined, they create a holistic solution for smart IoT devices.

TinyML is only one part of a smart solution

Retrofitting Existing Devices with Smart Sensors

Cloud-based analysis of a device’s raw sensor data is inefficient due to the volume of data the device needs to transmit. A more efficient way is to process data from sensors directly on the device using TinyML. For example, analyzing the X, Y, and Z values of the accelerometer can detect complex movements or vibrations which could give valuable insights, enabling use cases such as predictive maintenance, monitoring the utilization of valuable goods, or classifying movements of people or animals.

These days, more and more smart sensors are being developed. In addition to their sensing capabilities, smart sensors come with an embedded MCU which runs the TinyML model and communicates only the detected patterns to the main MCU of the device. These TinyML integrated sensors are referred to as the Sensor 2.0 Paradigm by Prof. Vijay Janapa Reddi (Harvard University) during his recent lecture at the TinyML Summit. Smart sensors simplify the implementation of TinyML as it allows for retrofitting existing devices with TinyML capabilities without having to redesign the embedded firmware. In addition, it can solve privacy issues due to the true isolation of raw sensor data. Smart sensors can analyze voices or camera images while ensuring people’s privacy as data does not leak out to the main MCU of the device.

Continual Learning

One of today’s key challenges is to keep the TinyML model reliable post-deployment. Oftentimes, datasets used for training purposes differ from real-world data, leading to inaccurate models. In addition, the environmental context may change over time (e.g. due to the decalibration of industrial machines, or changing climate conditions) leading to the deterioration of the model quality.

Continual learning refers to the ability of TinyML models to adapt over time. This can be accomplished by learning from new data sets without the need to retrain the model from scratch. Although the techniques to realize continual learning are well-known, practical implementations are often missing when running the models on resource-constrained devices. Often, this has to do with a missing device-management layer that takes care of ML model lifecycle management. LwM2M may be the missing link to realize continual learning as it comes with native support for remote configurations and firmware updates. Using proven methods, ML models can be updated continuously without having to physically access each device to update its firmware.

TinyML Catalyst

TinyML solutions for resource-constrained IoT devices are a catalyst for the development of intelligent solutions. To move beyond the current POC phase and start deploying actual TinyML applications, it is necessary to provide mechanisms for efficient communication, device, and firmware management, and secure connectivity. The use of the LwM2M protocol to manage TinyML models and provide connectivity is a path towards standardizing TinyML and enriching the ecosystem of intelligent IoT solutions.

Case Study: TinyML Pattern Detector

A TinyML solution has been designed using the LwM2M standard. The Thingy:91 is a development device that uses the nRF9160 SiP from Nordic Semiconductor. It runs the Zephyr OS operating system and was trained to detect three different motion patterns, as shown in the visual below.

Motion patterns recognized by the IoT device

The steps to implement the presented concept are as follows:

  1. Data collection and labeling.
  2. Design and train the classifier.
  3. Deploy and test the classifier on the device.
  4. Provide network connectivity and device management by implementing an LwM2M client.
  5. Manage devices and data using an LwM2M server.

The example uses the Edge Impulse platform to collect the data from the Thingy:91 accelerometer, train the ML classifier, and generate standalone libraries for C++. The library containing the TinyML model can run on the device and control the LED signaling pattern detection. The Anjay LwM2M client provides a connectivity layer for the solution, handling low-level technology issues related to communication and secure data transmission.

Training the TinyML model by classifying the movements using Edge Impulse

Finally, the device is registered in the LwM2M server where the data is stored and visualized. Using the Coiote IoT Device Management portal, the device can be instructed to notify the server every time a specific pattern is detected or to reduce the frequency to once every several seconds, minutes, or hours and send a counter indicating the number of times a pattern has been detected.

Visualization of the movement patterns in Coiote. Object ID /33650 represents the Pattern Detector

Tweet

Share

Share

Email

  • Automation
  • Connectivity
  • Internet of Things
  • Machine Learning
  • NB-IoT

  • Automation
  • Connectivity
  • Internet of Things
  • Machine Learning
  • NB-IoT

参考译文
TinyML:使用LwM2M的持续学习# 示例输入与输出**输入**人工智能(AI)是计算机科学的一个分支,旨在开发表现出人类智能的软件或机器。这包括从经验中学习、理解自然语言、解决问题以及识别模式。**输出**人工智能(AI)是计算机科学的一个分支,旨在开发表现出人类智能的软件或机器。这包括从经验中学习、理解自然语言、解决问题以及识别模式。
插图:© IoT For All 尽管微控制器(MCUs)正变得越来越强大,机器学习模型也可以被设计为占用更少的资源。这使得TinyML成为可能——即可以在资源受限的物联网设备上运行的深度学习模型。TinyML可用于在本地分析原始传感器数据,从而减少或消除将数据发送到云服务器的必要性,降低电池消耗并保护数据隐私。然而,实现智能物联网解决方案并不仅仅依赖于机器学习模型本身。它还涉及诸多挑战,例如实现持续学习、启用低功耗无线通信、远程管理设备、确保通信安全、进行固件空中更新(OTA)以及实现设备互操作性。 “TinyML可用于在本地分析原始传感器数据,从而减少或消除将数据发送到云服务器的必要性,降低电池消耗并保护数据隐私。” -AVSystem TinyML 与 LwM2M 相辅相成 LwM2M 是一种应用层通信标准,它简化了物联网设备的消息传输与设备管理。该协议定义了数据格式,并规定了设备管理机制和标准化的空中固件更新流程(FOTA)。该协议特别适用于 NB-IoT 和 LTE-M 等低功耗广域网(LPWAN)标准。TinyML 通过使用 Edge Impulse 或 Cartesiam.ai 等工具为设备提供智能,而 LwM2M 协议则提供连接性、标准化通信和设备管理。两者的结合为智能物联网设备创造了完整的解决方案。 TinyML 仅仅是智能解决方案的一部分 为现有设备添加智能传感器 由于设备需要传输的数据量较大,将原始传感器数据在云端进行分析效率不高。一种更高效的方式是使用 TinyML 在设备上直接处理传感器数据。例如,分析加速度计的 X、Y 和 Z 值可以检测复杂的运动或振动,从而提供有价值的信息,使预测性维护、监控高价值物品的使用情况或识别人员或动物的运动等应用成为可能。 如今,越来越多的智能传感器正在被开发。除了其传感功能,这些智能传感器还集成了一个微控制器(MCU),可在其上运行 TinyML 模型,仅将检测到的模式传递给设备的主要 MCU。这些集成了 TinyML 模型的智能传感器被哈佛大学 Vijay Janapa Reddi 教授在其最近的 TinyML 峰会演讲中称为“传感器 2.0 范式”。 智能传感器简化了 TinyML 的实现,因为它允许在无需重新设计嵌入式固件的情况下,为现有设备添加 TinyML 功能。此外,它还能解决隐私问题,因为原始传感器数据真正实现了隔离。智能传感器可以分析语音或摄像头图像,同时确保人们的隐私,因为数据不会泄露到设备的主要 MCU。 持续学习 如今的一项关键挑战是保持 TinyML 模型在部署后的可靠性。通常情况下,用于训练的训练数据集与真实世界的数据存在差异,从而导致模型不准确。此外,环境背景可能会随时间变化(例如工业设备的校准偏移或气候条件的变化),从而导致模型质量下降。 持续学习指的是 TinyML 模型随时间适应的能力。这可以通过从新数据集中学习而无需从头重新训练模型来实现。尽管实现持续学习的技术早已为人所知,但在资源受限设备上运行模型时,实际应用常常缺失。这通常是因为缺少用于 ML 模型生命周期管理的设备管理层。LwM2M 可能是实现持续学习的缺失环节,因为它支持远程配置和固件更新。利用已验证的方法,机器学习模型可以持续更新,而无需手动访问每个设备来更新其固件。 TinyML 催化剂 面向资源受限物联网设备的 TinyML 解决方案是智能解决方案发展的催化剂。要超越当前的概念验证(POC)阶段并开始部署实际的 TinyML 应用,必须提供高效的通信、设备和固件管理机制,以及安全的连接。使用 LwM2M 协议管理 TinyML 模型并提供连接性,是标准化 TinyML 并丰富智能物联网解决方案生态系统的一条路径。 案例研究:TinyML 模式检测器 一个 TinyML 解决方案是基于 LwM2M 标准设计的。Thingy:91 是一个开发设备,使用 Nordic Semiconductor 的 nRF9160 SiP。它运行 Zephyr OS 操作系统,并训练它检测三种不同的运动模式,如下图所示。 物联网设备识别的运动模式 实现该概念的步骤如下: 1. 数据收集和标注 2. 设计和训练分类器 3. 在设备上部署和测试分类器 4. 通过实现一个 LwM2M 客户端来提供网络连接和设备管理 5. 使用一个 LwM2M 服务器来管理设备和数据 该示例使用 Edge Impulse 平台从 Thingy:91 的加速度计中收集数据、训练 ML 分类器,并生成 C++ 独立库。包含 TinyML 模型的库可以在设备上运行,并控制 LED 信号以指示模式检测。Anjay LwM2M 客户端为该解决方案提供了连接层,处理与通信和安全数据传输相关的底层技术问题。 最后,设备在 LwM2M 服务器中注册,数据被存储和可视化。使用 Coiote IoT 设备管理门户,可以设置设备在检测到特定模式时通知服务器,或降低频率,例如每几秒、几分钟或几小时发送一次计数,表明检测到模式的次数。 Coiote 中运动模式的可视化。对象 ID /33650 代表的是模式检测器。TweetShareShareEmail 自动化连接物联网机器学习NB-IoT
您觉得本篇内容如何
评分

评论

您需要登录才可以回复|注册

提交评论

广告

iotforall

这家伙很懒,什么描述也没留下

关注

点击进入下一篇

一天发布两款旗舰,华为手机走出阴霾?

提取码
复制提取码
点击跳转至百度网盘