1.1.0 • Published 1 year ago

extract-faces v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

extract-faces

NPM version build status Test coverage npm download

Very simple library to extract faces from images using face-api.js

Extracts location (coordinates) of faces on images.

Installation

npm i extract-faces

Example (Browser or Node)

//import * as tf from "@tensorflow/tfjs-node" //to run faster in NodeJS, no call needed
import { extractFaces, loadNN } from 'extract-faces';

async function run(){
  await loadNN("./path/") //the NN is in the "/models" folder
  const detections = await extractFaces('./testThreeFaces.jpg');
  console.log(detections); //sample output below
};

run()

Result example

Inputting .jpg image with three faces

[
  {
    box: {
      x: 70.56989809634749,
      y: 33.42865779995918,
      width: 113.40223568555547,
      height: 119.53723356127739,
    },
    score: 0.9686242341995239,
  },
  {
    box: {
      x: 68.11937841152515,
      y: 86.75163015723228,
      width: 30.880290280339302,
      height: 37.48519569635391,
    },
    score: 0.7888553142547607,
  },
  {
    box: {
      x: 1.5452960509358962,
      y: 104.92549985647202,
      width: 57.86328758172625,
      height: 71.66649997234344,
    },
    score: 0.6099629402160645,
  },
];

License

MIT

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago