Custom Keras ML block example for Edge Impulse
This repository is an example on how to bring a custom transfer learning model into Edge Impulse. This repository contains a small fully-connected model built in Keras & TensorFlow. If you want to see a more complex PyTorch example, see edgeimpulse/yolov5.
As a primer, read the Adding custom transfer learning models page in the Edge Impulse docs.
To test this locally:
Create a new Edge Impulse project, and add data from the continuous gestures dataset.
Under Create impulse add a 'Spectral features' processing block, and a random ML block.
Generate features for the DSP block.
Then go to Dashboard and download the 'Spectral features training data' and 'Spectral features training labels' files.
Create a new folder in this repository named
homeand copy the downloaded files in under the names:
Build the container:
$ docker build -t custom-ml .
Run the container to test:
$ docker run --rm -v $PWD/home:/home custom-ml --epochs 1 --learning-rate 0.01 --validation-set-size 0.2 --input-shape "(33)"
This should have created two .tflite files in the 'home' directory.
Now you can initialize the block to Edge Impulse:
$ edge-impulse-blocks init # Answer the questions, select "other" for 'What type of data does this model operate on?'
And push the block:
$ edge-impulse-blocks push
The block is now available under any project that's owned by your organization.