Multi-impulse vs Multi-model vs Sensor Fusion
Audio + Image classification
--float32
as an argument.
Similarly by default the EON compiled model is used, if you want to use full tflite then add the option --full-tflite
and be sure to include a recent version of tensorflow lite compiled for your device architecture in the root of your project in a folder named tensorflow-lite
If you need a mix of quantized and float32, you can look at the dzip.download_model
function call in generate.py and change the code accordingly.
By default, the block will download cached version of builds. You can force new builds using the --force-build
option.
python generate.py --out-directory output --api-keys ei_0b0e...,ei_acde... --quantization-map <0/1>,<0/1>
docker build -t multi-impulse .
Then run:
docker run --rm -it -v $PWD:/home multi-impulse --api-keys ei_0b0e...,ei_acde...
edge-impulse-blocks init
Push the block:
edge-impulse-blocks push
Then go your Organization and Edit the deployment block with:
--api-keys ei_0b0e...,ei_acde...
generate.py
script, it streamline the process of generating a C++ library from multiple impulses through several steps:
tflite-model
directory. This customization ensures that each project’s files are unique.model_variables.h
functions by adding the project-specific suffix to various patterns. This step ensures that model parameters are correctly associated with each project.model_variables.h
is merged into the first project’s directory to consolidate model information.trained_model_ops_define.h
files for different projects, ensuring consistency.templates
directory to the target directory. The template available includes files with code structures and placeholders for customization. It’s adapted from the example-standalone-inferencing example available on Github.model_variables.h
for each project. Impulses are a key part of edge machine learning models.main.cpp
file of each project at specific locations.generate.py
locally:You may need to include the --force-build
option to ensure correctness of the combined library.features[]
array in source/main.cppmake -j
in this directory to compile the project. If you encounter any OOM memory error try make -j4
(replace 4 with the number of cores available)./build/app
to run the applicationmodel_metadata.h
comes from the first API Key of your project. This means some #define
statement might be missing or conflicting.
#define EI_CLASSIFIER_OBJECT_DETECTION 1
and eventually the #define EI_HAS_FOMO 1
. Note that you can overwrite them manually but it requires an extra step.model-parameter/anomaly_metadata.h
file will not be included.#define EI_CLASSIFIER_HAS_ANOMALY
statement expect ONLY one of the following argument:
See the legacy steps
Deployment page of the glass-breaking project
multi-impulse
for example).tflite-model
directory in your extracted archives and rename the following files by post-fixing them with the name of the project:tflite_learn_[block-id]_compiled.cpp
/tflite_learn_[block-id]_compiled.h
.tflite_learn_[block-id].cpp
/tflite_learn_[block-id].h
.trained_model_compiled_audio.h
from:tflite-model/tflite_learn_[block-id]_compiled.h
tflite-model/tflite_learn_[block-id]_compiled.cpp
Visual Studio find and replace
model-parameters/model_variables.h
_model_
need to be replaced.Example for the audio project:merged-impulse
for example). Copy the content of one project into this new directory (audio
for example). Copy the content of the tflite-model
directory from the other project (image
) inside the newly created merged-impulse/tflite-model
.The structure of this new directory should look like the following:image/model_metadata.h
file content to the merged-impulse/model_metadata.h
.To do so, include both of these lines in the #include
section:const char* ei_classifier_inferencing_categories...
to the line before const ei_impulse_t ei_default_impulse = impulse_<ProjectID>_<version>
.Make sure to leave only one const ei_impulse_t ei_default_impulse = impulse_233502_3;
this will define which of your impulse is the default one.EI_TFLITE_DISABLE_...
are a COMBINATION of the ones present in two deployments.For EON-compiled projects:E.g. if #define EI_TFLITE_DISABLE_SOFTMAX_IN_U8 1
is present in one deployment and absent in the other, it should be ABSENT in the combined trained_model_ops_define.h
.For non-EON-Compiled projects:E.g. if resolver.AddFullyConnected();
is present in one deployment and absent in the other, it should be PRESENT in the combined tflite-resolver.h
. Remember to change the length of the resolver array if necessary.In this example, here are the lines to deleted:diff trained\_model\_ops\_define.h