1.5.23427 • Published 1 year ago

@trueface/trueface-sdk-javascript v1.5.23427

Weekly downloads
1
License
Trueface License
Repository
-
Last release
1 year ago

Trueface SDK NodeJS Binding

A few notes

The Node SDK is still in Beta. That being said, there may be a few methods from the main Trueface SDK which are still not available in the Node SDK. Please read this entire document. You will need to download the model files and dependency libraries before you can use the SDK.

NPM submission

In each stable release pipeline, the node binding package is submitted to https://npmjs.org automatically. Therefore, it will have always the latest SDK reference.

Installation

npm install @trueface/trueface-sdk-javascript

or

yarn add @trueface/trueface-sdk-javascript

Download dependency libraries

In order to use the Node SDK, you must download the appropriate dependency library for your operating system. Extract the libraries and then place them in the same directory as the javascript project folder.

Windows x86

curl -O -L https://storage.googleapis.com/reference.trueface.ai/cpp/dev/latest/uploads/windows/trueface_c_sdk.zip 

Linux x86

curl -O -L https://storage.googleapis.com/reference.trueface.ai/cpp/dev/latest/uploads/amd64_ubuntu20/trueface_c_sdk.zip

MacOS x86

curl -O -L https://storage.googleapis.com/reference.trueface.ai/cpp/dev/latest/uploads/mac/trueface_c_sdk.zip

MacOS ARM (M1/M2)

curl -O -L https://storage.googleapis.com/sdk-resources/MacOS_ARM/1.5/libtfsdk.dylib

Usage

const SDK = require("@trueface/trueface-sdk-javascript")

const license = process.env.TRUEFACE_TOKEN;

const sdk = new SDK({
  "frModel": 0, // 0: lite model, 1: tfv5 model
  "modelsPath": "."
}, ".");

sdk.setLicense(license)

if (!sdk.isLicensed()) return false

let image = sdk.preprocessImageFromFile("./image/test.jpeg")
if (image.errorCode !== 0) return false

const face = sdk.detectLargestFace(image)
console.log(face);

if (!face.found) return false
return face

Model download

The following commands can be used to download the desired model files.

Download blink detector model

curl -O -L https://storage.googleapis.com/sdk-models/enc/blink/blink_detector_v1.trueface.enc

Download body pose estimator model

curl -O -L https://storage.googleapis.com/sdk-models/enc/body_pose_estimator/v1/body_pose_estimator_v1.trueface.enc

Download face landmarks v2 model

curl -O -L https://storage.googleapis.com/sdk-models/enc/landmark_detection/face_landmark_detector_v2.trueface.enc

Download face recognition lite v2 model

curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/cpu/face_recognition_cpu_lite_v2.trueface.enc

Download face recognition tfv5 cpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/cpu/face_recognition_cpu_v5.trueface.enc

Download face recognition tfv5 gpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/gpu/face_recognition_gpu_v5.trueface.enc

Download face recognition tfv6 cpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/cpu/face_recognition_cpu_v6.trueface.enc

Download face recognition tfv6 gpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/gpu/face_recognition_gpu_v6.trueface.enc

Download object detector v2 cpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/object_detection/object_detector_cpu_v2.trueface.enc

Download object detector v2 gpu model - accurate

curl -O -L https://storage.googleapis.com/sdk-models/enc/object_detection/object_detector_gpu_v2_accurate.trueface.enc

Download object detector v2 gpu model - fast

curl -O -L https://storage.googleapis.com/sdk-models/enc/object_detection/object_detector_gpu_v2_fast.trueface.enc

Download mask detector v3 cpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/mask/mask_detector_cpu_v3.trueface.enc

Download mask detector v3 gpu model

curl -O -L https://storage.googleapis.com/sdk-models/enc/mask/mask_detector_gpu_v3.trueface.enc

Download spoof model v4

curl -O -L https://storage.googleapis.com/sdk-models/enc/spoof/v4/spoof_v4.trueface.enc

Then place the model files in desired location, be sure to set the correct modelsPath in your sdk initialization.

1.5.23408

1 year ago

1.5.23427

1 year ago

1.5.23334

1 year ago

1.5.23397

1 year ago

1.3.21907

2 years ago

1.3.21919

2 years ago

1.2.20636

2 years ago

1.2.20634

2 years ago

1.2.20709

2 years ago

1.2.20696

2 years ago

1.1.19676

2 years ago

0.33.14571

2 years ago

0.33.13841

2 years ago

0.33.14632

2 years ago

0.33.14543

2 years ago

0.33.14454

2 years ago

0.33.14526

2 years ago

0.32.13391

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago