Skip to content

Edge Impulse Machine Learning

Get started with embedded machine learning on Raspberry Pi using Edge Impulse for object detection and audio classification.

  • Raspberry Pi
  • Advanced
  • 90 minutes
  • 6 steps

Shop this project

Cart

You'll need

Prices from vilros.com. Tax and shipping at checkout.

Before you start, you'll need

  • Raspberry Pi 4 (4GB or 8GB recommended)
  • USB webcam or Pi Camera
  • USB microphone (optional for audio)
  • Internet connection
  • Edge Impulse account (free)

Install Edge Impulse CLI

About 15 minutes

Set up Edge Impulse tools on Pi.

  1. Update system: sudo apt update && sudo apt upgrade
  2. Install Node.js: curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
  3. Install dependencies: sudo apt install nodejs gcc g++ make build-essential
  4. Install Edge Impulse CLI: sudo npm install -g edge-impulse-linux
  5. Create free account at edgeimpulse.com.

You should see

Edge Impulse CLI is installed.

Connect Pi to Edge Impulse

About 10 minutes

Link your Pi to Edge Impulse project.

  1. Run: edge-impulse-linux
  2. Log in with your Edge Impulse credentials.
  3. Create new project or select existing one.
  4. Pi is now connected and ready to collect data.

You should see

Pi shows as connected device in Edge Impulse dashboard.

Collect training data

About 25 minutes

Capture images or audio for your model.

  1. Connect USB webcam to Pi.
  2. In Edge Impulse dashboard, go to Data Acquisition.
  3. Use Pi to capture images of objects you want to detect.
  4. Capture at least 50-100 images per object class.
  5. Label each image with the correct class.
  6. For audio: use USB microphone to record sound samples.

You should see

Training data is collected and labeled.

Design and train model

About 25 minutes

Build a machine learning model.

  1. In Edge Impulse, go to Create Impulse.
  2. For object detection: add Image processing block and Object Detection learning block.
  3. For audio: add Audio processing block and Classification learning block.
  4. Generate features from your data.
  5. Train the neural network (takes 5-10 minutes).
  6. Review accuracy metrics.

You should see

Model is trained with good accuracy (>85%).

Deploy to Raspberry Pi

About 10 minutes

Download and run trained model.

  1. In Edge Impulse dashboard, go to Deployment.
  2. Select 'Linux (ARMv7)' as target.
  3. Download the model package.
  4. Extract on Raspberry Pi.
  5. Run: edge-impulse-linux-runner
  6. Model now runs inference on Pi!

You should see

Model runs on Pi and detects objects/sounds in real-time.

Test your ML model

About 5 minutes

Verify detection works.

  1. Point camera at trained objects.
  2. Watch terminal for detection results and confidence scores.
  3. For audio: make sounds the model was trained on.
  4. Adjust camera angle or lighting for better results.

You should see

Model accurately detects trained objects or sounds.

It didn't work
  • Low accuracy.

    Collect more diverse training data. Include different angles, lighting conditions, and backgrounds. Retrain the model.

What to do next

Stuck? Contact Vilros Support with your board model and what you see on screen.