justadudewhohacks / face-api.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
MIT License
16.72k stars 3.72k forks source link

'unshiftedLandmarks' of undefined for higher resolution files #288

Open laz666 opened 5 years ago

laz666 commented 5 years ago

Hi,

I am getting the below 'unshiftedLandmarks' error when trying to process iphone camera photos. I think there may be an issue with rotating the image or perhaps compressing the size? Any idea how I could fix this?

I have tried to reduce the image size first, with the below code, but it still does not seem to help.

document.getElementById("original-Img").src=image.src; var canvas=document.createElement("canvas"); var context=canvas.getContext("2d"); canvas.width=image.width/4; canvas.height=image.height/4; context.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height );

Error Uncaught (in promise) TypeError: Cannot read property 'unshiftedLandmarks' of undefined at Object.resizeResults (face-api.js:5652)

Thanks.

justadudewhohacks commented 5 years ago

Can you show me the relevant code? The error is apparently thrown in faceapi.resizeResults. The error may indicate that you are passing invalid stuff into faceapi.resizeResults, maybe undefined?