New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

edge-impulse-linux

Package Overview
Dependencies
Maintainers
0
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

edge-impulse-linux

Node.js SDK and tools for Edge Impulse for Linux

  • 1.14.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
146
increased by23.73%
Maintainers
0
Weekly downloads
 
Created
Source

Edge Impulse Linux SDK for Node.js

This library lets you run machine learning models and collect sensor data on Linux machines using Node.js. This SDK is part of Edge Impulse where we enable developers to create the next generation of intelligent device solutions with embedded machine learning. Start here to learn more and train your first model.

Installation guide

Add the library to your application via:

$ npm install edge-impulse-linux

Collecting data

Before you can classify data you'll first need to collect it. If you want to collect data from the camera or microphone on your system you can use the Edge Impulse CLI, and if you want to collect data from different sensors (like accelerometers or proprietary control systems) you can do so in a few lines of code.

Collecting data from the camera or microphone

  1. Install the Edge Impulse CLI for Linux:

    $ npm install edge-impulse-linux -g --unsafe-perm
    
  2. Start the CLI and follow the instructions:

    $ edge-impulse-linux
    
  3. That's it. Your device is now connected to Edge Impulse and you can capture data from the camera and microphone.

Collecting data from other sensors

To collect data from other sensors you'll need to write some code where you instantiate a DataForwarder object, write data samples, and finally call finalize() which uploads the data to Edge Impulse. Here's an end-to-end example.

CLI Options

You can pass in options to the CLI. Here are the key ones:

  • --disable-camera - disables the camera.
  • --disable-microphone - disable the microphone.
  • --clean - clear credentials, and re-authenticate. Use this to switch projects or devices.
  • --api-key <apikey> - set an API key, useful for automatic authentication with a new project.
  • --greengrass - utilize the AWS IoT Greengrass authentication context and AWS Secrets Manager to authenticate with a new project. See additional Greegrass notes below.
  • --help - see all options.
Greengrass Integration Note

edge-impulse-linux and edge-impulse-linux-runner can be run as a service via a custom AWS IoT Greengrass component(s). When provided with the "--greengrass" option, both services will utilize the AWS IoT Greengrass authentication context (ONLY present when launched as a AWS IoT Greengrass custom component) as well as AWS Secrets Manager to extract the api key to be used to authenticate to a new project. If the authentication context is abscent and/or incorrect, both services will simply ignore the "--greengrass" option that was provided and continue with any of the other provided options normally.

Classifying data

To classify data (whether this is from the camera, the microphone, or a custom sensor) you'll need a model file. This model file contains all signal processing code, classical ML algorithms and neural networks - and typically contains hardware optimizations to run as fast as possible. To grab a model file:

  1. Train your model in Edge Impulse.

  2. Install the Edge Impulse CLI:

    $ npm install edge-impulse-linux -g --unsafe-perm
    
  3. Download the model file via:

    $ edge-impulse-linux-runner --download modelfile.eim
    

    This downloads the file into modelfile.eim. (Want to switch projects? Add --clean)

Then you can start classifying realtime sensor data. We have examples for:

  • Audio - grabs data from the microphone and classifies it in realtime.
  • Audio (moving average filter) - as above, but shows how to use the moving-average filter to smooth your data and reduce false positives.
  • Camera - grabs data from a webcam and classifies it in realtime.
  • Custom data - classifies custom sensor data.

Moving average filter

To smooth your results and reduce false positives there's an implementation of a moving-average filter in this library. To use it:

const { MovingAverageFilter } = require("edge-impulse-linux");

let movingAverageFilter = new MovingAverageFilter(
    4 /* filter size, smooths over X results */,
    model.modelParameters.labels);

// classify item
let res = await runner.classify(features);

// run the filter
let filteredRes = movingAverageFilter.run(res);

Development tips

Auto-reload the runner

If you're working on something in the runner, and want to auto-recompile on changes; start with:

npm run watch-runner -- "--model-file /Users/yourname/Downloads/yourmodel-v36.eim --run-http-server 1338"

FAQs

Package last updated on 26 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc