BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JavaScript Face Detection with face-api.js

JavaScript Face Detection with face-api.js

This item in japanese

Lire ce contenu en français

Bookmarks

The face-api.js JavaScript module implements convolutional neural networks to solve for face detection and recognition of faces and face landmarks. The face-api.js leverages TensorFlow.js and is optimized for the desktop and mobile web.

As explained by face-api.js creator Vincent Mühler, face recognition with deep learning is a detailed process:

To keep it simple, what we actually want to achieve, is to identify a person given an image of his / her face, e.g. the input image. The way we do that, is to provide one (or more) image(s) for each person we want to recognize, labeled with the persons name, e.g. the reference data. Now we compare the input image to the reference data and find the most similar reference image. If both images are similar enough we output the person’s name, otherwise we output ‘unknown’. Sounds like a plan! However, two problems remain. Firstly, what if we have an image showing multiple persons and we want to recognize all of them? And secondly, we need to be able to obtain such kind of a similarity metric for two face images in order to compare them…

There are several models available with face-api.js, including face detection, face landmark detection, face recognition, facial expression recognition, age estimation, and gender recognition.

Face Detection of face-api.js creator

To get started with face-api.js, developers can include the latest JavaScript resource of face-api.js or install it via npm:

npm i face-api.js

Developers load the various neural network instances via faceapis.nets, and asynchronously load a model, a named tensor map, or uncompressed models as weights in a Float32Array.

Recent releases to face-api.js have maintained consistency with the latest versions of TensorFlow.js, and also refine and deprecate APIs as the project moves closer to a 1.0 release.

Full face-api.js API documentation is available, as well as numerous examples.

The face-api.js project is open source software available under the MIT license. Contributions are welcome via the face-api.js GitHub repository.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT