How to Update a Deep Learning Model on STM32MP1 with FullMetalUpdate

Homepage How to Update a Deep Learning Model on STM32MP1 with FullMetalUpdate

No IoT device can be free from updates and so no IoT project can disregard the importance of delivering those updates. Whether firmware changes, security patches, or upgrades to the core embedded or application software, updates present a challenge for IoT manufacturers and users alike. Today updates to IoT devices are most commonly delivered wirelessly or over the air (OTA). While pushing updates remotely presents a significant cost and time savings for the IoT network owner, the potential for updates to fail and – even worse – for IoT devices to be left ‘bricked’ and unusable is real.

For some time now IoT devices have been doing their computing ‘on the edge’. More recently, though, a new trend is emerging where AI models are being deployed to IoT devices with the computing power to run those models on the device. This Edge AI is a new and growing use case in the IoT world and is expected to spread rapidly across industries as innovators embrace its power and potential. Yet at the same time, it presents challenges for updating the AI models on the device as these are often large and complex, and bricking the device altogether is a constant concern.

Thanks to Witekio’s open-source Full Metal Update, however, the fear of a bricked device after a software update is no more. In a recent video presentation, Embedded Software Engineer Antonin Godard and I demonstrated how to use FullMetalUpdate to update a deep learning model on an STM32MP1 microprocessor – here’s how it was done.

Why Use FullMetalUpdate for your deep learning model update?

FullMetalUpdate is a full open-source solution for delivering OTA updates to your connected, mobile, and smart devices all across your IoT platform. FMU offers users the freedom to manage their OTA updates in house with scalability, transparency, and costs savings, too.

FullMetalUpdate has six key features that separate it from alternative update options. To begin with, it is open-source, offering the reassuring transparency that OSS projects carry. It offers delta updates meaning that only changes to an OS or application are pushed to the device, and is container-based for assured security and versatility. Updates are made in the background meaning users can avoid downtime, and the solution is cloud-agnostic for maximum utility. Finally, Full Metal Update’s rollback functionality means that it will never leave a device unusable – it is unbrickable by design.

 

For IoT devices with Edge AI capacity, this final feature is particularly welcome, but there are other reasons why FullMetalUpdate makes particular sense for Edge AI, too.

Most deep learning models are very large, for example, and updating an entire deep learning model in order to make a very minor change is heavy on resources. With FullMetalUpdate, on the other hand, only the changes to the model are pushed, and this means a lighter, faster update process with potential cost savings for the operator, too.

Deep learning models are also constructed on a number of different frameworks which can then be containerized. By placing each model in a different container and coupling them in a loosely-formulated subsystem, you can reduce volatility and ease your update process, too. Thanks to a tool like FullMetalUpdate,  you can update only differences between two versions of one of your AI models rather than trying to push a change to an entire deep learning model.

An Example of a Deep Learning Model for Edge AI on an STM32MP1

Every IoT device is a combination of hardware and software and, in this case, the hardware is the STM32MP1 microprocessor.

The STM32MP1 is a general-purpose microprocessor that is popular for a variety of IoT projects. Among its advantages are its flexible architecture, its power efficiency, and its support for a variety of operating systems and open-source software. It has a wide variety of connectivity options and the capacity to support data processing on the microprocessor. This capacity to support Edge AI projects and both machine and deep learning software – including increasingly popular Tiny ML projects – makes it an attractive choice for our team and this demonstration.

The deep learning model deployed on the microprocessor, in this case, is a simple image recognition learning model. In this case, the original deep learning model deployed was trained to identify cats. An update to this deep learning model was later introduced to train the algorithm to differentiate between cats and dogs. Now, in a new update to the learning model, the training will extend to another animal: a horse. It is this cat + dog + horse deep learning model update that the Witekio engineers set out to push to the STM32MP1 microprocessor.

Step-by-Step: Updating the Deep Learning Model on STM32MP1 using FullMetalUpdate

FullMetalUpdate is designed to be simple to use and offers an intuitive, user-friendly interface. As demonstrated in the video presentation, updating the STM32MP1 microprocessor is simple and accomplished OTA in just a few minutes, breathing even more life into the potential of Edge AI.

Step Zero: Before Beginning: Ensure that the Microprocessor is Properly Configured

Before launching an update, it is important to ensure that the IoT device is properly configured. A green checkmark next to the microprocessor on hawkbit indicates that all is well, and that the device is ready to receive the update.

Step One: Select the Distribution to Push as an Update

HawkBit’s Deployment Management dashboard lists the various distributions in their different containers that are available to push as an update to the microprocessor. In this case, each container includes a different distribution and version of the update, namely:

  • container-qt-tflite version cats + dogs
  • container-qt-tflite version cats + dogs + horse

It is this third distribution that needs to be pushed to the device that currently has the cats + dogs deep learning model installed.

By selecting the cats + dogs + horse container, dragging it to the STM32MP1 target, and clicking to confirm the update the Full Metal Update process is launched.

Step Two: Tracking the Update in the Terminal

The update begins and, by reviewing the update in a terminal window, a few things become clear:

  1. Small update size. In this case, the update is only 13KB. This keeps the update incredibly light and it means updating the deep learning model with very little data.
  2. Rapid updates and restart. The update, owing to its small size, is rapid and the new deep learning model is ready to go within seconds.

As the video presentation shows, the deep learning model can identify a horse with accuracy just moments after being unable to identify any animal other than a cat or a dog, proof positive that the update is working as required on our STM32MP1.

The update process is seamless, fast, and there is no chance that the microprocessor will brick – it’s another success for FullMetalUpdate.

 

Replay: Witekio’s Video Presentation

The entire video presentation including an explanation of the background to the development of Full MetalUpdate, the benefits of FullMetalUpdate for OS and container rollbacks, and the application of FullMetalUpdate to deep learning and Edge AI inference models are available on below.

https://www.youtube.com/watch?v=-As6og1D7bc

You might also like...
Adding Rollback to FullMetalUpdate

Adding Rollback to FullMetalUpdate

Read more
Cedric Vincent - Chief Technical Officer
29 January 2021