Custom processing block structure
Method | Path | Description |
---|---|---|
GET | / | Requesting general information about the processing block. |
GET | /parameters | Requesting the parameters.json file for the block. |
POST | /run | Requesting features be generated for a single data sample. |
POST | /batch | Requesting features be generated for multiple data samples. |
Header | Passed | Description |
---|---|---|
x-ei-project-id | Conditional | Provided with GET /run or GET /batch requests. The ID of the project. |
x-ei-sample-id | Conditional | Provided with GET /run request. The ID of the sample to be processed. |
x-ei-sample-ids | Conditional | Provided with GET /batch request. A list of IDs of data samples to be processed. |
POST
methods. GET
methods do not have a request body.
features
property.
The axes
property provides the names of the signals for the data sample. For example, if this was an accelerometer data sample, the axes could be [ 'accX', 'accY', 'accZ' ]
. These names could be mapped to other names in the named_axes
property.
The parameters defined in your parameters.json
file will be passed to your block in the params
property. If your parameter names contain dashes, these are replaced with underscores before being added to the request body. For example, a processing block parameter named custom-processing-param
is passed as custom_processing_param
. Please refer to the parameters.json documentation for further details about creating this file, parameter options available, and examples.
GET /
:
A plain text response with some information about the block. For example, the response could be the block name and author.
GET /parameters
:
The parameters file returned as a JSON object.
features
property is where you return the features that were generated by processing the data sample(s).
The labels
property can be used return the names of the features you generated. For example, if you calculated the average, maximum, and minimum values of the signal, the labels could be [ 'Average', 'Maximum', 'Minimum' ]
. These labels will be used for the feature explorer.
graphs
property of the response body for the POST /run
method. Graphs should be created in your feature generation script conditionally based on the draw_graphs
property in the request body. See the interface for a graphs object in the Outputs section above.
Graphs can be of different types: linear, logarithmic, or an image. The type of graph is controlled by the type
property of a graph object.
Graph | Type value |
---|---|
Linear | linear |
Logarithmic | logarithmic |
Image | image |
visualization
property in your parameters.json
file to dimensionalityReduction
.
edge-impulse-blocks runner
tool. See Block runner for additional details.
The port you publish for your Docker container can be configured in the parameters.json file. The blocks runner will also look for the EXPOSE
instruction in your Dockerfile and publish that port for you if you wish to override the default port.
https://
forwarding address in the response. You can use this URL to add the block to an impulse in a Studio project.
Add custom block
button. In the next modal that pops up, enter your forwarding URL from above and save. The block can now be used in your project and you will be able to view the processing results, including any visualizations you have created.
Adding a custom processing block using an ngrok forwarding URL
model-parameters/model_variables.h
file.
cppType
property in your parameters.json
file.
main.cpp
file of the C++ library. Example implementations for the processing blocks built into Edge Impulse can be found in the C++ inferencing SDK.
example-custom-processing-block-<description>
. As such, they can be found by searching the repositories for example-custom-processing
.
Below are direct links to some examples: