Controlling actuators and sensor's in raspberry pi 4 , based on the outcome of classification using Edge Impulse

Hi ,
I am currently running an edge impulse model for audio classification in edge impulse in raspberry pi 4 .
I want to use this classification data to run some actuators based on the classification results , could you please point me on what to do for that. (I have been able to do this successfully using arduino nano 33 ble , but I am stuck on how to proceed this with the raspberry pi 4 environment )
I am new to raspberry pi environment

Hi @vinaycs ,

For the Raspberry Pi, you can use the Edge Impulse for Linux high level language SDKs that are available for:

Python
Node.js
Go
C++

For example using the python SDK and the audio classify.py example script, you might need to switch ON/OFF the actuators using GPIO here:


            for res, audio in runner.classifier(device_id=selected_device_id):
                print('Result (%d ms.) ' % (res['timing']['dsp'] + res['timing']['classification']), end='')
                for label in labels:
                    score = res['result']['classification'][label]
                    print('%s: %.2f\t' % (label, score), end='')
                print('', flush=True)

 

To prepare your Raspberry Pi 4 for audio classification with Edge Impulse, you can follow this tutorial in our docs: Raspberry Pi 4 - Edge Impulse Documentation.

Let me know if this helps.

Regards,
Clinton

@oduor_c
I am getting the following error when i am using the classify.py example script


This happens due to the following line
from edge_impulse_linux.runner import ImpulseRunner
(line 5 in the script)

Hi @vinaycs ,

Just to confirm you have installed the Python SDK on your Raspberry Pi using these instructions: Linux Python SDK - Edge Impulse Documentation?

Clinton

@oduor_c
Yeah , I have installed everything correctly
I have managed to fix this issue by updating numpy version from 1.19 to 1.20 ,
From what I read numpy 1.19 works well with python 3.7 but will cause issue with python version 3.9 which I had ,
So upgrading the numpy solved the issue for me

2 Likes

Hi @vinaycs ,

happy to hear that you found a way around it!

Clinton

1 Like