npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

edgeai

v1.0.38

Published

Library for EdgeAI from cnr.ai

Downloads

44

Readme

edgeai - Library for EdgeAI

edgeai is a library for interfacing EdgeAI. It uses the HTTP REST interface and provides a set of simple promised-based function calls to manage and operate the AI device. You must have access to the device before you can use this device.

Get Started

The library uses Promise interface. To get started, the edgeai context must be initialized.

const edgeai = require('edgeai');

edgeai.init({ hostname: 'localhost' })
  .then(context => console.log(context));

Topics

Upload File

You can use uploadFile to upload an existing file in the directory. The response is a boolean where true means success. The destination directory is the root directory in the device. For simplicity, this API does not support upload to other directories.

const edgeai = require('edgeai');

edgeai.init({ hostname: 'localhost' })
  .then(context => edgeai.uploadFile(context, 'apple.jpg'))
  .then(response => console.log(response));

Activate Model

You can activate a mlmodel using load. Before activating the model, the model file should have been uploaded to the device. To activate, the model name, filenames and type should be specified in the API as follows. The response is a boolean where true means success.

const edgeai = require('edgeai');

edgeai.init({ hostname: 'localhost' })
  .then(context => edgeai.uploadFile(context, 'fruit.mlmodel')
    .then(() => edgeai.load(
      context,
      {
        model: 'fruit',
        filenames: {
          model: 'fruit.mlmodel',
        },
        type: 'classifier',
      }
    ))
    .then(response => console.log(response)));

Predict Image

Once the image is uploaded and the model is activated, you can simply predict the image by using predict. The API takes 2 parameters namely the image filename and the model name.

const edgeai = require('edgeai');

edgeai.init({ hostname: 'localhost' })
  .then(context => edgeai.predict(context, 'apple.jpg', 'fruit')
    .then(response => console.log(response)));

The response contains an array output which lists the recognizied objects. In this case, only one apple is recognized. The coordinate x and y is the center point of the object. The left value means the number of pixels from the left edge of the image to the left side of the bounding box. The top value means the number of pixels from the top edge of the image to the top side of the bounding box.

{
  "success": true,
  "output": [
    {
      "confidence": 1,
      "left": 0,
      "x": 230,
      "object": "apple",
      "top": 0,
      "width": 460,
      "height": 460,
      "y": 230
    }
  ]
}

Acquire Demo Device

Please send an email [email protected] to request for a demo device. The request will be evaluated based on business criteria.

All HTTP APIs

Please refer to here.