🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

oxyzen_node

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oxyzen_node

oxyzen bindings for Node.js

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

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

  • node-tflite can run TensorFlow Lite models (.tflite) while TensorFlow.js cannot (you'll need a different way of model conversion in TensorFlow.js)
  • node-tflite may or may not be faster than TensorFlow.js
    • I didn't run any benchmarks yet, but the example below runs faster than TF.js
  • node-tflite only supports model inference, not training
  • node-tflite doesn't support Web environments
  • node-tflite doesn't support GPU execution (now) while TensorFlow.js supports through WebGL or tfjs-node-gpu

Supported Platforms

  • macOS
  • Windows
  • Linux

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

  • BlazeFace face detection in Electron
    • Uses the BlazeFace model from MediaPipe
    • It runs in 60 FPS in MacBook Pro 16'' 2019, which is faster than BlazeFace TF.js demo (around 40 FPS in both wasm and WebGL)

Benchmark

TODO

Develop

Setup

npm install

Test

npm test

Build .js and .d.ts

cd node/node-bindings 
yarn 
yarn dist

How to build tensorflowlite_c library

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts