parameters.json
file. Block specific structures are shown in their respective documentation.
Custom block structure
ENTRYPOINT
for the image.
WORKDIR
argument to /home
or /data
The /home
and /data
directory paths are used by Edge Impulse. Therefore, if you set the working directory for your container to this path, your files will be overwritten and rendered inaccessible. You will notice in most examples from Edge Impulse, the argument for the WORKDIR
instruction is set to /app
.ENTRYPOINT
instructionIt is important to set the ENTRYPOINT
instruction at the end of your Dockerfile to specify the default executable for the container. This instruction is used to turn a container into a standalone executable and blocks in Edge Impulse have been designed with this in mind.Do not use the RUN
or CMD
instructions to set the default executable. The RUN
instruction is not meant for this purpose (it’s meant for building layers of an image) and the CMD
instruction is not what Edge Impulse expects.ENTRYPOINT
in your Dockerfile will be your custom script. For processing blocks, however, this will be an HTTP server. In this case, you will also need to expose the port for your server using the EXPOSE
instruction.
If you want to leverage GPU compute for your custom learning blocks, you will need to make sure to install the CUDA packages. You can refer to the example-custom-ml-keras repository to see an example Dockerfile that installs these packages.
When running in Edge Impulse, processing and learning block containers do not have network access. Make sure you don’t download dependencies while running these containers, only when building the images.
parameters.json
file is to be included at the root of your custom block directory. This file describes the block itself and identifies the parameter items that will be exposed for configuration in Studio and, in turn, passed to the script you defined in your Dockerfile as the ENTRYPOINT
. See parameters.json for more details.
In most cases, the parameter items defined in your parameters.json
file are passed to your script as command line arguments. For example, a parameter named custom-param-one
with an associated value will be passed to your script as --custom-param-one <value>
.
Processing blocks are handled differently. In the case of processing blocks, parameter items are passed as properties in the body of an HTTP request. In this case, a parameter named custom-param-one
with an associated value will be passed to the function generating features in your script as an argument named custom_param_one
. Notice the dashes have been converted to underscores.
One additional note in regards to how parameter items are passed is that items of the type secret
will be passed as environment variables instead of command line arguments.
Parameter types are enforced and validation is performed automatically when values are being entered in Studio.
edge-impulse-blocks init
command and follow the prompts to initialize your block. This will do two things:
.ei-block-config
file that associates the block with your organizationparameters.json
file (if one does not already exist in your custom block directory)parameters.json
file is created, you will want to take a look at it and make modifications as necessary. The CLI creates a basic file for you and you may want to include additional metadata and parameter items.
edge-impulse-blocks runner
command from within your custom block directory and follow the prompts to test your block locally. See Block runner.
Refer to the documentation for your type of custom block for additional details about testing locally.
edge-impulse-blocks push
command and follow the prompts to push your block to Edge Impulse.
Once pushed successfully, your block will appear in your organization or, if it is a custom learning block and you are not on the Enterprise plan, in your developer profile. See Editing a custom block in Studio for images showing each block type after being pushed to Edge Impulse.
edge-impulse-blocks
commands, say to download data from a different project with the runner
, you can execute any of the respective commands with the --clean
flag.
+ Add new <block-type> block
button (or select an existing block to edit). In the modal that pops up, configure your block as desired and in the Docker container field enter the details for your image in the username/image:tag
format.
Custom AI labeling block pushed to an organization
parameters.json
file; they must be configured when editing the block after it has been pushed to Edge Impulse.