justadudewhohacks /face-api.js
JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
★ 17,994⑂ 3,872👁 349⑃ 115● 847▤ 38
+0
Daily
17,994
stars
3,872
forks
349
watchers
115
prs
847
issues
38
releases
README
face-api.js JavaScript face recognition API for the browser and nodejs implemented on top of tensorflow.js core (tensorflow/tfjs-core) !faceapi Click me for Live Demos! Tutorials face-api.js — JavaScript API for Face Recognition in the Browser with tensorflow.js Realtime JavaScript Face Tracking and Face Recognition using face-api.js’ MTCNN Face Detector Realtime Webcam Face Detection And Emotion Recognition - Video Easy Face Recognition Tutorial With JavaScript - Video Using face-api.js with Vue.js and Electron Add Masks to People - Gant Laborde on Learn with Jason Table of Contents Features Running the Examples face-api.js for the Browser face-api.js for Nodejs Usage Loading the Models High Level API Displaying Detection Results Face Detection Options Utility Classes Other Useful Utility Available Models Face Detection Face Landmark Detection Face Recognition Face Expression Recognition Age Estimation and Gender Recognition API Documentation Features Face Recognition !face-recognition Face Landmark Detection !face_landmark_detection Face Expression Recognition !preview_face-expression-recognition Age Estimation & Gender Recognition !age_gender_recognition Running the Examples Clone the repository: bash git clone https://github.com/justadudewhohacks/face-api.js.git Running the Browser Examples bash cd face-api.js/examples/examples-browser npm i npm start Browse to http://localhost:3000/. Running the Nodejs Examples bash cd face-api.js/examples/examples-nodejs npm i Now run one of the examples using ts-node: bash ts-node faceDetection.ts Or simply compile and run them with node: bash tsc faceDetection.ts node faceDetection.js face-api.js for the Browser Simply include the latest script from dist/face-api.js. Or install it via npm: bash npm i face-api.js face-api.js for Nodejs We can use the equivalent API in a nodejs environment by polyfilling some browser specifics, such as HTMLImageElement, HTMLCanvasElement and ImageData. The easiest way to do so is by installing the node-canvas package. Alternatively you can simply construct your own tensors from image data and pass tensors as inputs to the API. Furthermore you want to install @tensorflow/tfjs-node (not required, but highly recommended), which speeds things up drastically by compiling and binding to the native Tensorflow C++ library: bash npm i face-api.js canvas @tensorflow/tfjs-node Now we simply monkey patch the environment to use the polyfills: javascript // import nodejs bindings to native tensorflow, // not required, but will speed up things drastically (python required) import '@tensorflow/tfjs-node'; // implements nodejs wrappers for HTMLCanvasElement, HTMLImageElement, ImageData import as canvas from 'canvas'; import as faceapi from 'face-api.js'; // patch nodejs environment, we need to provide an implementation of // HTMLCanvasElement and HTMLImageElement co
Top issues
#47Webworker83 comments · 2018-07-12#438Unable to integrate it with react native 33 comments · 2019-10-12#176Can I detect eye blink?27 comments · 2018-12-31#602face-api.js ERROR: Based on the provided shape, [256,128], the tensor should have 32768 values but has 2907626 comments · 2020-04-21#107Head position (Yaw, Roll, Pitch)24 comments · 2018-10-22#264[electron] Face recognitions is not working properly in my project22 comments · 2019-04-05#633solved: face-api is not compatible with tfjs 2.x or tfjs 3.x20 comments · 2020-06-08#491node-js examples not compiling20 comments · 2019-12-02
Latest release
0.22.2 0.22.2 2020-03-22- bumped tfjs-core to version 1.7.0