2.2.0 • Published 6 months ago

tfjs-image-node v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

tfjs-image-node

Known Vulnerabilities npm version CI

A simple image classifier using tfjs, that can run in Node.js

Install

npm i tfjs-image-node
# or
pnpm add tfjs-image-node

Import

tfjs-image-node has two different exports. One for the tfjs-node platform and one for the regular tfjs package - one package is preferred for operations in the node runtime, the other is preferred for regular javascript.

const classifyImage = require("tfjs-image-node");
// or
import classifyImage from "tfjs-image-node";

Example

import classifyImage from "tfjs-image-node/node";

const model = "https://teachablemachine.withgoogle.com/models/jAIOHvmge";
const image = "https://www.stgeorges.nhs.uk/wp-content/uploads/2014/03/hand-2.jpeg";

// With tfjs-node as the platform
(async () => {
	const prediction = await classifyImage(model, image);
	console.log(prediction[0]);
})();

// With classic tfjs as the platform
(async () => {
	const prediction = await classifyImage(model, image, "classic");
	console.log(prediction[0]);
})();

// expected output:
// { label: 'Hand', probability: 0.9999574422836304 }

Parameters

1.1.1

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.6

6 months ago

1.1.4

6 months ago

1.1.2

6 months ago

2.0.3

6 months ago

2.2.0

6 months ago

2.0.2

6 months ago

2.0.4

6 months ago

2.1.0

6 months ago

2.0.1

6 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.0.1

7 months ago