mirror of https://github.com/vladmandic/human
polish demos
parent
55efcafc0f
commit
daec8d4ba1
|
@ -9,8 +9,9 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2022/11/18 mandic00@live.com
|
||||
### **HEAD -> main** 2022/11/21 mandic00@live.com
|
||||
|
||||
- enforce markdown linting
|
||||
- cleanup git history
|
||||
- default empty result
|
||||
- refactor draw and models namespaces
|
||||
|
|
19
TODO.md
19
TODO.md
|
@ -51,9 +51,9 @@ No support for running in **web workers** as Safari still does not support `Offs
|
|||
|
||||
## Pending Release Changes
|
||||
|
||||
Optimizations:
|
||||
Optimizations:
|
||||
- Enabled high-resolution optimizations
|
||||
Internal limits are increased from **2k** to **4k**
|
||||
Internal limits are increased from **2k** to **4k**
|
||||
- Enhanced device capabilities detection
|
||||
See `human.env.[agent, wasm, webgl, webgpu]` for details
|
||||
- If `config.backend` is not set, Human will auto-select best backend
|
||||
|
@ -62,15 +62,16 @@ Optimizations:
|
|||
- Reduce build dependencies
|
||||
`Human` is now 30% smaller :)
|
||||
As usual, `Human` has **zero** runtime dependencies,
|
||||
all *devDependencies* are only to rebuild `Human` itself
|
||||
all *devDependencies* are only to rebuild `Human` itself
|
||||
- Default hand skeleton model changed from `handlandmark-full` to `handlandmark-lite`
|
||||
Both models are still supported, this reduces default size and increases performance
|
||||
|
||||
Features:
|
||||
Features:
|
||||
- Add [draw label templates](https://github.com/vladmandic/human/wiki/Draw)
|
||||
- Add `config.filter.autoBrightness` (*enabled by default*)
|
||||
Per-frame video on-the-fly brightness adjustments
|
||||
Which significantly increases performance and precision in poorly lit scenes
|
||||
- Add new demo [face detect]((https://vladmandic.github.io/human/demo/facedetect/index.html))
|
||||
- Improved `config.filter.equalization` (*disabled by default*)
|
||||
Image and video on-demand histogram equalization
|
||||
- Support selecting specific video source when multiple cameras are present
|
||||
|
@ -78,7 +79,7 @@ Features:
|
|||
- Updated algorithm to determine distance from camera based on iris size
|
||||
See `human.result.face[n].distance`
|
||||
|
||||
Architecture:
|
||||
Architecture:
|
||||
- Upgrade to **TFJS 4.1** with **strong typing**
|
||||
see [notes](https://github.com/vladmandic/human#typedefs) on how to use
|
||||
- `TypeDef` refactoring
|
||||
|
@ -87,14 +88,14 @@ Architecture:
|
|||
- Repack external typedefs
|
||||
Removes all external typedef dependencies
|
||||
- Refactor namespace exports
|
||||
Better [TypeDoc specs](https://vladmandic.github.io/human/typedoc/index.html)
|
||||
Better [TypeDoc specs](https://vladmandic.github.io/human/typedoc/index.html)
|
||||
- Add named export for improved bundler support when using non-default imports
|
||||
- Cleanup Git history for `dist`/`typedef`/`types`
|
||||
- Cleanup `@vladmandic/human-models`
|
||||
- Cleanup Git history for `dist`/`typedef`/`types`
|
||||
- Cleanup `@vladmandic/human-models`
|
||||
- Support for **NodeJS v19**
|
||||
- Upgrade to **TypeScript 4.9**
|
||||
|
||||
Breaking changes:
|
||||
Breaking changes:
|
||||
- Replaced `result.face[n].iris` with `result.face[n].distance`
|
||||
- Replaced `human.getModelStats()` with `human.models.stats()`
|
||||
- Moved `human.similarity`, `human.distance` and `human.match` to namespace `human.match.*`
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 70 KiB |
|
@ -6,7 +6,8 @@
|
|||
|
||||
/** @type {Human} */
|
||||
import { Human } from '../../dist/human.esm.js';
|
||||
import { showLoader, hideLoader } from './loader.js';
|
||||
|
||||
let loader;
|
||||
|
||||
const humanConfig = { // user configuration for human, used to fine-tune behavior
|
||||
debug: true,
|
||||
|
@ -30,29 +31,83 @@ const humanConfig = { // user configuration for human, used to fine-tune behavio
|
|||
|
||||
const human = new Human(humanConfig); // new instance of human
|
||||
|
||||
export const showLoader = (msg) => { loader.setAttribute('msg', msg); loader.style.display = 'block'; };
|
||||
export const hideLoader = () => loader.style.display = 'none';
|
||||
|
||||
class ComponentLoader extends HTMLElement { // watch for attributes
|
||||
message = document.createElement('div');
|
||||
|
||||
static get observedAttributes() { return ['msg']; }
|
||||
|
||||
attributeChangedCallback(_name, _prevVal, currVal) {
|
||||
this.message.innerHTML = currVal;
|
||||
}
|
||||
|
||||
connectedCallback() { // triggered on insert
|
||||
this.attachShadow({ mode: 'open' });
|
||||
const css = document.createElement('style');
|
||||
css.innerHTML = `
|
||||
.loader-container { top: 450px; justify-content: center; position: fixed; width: 100%; }
|
||||
.loader-message { font-size: 1.5rem; padding: 1rem; }
|
||||
.loader { width: 300px; height: 300px; border: 3px solid transparent; border-radius: 50%; border-top: 4px solid #f15e41; animation: spin 4s linear infinite; position: relative; }
|
||||
.loader::before, .loader::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 6px; right: 6px; border-radius: 50%; border: 4px solid transparent; }
|
||||
.loader::before { border-top-color: #bad375; animation: 3s spin linear infinite; }
|
||||
.loader::after { border-top-color: #26a9e0; animation: spin 1.5s linear infinite; }
|
||||
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
||||
`;
|
||||
const container = document.createElement('div');
|
||||
container.id = 'loader-container';
|
||||
container.className = 'loader-container';
|
||||
loader = document.createElement('div');
|
||||
loader.id = 'loader';
|
||||
loader.className = 'loader';
|
||||
this.message.id = 'loader-message';
|
||||
this.message.className = 'loader-message';
|
||||
this.message.innerHTML = '';
|
||||
container.appendChild(this.message);
|
||||
container.appendChild(loader);
|
||||
this.shadowRoot?.append(css, container);
|
||||
loader = this; // eslint-disable-line @typescript-eslint/no-this-alias
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('component-loader', ComponentLoader);
|
||||
|
||||
function addFace(face, source) {
|
||||
const deg = (rad) => Math.round((rad || 0) * 180 / Math.PI);
|
||||
const canvas = document.createElement('canvas');
|
||||
const emotion = face.emotion?.map((e) => `${Math.round(100 * e.score)}% ${e.emotion}`) || [];
|
||||
const rotation = `pitch ${deg(face.rotation?.angle.pitch)}° | roll ${deg(face.rotation?.angle.roll)}° | yaw ${deg(face.rotation?.angle.yaw)}°`;
|
||||
const gaze = `direction ${deg(face.rotation?.gaze.bearing)}° strength ${Math.round(100 * (face.rotation.gaze.strength || 0))}%`;
|
||||
canvas.title = `
|
||||
source: ${source}
|
||||
score: ${Math.round(100 * face.boxScore)}% detection ${Math.round(100 * face.faceScore)}% analysis
|
||||
age: ${face.age} years | gender: ${face.gender} score ${Math.round(100 * face.genderScore)}%
|
||||
emotion: ${emotion.join(' | ')}
|
||||
head rotation: ${rotation}
|
||||
eyes gaze: ${gaze}
|
||||
camera distance: ${face.distance}m | ${Math.round(100 * face.distance / 2.54)}in
|
||||
check: ${Math.round(100 * face.real)}% real ${Math.round(100 * face.live)}% live
|
||||
`.replace(/ /g, ' ');
|
||||
canvas.onclick = (e) => {
|
||||
e.preventDefault();
|
||||
document.getElementById('description').innerHTML = canvas.title;
|
||||
};
|
||||
human.tf.browser.toPixels(face.tensor, canvas);
|
||||
human.tf.dispose(face.tensor);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
async function addFaces(imgEl) {
|
||||
showLoader('human: busy');
|
||||
const faceEl = document.getElementById('faces');
|
||||
faceEl.innerHTML = '';
|
||||
const res = await human.detect(imgEl);
|
||||
console.log(res); // eslint-disable-line no-console
|
||||
document.getElementById('description').innerHTML = `detected ${res.face.length} faces`;
|
||||
for (const face of res.face) {
|
||||
const canvas = document.createElement('canvas');
|
||||
const emotion = face.emotion?.map((e) => `${Math.round(100 * e.score)}% ${e.emotion}`) || [];
|
||||
canvas.title = `
|
||||
source: ${imgEl.src.substring(0, 64)}
|
||||
score: ${Math.round(100 * face.boxScore)}% detection ${Math.round(100 * face.faceScore)}% analysis
|
||||
age: ${face.age} years
|
||||
gender: ${face.gender} score ${Math.round(100 * face.genderScore)}%
|
||||
emotion: ${emotion.join(' | ')}
|
||||
check: ${Math.round(100 * face.real)}% real ${Math.round(100 * face.live)}% live
|
||||
`.replace(/ /g, ' ');
|
||||
canvas.onclick = (e) => {
|
||||
e.preventDefault();
|
||||
document.getElementById('description').innerHTML = canvas.title;
|
||||
};
|
||||
human.tf.browser.toPixels(face.tensor, canvas);
|
||||
human.tf.dispose(face.tensor);
|
||||
faceEl?.appendChild(canvas);
|
||||
const canvas = addFace(face, imgEl.src.substring(0, 64));
|
||||
faceEl.appendChild(canvas);
|
||||
}
|
||||
hideLoader();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<script src="./facedetect.js" type="module"></script>
|
||||
<style>
|
||||
img { object-fit: contain; }
|
||||
img:hover { filter: grayscale(1); transform: scale(1.08); transition : all 0.3s ease; }
|
||||
@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: 24px; font-variant: small-caps; }
|
||||
body { margin: 24px; background: black; color: white; overflow: hidden; text-align: -webkit-center; width: 100vw; height: 100vh; }
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
let loader;
|
||||
|
||||
export const showLoader = (msg) => { loader.setAttribute('msg', msg); loader.style.display = 'block'; };
|
||||
export const hideLoader = () => loader.style.display = 'none';
|
||||
|
||||
class ComponentLoader extends HTMLElement { // watch for attributes
|
||||
message = document.createElement('div');
|
||||
|
||||
static get observedAttributes() { return ['msg']; }
|
||||
|
||||
attributeChangedCallback(_name, _prevVal, currVal) {
|
||||
this.message.innerHTML = currVal;
|
||||
}
|
||||
|
||||
connectedCallback() { // triggered on insert
|
||||
this.attachShadow({ mode: 'open' });
|
||||
const css = document.createElement('style');
|
||||
css.innerHTML = `
|
||||
.loader-container { top: 450px; justify-content: center; position: fixed; width: 100%; }
|
||||
.loader-message { font-size: 1.5rem; padding: 1rem; }
|
||||
.loader { width: 300px; height: 300px; border: 3px solid transparent; border-radius: 50%; border-top: 4px solid #f15e41; animation: spin 4s linear infinite; position: relative; }
|
||||
.loader::before, .loader::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 6px; right: 6px; border-radius: 50%; border: 4px solid transparent; }
|
||||
.loader::before { border-top-color: #bad375; animation: 3s spin linear infinite; }
|
||||
.loader::after { border-top-color: #26a9e0; animation: spin 1.5s linear infinite; }
|
||||
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
||||
`;
|
||||
const container = document.createElement('div');
|
||||
container.id = 'loader-container';
|
||||
container.className = 'loader-container';
|
||||
loader = document.createElement('div');
|
||||
loader.id = 'loader';
|
||||
loader.className = 'loader';
|
||||
this.message.id = 'loader-message';
|
||||
this.message.className = 'loader-message';
|
||||
this.message.innerHTML = '';
|
||||
container.appendChild(this.message);
|
||||
container.appendChild(loader);
|
||||
this.shadowRoot?.append(css, container);
|
||||
loader = this;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('component-loader', ComponentLoader);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,100 +4,6 @@
|
|||
author: <https://github.com/vladmandic>'
|
||||
*/
|
||||
|
||||
|
||||
// demo/typescript/index.ts
|
||||
import * as H from "../../dist/human.esm.js";
|
||||
var width = 1920;
|
||||
var humanConfig = {
|
||||
modelBasePath: "../../models",
|
||||
filter: { enabled: true, equalization: false, flip: false, width },
|
||||
face: { enabled: true, detector: { rotation: true }, mesh: { enabled: true }, attention: { enabled: false }, iris: { enabled: true }, description: { enabled: true }, emotion: { enabled: true }, antispoof: { enabled: true }, liveness: { enabled: true } },
|
||||
body: { enabled: true },
|
||||
hand: { enabled: false },
|
||||
object: { enabled: false },
|
||||
segmentation: { enabled: false },
|
||||
gesture: { enabled: true }
|
||||
};
|
||||
var human = new H.Human(humanConfig);
|
||||
human.env.perfadd = false;
|
||||
human.draw.options.font = 'small-caps 18px "Lato"';
|
||||
human.draw.options.lineHeight = 20;
|
||||
var dom = {
|
||||
video: document.getElementById("video"),
|
||||
canvas: document.getElementById("canvas"),
|
||||
log: document.getElementById("log"),
|
||||
fps: document.getElementById("status"),
|
||||
perf: document.getElementById("performance")
|
||||
};
|
||||
var timestamp = { detect: 0, draw: 0, tensors: 0, start: 0 };
|
||||
var fps = { detectFPS: 0, drawFPS: 0, frames: 0, averageMs: 0 };
|
||||
var log = (...msg) => {
|
||||
dom.log.innerText += msg.join(" ") + "\n";
|
||||
console.log(...msg);
|
||||
};
|
||||
var status = (msg) => dom.fps.innerText = msg;
|
||||
var perf = (msg) => dom.perf.innerText = "tensors:" + human.tf.memory().numTensors.toString() + " | performance: " + JSON.stringify(msg).replace(/"|{|}/g, "").replace(/,/g, " | ");
|
||||
async function detectionLoop() {
|
||||
if (!dom.video.paused) {
|
||||
if (timestamp.start === 0)
|
||||
timestamp.start = human.now();
|
||||
await human.detect(dom.video);
|
||||
const tensors = human.tf.memory().numTensors;
|
||||
if (tensors - timestamp.tensors !== 0)
|
||||
log("allocated tensors:", tensors - timestamp.tensors);
|
||||
timestamp.tensors = tensors;
|
||||
fps.detectFPS = Math.round(1e3 * 1e3 / (human.now() - timestamp.detect)) / 1e3;
|
||||
fps.frames++;
|
||||
fps.averageMs = Math.round(1e3 * (human.now() - timestamp.start) / fps.frames) / 1e3;
|
||||
if (fps.frames % 100 === 0 && !dom.video.paused)
|
||||
log("performance", { ...fps, tensors: timestamp.tensors });
|
||||
}
|
||||
timestamp.detect = human.now();
|
||||
requestAnimationFrame(detectionLoop);
|
||||
}
|
||||
async function drawLoop() {
|
||||
var _a, _b, _c;
|
||||
if (!dom.video.paused) {
|
||||
const interpolated = human.next(human.result);
|
||||
const processed = await human.image(dom.video);
|
||||
human.draw.canvas(processed.canvas, dom.canvas);
|
||||
const opt = { bodyLabels: `person confidence [score] and ${(_c = (_b = (_a = human.result) == null ? void 0 : _a.body) == null ? void 0 : _b[0]) == null ? void 0 : _c.keypoints.length} keypoints` };
|
||||
await human.draw.all(dom.canvas, interpolated, opt);
|
||||
perf(interpolated.performance);
|
||||
}
|
||||
const now = human.now();
|
||||
fps.drawFPS = Math.round(1e3 * 1e3 / (now - timestamp.draw)) / 1e3;
|
||||
timestamp.draw = now;
|
||||
status(dom.video.paused ? "paused" : `fps: ${fps.detectFPS.toFixed(1).padStart(5, " ")} detect | ${fps.drawFPS.toFixed(1).padStart(5, " ")} draw`);
|
||||
setTimeout(drawLoop, 30);
|
||||
}
|
||||
async function webCam() {
|
||||
const devices = await human.webcam.enumerate();
|
||||
const id = devices[0].deviceId;
|
||||
await human.webcam.start({ element: dom.video, crop: true, width, id });
|
||||
dom.canvas.width = human.webcam.width;
|
||||
dom.canvas.height = human.webcam.height;
|
||||
dom.canvas.onclick = async () => {
|
||||
if (human.webcam.paused)
|
||||
await human.webcam.play();
|
||||
else
|
||||
human.webcam.pause();
|
||||
};
|
||||
}
|
||||
async function main() {
|
||||
log("human version:", human.version, "| tfjs version:", human.tf.version["tfjs-core"]);
|
||||
log("platform:", human.env.platform, "| agent:", human.env.agent);
|
||||
status("loading...");
|
||||
await human.load();
|
||||
log("backend:", human.tf.getBackend(), "| available:", human.env.backends);
|
||||
log("models stats:", human.models.stats());
|
||||
log("models loaded:", human.models.loaded());
|
||||
log("environment", human.env);
|
||||
status("initializing...");
|
||||
await human.warmup();
|
||||
await webCam();
|
||||
await detectionLoop();
|
||||
await drawLoop();
|
||||
}
|
||||
window.onload = main;
|
||||
import*as m from"../../dist/human.esm.js";var f=1920,b={modelBasePath:"../../models",filter:{enabled:!0,equalization:!1,flip:!1,width:f},face:{enabled:!0,detector:{rotation:!0},mesh:{enabled:!0},attention:{enabled:!1},iris:{enabled:!0},description:{enabled:!0},emotion:{enabled:!0},antispoof:{enabled:!0},liveness:{enabled:!0}},body:{enabled:!0},hand:{enabled:!1},object:{enabled:!1},segmentation:{enabled:!1},gesture:{enabled:!0}},e=new m.Human(b);e.env.perfadd=!1;e.draw.options.font='small-caps 18px "Lato"';e.draw.options.lineHeight=20;var a={video:document.getElementById("video"),canvas:document.getElementById("canvas"),log:document.getElementById("log"),fps:document.getElementById("status"),perf:document.getElementById("performance")},n={detect:0,draw:0,tensors:0,start:0},s={detectFPS:0,drawFPS:0,frames:0,averageMs:0},o=(...t)=>{a.log.innerText+=t.join(" ")+`
|
||||
`,console.log(...t)},r=t=>a.fps.innerText=t,g=t=>a.perf.innerText="tensors:"+e.tf.memory().numTensors.toString()+" | performance: "+JSON.stringify(t).replace(/"|{|}/g,"").replace(/,/g," | ");async function u(){if(!a.video.paused){n.start===0&&(n.start=e.now()),await e.detect(a.video);let t=e.tf.memory().numTensors;t-n.tensors!==0&&o("allocated tensors:",t-n.tensors),n.tensors=t,s.detectFPS=Math.round(1e3*1e3/(e.now()-n.detect))/1e3,s.frames++,s.averageMs=Math.round(1e3*(e.now()-n.start)/s.frames)/1e3,s.frames%100===0&&!a.video.paused&&o("performance",{...s,tensors:n.tensors})}n.detect=e.now(),requestAnimationFrame(u)}async function p(){var d,i,c;if(!a.video.paused){let l=e.next(e.result),w=await e.image(a.video);e.draw.canvas(w.canvas,a.canvas);let v={bodyLabels:`person confidence [score] and ${(c=(i=(d=e.result)==null?void 0:d.body)==null?void 0:i[0])==null?void 0:c.keypoints.length} keypoints`};await e.draw.all(a.canvas,l,v),g(l.performance)}let t=e.now();s.drawFPS=Math.round(1e3*1e3/(t-n.draw))/1e3,n.draw=t,r(a.video.paused?"paused":`fps: ${s.detectFPS.toFixed(1).padStart(5," ")} detect | ${s.drawFPS.toFixed(1).padStart(5," ")} draw`),setTimeout(p,30)}async function y(){let d=(await e.webcam.enumerate())[0].deviceId;await e.webcam.start({element:a.video,crop:!0,width:f,id:d}),a.canvas.width=e.webcam.width,a.canvas.height=e.webcam.height,a.canvas.onclick=async()=>{e.webcam.paused?await e.webcam.play():e.webcam.pause()}}async function h(){o("human version:",e.version,"| tfjs version:",e.tf.version["tfjs-core"]),o("platform:",e.env.platform,"| agent:",e.env.agent),r("loading..."),await e.load(),o("backend:",e.tf.getBackend(),"| available:",e.env.backends),o("models stats:",e.models.stats()),o("models loaded:",e.models.loaded()),o("environment",e.env),r("initializing..."),await e.warmup(),await y(),await u(),await p()}window.onload=h;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
|
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 it is too large
Load Diff
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,35 +4,4 @@
|
|||
author: <https://github.com/vladmandic>'
|
||||
*/
|
||||
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-core@4.1.0/node_modules/@tensorflow/tfjs-core/package.json
|
||||
var version = "4.1.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-converter@4.1.0_npjwttp6o2hhjgfcmiedqvkgoa/node_modules/@tensorflow/tfjs-converter/package.json
|
||||
var version2 = "4.1.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-cpu@4.1.0_npjwttp6o2hhjgfcmiedqvkgoa/node_modules/@tensorflow/tfjs-backend-cpu/package.json
|
||||
var version3 = "4.1.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-webgl@4.1.0_npjwttp6o2hhjgfcmiedqvkgoa/node_modules/@tensorflow/tfjs-backend-webgl/package.json
|
||||
var version4 = "4.1.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-wasm@4.1.0_npjwttp6o2hhjgfcmiedqvkgoa/node_modules/@tensorflow/tfjs-backend-wasm/package.json
|
||||
var version5 = "4.1.0";
|
||||
|
||||
// node_modules/.pnpm/@tensorflow+tfjs-backend-webgpu@0.0.1-alpha.16_npjwttp6o2hhjgfcmiedqvkgoa/node_modules/@tensorflow/tfjs-backend-webgpu/package.json
|
||||
var version6 = "0.0.1-alpha.16";
|
||||
|
||||
// tfjs/tf-version.ts
|
||||
var version7 = {
|
||||
tfjs: version,
|
||||
"tfjs-core": version,
|
||||
"tfjs-converter": version2,
|
||||
"tfjs-backend-cpu": version3,
|
||||
"tfjs-backend-webgl": version4,
|
||||
"tfjs-backend-wasm": version5,
|
||||
"tfjs-backend-webgpu": version6
|
||||
};
|
||||
export {
|
||||
version7 as version
|
||||
};
|
||||
var e="4.1.0";var s="4.1.0";var t="4.1.0";var n="4.1.0";var r="4.1.0";var i="0.0.1-alpha.16";var h={tfjs:e,"tfjs-core":e,"tfjs-converter":s,"tfjs-backend-cpu":t,"tfjs-backend-webgl":n,"tfjs-backend-wasm":r,"tfjs-backend-webgpu":i};export{h as version};
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"emotion": 820516,
|
||||
"facemesh": 1477958,
|
||||
"faceres": 6978814,
|
||||
"handlandmark-full": 5431368,
|
||||
"handlandmark-lite": 2023432,
|
||||
"handtrack": 2964837,
|
||||
"iris": 2599092,
|
||||
"liveness": 592976,
|
||||
|
@ -14,24 +14,22 @@
|
|||
"age": 161240,
|
||||
"blazeface-back": 538928,
|
||||
"blazeface-front": 402048,
|
||||
"blazepose-detector2d": 7499400,
|
||||
"blazepose-detector3d": 5928856,
|
||||
"blazepose-full": 6338290,
|
||||
"blazepose-heavy": 27501554,
|
||||
"blazepose-lite": 2725490,
|
||||
"blazepose-detector": 5928856,
|
||||
"blazepose-full": 6339202,
|
||||
"blazepose-heavy": 27502466,
|
||||
"blazepose-lite": 2726402,
|
||||
"efficientpose": 5651240,
|
||||
"faceboxes": 2013002,
|
||||
"facemesh-attention-alt": 2387598,
|
||||
"facemesh-attention-pinto": 2387598,
|
||||
"facemesh-attention": 2382414,
|
||||
"facemesh-detection-full": 1026192,
|
||||
"facemesh-detection-short": 201268,
|
||||
"facemesh-orig": 2955780,
|
||||
"faceres-deep": 13957620,
|
||||
"gear": 1498916,
|
||||
"gender-ssrnet-imdb": 161236,
|
||||
"gender": 201808,
|
||||
"handdetect": 3515612,
|
||||
"handlandmark-lite": 2023432,
|
||||
"handlandmark-full": 5431368,
|
||||
"handlandmark-sparse": 5286322,
|
||||
"handskeleton": 5502280,
|
||||
"meet": 372228,
|
||||
|
@ -43,7 +41,6 @@
|
|||
"posenet": 5032780,
|
||||
"rvm": 3739355,
|
||||
"selfie": 212886,
|
||||
"blazepose-detector": 5928856,
|
||||
"anti-spoofing": 853098,
|
||||
"efficientpose-i-lite": 2269064,
|
||||
"efficientpose-ii-lite": 5651240,
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
3233
test/build.log
3233
test/build.log
File diff suppressed because it is too large
Load Diff
|
@ -89,15 +89,16 @@ async function testInstance(human) {
|
|||
}
|
||||
log('state', 'tensors', human.tf.memory().numTensors);
|
||||
|
||||
if (human.models.models) {
|
||||
log('state', 'passed: load models');
|
||||
const keys = Object.keys(human.models.models);
|
||||
const loaded = human.models.loaded();
|
||||
log('state', ' result: defined models:', keys.length, 'loaded models:', loaded.length);
|
||||
const keys = Object.keys(human.models.models);
|
||||
const loaded = human.models.loaded();
|
||||
log('state', ' result: defined models:', keys.length, 'loaded models:', loaded.length);
|
||||
if (loaded.length > 10) {
|
||||
log('state', 'passed: load models', loaded.length);
|
||||
return true;
|
||||
} else {
|
||||
log('error', 'failed: load models', loaded.length);
|
||||
return false;
|
||||
}
|
||||
log('error', 'failed: load models');
|
||||
return false;
|
||||
}
|
||||
|
||||
async function testWarmup(human, title) {
|
||||
|
@ -295,7 +296,7 @@ async function test(Human, inputConfig) {
|
|||
await human.load();
|
||||
const models = human.models.list();
|
||||
const loaded = human.models.loaded();
|
||||
if (models.length === 24 && loaded.length === 11) log('state', 'passed: models loaded', models.length, loaded.length, models);
|
||||
if (loaded.length === 11) log('state', 'passed: models loaded', models.length, loaded.length, models);
|
||||
else log('error', 'failed: models loaded', models.length, loaded.length, models);
|
||||
log('info', 'memory:', { memory: human.tf.memory() });
|
||||
log('info', 'state:', { state: human.tf.engine().state });
|
||||
|
|
1995
test/test.log
1995
test/test.log
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -44,8 +44,7 @@
|
|||
</div></section>
|
||||
<section class="tsd-index-section">
|
||||
<h3 class="tsd-index-heading">Properties</h3>
|
||||
<div class="tsd-index-list"><a href="models.Models.html#instance" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-1024-path"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)" id="icon-1024-text"></path></svg><span>instance</span></a>
|
||||
<a href="models.Models.html#models" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg><span>models</span></a>
|
||||
<div class="tsd-index-list"><a href="models.Models.html#models" class="tsd-index-link tsd-kind-property tsd-parent-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="#FF984D" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12" id="icon-1024-path"></rect><path d="M9.354 16V7.24H12.174C12.99 7.24 13.638 7.476 14.118 7.948C14.606 8.412 14.85 9.036 14.85 9.82C14.85 10.604 14.606 11.232 14.118 11.704C13.638 12.168 12.99 12.4 12.174 12.4H10.434V16H9.354ZM10.434 11.428H12.174C12.646 11.428 13.022 11.284 13.302 10.996C13.59 10.7 13.734 10.308 13.734 9.82C13.734 9.324 13.59 8.932 13.302 8.644C13.022 8.356 12.646 8.212 12.174 8.212H10.434V11.428Z" fill="var(--color-text)" id="icon-1024-text"></path></svg><span>models</span></a>
|
||||
</div></section>
|
||||
<section class="tsd-index-section">
|
||||
<h3 class="tsd-index-heading">Methods</h3>
|
||||
|
@ -73,14 +72,9 @@
|
|||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L93">src/models.ts:93</a></li></ul></aside></li></ul></section></section>
|
||||
<section class="tsd-panel-group tsd-member-group">
|
||||
<h2>Properties</h2>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="instance" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>instance</span><a href="#instance" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">instance<span class="tsd-signature-symbol">:</span> <a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L90">src/models.ts:90</a></li></ul></aside></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="models" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>models</span><a href="#models" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<div class="tsd-signature">models<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="GraphModel.html" class="tsd-signature-type" data-tsd-kind="Class">GraphModel</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources">
|
||||
<div class="tsd-signature">models<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="GraphModel.html" class="tsd-signature-type" data-tsd-kind="Class">GraphModel</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">IOHandler</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = {}</span></div><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L91">src/models.ts:91</a></li></ul></aside></section></section>
|
||||
<section class="tsd-panel-group tsd-member-group">
|
||||
|
@ -92,12 +86,17 @@
|
|||
<li class="tsd-description">
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span><br/><span> </span>loaded<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span> </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span> </span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span> </span>url<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L163">src/models.ts:163</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L166">src/models.ts:166</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="load" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>load</span><a href="#load" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||
<li class="tsd-signature tsd-anchor-link" id="load.load-1">load<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#load.load-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-signature tsd-anchor-link" id="load.load-1">load<span class="tsd-signature-symbol">(</span>instance<span class="tsd-signature-symbol">?: </span><a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#load.load-1" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></li>
|
||||
<li class="tsd-description">
|
||||
<div class="tsd-parameters">
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameter-list">
|
||||
<li>
|
||||
<h5><code class="tsd-tag ts-flagOptional">Optional</code> instance: <a href="Human.html" class="tsd-signature-type" data-tsd-kind="Class">Human</a></h5></li></ul></div>
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L123">src/models.ts:123</a></li></ul></aside></li></ul></section>
|
||||
|
@ -108,7 +107,7 @@
|
|||
<li class="tsd-description">
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L174">src/models.ts:174</a></li></ul></aside></li></ul></section>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L177">src/models.ts:177</a></li></ul></aside></li></ul></section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="reset" class="tsd-anchor"></a>
|
||||
<h3 class="tsd-anchor-link"><span>reset</span><a href="#reset" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||
|
@ -132,7 +131,7 @@
|
|||
<li class="tsd-description">
|
||||
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span><br/><span> </span>missing<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">; </span><br/><span> </span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L180">src/models.ts:180</a></li></ul></aside></li></ul></section></section></div>
|
||||
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/models.ts#L183">src/models.ts:183</a></li></ul></aside></li></ul></section></section></div>
|
||||
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
||||
<div class="tsd-navigation settings">
|
||||
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
||||
|
@ -160,7 +159,6 @@
|
|||
<li class="current tsd-kind-class tsd-parent-kind-namespace"><a href="models.Models.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg><span>Models</span></a>
|
||||
<ul>
|
||||
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="models.Models.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-512-path"></use><use href="#icon-512-text"></use></svg>constructor</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class"><a href="models.Models.html#instance" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>instance</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-class"><a href="models.Models.html#models" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-1024-path"></use><use href="#icon-1024-text"></use></svg>models</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="models.Models.html#list" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>list</a></li>
|
||||
<li class="tsd-kind-method tsd-parent-kind-class"><a href="models.Models.html#load" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-2048-path"></use><use href="#icon-2048-text"></use></svg>load</a></li>
|
||||
|
|
|
@ -1954,12 +1954,12 @@ declare interface ModelPredictConfig {
|
|||
* - stats: live detailed model stats that can be checked during model load phase
|
||||
*/
|
||||
declare class Models {
|
||||
instance: Human;
|
||||
private instance;
|
||||
models: Record<string, null | GraphModel>;
|
||||
constructor(currentInstance: Human);
|
||||
stats(): ModelStats;
|
||||
reset(): void;
|
||||
load(): Promise<void>;
|
||||
load(instance?: Human): Promise<void>;
|
||||
list(): {
|
||||
name: string;
|
||||
loaded: boolean;
|
||||
|
|
Loading…
Reference in New Issue