Welcome back to our series on Edge Impulse, one of the major players in the world of embedded machine learning specifically designed to provide developers with the tools they need to integrate machine learning capabilities into edge devices. Among their many functionalities, live classification is an essential feature for real-world testing. The live classification feature allows you to validate your model within the browser with data captured directly from any device or supported development board. Thus, live classification eliminates the need to deploy the model with every iteration of your model. To use live classification, you first need to create an impulse, as we discussed in the previous entries in this series. Recall that an impulse is a collection of data, preprocessing blocks, and learning blocks that can be used to classify new data. Once you have created an impulse, you can connect your device to Edge Impulse and start live classification.
Understanding Live Classification
Live classification in the context of Edge Impulse refers to the near real-time, cloud-based processing and analysis of data directly taken from sensors aboard edge devices. When you are in live classification mode, Edge Impulse will continuously stream data from your device and classify it using your model. You can see the classification results in real-time and adjust the thresholds for the classification to improve the accuracy. It can be used to debug your model and identify any problems. Lastly, validating your model with real-world data makes it more likely to perform well for others once deployed.
To enable live classification, you must use one of the supported development boards, a smartphone, or a desktop computer. If you are using a supported development board, it must be connected to an internet-connected desktop computer via USB. The data will stream from the desktop to Edge Impulse ingestion service using the Edge Impulse Command Line Interface (CLI) or Web Serial (WebUSB). The chief advantage of WebUSB is that it can collect data from any fully supported development board straight from your browser without the need to install additional software onto your computer. The data forwarder of the CLI, on the other hand, can be used on any development board beyond those that are officially supported.
Inside Edge Impulse Studio, the live classification tool offers a few settings the developer can tweak. First, you can specify which device to accept incoming data from. If the board has multiple sensors, you can designate which sensor to perform live classification against. Lastly, you can adjust the sample length (in milliseconds) and sample frequency to improve the model performance (Figure 1). Also, recall that every learning block has a threshold. The threshold can be the minimum confidence that a neural network requires or the maximum anomaly score before a sample is tagged as an anomaly. You can configure these thresholds to tweak the sensitivity of these learning blocks. This affects both live classification and model testing.
With the target device connected to the development computer from within Edge Impulse Studio, click the Live classification button. This button is located in the top right corner of the user interface. Once you have clicked on the “Live classification” button, you will need to start streaming data from your device. Your specific method will depend on your device and your development board. Once data is streaming from your device, you will see the classification results in real time (Figure 2). The classification results will be displayed in a table, and they will also be plotted on a graph. Adjust the thresholds for the classification to improve the accuracy. The thresholds for the classification are the values that determine how confident the model must be to make a classification. You can adjust the thresholds to improve the accuracy of the classification.
Here are some additional tips for performing live classification with Edge Impulse:
- Make sure that your device is connected to a stable internet connection. This will ensure that the data is streamed to Edge Impulse without any problems.
- Use a large enough dataset for training your model. The more data you use, the better the model will classify new data.
- Use a variety of data for training your model. This will help the model to generalize better with new data.
- Tune the hyperparameters of your model. The hyperparameters are the settings that control the behavior of the model. Tuning the hyperparameters can improve the accuracy of the model.
Edge Impulse live classification is a powerful tool that can be used to validate and improve the performance of machine learning models for embedded devices. By streaming data from the device in real-time, Edge Impulse allows developers to see how the model is performing and adjust as needed to ensure that the model is ready for deployment and that it will perform well in the real world. In the next entry, we will look at how Edge Impulse supports modern development operations (DevOps) procedures, including version control and secure deployment of trained models from the cloud to edge devices.