{"id":21191673,"url":"https://github.com/edgeimpulse/edge-impulse-linux-cli","last_synced_at":"2025-10-25T17:43:10.557Z","repository":{"id":45373223,"uuid":"352964805","full_name":"edgeimpulse/edge-impulse-linux-cli","owner":"edgeimpulse","description":"Data acquisition and impulse runner CLI tools for Edge Impulse for Linux","archived":false,"fork":false,"pushed_at":"2024-09-18T08:10:35.000Z","size":39760,"stargazers_count":9,"open_issues_count":1,"forks_count":7,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-09-18T10:47:32.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edgeimpulse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-30T10:43:44.000Z","updated_at":"2024-09-18T08:10:39.000Z","dependencies_parsed_at":"2023-01-30T04:30:51.809Z","dependency_job_id":"8a10aa09-416e-4384-a5e6-3c0cab58d691","html_url":"https://github.com/edgeimpulse/edge-impulse-linux-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edgeimpulse%2Fedge-impulse-linux-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edgeimpulse%2Fedge-impulse-linux-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edgeimpulse%2Fedge-impulse-linux-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edgeimpulse%2Fedge-impulse-linux-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edgeimpulse","download_url":"https://codeload.github.com/edgeimpulse/edge-impulse-linux-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225615185,"owners_count":17496944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T19:04:23.837Z","updated_at":"2025-10-25T17:43:10.549Z","avatar_url":"https://github.com/edgeimpulse.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Edge Impulse Linux SDK for Node.js\n\nThis library lets you run machine learning models and collect sensor data on Linux machines using Node.js. This SDK is part of [Edge Impulse](https://www.edgeimpulse.com) 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](https://docs.edgeimpulse.com).\n\n## Installation guide\n\nAdd the library to your application via:\n\n```\n$ npm install edge-impulse-linux\n```\n\n## Collecting data\n\nBefore 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.\n\n### Collecting data from the camera or microphone\n\n1. Install the Edge Impulse CLI for Linux:\n\n    ```\n    $ npm install edge-impulse-linux -g --unsafe-perm\n    ```\n\n1. Start the CLI and follow the instructions:\n\n    ```\n    $ edge-impulse-linux\n    ```\n\n1. That's it. Your device is now connected to Edge Impulse and you can capture data from the camera and microphone.\n\n### Collecting data from other sensors\n\nTo 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](https://github.com/edgeimpulse/edge-impulse-linux-cli/blob/master/examples/collect-custom.ts).\n\n### CLI Options\n\nYou can pass in options to the CLI. Here are the key ones:\n\n* `--disable-camera` - disables the camera.\n* `--disable-microphone` - disable the microphone.\n* `--clean` - clear credentials, and re-authenticate. Use this to switch projects or devices.\n* `--api-key \u003capikey\u003e` - set an API key, useful for automatic authentication with a new project.\n* `--greengrass` - utilize the AWS IoT Greengrass authentication context and AWS Secrets Manager to authenticate with a new project. See additional Greegrass notes below.\n* `--help` - see all options.\n\n#### Greengrass Integration Note\n\nedge-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. \n\n## Classifying data\n\nTo 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:\n\n1. Train your model in Edge Impulse.\n1. Install the Edge Impulse CLI:\n\n    ```\n    $ npm install edge-impulse-linux -g --unsafe-perm\n    ```\n\n1. Download the model file via:\n\n    ```\n    $ edge-impulse-linux-runner --download modelfile.eim\n    ```\n\n    This downloads the file into `modelfile.eim`. (Want to switch projects? Add `--clean`)\n\nThen you can start classifying realtime sensor data. We have examples for:\n\n* [Audio](https://github.com/edgeimpulse/edge-impulse-linux-cli/blob/master/examples/js/classify-audio.js) - grabs data from the microphone and classifies it in realtime.\n* [Audio (moving average filter)](https://github.com/edgeimpulse/edge-impulse-linux-cli/blob/master/examples/js/classify-audio-maf.js) - as above, but shows how to use the moving-average filter to smooth your data and reduce false positives.\n* [Camera](https://github.com/edgeimpulse/edge-impulse-linux-cli/blob/master/examples/js/classify-camera.js) - grabs data from a webcam and classifies it in realtime.\n* [Custom data](https://github.com/edgeimpulse/edge-impulse-linux-cli/blob/master/examples/js/classify-custom.js) - classifies custom sensor data.\n\n### Moving average filter\n\nTo smooth your results and reduce false positives there's an implementation of a moving-average filter in this library. To use it:\n\n```js\nconst { MovingAverageFilter } = require(\"edge-impulse-linux\");\n\nlet movingAverageFilter = new MovingAverageFilter(\n    4 /* filter size, smooths over X results */,\n    model.modelParameters.labels);\n\n// classify item\nlet res = await runner.classify(features);\n\n// run the filter\nlet filteredRes = movingAverageFilter.run(res);\n```\n\n## Development tips\n\n### Auto-reload the runner\n\nIf you're working on something in the runner, and want to auto-recompile on changes; start with:\n\n```\nnpm run watch-runner -- \"--model-file /Users/yourname/Downloads/yourmodel-v36.eim --run-http-server 1338\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedgeimpulse%2Fedge-impulse-linux-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedgeimpulse%2Fedge-impulse-linux-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedgeimpulse%2Fedge-impulse-linux-cli/lists"}