1.0.1 • Published 6 years ago

customvision-tfjs v1.0.1

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

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
]