vladmandic / face-api

FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS
https://vladmandic.github.io/face-api/demo/webcam.html
MIT License
824 stars 149 forks source link

node-cpu build not available #124

Closed LeoMartinDev closed 1 year ago

LeoMartinDev commented 1 year ago

Hi ! Looking at the documentation, we should be able to use face-api.node-cpu build but it looks like it has been removed in this commit https://github.com/vladmandic/face-api/commit/d13586f54980b7ad14744b9c2ee260e9b573ada7

If you want to use FaceAPI in a NodeJS on platforms where NodeJS binary libraries are not supported, you can use JavaScript CPU backend. npm install @tensorflow/tfjs npm install @vladmandic/face-api And then use with: const tf = require('@tensorflow/tfjs') const faceapi = require('@vladmandic/face-api/dist/face-api.node-cpu.js');

Any way to solve this issue ?

vladmandic commented 1 year ago

i forgot to remove it from readme

but the target was removed because:

if you cannot use native tensorflow (via tfjs-node or tfjs-node-gpu) because you're on unsupported platform (note: even then its possible to custom-compile libtensorflow, but its not easy), you can still use face-api.node-wasm.js as that is still cross-platform and far faster than node-cpu would be

what is your use case?

btw, i've just added example on how to use wasm with node: https://github.com/vladmandic/face-api/blob/master/demo/node-wasm.js

LeoMartinDev commented 1 year ago

I'm trying to run face-api in a Vercel lambda function. My issue is that there is a bundle size limit per function of 50Mb and thanks to tensorflow, my build size is over 150Mb 😬

The asm build looks like what I want, thanks !

vladmandic commented 1 year ago

closing as resolved, but feel free to post any additional questions here.