bugfix embedding check

pull/50/head
Vladimir Mandic 2020-11-19 15:22:08 -05:00
parent 69823e9c69
commit 7e7432d733
9 changed files with 15 additions and 14 deletions

View File

@ -77,12 +77,13 @@ const status = (msg) => {
let original;
async function calcSimmilariry(result) {
document.getElementById('compare-container').style.display = human.config.face.embedding.enabled ? 'block' : 'none';
if (!human.config.face.embedding.enabled) return;
if ((result?.face?.length > 0) && (result?.face[0].embedding?.length !== 192)) return;
if (!original) {
original = result;
document.getElementById('compare-canvas').getContext('2d').drawImage(original.canvas, 0, 0, 200, 200);
}
const simmilarity = human.simmilarity(original.face[0].embedding, result.face[0].embedding);
const simmilarity = human.simmilarity(original?.face[0]?.embedding, result?.face[0]?.embedding);
document.getElementById('simmilarity').innerText = `simmilarity: ${Math.trunc(1000 * simmilarity) / 10}%`;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"inputs": {
"demo/browser.js": {
"bytes": 24755,
"bytes": 24811,
"imports": [
{
"path": "dist/human.esm.js"
@ -38,7 +38,7 @@
"dist/demo-browser-index.js.map": {
"imports": [],
"inputs": {},
"bytes": 2675872
"bytes": 2675985
},
"dist/demo-browser-index.js": {
"imports": [],
@ -57,10 +57,10 @@
"bytesInOutput": 7436
},
"demo/browser.js": {
"bytesInOutput": 19015
"bytesInOutput": 19152
}
},
"bytes": 1829485
"bytes": 1829622
}
}
}

File diff suppressed because one or more lines are too long

2
dist/human.esm.js vendored

File diff suppressed because one or more lines are too long

2
dist/human.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/human.node.js vendored

File diff suppressed because one or more lines are too long