edge-impulse-blocks
afterwards to verify that the CLI was installed correctly.ACC.csv
, HR.csv
, EDA.csv
, etc., which contain sensor data.Dockerfile
We’re building a Python based transformation block. The Dockerfile describes our base image (Python 3.7.5), our dependencies (in requirements.txt
) and which script to run (transform.py
).
WORKDIR
under /home
! The /home
path will be mounted in by Edge Impulse, making your files inaccessible.
ENTRYPOINT
to specify the application to execute, rather than RUN
or CMD
.requirements.txt
This file describes the dependencies for the block. We’ll be using pandas
and pyarrow
to parse the Parquet file, and numpy
to do some calculations.
transform.py
This file includes the actual application. Transformation blocks are invoked with three parameters (as command line arguments):
--in-file
or --in-directory
- A file (if the block operates on a file), or a directory (if the block operates on a data item) from the organizational dataset. In this case the unified_data.parquet
file.--out-directory
- Directory to write files to.--hmac-key
- You can use this HMAC key to sign the output files. This is not used in this tutorial.--metadata
- Key/value pairs containing the metadata for the data item, plus additional metadata about the data item in the dataItemInfo
key. E.g.:{ "subject": "AAA001", "ei_check": "1", "dataItemInfo": { "id": 101, "dataset": "Human Activity 2022", "bucketName": "edge-impulse-tutorial", "bucketPath": "janjongboom/human_activity/AAA001/", "created": "2022-03-07T09:20:59.772Z", "totalFileCount": 14, "totalFileSize": 6347421 } }
unified_data.parquet
is in the same directory):
out/
directory containing the RMS of the X, Y and Z axes. If you inspect the content of the file (e.g. using parquet-tools) you’ll see the output:
If you don’t have parquet-tools
installed, you can install it via:
The transformation block in Edge Impulse
edge-impulse-blocks push
and the block will be updated.
unified_data.parquet
file, by going to Data > Add data… > Add data item, setting name as ‘Gestures’, dataset to ‘Transform tutorial’, and selecting the Parquet file.
This makes the unified_data.parquet
file available from the Data page.
dataset = 'Transform tutorial'
.
Selecting the transform tutorial dataset
Configuring the transformation job
Dataset transformation running
ei-metadata.json
file in the output directory. The metadata is then applied to the new data item automatically when the transform job finishes. The ei-metadata.json
file has the following structure:
action
is set to add
the metadata keys are added to the data item. If action
is set to replace
all existing metadata keys are removed.EI_API_KEY
- an API key with ‘member’ privileges for the organization.EI_ORGANIZATION_ID
- the organization ID that the block runs in.EI_API_ENDPOINT
- the API endpoint (default: https://studio.edgeimpulse.com/v1).Running a transformation block with custom parameters