npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cutos/ai-face-detect

v3.4.0

Published

@cutos/ai-face-detect is a JavaScript library that provides face recognition, face matching, face comparison and other functions

Readme

AI Face Detect API

CUTOS Face Recognition Service Features:

  • Supports face register, search, unregister, and comparison.
Installation

npm install @cutos/ai-face-detect

Import Dependencies
import {Face} from '@cutos/ai-face-detect'

Model File Resource Path Configuration

1. Automatic Installation (Recommended)

When running npm install, the installation script will automatically download the model files and copy them into the project directory:

public/cutos-ai-face-models/

No additional action is required from developers. Once installation is complete, the project can be used directly.

2. Manual Installation

If automatic installation fails or manual setup is preferred, follow the steps below:

(1) Locate the downloaded model files in the dependency package directory:

/node_modules/@cutos/ai-face-detect/cutos-ai-face-models/

(2) Copy this entire directory into the project path public/cutos-ai-face-models/. The final directory structure should look like this:

public/
├── cutos-ai-face-models/   # Model file directory
│   ├── blaze_face_short_range.tflite
│   ├── vision_wasm_internal.js
│   └── vision_wasm_internal.wasm
├── config.json
├── index.html
└── thumbnail.png

Face

Constructor, creates a face recognition service instance

const faceInstance = new Face();

Face.init

Initialize the face recognition gateway service

faceInstance.init(gwClient);
  • gwClient: Object, instance of the face recognition gateway service.

Face.detectSingleFace

Detect a single face in the camera stream

faceInstance.detectSingleFace(videoElement);
  • videoElement: <video> Element
Example:
//index.html
<video class="cam-video" autoplay muted playsinline id="cam"></video>
...
//main.js
const $cam = document.querySelector('#cam')
const result = faceInstance.detectSingleFace($cam);
console.log(result)
  • Example return result:
{
  "face": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAA",
  "fullFrame": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAA",
  "score": 0.9609517455101013
}
  • result.face: The detected face image.
  • result.fullFrame: The original camera frame (Blob in base64).
  • result.score: Confidence score (0--1), recommended above 0.9 to consider detection successful.

Face.register

Register a face image

faceInstance.register(fullFrame)
  • fullFrame:Base64 formatted image
Example:
const id = faceInstance.register('data:image/jpeg;base64,/9jtUgA.../Z);')
console.log(id)
  • Example return result:
"f956ac67-0dd8-4dc4-ae5b-55f37d99bc6b" //Returns ID after successful registration

Face.search

Search for a registered face

faceInstance.search(fullFrame)
  • fullFrame:Base64 formatted image
Example:
const result = faceInstance.search('data:image/jpeg;base64,/9jtUgA.../Z);');
console.log(result)
  • Example return result:
{
  "id": "f956ac67-0dd8-4dc4-ae5b-55f37d99bc6b",
  "payload": {},
  "score": 0.9953916239059821
}
  • result.id: Matched ID.
  • result.score: Matching score.

Face.unregister

Unregister a face ID

faceInstance.unregister(id);
Example:
const id = faceInstance.unregister("f956ac67-0dd8-4dc4-ae5b-55f37d99bc6b");
console.log(id)
  • Example return result:
"f956ac67-0dd8-4dc4-ae5b-55f37d99bc6b" //Returns ID after successful unregistration

Face.compare

Compare two faces

faceInstance.compare(image1, image2);
  • image1: Base64 formatted image of face 1.
  • image2: Base64 formatted image of face 2.
Example:
const score = faceInstance.compare('data:image/jpeg;base64,/9j/4...', 'data:image/jpeg;base64,/9j/4...');
console.log(score)
  • Example return result:
0.9973043918609619 //Recommended above 0.9 to consider a successful match