seanchas116 / node-tflite

TensorFlow Lite bindings for Node.js
https://www.npmjs.com/package/node-tflite
MIT License
14 stars 6 forks source link
deep-learning electron javascript machine-learning nodejs tensorflow tensorflow-lite typescript

node-tflite

node-tflite is an unofficial TensorFlow Lite 2.2 bindings for Node.js.

It can run TensorFlow Lite models (.tflite) in Node.js environment (including Electron).

Differences to TensorFlow.js

Supported Platforms

Install

npm install node-tflite

Use

import { Interpreter } from "node-tflite";

const modelData = fs.readFileSync("/path/to/model.tflite");
const interpreter = new Interpreter(modelData);

interpreter.allocateTensors();

interpreter.inputs[0].copyFrom(inputData);

interpreter.invoke();

interpreter.outputs[0].copyTo(outputData);

Examples

Benchmark

TODO

Develop

Setup

npm install

Test

npm test

Build .js and .d.ts

npm run dist

How to build tensorflowlite_c library