Doubt about the custom preprocessing block

Hi I have some doubts with the custom preprocessing block.
Is it possible to upload as a custom block some hardware preprocessing or does it need to be all code?
Project ID:

Context/Use case:

Hello @JosuGaztelu,

When you create a custom DSP block, you can give a name to your corresponding cpp implementation in the parameter.json file under cppType.

For example, imagine you want to create an Edge Detection custom DSP block for images, your parameter.json file will look like this:

    "version": 1,
    "info": {
        "title": "Edge Detection",
        "author": "Louis Moreau",
        "description": "Edge Detection for images",
        "name": "Edge Detection",
        "cppType": "canny_filters_edge_detection",
        "preferConvolution": false,
        "visualization": "dimensionalityReduction",
        "experimental": false,
        "latestImplementationVersion": 1
    "parameters": [
            "group": "Edge Detection",
            "items": [
                    "name": "High threshold",
                    "value": 100,
                    "help": "High threshold value of intensity gradient",
                    "type": "int",
                    "param": "high_threshold"
                    "name": "Low threshold",
                    "value": 200,
                    "help": "Low threshold value of intensity gradient",
                    "type": "int",
                    "param": "low_threshold"
                    "name": "Gaussian blur",
                    "value": 3,
                    "help": "Amount of blur",
                    "type": "int",
                    "param": "gaussian_blur"

Then in the C++ library that you download from the studio, you will find a file model-parameters/dsp_blocks.h that will contain:


#include "model-parameters/model_metadata.h"
#include "model-parameters/model_variables.h"
#include "edge-impulse-sdk/classifier/ei_run_dsp.h"
#include "edge-impulse-sdk/classifier/ei_model_types.h"

int extract_canny_filters_edge_detection_features(signal_t *signal, matrix_t *output_matrix, void *config_ptr, const float frequency);

const size_t ei_dsp_blocks_size = 1;
ei_model_dsp_t ei_dsp_blocks[ei_dsp_blocks_size] = {
    { // DSP block 14


And in edge-impulse-sdk/classifier/ei_run_dsp.h you can write your own implementation of your custom dsp function that will be called extract_canny_filters_edge_detection_features.

Let me know if you need more information.



Hi @louis ,
I think I get what you mean but still not clear about the relation between a preprocessing block and a real hardware processing while training/testing in Edge Impulse, I get that I can upload my parameters in a .json file. But if I have an already configured Digital Signal Processor and I must use it in my application, how can I make it know to the project? How can I upload the information of what preprocessing is running on my hardware board? Or must it use my specific hardware to train/test?


We just published that video that was recorded some time ago by @janjongboom: Advanced Anomaly Detection with Edge Impulse (Custom DSP Blocks, Feature Importance) - YouTube

If you look at around minute 25, Jan explains how to implement your custom DSP block in with your C++ library that you can download from the studio.



1 Like

And this is the associated Github repository:

1 Like