Closed michelle54725 closed 1 year ago
can you post actual detected faces from both images? or even better, upload originals somewhere and i'll test. as it is, i don't have much to go on.
Thanks for the quick response! Turns out that tf.node.decodeImage
(and decodeJpeg
) was rotating some images, so I'm using sharp
to rotate all images back. So this is no longer a product issue, but would you happen to know why decoding some images would rotate them? This also happens with sharp().toBuffer()
.
code I used to test:
const response = await fetch(url);
const arrBuf = await response.arrayBuffer();
const uint8Arr = new Uint8Array(arrBuf);
// is not rotated
writeFile(`./test_${which}_og.jpeg`, uint8Arr, (err) => {
if (err) console.log(err);
});
// is rotated
const test1 = await sharp(uint8Arr).toBuffer();
writeFile(`./test_${which}_test1.jpeg`, test1, (err) => {
if (err) console.log(err);
});
// is rotated
const test2 = tf.node.decodeJpeg(uint8Arr);
console.log(test2.shape); // confirm already rotated before encoding it back
const encodedTensor = await tf.node.encodeJpeg(test2);
const dataBuf = Buffer.from(encodedTensor);
writeFile(`./test_${which}_test2.jpeg`, dataBuf, (err) => {
if (err) console.log(err);
});
most likely images contain exif tag orientation
closing the issue as resolved, but feel free to post further on this thread with any questions.
Using the same image but one is 800x600 and other is 2316x3088 and getting distance values as high as 0.80! The face is very clear in the image. Any idea why or tips to reduce this effect?
I'm using tfjs-node with monkey patch, SsdMobilenetv1Options, faceLandmark68Net, and faceRecognitionNet.