New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

bakuparjo

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bakuparjo

Simple face comparison library with auto model download

latest
npmnpm
Version
1.2.1
Version published
Maintainers
0
Created
Source

Bakuparjo

A JavaScript face comparison library that automatically handles model loading and provides easy-to-use face similarity detection.

Features

  • Compare faces between images with percentage similarity scores
  • Automatic download and caching of face recognition models
  • Works in both Node.js and browser environments
  • Simple API for face detection and comparison

Installation

npm install bakuparjo

Usage

Basic usage

import FaceComparison from 'bakuparjo';

async function checkAttendance() {

const faceComparer = new FaceComparison();

const collectionImages = [
    "/media/person1.jpg",
    "/media/person2.jpg",
    "/media/person3.jpg"
];

const loginImage = "/facelogin/new-capture.jpg";

try {

    const results = await faceComparer.compareFaces(loginImage, collectionImages);

    console.log('Similarity results:');
    results.forEach(result => {
        console.log(${result.imagePath}: ${result.similarity}% similar);
    });

    const mostSimilar = results.reduce((prev, current) =>
        (parseFloat(prev.similarity) > parseFloat(current.similarity)) ? prev : current
    );

    console.log(Most similar image: ${mostSimilar.imagePath} with ${mostSimilar.similarity}% similarity);
    } catch (error) {
        console.error('Error comparing faces:', error);
    }
}

Advanced usage


const faceComparer = new FaceComparison({
    threshold: 0.5, // Adjust similarity threshold (lower = stricter)
    modelPath: './my-models' // Custom model path
});

API Reference

new FaceComparison(options)

Creates a new face comparison instance.

Options:

  • threshold (number): Similarity threshold (default: 0.6)
  • modelPath (string): Path to store/load models (default: './models' in Node.js, '/models' in browser)

async loadModels()

Loads the required face recognition models. Called automatically when needed.

async compareFaces(referenceImagePath, collectionImagePaths)

Compares a reference face with a collection of faces.

Parameters:

  • referenceImagePath (string): Path to the reference image
  • collectionImagePaths (array): Array of paths to compare against

Returns: Array of objects with:

  • imagePath (string): Path to the compared image
  • similarity (string): Percentage similarity (0-100%)
  • error (string, optional): Error message if processing failed

Browser Usage

For browser environments, make sure the models are available in your web root:

<!-- Models should be available at /models/ -->
<script type="module">
import FaceComparison from 'bakuparjo';
const faceComparer = new FaceComparison();
// ...
</script>

License

MIT

Keywords

face

FAQs

Package last updated on 14 Mar 2025

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