[go: nahoru, domu]

ai-face-detection
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

Face detection

This is simple face detection using face-api.js and tensorflow.js

Getting Started

npm install

Usage

import { detectFaces } from 'ai-face-detection'

// using remote image
const imageFromUrl = 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Elon_Musk_Royal_Society.jpg/640px-Elon_Musk_Royal_Society.jpg'

// using local image
const imageFromFile = './face/face1.jpeg'

faceDetect(imageFromUrl)
  .then((result) => {
        console.log(
        `Face detected gender: ${result?.gender} with probability ${result?.genderProbability}`
        )
        console.log(`Face detected age: ${result?.age}`)
        console.log(`Face detected expressions:`)
        console.log(result?.expressions.asSortedArray())
  })
  .catch((err) => {
    // console.log('err, ', err)
    logger.error('err, ', err)
  })

License

The MIT License (MIT). Please see License File for more information.

Package Sidebar

Install

npm i ai-face-detection

Weekly Downloads

36

Version

1.0.10

License

SEE LICENSE IN LICENSE

Unpacked Size

15.6 MB

Total Files

31

Last publish

Collaborators

  • alexsanteeno