From 3c1b6f7caf7dc83520f20e7fc79b6b7debd9ad6e Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 23 Nov 2020 08:17:49 -0500 Subject: [PATCH] updated embedding notes --- Embedding.md | 14 ++++++++++++-- Platforms.md | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Embedding.md b/Embedding.md index 59c6d21..3af894c 100644 --- a/Embedding.md +++ b/Embedding.md @@ -22,9 +22,19 @@ const simmilarity = human.simmilarity(firstEmbedding, secondEmbedding); console.log(`faces are ${100 * simmilarity}% simmilar`); ``` +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 < secondResult.face.length; i++) { + const secondEmbedding = secondResult.face[i].embedding; + const simmilarity = human.simmilarity(firstEmbedding, secondEmbedding); + console.log(`face ${i} is ${100 * simmilarity}% simmilar`); +} +``` + Embedding vectors are calulated values uniquely identifying a given face and presented as array of 192 float values They can be stored as normal arrays and reused as needed -Simmilarity function calculates Eucilidean distance between all points in vector - +Simmilarity function is based on Eucilidean distance between all points in vector +*Eucilidean distance is a square root of sum of squared distances between each point in (each value in 192-member array)* diff --git a/Platforms.md b/Platforms.md index 527ed40..b7e2df5 100644 --- a/Platforms.md +++ b/Platforms.md @@ -10,6 +10,7 @@ - Minimum version Firefox 55 from 2017 - WebGL: Lower performance due to Firefox handing of WebGL memory garbage collection - WASM: For performance reasons it is recommended to enable `javascript.options.wasm.simd` in `about:config` + - WASM: Async operations are not supported (running multiple detections or models in parallel) Due to missing threaded WASM support in Firefox - Web Workers: Not supported due to Firefox missing implementation for `OffscreenCanvas` - **Safari**: *Limited support* - Minimum version Safari 10.3