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
850 stars 151 forks source link

ReferenceError: FileReader is not defined (node.js) #147

Closed danyhiol closed 1 year ago

danyhiol commented 1 year ago

Issue Description Apply face recognition on a 2 base64 string. Steps to Reproduce Apply face recognition using a 2 base64 string. Expected Behavior The API should be able to handle base64 images directly. **Environment macOS M1

Additional

vladmandic commented 1 year ago

Expected Behavior The API should be able to handle base64 images directly.

why would you expect that library should be able to handle base64 images directly?
library cannot be expected to "just know" how to handle every possible input type. and base64 does not even contain information about image encoding - is it rgb pixel-data, or rgba, or jpeg, or png.

i'm afraid you'll have to decode it yourself before using faceapi

btw, note that fetchImage is just a wrapper around platform fetch followed by filling resulting blob to image element using FileReader - so no chance that would work even if fileReader was implemented differently for nodejs.