diff --git a/Embedding.md b/Embedding.md index 2aef2d5..ae74802 100644 --- a/Embedding.md +++ b/Embedding.md @@ -15,7 +15,7 @@ It highlights functionality such as: ## Usage -To use face similarity compare feature, you must first enable `face.description` module +To use face similarity compare feature, make sure `face.description` module is enabled (default) to calculate embedding vectors *(a.k.a. face descriptors)* for both all images you want to compare To achieve accurate results, it is also highly recommended to have `face.mesh` and `face.detection.rotation` @@ -42,7 +42,7 @@ const similarity = human.similarity(firstResult.face[0].embedding, secondResult. console.log(`faces are ${100 * similarity}% simmilar`); ``` -If the image or video frame have multiple faces and you want to match all of them, simply loop through all `results.face` +If the image or video frame have multiple faces and you want to match all of them, simply loop through all `results.face` ```js for (let i = 0; i < currentResult.face.length; i++) { @@ -52,6 +52,15 @@ for (let i = 0; i < currentResult.face.length; i++) { } ``` +However, note that default configuration only detects first face in the frame, so increase maximum number of detected faces as well: +```js +const myConfig = { + face: { + detector: { maxDetected: 100 }, + }, +}; +``` + Additional helper function is `human.enhance(face)` which returns an enhanced tensor of a face image that can be further visualized with