@trueface/trueface-sdk-javascript v1.5.23427
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-javascriptor
yarn add @trueface/trueface-sdk-javascriptDownload 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.zipMacOS x86
curl -O -L https://storage.googleapis.com/reference.trueface.ai/cpp/dev/latest/uploads/mac/trueface_c_sdk.zipMacOS ARM (M1/M2)
curl -O -L https://storage.googleapis.com/sdk-resources/MacOS_ARM/1.5/libtfsdk.dylibUsage
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 faceModel 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.encDownload body pose estimator model
curl -O -L https://storage.googleapis.com/sdk-models/enc/body_pose_estimator/v1/body_pose_estimator_v1.trueface.encDownload face landmarks v2 model
curl -O -L https://storage.googleapis.com/sdk-models/enc/landmark_detection/face_landmark_detector_v2.trueface.encDownload face recognition lite v2 model
curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/cpu/face_recognition_cpu_lite_v2.trueface.encDownload face recognition tfv5 cpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/cpu/face_recognition_cpu_v5.trueface.encDownload face recognition tfv5 gpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/gpu/face_recognition_gpu_v5.trueface.encDownload face recognition tfv6 cpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/cpu/face_recognition_cpu_v6.trueface.encDownload face recognition tfv6 gpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/face_recognition/gpu/face_recognition_gpu_v6.trueface.encDownload object detector v2 cpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/object_detection/object_detector_cpu_v2.trueface.encDownload object detector v2 gpu model - accurate
curl -O -L https://storage.googleapis.com/sdk-models/enc/object_detection/object_detector_gpu_v2_accurate.trueface.encDownload object detector v2 gpu model - fast
curl -O -L https://storage.googleapis.com/sdk-models/enc/object_detection/object_detector_gpu_v2_fast.trueface.encDownload mask detector v3 cpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/mask/mask_detector_cpu_v3.trueface.encDownload mask detector v3 gpu model
curl -O -L https://storage.googleapis.com/sdk-models/enc/mask/mask_detector_gpu_v3.trueface.encDownload spoof model v4
curl -O -L https://storage.googleapis.com/sdk-models/enc/spoof/v4/spoof_v4.trueface.encThen place the model files in desired location, be sure to set the correct modelsPath in your sdk initialization.
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago