Skip to content

vladBaciu/ML-PPG-EduKit

Repository files navigation

Neural netoworks on PSoC6 - PPG-EduKit

DeepSource

Stream data to edge impulse

Prerequisite: install Edge Impulse CLI in order to communicate with PPG EduKit.

Any Edge Impulse Device could send data over serial using the data forwarder. The data forwarder collects the data, signs the data and sends the data to the ingestion service. The data forwarder is useful to quickly enable data collection from a wide variety of development boards without having to port the full remote management protocol and serial protocol, but only supports collecting data at relatively low frequencies.

Set the MAIN_APP_TYPE make variable accordingly. Build the streaming application by executing make build in project directory.

image

Output

image

Execute make program and flash the board.

Now the board is streaming the data over serial and data-forwarder can be launched from the command line by executing edge-impulse-data-forwarder. If it is the first time you launch this tool, follow the steps from here.

Note: To skip the compilation stage, in others directory there is a binary image that can be directly flashed using the PSoC Programmer tool.

Output

image image

Now go to your Edge Impulse project, connect the device and start training your ML model.

Output An anomaly detection model was trained to determine if the recorded PPG signal contains any artifacts.

image

On target inference

The anomaly detection model created earlier can be deployed as a C++ library. Edge Impulse does this for you (https://docs.edgeimpulse.com/docs/deployment/running-your-impulse-locally). I downloaded the model in the current directory (model-parameters, edge-impulse-sdk and tflite-model). After some updates in the makefile, the EI library could be compiled and used in the project.

Go to the Makefile and set the MAIN_APP_TYPE variable as 1. Run make build. This will compile the demo application that performs live inference on the measured PPG signal. Run make program and flash the board.

image

Tauno Serial Plotter can be used to visualize the classification results in real-time. The red signal represents the model anomaly class (0 - Anomaly, 1 - Normal).

Untitled video - Made with Clipchamp