
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
How to get it
- 1
Install with a package manager
You'll need: Node.js · npm
Install from npm
npm i face-api.js - 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
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
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| face-api.js (this) | 18k | Library | intermediate | 2.8 years ago | Web developers adding face detection to a browser page |
| facenet | 14.4k | AI model / agent | advanced | 3.3 years ago | Researchers reproducing the FaceNet paper with TensorFlow |
| face_recognition | 56.9k | Library | intermediate | 4 months ago | Python developers prototyping photo sorting or face matching |
| deepface | 23.6k | Library | intermediate | 6 days ago | Python developers prototyping face verification or face search |
| tambo | 11.2k | Library | intermediate | 5 days ago | React developers who want an AI chat to show charts, forms, or boards instead of only text |
| tiptap | 38.9k | Library | intermediate | 4 days ago | Developers 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.