pull/91/head
Vladimir Mandic 2021-03-13 11:37:16 -05:00
parent ff2d53f893
commit d5823db95d
17 changed files with 438601 additions and 6587 deletions

View File

@ -3,8 +3,9 @@ import Human from '../src/human';
import Menu from './menu.js';
import GLBench from './gl-bench.js';
// const userConfig = { backend: 'webgl' }; // add any user configuration overrides
const userConfig = { backend: 'webgl' }; // add any user configuration overrides
/*
const userConfig = {
backend: 'wasm',
async: false,
@ -15,6 +16,7 @@ const userConfig = {
gesture: { enabled: false },
body: { enabled: false, modelPath: '../models/blazepose.json' },
};
*/
const human = new Human(userConfig);

View File

@ -16,7 +16,7 @@
<script src="./embedding.js" type="module"></script>
<style>
@font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../assets/lato-light.woff2') }
html { font-family: 'Lato', 'Segoe UI'; font-size: 20px; font-variant: small-caps; }
html { font-family: 'Lato', 'Segoe UI'; font-size: 24px; font-variant: small-caps; }
body { margin: 0; background: black; color: white; overflow-x: hidden; scrollbar-width: none; }
body::-webkit-scrollbar { display: none; }
img { object-fit: contain; }
@ -26,7 +26,7 @@
<body>
<br>Sample Images:
<div id="images"></div>
<br>Selected Face (Enhanced)<br>
<br>Selected Face (Enhanced):<br>
<canvas id="orig" style="width: 200px; height: 200px;"></canvas>
<br><br>Extracted Faces - click on a face to sort by simmilarity:<br>
<div id="faces"></div>

View File

@ -52,16 +52,16 @@ async function analyze(face) {
const canvases = document.getElementsByClassName('face');
for (const canvas of canvases) {
// calculate simmilarity from selected face to current one in the loop
const res = human.simmilarity(face.embedding, all[canvas.tag.sample][canvas.tag.face].embedding, 3);
const res = human.simmilarity(face.embedding, all[canvas.tag.sample][canvas.tag.face].embedding, 2);
// draw the canvas and simmilarity score
canvas.title = res;
await human.tf.browser.toPixels(all[canvas.tag.sample][canvas.tag.face].tensor, canvas);
const ctx = canvas.getContext('2d');
ctx.font = 'small-caps 1rem "Lato"';
ctx.fillStyle = 'rgba(0, 0, 0, 1)';
ctx.fillText(`${(100 * res).toFixed(1)}%`, 3, 19);
ctx.fillText(`${(100 * res).toFixed(1)}%`, 3, 23);
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
ctx.fillText(`${(100 * res).toFixed(1)}%`, 4, 20);
ctx.fillText(`${(100 * res).toFixed(1)}%`, 4, 24);
}
// sort all faces by simmilarity

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

97796
dist/human.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

97802
dist/human.js vendored

File diff suppressed because one or more lines are too long

2
dist/human.js.map vendored

File diff suppressed because one or more lines are too long

25080
dist/human.node-gpu.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

25080
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

75446
dist/tfjs.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long