Data aquisition from S3 object store - Golioth on AI
Last updated
Last updated
In this tutorial we will demonstrate how to securely collect and process sensor data from a managed device with the Golioth on AI example project. The managed device is connected via cellular and streams labeled but unstructured data to a mutually accessible Object Storage (S3 Bucket), by collecting labeled sensor data in this method we can also demonstrate a common use for this form of data acquisition, performing automated Data processing or Data Quality steps to the collected data via custom transformation blocks.
We will then apply data processing steps on the collected data using the custom CBOR transformation block to convert this data to a format we can use to later train a model. This same process can be adapted to perform Data Quality techniques that would typically be performed by an ML engineer.
To follow along with this example, ensure that you have the following:
Golioth account with an organization and a connected compatible device (e.g., nrf9160).
Edge Impulse enterprise account.
Trained Edge Impulse project ready for deployment.
AWS account with access to S3.
Basic knowledge of AWS S3, Docker, and Zephyr.
Example from the Golioth on AI tutorial repository here
This tutorial was created for the Golioth on AI launch see the associated video on youtube Read it here.
Before proceeding with the integration, ensure that your Golioth device is set up with the appropriate firmware. For detailed instructions on initializing your Zephyr workspace, building, and flashing the firmware, please refer to the Golioth on AI repository README.
Clone the Golioth on AI repository and initialize the Zephyr workspace with the provided manifest file.
Log in to Golioth and create a new project. This project will handle the routing of sensor data and classification results.
Log in to Edge Impulse Studio and create a new project. This project will receive and process the raw accelerometer data uploaded from the S3 bucket.
Once your device is set up, follow the instructions in the repository README to create the necessary Golioth pipelines. This includes setting up the Classification Results Pipeline and the Accelerometer Data Pipeline. Latest detailed steps can be found in the repository Golioth on AI repository README.
Golioth Pipelines allows you to route data between different services and devices efficiently. You will need to configure two pipelines for this demo:
This pipeline routes classification results (e.g., gesture predictions) to Golioth's LightDB Stream, which stores data in a timeseries format.
You will configure a path for classification results (e.g., /class) and ensure that the data is converted to JSON format.
This pipeline handles raw accelerometer data by forwarding it to an S3 object storage bucket. Ensure the pipeline is set up to transfer binary data.
Important: Configure your AWS credentials by creating secrets in Golioth for AWS_ACCESS_KEY and AWS_SECRET_KEY, and specify the target bucket name and region.
Follow the instructions in the continuous motion recognition tutorial to generate a gesture recognition model.
Download the generated library from Edge Impulse Studio and extract the contents.
Build the firmware:
Set Golioth Credentials::
Add the same configuration to the Golioth secret store
Navigate to your Golioth Secret Store: https://console.golioth.io/org//project//secrets
Add your AWS credentials (Access Key ID and Secret Access Key) and the S3 bucket details to the Golioth secret store.
Press the button on the Nordic Thingy91 to start sampling data from the device's accelerometer.
Raw accelerometer data will be automatically routed to your S3 bucket via the Golioth pipeline. You can later import this data into Edge Impulse Studio for further model training.
Classification results will be stored in Golioth's LightDB Stream. You can access this data for further analysis or visualization.
In Edge Impulse Studio, use the Data acquisition page to import your raw accelerometer data directly from the S3 bucket
Once imported, label your data appropriately to prepare it for model training.
Below is an example of classification data you can expect to see in the Golioth console:
Raw accelerometer data uploaded to S3 can be imported as an array of X-Y-Z float values, which will appear in the Edge Impulse Studio as time-series data.
From here we can perform a number of data processing steps on the collected data:
Use the custom CBOR transformation block to convert raw accelerometer data to a format suitable for training a model in Edge Impulse.
Apply custom transformation blocks to perform data quality checks or preprocessing steps on the collected data.
Import the transformed data into Edge Impulse Studio and train a new model using the collected accelerometer data.
Deploy the trained model back to the Golioth device for real-time gesture recognition.
In this tutorial, we demonstrated how to securely collect and process sensor data from a managed device using Golioth and Edge Impulse. By leveraging Golioth's data routing capabilities and Edge Impulse's machine learning tools, you can easily build and deploy custom models for gesture recognition or other applications. This example showcases the end-to-end workflow from data acquisition to model training and deployment, highlighting the seamless integration between Golioth and Edge Impulse.
For more information on Golioth and Edge Impulse, visit the official documentation and tutorials: