customvision-tfjs

1.0.1 • Public • Published

customvision-tfjs

NPM package for TensorFlow.js models exported from Custom Vision Service

Install

npm install customvision-tfjs

Usage

<img id="image" src="test_image.jpg" />

Classification

import * as cvs from 'customvision-tfjs';
let model = new cvs.ClassificationModel();
await model.loadModelAsync('model.json');
const image = document.getElementById('image');
const result = await model.executeAsync(image);

The result is a 1D-array of probabilities.

Object Detection

import * as cvs from 'customvision-tfjs';
let model = new cvs.ObjectDetectionModel();
await model.loadModelAsync('model.json');
const image = document.getElementById('image');
const result = await model.executeAsync(image);

The result has 3 arrays.

[
	[[0.1, 0.3, 0.4, 0.3], [0.2, 0.4, 0.8, 0.9]], // bounding boxes (x1, y1, x2, y2)
	[0.2, 0.3], // probabilities
	[1, 4] // class ids
]

Readme

Keywords

none

Package Sidebar

Install

npm i customvision-tfjs

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

17.2 kB

Total Files

5

Last publish

Collaborators

  • shono