Edge Impulse ML Blocks
Edge Impulse is the leading development platform for machine learning on edge devices.
The models in SSCMA support running on Edge Impulse specific information is available in the sscma-ei-ml-blocks. The following is an example of how to run the SSCMA model on Edge Impulse, using the sscma-fomo
model.
Run the Pipeline
You run this pipeline via Docker. This encapsulates all dependencies and packages for you.
Pipeline on Docker
Clone the sample repository.
shgit clone https://github.com/Seeed-Studio/sscma-ei-ml-blocks && \ cd sscma-ei-ml-blocks/sscma-fomo
Install Docker Desktop.
Install the Edge Impulse CLI
v1.16.0
or higher.Create a new Edge Impulse project, and make sure the labeling method is set to
Bounding Boxes
.Click 'Create New Project' button.
Guess a project name and finish setup.
Add labels and some data.
Under Create Impulse set the image size (e.g.
160x160
,320x320
or640x640
), add anImage
DSP block and anObject Detection
learn block.Open a command prompt or terminal window.
Initialize the block.
shedge-impulse-blocks init # Answer the questions, select 'Object Detection' for 'What type of data does this model operate on?' and "FOMO" for 'What's the last layer...'
Fetch new data via.
shedge-impulse-blocks runner --download-data data/
Build the container.
shdocker build -t sscma-fomo .
Run the container to test the script (you don't need to rebuild the container if you make changes).
shdocker run --shm-size=1024m --rm -v $PWD:/scripts sscma-fomo --data-directory data/ --epochs 30 --learning-rate 0.00001 --out-directory out/
This creates a
.tflite
file in theout
directory.
TIP
If you have extra packages that you want to install within the container, add them to requirements.txt
and rebuild the container.
Fetching the new Data
To get up-to-date data from your project:
Install the Edge Impulse CLI
v1.16
or higher.Open a command prompt or terminal window.
Fetch new data using the command below.
shedge-impulse-blocks runner --download-data data/
Pushing the Block back to Edge Impulse
You can also push this block back to Edge Impulse, that makes it available like any other ML block so you can retrain your model when new data comes in, or deploy the model to device. See Docs > Adding custom learning blocks for more information.
Push the block.
shedge-impulse-blocks push
The block is now available under any of your projects, via Create impulse > Add learning block > Object Detection (Images).
Download block output.