Closed danies8 closed 2 years ago
there seems to be a typo in the method
new version is published
I used this code:
const distanceThreshold=0.5;
let matcher = new faceapi.FaceMatcher(labeledFaceDescriptors, distanceThreshold);
bestMatchPerson = matcher.findBestMatch(faces[0].descriptor);
I do npm install and check again and the problem still exist.
I check with another person that is not in DB, it happened with a lot of people that are not in DB. If I checked with people that are in DB is good matching. And I got this people that in db "bestMatchPerson": { "_label": "103", "_distance": 0.33258788746528983 }
i cannot reproduce the issue. post a link to a working gist (complete).
so what is the problem??
detected distance
is 0.33 and distanceThreshold
is 0.5
clearly distance
is less than that so it returns a match!?!?!
and when someone asks for reproducible code, make an effort to write a reproduction that works
copy & paste from your app is not helpful
btw, this is the code i just wrote to test your two images:
https://github.com/vladmandic/face-api/blob/master/demo/node-match.js
and you have NOT addressed issues or suggestions i made earlier:
writeFileSync
)
- so what is the problem?? detected
distance
is 0.33 anddistanceThreshold
is 0.5 clearlydistance
is less than that so it returns a match!?!?!
But is not the right person, how can i give him to enter ??? he return label of other person ?**
2.youre still loading models again and again I used these modals in loading process when app is loading, i didn't provided to you this file
const tf = require('@tensorflow/tfjs-node');
const faceapi = require('@vladmandic/face-api');
const path = require('path');
async function loadModals() {
const faceDetectionNet = new faceapi.FaceDetectionNet();
const modelPath = '../../node_modules/@vladmandic/face-api/model';
await faceDetectionNet.loadFromDisk(path.join(__dirname, modelPath));
await faceapi.nets.ageGenderNet.loadFromDisk(path.join(__dirname, modelPath));
await faceapi.nets.faceLandmark68Net.loadFromDisk(path.join(__dirname, modelPath));
await faceapi.nets.faceRecognitionNet.loadFromDisk(path.join(__dirname, modelPath));
await faceapi.nets.faceExpressionNet.loadFromDisk(path.join(__dirname, modelPath));
}
module.exports = { loadModals }
let arr = imageStrEncodedBase64.split(',');
let bstr = atob(arr[1]);
let n = bstr.length;
let u8arr = new Uint8Array(n);
while(n--){
u8arr[n] = bstr.charCodeAt(n);
}
const tensor = tf.node.decodeImage(u8arr, 3);
4.Check image is image is exactly 1 - fixed as follow
if (!faces) {
let detectAllFacesMessage = "compare all:faces is null or undefined";
utils.logger.log({
level: 'error',
message: detectAllFacesMessage,
label: 'faceRecognition.ts'
});
return { success: false, error: detectAllFacesMessage }
}
If distance is above threshold, you don't get a person, you get 'unknown'.
This is working as expected. Issue is closed.
So, how I can know if it right person or not ? I will ask differently, how can i know if to let him enter or not?
i think you got entire concept wrong - distance
means how different two faces are. distance of 0 means identical. so if distanced is below a threshold, you get a match.
I need to learn my pictures and define what is the distance that is right to my organization. I see good match is up to 0.35 and above is not good match. So 0.35 is the distance that above it will not enter, and below it it will enter. While threshold is 0.5. I understood you right ?
Hi , When I inserted this face into db : and compared with this, he found the first one! why ? he should return unknown. distance Threshold 0.5 and the actual threshold "bestMatchPerson": { "_label": "2", "_distance": 0.44472999761672266 } What do I miss ? the image inputs and compare are not good ? Thanks in advance.