Skip to content

face-api.js

JavaScript library that detects faces and recognizes facial features in browsers and Node.js.

Stars
18k
Forks
3.9k
Licence
MIT
Language
TypeScript
Last update
2.8 years ago
Type
Library

No commits in over a year — check for forks or alternatives before adopting.

What it is

face-api.js is a JavaScript library for finding faces in images and video and reading facial features from them, such as landmarks, expressions, and estimated age and gender. It runs on top of tensorflow.js, so it can work in a web browser or in Node.js. Developers use it to add face-related features to web pages or server-side scripts without writing their own machine learning code.

  • Detect all faces in a photo or video frame using faceapi.detectAllFaces
  • Compute 68 facial landmark points for each detected face
  • Recognize facial expressions and estimate age and gender with the included models
  • Draw detection results on a canvas overlay in a web page

Great for

  • Web developers adding face detection to a browser page
  • Developers building webcam demos that track faces or expressions
  • Node.js developers who want server-side face detection with tensorflow.js
  • Learners exploring face recognition in JavaScript

Not ideal for

  • Projects needing the latest research models, since the README does not describe model updates and the last push shown is from January 2024
  • Teams that need a fully supported commercial product with guaranteed accuracy, since the README makes no such claims
  • Anyone who needs face identification at large scale, where a dedicated server-side system would be more appropriate
Step-by-step guide: how to use face-api.jsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js · npm

    Install from npm

    npm i face-api.js
  2. 2

    Run it

    • Install the package with npm i face-api.js
    • Copy the model manifest.json and shard files into your public or assets folder
    • Load a model with await faceapi.nets.ssdMobilenetv1.loadFromUri('/models')
    • Call await faceapi.detectAllFaces(input) on an img, video, or canvas element
  3. 3

    Get the most out of it

    • Try the live demos linked in the README to see each model before integrating
    • Pick a detector with options such as new faceapi.TinyFaceDetectorOptions() for a lighter model
    • Add @tensorflow/tfjs-node in Node.js for much faster processing, as the README recommends
    • Run the included browser and Node.js examples in the examples folder to learn the API

Downloads

Strengths

  • Runs directly in the browser, so images can stay on the user's device
  • Covers several tasks in one API: detection, landmarks, recognition, expressions, age and gender
  • MIT licensed with a large community and many tutorials listed in the README

Trade-offs

  • Model files must be downloaded and served alongside the app, which adds load size
  • The README notes that installing the optional native tfjs-node binding is recommended for speed in Node.js, which adds setup complexity
  • The README is truncated and does not fully describe accuracy or limitations of each model

How it compares

ProjectStarsTypeLevelUpdatedBest for
face-api.js (this)18kLibraryintermediate2.8 years agoWeb developers adding face detection to a browser page
facenet14.4kAI model / agentadvanced3.3 years agoResearchers reproducing the FaceNet paper with TensorFlow
face_recognition56.9kLibraryintermediate4 months agoPython developers prototyping photo sorting or face matching
deepface23.6kLibraryintermediate5 days agoPython developers prototyping face verification or face search
tambo11.2kLibraryintermediate5 days agoReact developers who want an AI chat to show charts, forms, or boards instead of only text
tiptap38.9kLibraryintermediate4 days agoDevelopers building a custom text editor into a web product

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.