mirror of https://github.com/vladmandic/human
switch to custom tfjs for demos
parent
d9b179a08f
commit
4e05fa40fe
44
.build.json
44
.build.json
|
@ -111,34 +111,13 @@
|
|||
"sourcemap": true,
|
||||
"external": ["@tensorflow", "fs", "os", "buffer", "util"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "tfjs/browser/esm/custom",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-custom.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": true,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
{
|
||||
"name": "human/browser/esm/custom",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.custom.esm.js",
|
||||
"sourcemap": true,
|
||||
"minify": true,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "tfjs/browser/esm/bundle",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-browser.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"minify": true,
|
||||
"minify": false,
|
||||
"sourcemap": true,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
|
@ -158,7 +137,28 @@
|
|||
"format": "esm",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.esm.js",
|
||||
"minify": true,
|
||||
"sourcemap": true,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "tfjs/browser/esm/custom",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-custom.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
{
|
||||
"name": "human/browser/esm/custom",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.custom.esm.js",
|
||||
"sourcemap": true,
|
||||
"minify": false,
|
||||
"external": ["fs", "os", "buffer", "util"],
|
||||
"typings": "types",
|
||||
"typedoc": "typedoc"
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
"ecmaVersion": 2021
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
"@typescript-eslint",
|
||||
"html"
|
||||
],
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
|
|
2
.hintrc
2
.hintrc
|
@ -5,7 +5,7 @@
|
|||
"browserslist": [
|
||||
"chrome >= 90",
|
||||
"edge >= 90",
|
||||
"firefox >= 90",
|
||||
"firefox >= 100",
|
||||
"android >= 90",
|
||||
"safari >= 15"
|
||||
],
|
||||
|
|
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -9,11 +9,15 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/10/25 mandic00@live.com
|
||||
|
||||
|
||||
### **release: 2.4.1** 2021/10/25 mandic00@live.com
|
||||
|
||||
|
||||
### **2.4.1** 2021/10/25 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/main** 2021/10/25 mandic00@live.com
|
||||
|
||||
- refactoring plus jsdoc comments
|
||||
- increase face similarity match resolution
|
||||
- time based caching
|
||||
- turn on minification
|
||||
|
|
6
TODO.md
6
TODO.md
|
@ -2,11 +2,12 @@
|
|||
|
||||
## Work in Progress
|
||||
|
||||
- Switch to custom `tfjs` for main `human` ESM bundle
|
||||
|
||||
<br>
|
||||
|
||||
### Exploring
|
||||
|
||||
- Switch to custom `tfjs` for main `human` ESM bundle
|
||||
- Optical Flow: <https://docs.opencv.org/3.3.1/db/d7f/tutorial_js_lucas_kanade.html>
|
||||
- Histogram Equalization: Regular, Adaptive, Contrast Limited
|
||||
- TFLite Models: <https://js.tensorflow.org/api_tflite/0.0.1-alpha.4/>
|
||||
|
@ -22,6 +23,9 @@ Experimental support only until support is officially added in Chromium
|
|||
|
||||
## Known Issues
|
||||
|
||||
- `tfjs.esm.d.ts` missing namespace `OptimizerConstructors`
|
||||
- exports from `match` are marked as private
|
||||
|
||||
<br>
|
||||
|
||||
### Face Detection
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<link rel="manifest" href="../manifest.webmanifest">
|
||||
<link rel="shortcut icon" href="../../favicon.ico" type="image/x-icon">
|
||||
<link rel="apple-touch-icon" href="../../assets/icon.png">
|
||||
<script type="module" src="browser.js"></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: 16px; font-variant: small-caps; }
|
||||
|
@ -26,5 +25,56 @@
|
|||
<div id="status" class="status"></div>
|
||||
<img id="image" src="../../samples/in/group-1.jpg" alt="test image" style="display: none">
|
||||
<div id="log" class="log"></div>
|
||||
<script>
|
||||
import Human from '../../dist/human.custom.esm.js';
|
||||
|
||||
const loop = 20;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const log = (...msg) => console.log(...msg);
|
||||
|
||||
const myConfig = {
|
||||
backend: 'humangl',
|
||||
modelBasePath: 'https://vladmandic.github.io/human/models',
|
||||
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
debug: true,
|
||||
async: true,
|
||||
cacheSensitivity: 0,
|
||||
filter: { enabled: false },
|
||||
face: {
|
||||
enabled: true,
|
||||
detector: { enabled: true, rotation: false },
|
||||
mesh: { enabled: true },
|
||||
iris: { enabled: true },
|
||||
description: { enabled: true },
|
||||
emotion: { enabled: false },
|
||||
},
|
||||
hand: { enabled: true, rotation: false },
|
||||
body: { enabled: true },
|
||||
object: { enabled: false },
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const human = new Human(myConfig);
|
||||
await human.tf.ready();
|
||||
log('Human:', human.version);
|
||||
await human.load();
|
||||
const loaded = Object.keys(human.models).filter((a) => human.models[a]);
|
||||
log('Loaded:', loaded);
|
||||
log('Memory state:', human.tf.engine().memory());
|
||||
const element = document.getElementById('image');
|
||||
const processed = await human.image(element);
|
||||
const t0 = human.now();
|
||||
await human.detect(processed.tensor, myConfig);
|
||||
const t1 = human.now();
|
||||
log('Backend:', human.tf.getBackend());
|
||||
log('Warmup:', Math.round(t1 - t0));
|
||||
for (let i = 0; i < loop; i++) await human.detect(processed.tensor, myConfig);
|
||||
const t2 = human.now();
|
||||
log('Average:', Math.round((t2 - t1) / loop));
|
||||
}
|
||||
|
||||
window.onload = main;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
import Human from '../../dist/human.custom.esm.js';
|
||||
|
||||
const loop = 20;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const log = (...msg) => console.log(...msg);
|
||||
|
||||
const myConfig = {
|
||||
backend: 'humangl',
|
||||
modelBasePath: 'https://vladmandic.github.io/human/models',
|
||||
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
debug: true,
|
||||
async: true,
|
||||
cacheSensitivity: 0,
|
||||
filter: { enabled: false },
|
||||
face: {
|
||||
enabled: true,
|
||||
detector: { enabled: true, rotation: false },
|
||||
mesh: { enabled: true },
|
||||
iris: { enabled: true },
|
||||
description: { enabled: true },
|
||||
emotion: { enabled: false },
|
||||
},
|
||||
hand: { enabled: true, rotation: false },
|
||||
body: { enabled: true },
|
||||
object: { enabled: false },
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const human = new Human(myConfig);
|
||||
await human.tf.ready();
|
||||
log('Human:', human.version);
|
||||
await human.load();
|
||||
const loaded = Object.keys(human.models).filter((a) => human.models[a]);
|
||||
log('Loaded:', loaded);
|
||||
log('Memory state:', human.tf.engine().memory());
|
||||
const element = document.getElementById('image');
|
||||
const processed = await human.image(element);
|
||||
const t0 = human.now();
|
||||
await human.detect(processed.tensor, myConfig);
|
||||
const t1 = human.now();
|
||||
log('Backend:', human.tf.getBackend());
|
||||
log('Warmup:', Math.round(t1 - t0));
|
||||
for (let i = 0; i < loop; i++) await human.detect(processed.tensor, myConfig);
|
||||
const t2 = human.now();
|
||||
log('Average:', Math.round((t2 - t1) / loop));
|
||||
}
|
||||
|
||||
main();
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { DoubleSide, Mesh, MeshBasicMaterial, OrthographicCamera, Scene, sRGBEncoding, VideoTexture, WebGLRenderer, BufferGeometry, BufferAttribute } from '../helpers/three.js';
|
||||
import { OrbitControls } from '../helpers/three-orbitControls.js';
|
||||
import Human from '../../dist/human.esm.js'; // equivalent of @vladmandic/human
|
||||
import Human from '../../dist/human.custom.esm.js'; // equivalent of @vladmandic/human
|
||||
|
||||
const userConfig = {
|
||||
backend: 'wasm',
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// @ts-nocheck // typescript checks disabled as this is pure javascript
|
||||
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* Human demo for browsers
|
||||
*
|
||||
* Demo for face descriptor analysis and face simmilarity analysis
|
||||
*/
|
||||
|
||||
import Human from '../../dist/human.esm.js';
|
||||
/** @type {Human} */
|
||||
import Human from '../../dist/human.custom.esm.js';
|
||||
|
||||
const userConfig = {
|
||||
backend: 'wasm',
|
||||
|
@ -15,7 +15,6 @@ const userConfig = {
|
|||
cacheSensitivity: 0,
|
||||
debug: true,
|
||||
modelBasePath: '../../models/',
|
||||
// wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.9.0/dist/',
|
||||
face: {
|
||||
enabled: true,
|
||||
detector: { rotation: true, return: true, maxDetected: 50 },
|
||||
|
@ -165,6 +164,7 @@ async function AddFaceCanvas(index, res, fileName) {
|
|||
await human.tf.browser.toPixels(res.face[i].tensor, canvas);
|
||||
document.getElementById('faces').appendChild(canvas);
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) return false;
|
||||
ctx.font = 'small-caps 0.8rem "Lato"';
|
||||
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
|
||||
ctx.fillText(`${res.face[i].age}y ${(100 * (res.face[i].genderScore || 0)).toFixed(1)}% ${res.face[i].gender}`, 4, canvas.height - 6);
|
||||
|
@ -258,6 +258,8 @@ async function main() {
|
|||
|
||||
title('');
|
||||
log('Ready');
|
||||
human.validate(userConfig);
|
||||
human.similarity([], []);
|
||||
}
|
||||
|
||||
window.onload = main;
|
||||
|
|
|
@ -37,7 +37,7 @@ const UISVG = `
|
|||
|
||||
class GLBench {
|
||||
/** GLBench constructor
|
||||
* @param { WebGLRenderingContext | WebGL2RenderingContext } gl context
|
||||
* @param { WebGLRenderingContext | WebGL2RenderingContext | null } gl context
|
||||
* @param { Object | undefined } settings additional settings
|
||||
*/
|
||||
constructor(gl, settings = {}) {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
//@ts-nocheck
|
||||
|
||||
let instance = 0;
|
||||
let CSScreated = false;
|
||||
|
||||
|
@ -86,6 +84,7 @@ class Menu {
|
|||
}
|
||||
|
||||
createMenu(parent, title = '', position = { top: null, left: null, bottom: null, right: null }) {
|
||||
/** @type {HTMLDivElement} */
|
||||
this.menu = document.createElement('div');
|
||||
this.menu.id = `menu-${instance}`;
|
||||
this.menu.className = 'menu';
|
||||
|
@ -120,6 +119,7 @@ class Menu {
|
|||
|
||||
this.menu.appendChild(this.container);
|
||||
if (typeof parent === 'object') parent.appendChild(this.menu);
|
||||
// @ts-ignore undefined
|
||||
else document.getElementById(parent).appendChild(this.menu);
|
||||
}
|
||||
|
||||
|
@ -133,11 +133,11 @@ class Menu {
|
|||
}
|
||||
|
||||
get width() {
|
||||
return this.menu.offsetWidth || 0;
|
||||
return this.menu ? this.menu.offsetWidth : 0;
|
||||
}
|
||||
|
||||
get height() {
|
||||
return this.menu.offsetHeight || 0;
|
||||
return this.menu ? this.menu.offsetHeight : 0;
|
||||
}
|
||||
|
||||
hide() {
|
||||
|
@ -184,6 +184,7 @@ class Menu {
|
|||
this.hidden = !this.hidden;
|
||||
const all = document.getElementsByClassName('menu');
|
||||
for (const item of all) {
|
||||
// @ts-ignore
|
||||
item.style.display = this.hidden ? 'none' : 'block';
|
||||
}
|
||||
});
|
||||
|
@ -205,8 +206,10 @@ class Menu {
|
|||
el.innerHTML = `<div class="menu-checkbox"><input class="menu-checkbox" type="checkbox" id="${this.newID}" ${object[variable] ? 'checked' : ''}/><label class="menu-checkbox-label" for="${this.ID}"></label></div>${title}`;
|
||||
if (this.container) this.container.appendChild(el);
|
||||
el.addEventListener('change', (evt) => {
|
||||
object[variable] = evt.target.checked;
|
||||
if (callback) callback(evt.target.checked);
|
||||
if (evt.target) {
|
||||
object[variable] = evt.target['checked'];
|
||||
if (callback) callback(evt.target['checked']);
|
||||
}
|
||||
});
|
||||
return el;
|
||||
}
|
||||
|
@ -225,7 +228,7 @@ class Menu {
|
|||
el.style.fontVariant = document.body.style.fontVariant;
|
||||
if (this.container) this.container.appendChild(el);
|
||||
el.addEventListener('change', (evt) => {
|
||||
if (callback) callback(items[evt.target.selectedIndex]);
|
||||
if (callback && evt.target) callback(items[evt.target['selectedIndex']]);
|
||||
});
|
||||
return el;
|
||||
}
|
||||
|
@ -237,12 +240,13 @@ class Menu {
|
|||
if (this.container) this.container.appendChild(el);
|
||||
el.addEventListener('change', (evt) => {
|
||||
if (evt.target) {
|
||||
object[variable] = parseInt(evt.target.value) === parseFloat(evt.target.value) ? parseInt(evt.target.value) : parseFloat(evt.target.value);
|
||||
evt.target.setAttribute('value', evt.target.value);
|
||||
if (callback) callback(evt.target.value);
|
||||
object[variable] = parseInt(evt.target['value']) === parseFloat(evt.target['value']) ? parseInt(evt.target['value']) : parseFloat(evt.target['value']);
|
||||
// @ts-ignore
|
||||
evt.target.setAttribute('value', evt.target['value']);
|
||||
if (callback) callback(evt.target['value']);
|
||||
}
|
||||
});
|
||||
el.input = el.children[0];
|
||||
el['input'] = el.children[0];
|
||||
return el;
|
||||
}
|
||||
|
||||
|
@ -302,9 +306,12 @@ class Menu {
|
|||
// eslint-disable-next-line class-methods-use-this
|
||||
async updateChart(id, values) {
|
||||
if (!values || (values.length === 0)) return;
|
||||
/** @type {HTMLCanvasElement} */
|
||||
// @ts-ignore undefined
|
||||
const canvas = document.getElementById(`menu-canvas-${id}`);
|
||||
if (!canvas) return;
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) return;
|
||||
ctx.fillStyle = theme.background;
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
const width = canvas.width / values.length;
|
||||
|
@ -318,7 +325,7 @@ class Menu {
|
|||
ctx.fillRect(i * width, 0, width - 4, canvas.height);
|
||||
ctx.fillStyle = theme.background;
|
||||
ctx.font = `${width / 1.5}px "Segoe UI"`;
|
||||
ctx.fillText(Math.round(values[i]), i * width + 1, canvas.height - 1, width - 1);
|
||||
ctx.fillText(Math.round(values[i]).toString(), i * width + 1, canvas.height - 1, width - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
/// <reference lib="webworker" />
|
||||
/**
|
||||
* Web worker used by main demo app
|
||||
* Loaded from index.js
|
||||
*/
|
||||
|
||||
/// <reference lib="webworker"/>
|
||||
|
||||
// load Human using IIFE script as Chome Mobile does not support Modules as Workers
|
||||
// import Human from '../dist/human.esm.js';
|
||||
/** @type {Human} */
|
||||
const Human = {};
|
||||
self.importScripts('../dist/human.js');
|
||||
|
||||
let busy = false;
|
||||
// @ts-ignore // Human is registered as global namespace using IIFE script
|
||||
// eslint-disable-next-line no-undef, new-cap
|
||||
// eslint-disable-next-line new-cap
|
||||
const human = new Human.default();
|
||||
|
||||
onmessage = async (msg) => { // receive message from main thread
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
* @description Demo app that enables all Human modules and runs them in separate worker threads
|
||||
*
|
||||
*/
|
||||
// @ts-nocheck // typescript checks disabled as this is pure javascript
|
||||
|
||||
import Human from '../../dist/human.esm.js'; // equivalent of @vladmandic/human
|
||||
import Human from '../../dist/human.custom.esm.js'; // equivalent of @vladmandic/human
|
||||
import GLBench from '../helpers/gl-bench.js';
|
||||
|
||||
const workerJS = './worker.js';
|
||||
|
@ -92,9 +91,13 @@ const busy = {
|
|||
};
|
||||
|
||||
const workers = {
|
||||
/** @type {Worker | null} */
|
||||
face: null,
|
||||
/** @type {Worker | null} */
|
||||
body: null,
|
||||
/** @type {Worker | null} */
|
||||
hand: null,
|
||||
/** @type {Worker | null} */
|
||||
object: null,
|
||||
};
|
||||
|
||||
|
@ -138,7 +141,8 @@ async function drawResults() {
|
|||
time.draw = Math.round(1 + human.now() - start.draw);
|
||||
const fps = Math.round(10 * 1000 / time.main) / 10;
|
||||
const draw = Math.round(10 * 1000 / time.draw) / 10;
|
||||
document.getElementById('log').innerText = `Human: version ${human.version} | Performance: Main ${time.main}ms Face: ${time.face}ms Body: ${time.body}ms Hand: ${time.hand}ms Object ${time.object}ms | FPS: ${fps} / ${draw}`;
|
||||
const div = document.getElementById('log');
|
||||
if (div) div.innerText = `Human: version ${human.version} | Performance: Main ${time.main}ms Face: ${time.face}ms Body: ${time.body}ms Hand: ${time.hand}ms Object ${time.object}ms | FPS: ${fps} / ${draw}`;
|
||||
requestAnimationFrame(drawResults);
|
||||
}
|
||||
|
||||
|
@ -152,7 +156,7 @@ async function runDetection() {
|
|||
start.main = human.now();
|
||||
if (!bench) {
|
||||
bench = new GLBench(null, { trackGPU: false, chartHz: 20, chartLen: 20 });
|
||||
bench.begin();
|
||||
bench.begin('human');
|
||||
}
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
||||
|
@ -160,22 +164,22 @@ async function runDetection() {
|
|||
if (!busy.face) {
|
||||
busy.face = true;
|
||||
start.face = human.now();
|
||||
workers.face.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.face, type: 'face' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.face) workers.face.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.face, type: 'face' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
if (!busy.body) {
|
||||
busy.body = true;
|
||||
start.body = human.now();
|
||||
workers.body.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.body, type: 'body' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.body) workers.body.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.body, type: 'body' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
if (!busy.hand) {
|
||||
busy.hand = true;
|
||||
start.hand = human.now();
|
||||
workers.hand.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.hand, type: 'hand' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.hand) workers.hand.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.hand, type: 'hand' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
if (!busy.object) {
|
||||
busy.object = true;
|
||||
start.object = human.now();
|
||||
workers.object.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.object, type: 'object' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.object) workers.object.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.object, type: 'object' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
|
||||
time.main = Math.round(human.now() - start.main);
|
||||
|
@ -204,27 +208,29 @@ async function setupCamera() {
|
|||
try {
|
||||
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
||||
} catch (err) {
|
||||
output.innerText += `\n${err.name}: ${err.message}`;
|
||||
status(err.name);
|
||||
if (output) output.innerText += `\n${err.name}: ${err.message}`;
|
||||
log('camera error:', err);
|
||||
}
|
||||
const tracks = stream.getVideoTracks();
|
||||
log('enumerated viable tracks:', tracks);
|
||||
const track = stream.getVideoTracks()[0];
|
||||
const settings = track.getSettings();
|
||||
log('selected video source:', track, settings);
|
||||
if (stream) {
|
||||
const tracks = stream.getVideoTracks();
|
||||
log('enumerated viable tracks:', tracks);
|
||||
const track = stream.getVideoTracks()[0];
|
||||
const settings = track.getSettings();
|
||||
log('selected video source:', track, settings);
|
||||
} else {
|
||||
log('missing video stream');
|
||||
}
|
||||
const promise = !stream || new Promise((resolve) => {
|
||||
video.onloadeddata = () => {
|
||||
if (settings.width > settings.height) canvas.style.width = '100vw';
|
||||
else canvas.style.height = '100vh';
|
||||
canvas.style.height = '100vh';
|
||||
canvas.width = video.videoWidth;
|
||||
canvas.height = video.videoHeight;
|
||||
video.play();
|
||||
resolve();
|
||||
resolve(true);
|
||||
};
|
||||
});
|
||||
// attach input to video element
|
||||
if (stream) video.srcObject = stream;
|
||||
if (stream && video) video['srcObject'] = stream;
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
@ -240,21 +246,13 @@ async function startWorkers() {
|
|||
}
|
||||
|
||||
async function main() {
|
||||
window.addEventListener('unhandledrejection', (evt) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(evt.reason || evt);
|
||||
document.getElementById('log').innerHTML = evt.reason.message || evt.reason || evt;
|
||||
status('exception error');
|
||||
evt.preventDefault();
|
||||
});
|
||||
|
||||
if (typeof Worker === 'undefined' || typeof OffscreenCanvas === 'undefined') {
|
||||
status('workers are not supported');
|
||||
return;
|
||||
}
|
||||
|
||||
human = new Human(config.main);
|
||||
document.getElementById('log').innerText = `Human: version ${human.version}`;
|
||||
const div = document.getElementById('log');
|
||||
if (div) div.innerText = `Human: version ${human.version}`;
|
||||
|
||||
await startWorkers();
|
||||
await setupCamera();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// load Human using IIFE script as Chome Mobile does not support Modules as Workers
|
||||
|
||||
/// <reference lib="webworker" />
|
||||
|
||||
// import Human from '../dist/human.esm.js';
|
||||
// load Human using IIFE script as Chome Mobile does not support Modules as Workers
|
||||
self.importScripts('../../dist/human.js');
|
||||
|
||||
let human;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* config={}: contains all model configuration used by human
|
||||
*/
|
||||
|
||||
import Human from '../../dist/human.esm.js'; // equivalent of @vladmandic/human
|
||||
import Human from '../../dist/human.custom.esm.js'; // equivalent of @vladmandic/human
|
||||
import webRTC from '../helpers/webrtc.js'; // handle webrtc handshake and connects to webrtc stream
|
||||
|
||||
const config = { // use default values for everything just specify models location
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* @description Experimental Demo app for Human using WebGPU
|
||||
*
|
||||
*/
|
||||
// @ts-nocheck // typescript checks disabled as this is pure javascript
|
||||
|
||||
/** @type {Human} */
|
||||
import Human from '../../dist/human.custom.esm.js';
|
||||
import GLBench from '../helpers/gl-bench.js';
|
||||
|
||||
|
@ -100,9 +100,13 @@ const busy = {
|
|||
};
|
||||
|
||||
const workers = {
|
||||
/** @type {Worker | null} */
|
||||
face: null,
|
||||
/** @type {Worker | null} */
|
||||
body: null,
|
||||
/** @type {Worker | null} */
|
||||
hand: null,
|
||||
/** @type {Worker | null} */
|
||||
object: null,
|
||||
};
|
||||
|
||||
|
@ -146,7 +150,8 @@ async function drawResults() {
|
|||
time.draw = Math.round(1 + human.now() - start.draw);
|
||||
const fps = Math.round(10 * 1000 / time.main) / 10;
|
||||
const draw = Math.round(10 * 1000 / time.draw) / 10;
|
||||
document.getElementById('log').innerText = `Human: version ${human.version} | Performance: Main ${time.main}ms Face: ${time.face}ms Body: ${time.body}ms Hand: ${time.hand}ms Object ${time.object}ms | FPS: ${fps} / ${draw}`;
|
||||
const div = document.getElementById('log');
|
||||
if (div) div.innerText = `Human: version ${human.version} | Performance: Main ${time.main}ms Face: ${time.face}ms Body: ${time.body}ms Hand: ${time.hand}ms Object ${time.object}ms | FPS: ${fps} / ${draw}`;
|
||||
requestAnimationFrame(drawResults);
|
||||
}
|
||||
|
||||
|
@ -160,7 +165,7 @@ async function runDetection() {
|
|||
start.main = human.now();
|
||||
if (!bench) {
|
||||
bench = new GLBench(null, { trackGPU: false, chartHz: 20, chartLen: 20 });
|
||||
bench.begin();
|
||||
bench.begin('human');
|
||||
}
|
||||
const ctx = canvas.getContext('2d');
|
||||
// const image = await human.image(video);
|
||||
|
@ -170,22 +175,22 @@ async function runDetection() {
|
|||
if (!busy.face) {
|
||||
busy.face = true;
|
||||
start.face = human.now();
|
||||
workers.face.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.face, type: 'face' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.face) workers.face.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.face, type: 'face' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
if (!busy.body) {
|
||||
busy.body = true;
|
||||
start.body = human.now();
|
||||
workers.body.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.body, type: 'body' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.body) workers.body.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.body, type: 'body' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
if (!busy.hand) {
|
||||
busy.hand = true;
|
||||
start.hand = human.now();
|
||||
workers.hand.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.hand, type: 'hand' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.hand) workers.hand.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.hand, type: 'hand' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
if (!busy.object) {
|
||||
busy.object = true;
|
||||
start.object = human.now();
|
||||
workers.object.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.object, type: 'object' }, [imageData.data.buffer.slice(0)]);
|
||||
if (workers.object) workers.object.postMessage({ image: imageData.data.buffer, width: canvas.width, height: canvas.height, config: config.object, type: 'object' }, [imageData.data.buffer.slice(0)]);
|
||||
}
|
||||
|
||||
time.main = Math.round(human.now() - start.main);
|
||||
|
@ -194,8 +199,8 @@ async function runDetection() {
|
|||
}
|
||||
|
||||
async function setupCamera() {
|
||||
video = document.getElementById('video');
|
||||
canvas = document.getElementById('canvas');
|
||||
video = document.getElementById('video') || document.createElement('video');
|
||||
canvas = document.getElementById('canvas') || document.createElement('canvas');
|
||||
const output = document.getElementById('log');
|
||||
let stream;
|
||||
const constraints = {
|
||||
|
@ -214,28 +219,30 @@ async function setupCamera() {
|
|||
try {
|
||||
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
||||
} catch (err) {
|
||||
output.innerText += `\n${err.name}: ${err.message}`;
|
||||
status(err.name);
|
||||
if (output) output.innerText += `\n${err.name}: ${err.message}`;
|
||||
log('camera error:', err);
|
||||
}
|
||||
const tracks = stream.getVideoTracks();
|
||||
log('enumerated viable tracks:', tracks);
|
||||
const track = stream.getVideoTracks()[0];
|
||||
const settings = track.getSettings();
|
||||
log('selected video source:', track, settings);
|
||||
const promise = !stream || new Promise((resolve) => {
|
||||
video.onloadeddata = () => {
|
||||
if (settings.width > settings.height) canvas.style.width = '100vw';
|
||||
else canvas.style.height = '100vh';
|
||||
canvas.width = video.videoWidth;
|
||||
canvas.height = video.videoHeight;
|
||||
video.play();
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
// attach input to video element
|
||||
if (stream) video.srcObject = stream;
|
||||
return promise;
|
||||
if (stream) {
|
||||
const tracks = stream.getVideoTracks();
|
||||
log('enumerated viable tracks:', tracks);
|
||||
const track = stream.getVideoTracks()[0];
|
||||
const settings = track.getSettings();
|
||||
log('selected video source:', track, settings);
|
||||
const promise = new Promise((resolve) => {
|
||||
video.onloadeddata = () => {
|
||||
if (settings.width && settings.height && settings.width > settings.height) canvas.style.width = '100vw';
|
||||
else canvas.style.height = '100vh';
|
||||
canvas.width = video.videoWidth;
|
||||
canvas.height = video.videoHeight;
|
||||
video.play();
|
||||
resolve(true);
|
||||
};
|
||||
});
|
||||
// attach input to video element
|
||||
video['srcObject'] = stream;
|
||||
return promise;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async function startWorkers() {
|
||||
|
@ -261,12 +268,12 @@ async function main() {
|
|||
*/
|
||||
|
||||
if (typeof Worker === 'undefined' || typeof OffscreenCanvas === 'undefined') {
|
||||
status('workers are not supported');
|
||||
return;
|
||||
}
|
||||
|
||||
human = new Human(config.main);
|
||||
document.getElementById('log').innerText = `Human: version ${human.version}`;
|
||||
const div = document.getElementById('log');
|
||||
if (div) div.innerText = `Human: version ${human.version}`;
|
||||
|
||||
await startWorkers();
|
||||
await setupCamera();
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/// <reference lib="webworker" />
|
||||
|
||||
// import Human from '../../dist/human.esm'; // load Human using IIFE script as Chome Mobile does not support Modules as Workers
|
||||
// load Human using IIFE script as Chome Mobile does not support Modules as Workers
|
||||
// self.importScripts('../../dist/human.js');
|
||||
|
||||
import * as Human from '../../dist/human.custom.esm.js';
|
||||
|
||||
let human;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -108,6 +108,7 @@ function mergeDeep(...objects) {
|
|||
}
|
||||
|
||||
// src/config.ts
|
||||
var timeFact = 1e3;
|
||||
var config = {
|
||||
backend: "",
|
||||
modelBasePath: "",
|
||||
|
@ -147,7 +148,7 @@ var config = {
|
|||
rotation: true,
|
||||
maxDetected: 1,
|
||||
skipFrames: 99,
|
||||
skipTime: 2500,
|
||||
skipTime: 2.5 * timeFact,
|
||||
minConfidence: 0.2,
|
||||
iouThreshold: 0.1,
|
||||
return: false
|
||||
|
@ -164,20 +165,20 @@ var config = {
|
|||
enabled: true,
|
||||
minConfidence: 0.1,
|
||||
skipFrames: 99,
|
||||
skipTime: 1500,
|
||||
skipTime: 1.5 * timeFact,
|
||||
modelPath: "emotion.json"
|
||||
},
|
||||
description: {
|
||||
enabled: true,
|
||||
modelPath: "faceres.json",
|
||||
skipFrames: 99,
|
||||
skipTime: 3e3,
|
||||
skipTime: 3 * timeFact,
|
||||
minConfidence: 0.1
|
||||
},
|
||||
antispoof: {
|
||||
enabled: false,
|
||||
skipFrames: 99,
|
||||
skipTime: 4e3,
|
||||
skipTime: 4 * timeFact,
|
||||
modelPath: "antispoof.json"
|
||||
}
|
||||
},
|
||||
|
@ -190,13 +191,13 @@ var config = {
|
|||
maxDetected: -1,
|
||||
minConfidence: 0.3,
|
||||
skipFrames: 1,
|
||||
skipTime: 200
|
||||
skipTime: 0.2 * timeFact
|
||||
},
|
||||
hand: {
|
||||
enabled: true,
|
||||
rotation: true,
|
||||
skipFrames: 99,
|
||||
skipTime: 2e3,
|
||||
skipTime: 2 * timeFact,
|
||||
minConfidence: 0.5,
|
||||
iouThreshold: 0.2,
|
||||
maxDetected: -1,
|
||||
|
@ -215,7 +216,7 @@ var config = {
|
|||
iouThreshold: 0.4,
|
||||
maxDetected: 10,
|
||||
skipFrames: 99,
|
||||
skipTime: 1e3
|
||||
skipTime: 1 * timeFact
|
||||
},
|
||||
segmentation: {
|
||||
enabled: false,
|
||||
|
@ -11814,18 +11815,18 @@ function calc2(newResult, config3) {
|
|||
function distance(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
let sum2 = 0;
|
||||
for (let i = 0; i < descriptor1.length; i++) {
|
||||
const diff = options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
const diff = !options3.order || options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += !options3.order || options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
}
|
||||
return (options3.multiplier || 20) * sum2;
|
||||
}
|
||||
function similarity(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
const dist = distance(descriptor1, descriptor2, options3);
|
||||
const root = options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const root = !options3.order || options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const invert = Math.max(0, 100 - root) / 100;
|
||||
return invert;
|
||||
}
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, multiplier: 20 }) {
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, multiplier: 20, threshold: 0 }) {
|
||||
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) {
|
||||
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
|
||||
}
|
||||
|
@ -11837,10 +11838,10 @@ function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, mu
|
|||
best = res;
|
||||
index = i;
|
||||
}
|
||||
if (best < options3.threshold)
|
||||
if (best < (options3.threshold || 0))
|
||||
break;
|
||||
}
|
||||
best = options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
best = !options3.order || options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
return { index, distance: best, similarity: Math.max(0, 100 - best) / 100 };
|
||||
}
|
||||
|
||||
|
@ -12863,7 +12864,7 @@ var Human = class {
|
|||
if (this.config.debug)
|
||||
log("configuration:", this.config);
|
||||
if (this.config.debug)
|
||||
log("tf flags:", this.tf.ENV.flags);
|
||||
log("tf flags:", this.tf.ENV["flags"]);
|
||||
}
|
||||
}
|
||||
await load15(this);
|
||||
|
|
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
|
@ -143,6 +143,7 @@ function mergeDeep(...objects) {
|
|||
}
|
||||
|
||||
// src/config.ts
|
||||
var timeFact = 1e3;
|
||||
var config = {
|
||||
backend: "",
|
||||
modelBasePath: "",
|
||||
|
@ -182,7 +183,7 @@ var config = {
|
|||
rotation: true,
|
||||
maxDetected: 1,
|
||||
skipFrames: 99,
|
||||
skipTime: 2500,
|
||||
skipTime: 2.5 * timeFact,
|
||||
minConfidence: 0.2,
|
||||
iouThreshold: 0.1,
|
||||
return: false
|
||||
|
@ -199,20 +200,20 @@ var config = {
|
|||
enabled: true,
|
||||
minConfidence: 0.1,
|
||||
skipFrames: 99,
|
||||
skipTime: 1500,
|
||||
skipTime: 1.5 * timeFact,
|
||||
modelPath: "emotion.json"
|
||||
},
|
||||
description: {
|
||||
enabled: true,
|
||||
modelPath: "faceres.json",
|
||||
skipFrames: 99,
|
||||
skipTime: 3e3,
|
||||
skipTime: 3 * timeFact,
|
||||
minConfidence: 0.1
|
||||
},
|
||||
antispoof: {
|
||||
enabled: false,
|
||||
skipFrames: 99,
|
||||
skipTime: 4e3,
|
||||
skipTime: 4 * timeFact,
|
||||
modelPath: "antispoof.json"
|
||||
}
|
||||
},
|
||||
|
@ -225,13 +226,13 @@ var config = {
|
|||
maxDetected: -1,
|
||||
minConfidence: 0.3,
|
||||
skipFrames: 1,
|
||||
skipTime: 200
|
||||
skipTime: 0.2 * timeFact
|
||||
},
|
||||
hand: {
|
||||
enabled: true,
|
||||
rotation: true,
|
||||
skipFrames: 99,
|
||||
skipTime: 2e3,
|
||||
skipTime: 2 * timeFact,
|
||||
minConfidence: 0.5,
|
||||
iouThreshold: 0.2,
|
||||
maxDetected: -1,
|
||||
|
@ -250,7 +251,7 @@ var config = {
|
|||
iouThreshold: 0.4,
|
||||
maxDetected: 10,
|
||||
skipFrames: 99,
|
||||
skipTime: 1e3
|
||||
skipTime: 1 * timeFact
|
||||
},
|
||||
segmentation: {
|
||||
enabled: false,
|
||||
|
@ -11872,18 +11873,18 @@ function calc2(newResult, config3) {
|
|||
function distance(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
let sum2 = 0;
|
||||
for (let i = 0; i < descriptor1.length; i++) {
|
||||
const diff = options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
const diff = !options3.order || options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += !options3.order || options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
}
|
||||
return (options3.multiplier || 20) * sum2;
|
||||
}
|
||||
function similarity(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
const dist = distance(descriptor1, descriptor2, options3);
|
||||
const root = options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const root = !options3.order || options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const invert = Math.max(0, 100 - root) / 100;
|
||||
return invert;
|
||||
}
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, multiplier: 20 }) {
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, multiplier: 20, threshold: 0 }) {
|
||||
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) {
|
||||
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
|
||||
}
|
||||
|
@ -11895,10 +11896,10 @@ function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, mu
|
|||
best = res;
|
||||
index = i;
|
||||
}
|
||||
if (best < options3.threshold)
|
||||
if (best < (options3.threshold || 0))
|
||||
break;
|
||||
}
|
||||
best = options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
best = !options3.order || options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
return { index, distance: best, similarity: Math.max(0, 100 - best) / 100 };
|
||||
}
|
||||
|
||||
|
@ -12922,7 +12923,7 @@ var Human = class {
|
|||
if (this.config.debug)
|
||||
log("configuration:", this.config);
|
||||
if (this.config.debug)
|
||||
log("tf flags:", this.tf.ENV.flags);
|
||||
log("tf flags:", this.tf.ENV["flags"]);
|
||||
}
|
||||
}
|
||||
await load15(this);
|
||||
|
|
|
@ -144,6 +144,7 @@ function mergeDeep(...objects) {
|
|||
}
|
||||
|
||||
// src/config.ts
|
||||
var timeFact = 1e3;
|
||||
var config = {
|
||||
backend: "",
|
||||
modelBasePath: "",
|
||||
|
@ -183,7 +184,7 @@ var config = {
|
|||
rotation: true,
|
||||
maxDetected: 1,
|
||||
skipFrames: 99,
|
||||
skipTime: 2500,
|
||||
skipTime: 2.5 * timeFact,
|
||||
minConfidence: 0.2,
|
||||
iouThreshold: 0.1,
|
||||
return: false
|
||||
|
@ -200,20 +201,20 @@ var config = {
|
|||
enabled: true,
|
||||
minConfidence: 0.1,
|
||||
skipFrames: 99,
|
||||
skipTime: 1500,
|
||||
skipTime: 1.5 * timeFact,
|
||||
modelPath: "emotion.json"
|
||||
},
|
||||
description: {
|
||||
enabled: true,
|
||||
modelPath: "faceres.json",
|
||||
skipFrames: 99,
|
||||
skipTime: 3e3,
|
||||
skipTime: 3 * timeFact,
|
||||
minConfidence: 0.1
|
||||
},
|
||||
antispoof: {
|
||||
enabled: false,
|
||||
skipFrames: 99,
|
||||
skipTime: 4e3,
|
||||
skipTime: 4 * timeFact,
|
||||
modelPath: "antispoof.json"
|
||||
}
|
||||
},
|
||||
|
@ -226,13 +227,13 @@ var config = {
|
|||
maxDetected: -1,
|
||||
minConfidence: 0.3,
|
||||
skipFrames: 1,
|
||||
skipTime: 200
|
||||
skipTime: 0.2 * timeFact
|
||||
},
|
||||
hand: {
|
||||
enabled: true,
|
||||
rotation: true,
|
||||
skipFrames: 99,
|
||||
skipTime: 2e3,
|
||||
skipTime: 2 * timeFact,
|
||||
minConfidence: 0.5,
|
||||
iouThreshold: 0.2,
|
||||
maxDetected: -1,
|
||||
|
@ -251,7 +252,7 @@ var config = {
|
|||
iouThreshold: 0.4,
|
||||
maxDetected: 10,
|
||||
skipFrames: 99,
|
||||
skipTime: 1e3
|
||||
skipTime: 1 * timeFact
|
||||
},
|
||||
segmentation: {
|
||||
enabled: false,
|
||||
|
@ -11873,18 +11874,18 @@ function calc2(newResult, config3) {
|
|||
function distance(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
let sum2 = 0;
|
||||
for (let i = 0; i < descriptor1.length; i++) {
|
||||
const diff = options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
const diff = !options3.order || options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += !options3.order || options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
}
|
||||
return (options3.multiplier || 20) * sum2;
|
||||
}
|
||||
function similarity(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
const dist = distance(descriptor1, descriptor2, options3);
|
||||
const root = options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const root = !options3.order || options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const invert = Math.max(0, 100 - root) / 100;
|
||||
return invert;
|
||||
}
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, multiplier: 20 }) {
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, multiplier: 20, threshold: 0 }) {
|
||||
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) {
|
||||
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
|
||||
}
|
||||
|
@ -11896,10 +11897,10 @@ function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, mu
|
|||
best = res;
|
||||
index = i;
|
||||
}
|
||||
if (best < options3.threshold)
|
||||
if (best < (options3.threshold || 0))
|
||||
break;
|
||||
}
|
||||
best = options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
best = !options3.order || options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
return { index, distance: best, similarity: Math.max(0, 100 - best) / 100 };
|
||||
}
|
||||
|
||||
|
@ -12923,7 +12924,7 @@ var Human = class {
|
|||
if (this.config.debug)
|
||||
log("configuration:", this.config);
|
||||
if (this.config.debug)
|
||||
log("tf flags:", this.tf.ENV.flags);
|
||||
log("tf flags:", this.tf.ENV["flags"]);
|
||||
}
|
||||
}
|
||||
await load15(this);
|
||||
|
|
|
@ -143,6 +143,7 @@ function mergeDeep(...objects) {
|
|||
}
|
||||
|
||||
// src/config.ts
|
||||
var timeFact = 1e3;
|
||||
var config = {
|
||||
backend: "",
|
||||
modelBasePath: "",
|
||||
|
@ -182,7 +183,7 @@ var config = {
|
|||
rotation: true,
|
||||
maxDetected: 1,
|
||||
skipFrames: 99,
|
||||
skipTime: 2500,
|
||||
skipTime: 2.5 * timeFact,
|
||||
minConfidence: 0.2,
|
||||
iouThreshold: 0.1,
|
||||
return: false
|
||||
|
@ -199,20 +200,20 @@ var config = {
|
|||
enabled: true,
|
||||
minConfidence: 0.1,
|
||||
skipFrames: 99,
|
||||
skipTime: 1500,
|
||||
skipTime: 1.5 * timeFact,
|
||||
modelPath: "emotion.json"
|
||||
},
|
||||
description: {
|
||||
enabled: true,
|
||||
modelPath: "faceres.json",
|
||||
skipFrames: 99,
|
||||
skipTime: 3e3,
|
||||
skipTime: 3 * timeFact,
|
||||
minConfidence: 0.1
|
||||
},
|
||||
antispoof: {
|
||||
enabled: false,
|
||||
skipFrames: 99,
|
||||
skipTime: 4e3,
|
||||
skipTime: 4 * timeFact,
|
||||
modelPath: "antispoof.json"
|
||||
}
|
||||
},
|
||||
|
@ -225,13 +226,13 @@ var config = {
|
|||
maxDetected: -1,
|
||||
minConfidence: 0.3,
|
||||
skipFrames: 1,
|
||||
skipTime: 200
|
||||
skipTime: 0.2 * timeFact
|
||||
},
|
||||
hand: {
|
||||
enabled: true,
|
||||
rotation: true,
|
||||
skipFrames: 99,
|
||||
skipTime: 2e3,
|
||||
skipTime: 2 * timeFact,
|
||||
minConfidence: 0.5,
|
||||
iouThreshold: 0.2,
|
||||
maxDetected: -1,
|
||||
|
@ -250,7 +251,7 @@ var config = {
|
|||
iouThreshold: 0.4,
|
||||
maxDetected: 10,
|
||||
skipFrames: 99,
|
||||
skipTime: 1e3
|
||||
skipTime: 1 * timeFact
|
||||
},
|
||||
segmentation: {
|
||||
enabled: false,
|
||||
|
@ -11872,18 +11873,18 @@ function calc2(newResult, config3) {
|
|||
function distance(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
let sum2 = 0;
|
||||
for (let i = 0; i < descriptor1.length; i++) {
|
||||
const diff = options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
const diff = !options3.order || options3.order === 2 ? descriptor1[i] - descriptor2[i] : Math.abs(descriptor1[i] - descriptor2[i]);
|
||||
sum2 += !options3.order || options3.order === 2 ? diff * diff : diff ** options3.order;
|
||||
}
|
||||
return (options3.multiplier || 20) * sum2;
|
||||
}
|
||||
function similarity(descriptor1, descriptor2, options3 = { order: 2, multiplier: 20 }) {
|
||||
const dist = distance(descriptor1, descriptor2, options3);
|
||||
const root = options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const root = !options3.order || options3.order === 2 ? Math.sqrt(dist) : dist ** (1 / options3.order);
|
||||
const invert = Math.max(0, 100 - root) / 100;
|
||||
return invert;
|
||||
}
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, multiplier: 20 }) {
|
||||
function match2(descriptor, descriptors, options3 = { order: 2, multiplier: 20, threshold: 0 }) {
|
||||
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) {
|
||||
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
|
||||
}
|
||||
|
@ -11895,10 +11896,10 @@ function match2(descriptor, descriptors, options3 = { order: 2, threshold: 0, mu
|
|||
best = res;
|
||||
index = i;
|
||||
}
|
||||
if (best < options3.threshold)
|
||||
if (best < (options3.threshold || 0))
|
||||
break;
|
||||
}
|
||||
best = options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
best = !options3.order || options3.order === 2 ? Math.sqrt(best) : best ** (1 / options3.order);
|
||||
return { index, distance: best, similarity: Math.max(0, 100 - best) / 100 };
|
||||
}
|
||||
|
||||
|
@ -12922,7 +12923,7 @@ var Human = class {
|
|||
if (this.config.debug)
|
||||
log("configuration:", this.config);
|
||||
if (this.config.debug)
|
||||
log("tf flags:", this.tf.ENV.flags);
|
||||
log("tf flags:", this.tf.ENV["flags"]);
|
||||
}
|
||||
}
|
||||
await load15(this);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -66,16 +66,18 @@
|
|||
"@tensorflow/tfjs-layers": "^3.10.0",
|
||||
"@tensorflow/tfjs-node": "^3.10.0",
|
||||
"@tensorflow/tfjs-node-gpu": "^3.10.0",
|
||||
"@types/node": "^16.11.5",
|
||||
"@types/node": "^16.11.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||
"@typescript-eslint/parser": "^5.2.0",
|
||||
"@vladmandic/build": "^0.6.3",
|
||||
"@vladmandic/pilogger": "^0.3.3",
|
||||
"canvas": "^2.8.0",
|
||||
"dayjs": "^1.10.7",
|
||||
"long": "^4.0.0",
|
||||
"esbuild": "^0.13.9",
|
||||
"eslint": "8.1.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-html": "^6.2.0",
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
|
@ -88,6 +90,5 @@
|
|||
"typescript": "4.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"long": "^4.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/** Face descriptor type as number array */
|
||||
export type Descriptor = Array<number>
|
||||
export type Options = { order?: number, threshold?: number, multiplier?: number } | undefined;
|
||||
|
||||
/** Calculates distance between two descriptors
|
||||
* @param {object} options
|
||||
|
@ -9,12 +10,12 @@ export type Descriptor = Array<number>
|
|||
* - default is 20 which normalizes results to similarity above 0.5 can be considered a match
|
||||
* @returns {number}
|
||||
*/
|
||||
export function distance(descriptor1: Descriptor, descriptor2: Descriptor, options = { order: 2, multiplier: 20 }) {
|
||||
export function distance(descriptor1: Descriptor, descriptor2: Descriptor, options: Options = { order: 2, multiplier: 20 }) {
|
||||
// general minkowski distance, euclidean distance is limited case where order is 2
|
||||
let sum = 0;
|
||||
for (let i = 0; i < descriptor1.length; i++) {
|
||||
const diff = (options.order === 2) ? (descriptor1[i] - descriptor2[i]) : (Math.abs(descriptor1[i] - descriptor2[i]));
|
||||
sum += (options.order === 2) ? (diff * diff) : (diff ** options.order);
|
||||
const diff = (!options.order || options.order === 2) ? (descriptor1[i] - descriptor2[i]) : (Math.abs(descriptor1[i] - descriptor2[i]));
|
||||
sum += (!options.order || options.order === 2) ? (diff * diff) : (diff ** options.order);
|
||||
}
|
||||
return (options.multiplier || 20) * sum;
|
||||
}
|
||||
|
@ -27,9 +28,9 @@ export function distance(descriptor1: Descriptor, descriptor2: Descriptor, optio
|
|||
* - default is 20 which normalizes results to similarity above 0.5 can be considered a match
|
||||
* @returns {number} similarity between two face descriptors normalized to 0..1 range where 0 is no similarity and 1 is perfect similarity
|
||||
*/
|
||||
export function similarity(descriptor1: Descriptor, descriptor2: Descriptor, options = { order: 2, multiplier: 20 }) {
|
||||
export function similarity(descriptor1: Descriptor, descriptor2: Descriptor, options: Options = { order: 2, multiplier: 20 }) {
|
||||
const dist = distance(descriptor1, descriptor2, options);
|
||||
const root = (options.order === 2) ? Math.sqrt(dist) : dist ** (1 / options.order);
|
||||
const root = (!options.order || options.order === 2) ? Math.sqrt(dist) : dist ** (1 / options.order);
|
||||
const invert = Math.max(0, 100 - root) / 100.0;
|
||||
return invert;
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ export function similarity(descriptor1: Descriptor, descriptor2: Descriptor, opt
|
|||
* - {@link distance} calculated `distance` of given descriptor to the best match
|
||||
* - {@link similarity} calculated normalized `similarity` of given descriptor to the best match
|
||||
*/
|
||||
export function match(descriptor: Descriptor, descriptors: Array<Descriptor>, options = { order: 2, threshold: 0, multiplier: 20 }) {
|
||||
export function match(descriptor: Descriptor, descriptors: Array<Descriptor>, options: Options = { order: 2, multiplier: 20, threshold: 0 }) {
|
||||
if (!Array.isArray(descriptor) || !Array.isArray(descriptors) || descriptor.length < 64 || descriptors.length === 0 || descriptor.length !== descriptors[0].length) { // validate input
|
||||
return { index: -1, distance: Number.POSITIVE_INFINITY, similarity: 0 };
|
||||
}
|
||||
|
@ -57,8 +58,8 @@ export function match(descriptor: Descriptor, descriptors: Array<Descriptor>, op
|
|||
best = res;
|
||||
index = i;
|
||||
}
|
||||
if (best < options.threshold) break;
|
||||
if (best < (options.threshold || 0)) break;
|
||||
}
|
||||
best = (options.order === 2) ? Math.sqrt(best) : best ** (1 / options.order);
|
||||
best = (!options.order || options.order === 2) ? Math.sqrt(best) : best ** (1 / options.order);
|
||||
return { index, distance: best, similarity: Math.max(0, 100 - best) / 100.0 };
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/* eslint-disable node/no-missing-import */
|
||||
|
||||
/*
|
||||
declare module '@vladmandic/human/dist/tfjs.esm' {
|
||||
export * from '@vladmandic/human/types/dist/tfjs.esm';
|
||||
}
|
||||
*/
|
||||
|
||||
declare module '@vladmandic/human/dist/human.esm' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human.esm-nobundle' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human.node' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human.node-gpu' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human.node-wasm' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human.custom.esm' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
||||
|
||||
declare module '@vladmandic/human/dist/human.custom.esm' {
|
||||
export * from '@vladmandic/human/types/src/human';
|
||||
}
|
|
@ -212,7 +212,7 @@ export class Human {
|
|||
}
|
||||
|
||||
/** Validate current configuration schema */
|
||||
public validate(userConfig?: Partial<Config>) {
|
||||
validate(userConfig?: Partial<Config>) {
|
||||
return validate(defaults, userConfig || this.config);
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ export class Human {
|
|||
await tf.ready();
|
||||
if (this.env.browser) {
|
||||
if (this.config.debug) log('configuration:', this.config);
|
||||
if (this.config.debug) log('tf flags:', this.tf.ENV.flags);
|
||||
if (this.config.debug) log('tf flags:', this.tf.ENV['flags']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
debug: true,
|
||||
cacheSensitivity: 0,
|
||||
object: { enabled: true },
|
||||
}
|
||||
};
|
||||
|
||||
const backends = ['wasm', 'webgl', 'humangl', 'webgpu'];
|
||||
|
||||
|
@ -55,7 +55,8 @@
|
|||
const dt = new Date();
|
||||
const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;
|
||||
const elap = (dt - last).toString().padStart(5, '0');
|
||||
document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms' + ' ' + str(...msgs);
|
||||
document.getElementById('log').innerHTML += ts + ' +' + elap + 'ms  ' + str(...msgs);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(ts, elap, ...msgs);
|
||||
last = dt;
|
||||
}
|
||||
|
@ -63,7 +64,7 @@
|
|||
async function image(url) {
|
||||
const el = document.createElement('img');
|
||||
el.id = 'image';
|
||||
const loaded = new Promise((resolve) => { el.onload = () => resolve(true) });
|
||||
const loaded = new Promise((resolve) => { el.onload = () => resolve(true); });
|
||||
el.src = url;
|
||||
await loaded;
|
||||
return el;
|
||||
|
@ -88,7 +89,7 @@
|
|||
async function main() {
|
||||
log('human tests');
|
||||
let res;
|
||||
let human = new Human(config);
|
||||
const human = new Human(config);
|
||||
await human.init();
|
||||
human.events.addEventListener('warmup', () => events('warmup'));
|
||||
human.events.addEventListener('image', () => events('image'));
|
||||
|
@ -110,7 +111,7 @@
|
|||
log({ memory: human.tf.memory() });
|
||||
res = await human.validate();
|
||||
log({ validate: res });
|
||||
res = await human.warmup({ warmup: 'face'});
|
||||
res = await human.warmup({ warmup: 'face' });
|
||||
draw(res.canvas);
|
||||
log({ warmup: 'face' });
|
||||
let img = await image('../../samples/in/ai-body.jpg');
|
||||
|
@ -119,11 +120,11 @@
|
|||
draw(res.canvas);
|
||||
res = await human.detect(input.tensor);
|
||||
log({ detect: true });
|
||||
const interpolated = human.next();
|
||||
human.next();
|
||||
log({ interpolated: true });
|
||||
const persons = res.persons;
|
||||
log({ persons: true });
|
||||
log({ summary: { persons: persons.length, face: res.face.length, body: res.body.length, hand: res.hand.length, object: res.object.length, gesture: res.gesture.length }});
|
||||
log({ summary: { persons: persons.length, face: res.face.length, body: res.body.length, hand: res.hand.length, object: res.object.length, gesture: res.gesture.length } });
|
||||
log({ performance: human.performance });
|
||||
human.tf.dispose(input.tensor);
|
||||
draw();
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
2021-10-25 13:20:16 [36mINFO: [39m @vladmandic/human version 2.4.1
|
||||
2021-10-25 13:20:16 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.10.0
|
||||
2021-10-25 13:20:16 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.4.1"}
|
||||
2021-10-25 13:20:16 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2021-10-25 13:20:16 [36mINFO: [39m Toolchain: {"build":"0.6.3","esbuild":"0.13.9","typescript":"4.4.4","typedoc":"0.22.7","eslint":"8.1.0"}
|
||||
2021-10-25 13:20:16 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1275}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":55,"inputBytes":524815,"outputBytes":438967}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1283}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":55,"inputBytes":524823,"outputBytes":438971}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1350}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":55,"inputBytes":524890,"outputBytes":439043}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1652}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2323,"outputBytes":973}
|
||||
2021-10-25 13:20:16 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":55,"inputBytes":524513,"outputBytes":440910}
|
||||
2021-10-25 13:20:17 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2572202,"outputBytes":2491625}
|
||||
2021-10-25 13:20:17 [35mSTATE:[39m Compile: {"name":"human/browser/esm/custom","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.custom.esm.js","files":55,"inputBytes":3015165,"outputBytes":1607407}
|
||||
2021-10-25 13:20:17 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":2323,"outputBytes":1155160}
|
||||
2021-10-25 13:20:18 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":55,"inputBytes":1678700,"outputBytes":1431091}
|
||||
2021-10-25 13:20:18 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":55,"inputBytes":1678700,"outputBytes":1879499}
|
||||
2021-10-25 13:20:29 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types","files":96}
|
||||
2021-10-25 13:20:34 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":48,"generated":true}
|
||||
2021-10-25 13:21:01 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":91,"errors":0,"warnings":0}
|
||||
2021-10-25 13:21:01 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2021-10-25 13:21:01 [36mINFO: [39m Done...
|
||||
2021-10-26 15:02:47 [36mINFO: [39m @vladmandic/human version 2.4.1
|
||||
2021-10-26 15:02:47 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v17.0.1
|
||||
2021-10-26 15:02:47 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"2.4.1"}
|
||||
2021-10-26 15:02:47 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2021-10-26 15:02:47 [36mINFO: [39m Toolchain: {"build":"0.6.3","esbuild":"0.13.9","typescript":"4.4.4","typedoc":"0.22.7","eslint":"8.1.0"}
|
||||
2021-10-26 15:02:47 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1275}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":55,"inputBytes":525089,"outputBytes":439140}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1283}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":55,"inputBytes":525097,"outputBytes":439144}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1350}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":55,"inputBytes":525164,"outputBytes":439216}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1652}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2323,"outputBytes":973}
|
||||
2021-10-26 15:02:47 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":55,"inputBytes":524787,"outputBytes":441083}
|
||||
2021-10-26 15:02:48 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":2323,"outputBytes":2411208}
|
||||
2021-10-26 15:02:48 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":55,"inputBytes":2935022,"outputBytes":1433161}
|
||||
2021-10-26 15:02:49 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":55,"inputBytes":2935022,"outputBytes":1433151}
|
||||
2021-10-26 15:02:49 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":2577343,"outputBytes":2496714}
|
||||
2021-10-26 15:02:49 [35mSTATE:[39m Compile: {"name":"human/browser/esm/custom","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.custom.esm.js","files":55,"inputBytes":3020528,"outputBytes":2941349}
|
||||
2021-10-26 15:03:08 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types","files":96}
|
||||
2021-10-26 15:03:15 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":48,"generated":true}
|
||||
2021-10-26 15:03:55 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":91,"errors":0,"warnings":0}
|
||||
2021-10-26 15:03:55 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2021-10-26 15:03:55 [36mINFO: [39m Done...
|
||||
|
|
1018
test/test.log
1018
test/test.log
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@
|
|||
"outDir": "types",
|
||||
"baseUrl": "./",
|
||||
"paths": { "tslib": ["./node_modules/tslib/tslib.d.ts"] },
|
||||
"lib": ["es2020", "dom", "webworker"],
|
||||
"allowJs": true,
|
||||
"allowSyntheticDefaultImports": false,
|
||||
"allowUnreachableCode": false,
|
||||
|
@ -50,7 +51,7 @@
|
|||
"tabSize": 2
|
||||
},
|
||||
"exclude": ["node_modules/", "types/", "tfjs/", "dist/"],
|
||||
"include": ["src"],
|
||||
"include": ["src", "types/human.d.ts"],
|
||||
"typedocOptions": {
|
||||
"externalPattern": ["node_modules/", "tfjs/"]
|
||||
}
|
||||
|
|
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
|
@ -216,7 +216,7 @@ export interface Config {
|
|||
/** {@link SegmentationConfig} */
|
||||
segmentation: Partial<SegmentationConfig>;
|
||||
}
|
||||
/** - [See all default Config values...](https://github.com/vladmandic/human/blob/main/src/config.ts#L250) */
|
||||
/** - [See all default Config values...](https://github.com/vladmandic/human/blob/main/src/config.ts#L252) */
|
||||
declare const config: Config;
|
||||
export { config as defaults };
|
||||
//# sourceMappingURL=config.d.ts.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,UAAU,EAAE,MAAM,CAAC;IACnB,yGAAyG;IACzG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAC;IACrB,mGAAmG;IACnG,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAe,SAAQ,aAAa;CAAG;AAExD,sCAAsC;AACtC,MAAM,WAAW,cAAe,SAAQ,aAAa;CAAG;AAExD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,+CAA+C;AAC/C,MAAM,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;IACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,2BAA2B;IAC3B,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAE9B,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3C;AAID,6GAA6G;AAC7G,QAAA,MAAM,MAAM,EAAE,MAmLb,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,CAAC"}
|
|
@ -1,5 +1,10 @@
|
|||
/** Face descriptor type as number array */
|
||||
export declare type Descriptor = Array<number>;
|
||||
export declare type Options = {
|
||||
order?: number;
|
||||
threshold?: number;
|
||||
multiplier?: number;
|
||||
} | undefined;
|
||||
/** Calculates distance between two descriptors
|
||||
* @param {object} options
|
||||
* @param {number} options.order algorithm to use
|
||||
|
@ -8,10 +13,7 @@ export declare type Descriptor = Array<number>;
|
|||
* - default is 20 which normalizes results to similarity above 0.5 can be considered a match
|
||||
* @returns {number}
|
||||
*/
|
||||
export declare function distance(descriptor1: Descriptor, descriptor2: Descriptor, options?: {
|
||||
order: number;
|
||||
multiplier: number;
|
||||
}): number;
|
||||
export declare function distance(descriptor1: Descriptor, descriptor2: Descriptor, options?: Options): number;
|
||||
/** Calculates normalized similarity between two face descriptors based on their `distance`
|
||||
* @param {object} options
|
||||
* @param {number} options.order algorithm to use
|
||||
|
@ -20,10 +22,7 @@ export declare function distance(descriptor1: Descriptor, descriptor2: Descripto
|
|||
* - default is 20 which normalizes results to similarity above 0.5 can be considered a match
|
||||
* @returns {number} similarity between two face descriptors normalized to 0..1 range where 0 is no similarity and 1 is perfect similarity
|
||||
*/
|
||||
export declare function similarity(descriptor1: Descriptor, descriptor2: Descriptor, options?: {
|
||||
order: number;
|
||||
multiplier: number;
|
||||
}): number;
|
||||
export declare function similarity(descriptor1: Descriptor, descriptor2: Descriptor, options?: Options): number;
|
||||
/** Matches given descriptor to a closest entry in array of descriptors
|
||||
* @param descriptor face descriptor
|
||||
* @param descriptors array of face descriptors to commpare given descriptor to
|
||||
|
@ -35,11 +34,7 @@ export declare function similarity(descriptor1: Descriptor, descriptor2: Descrip
|
|||
* - {@link distance} calculated `distance` of given descriptor to the best match
|
||||
* - {@link similarity} calculated normalized `similarity` of given descriptor to the best match
|
||||
*/
|
||||
export declare function match(descriptor: Descriptor, descriptors: Array<Descriptor>, options?: {
|
||||
order: number;
|
||||
threshold: number;
|
||||
multiplier: number;
|
||||
}): {
|
||||
export declare function match(descriptor: Descriptor, descriptors: Array<Descriptor>, options?: Options): {
|
||||
index: number;
|
||||
distance: number;
|
||||
similarity: number;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/face/match.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,oBAAY,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AAEtC;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO;;;CAA+B,UAQhH;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO;;;CAA+B,UAKlH;AAED;;;;;;;;;;EAUE;AACF,wBAAgB,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO;;;;CAA6C;;;;EAgBjI"}
|
||||
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../src/face/match.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,oBAAY,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;AACtC,oBAAY,OAAO,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC;AAE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