Menu

1 / 2

face-api.js Alternative: Face Recognition in Node.js with an API

DEV Community: node·AI Engine·8 days ago
#c7riqx9v
#devtonodejs#devto#dev#face#await
Reading 0:00
15s threshold

face-api.js made face recognition in JavaScript easy, but its last release (0.22.2) shipped in March 2020 and still pins TensorFlow.js core 1.7.0. The best-known fork, @vladmandic/face-api, is now archived too, yet the two packages still pull about 465,000 and 518,000 npm downloads a month.

Here is how to replace it with a face recognition API from Node.js 20: built-in fetch and FormData , no SDK, no model weights, no canvas or tfjs-node build. All code below ran against the live API.

Want to run it on your own photos? Get a key for the Face Analyzer API .

face-api.js calls mapped to endpoints

face-api.js Face Analyzer API

nets.*.loadFromDisk("./models") nothing to load

detectAllFaces().withFaceLandmarks() /faceanalysis ( boundingBox , landmarks )

.withAgeAndGender() , .withFaceExpressions() /faceanalysis ( AgeRange , Gender , Emotions )

euclideanDistance(d1, d2) < 0.6 /compare-faces ( matchedFaces , unmatchedFaces )

new FaceMatcher(labeledDescriptors) /save-face-in-repository with…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.