mirror of https://github.com/vladmandic/human
update wiki
parent
a4cc793d5a
commit
9785618d94
13
Embedding.md
13
Embedding.md
|
@ -15,7 +15,7 @@ It highlights functionality such as:
|
||||||
|
|
||||||
## Usage
|
## 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 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`
|
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`);
|
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
|
```js
|
||||||
for (let i = 0; i < currentResult.face.length; i++) {
|
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
|
Additional helper function is `human.enhance(face)` which returns an enhanced tensor
|
||||||
of a face image that can be further visualized with
|
of a face image that can be further visualized with
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue