From 2dba5ceb5b2de881562eb8af501c6c566eb798c1 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 14 Jun 2021 08:16:10 -0400 Subject: [PATCH] reorganize demos --- CHANGELOG.md | 2 +- README.md | 8 ++++---- demo/{ => facematch}/facematch.js | 10 ++++++---- demo/{facematch-faces.json => facematch/faces.json} | 0 demo/{facematch.html => facematch/index.html} | 10 +++++----- demo/{ => nodejs}/node-multiprocess-worker.js | 2 +- demo/{ => nodejs}/node-multiprocess.js | 5 ++++- demo/{ => nodejs}/node-video.js | 4 ++-- demo/{ => nodejs}/node-webcam.js | 4 ++-- demo/{ => nodejs}/node.js | 2 +- package.json | 6 +++--- wiki | 2 +- 12 files changed, 30 insertions(+), 25 deletions(-) rename demo/{ => facematch}/facematch.js (96%) rename demo/{facematch-faces.json => facematch/faces.json} (100%) rename demo/{facematch.html => facematch/index.html} (84%) rename demo/{ => nodejs}/node-multiprocess-worker.js (95%) rename demo/{ => nodejs}/node-multiprocess.js (95%) rename demo/{ => nodejs}/node-video.js (94%) rename demo/{ => nodejs}/node-webcam.js (94%) rename demo/{ => nodejs}/node.js (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f9da4b6..b9eca3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Repository: **** ## Changelog -### **HEAD -> main** 2021/06/09 mandic00@live.com +### **HEAD -> main** 2021/06/11 mandic00@live.com - add body segmentation sample diff --git a/README.md b/README.md index a796b37e..4fc17a72 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) ap ## Demos - [**Main Application**](https://vladmandic.github.io/human/demo/index.html) -- [**Face Extraction, Description, Identification and Matching**](https://vladmandic.github.io/human/demo/facematch.html) -- [**Face Extraction and 3D Rendering**](https://vladmandic.github.io/human/demo/face3d.html) +- [**Face Extraction, Description, Identification and Matching**](https://vladmandic.github.io/human/demo/facematch/index.html) +- [**Face Extraction and 3D Rendering**](https://vladmandic.github.io/human/demo/face3d/index.html) - [**Details on Demo Applications**](https://github.com/vladmandic/human/wiki/Demos) ## Project pages @@ -134,14 +134,14 @@ All options as presented in the demo application... Extracts all faces from provided input images, sorts them by similarity to selected face and optionally matches detected face with database of known people to guess their names -> [demo/facematch.html](demo/facematch.html) +> [demo/facematch](demo/facematch/index.html) ![Face Matching](assets/screenshot-facematch.jpg)
**Face3D OpenGL Rendering:** -> [demo/face3d.html](demo/face3d.html) +> [demo/face3d](demo/face3d/index.html) ![Face Matching](assets/screenshot-face3d.jpg) diff --git a/demo/facematch.js b/demo/facematch/facematch.js similarity index 96% rename from demo/facematch.js rename to demo/facematch/facematch.js index cd4d2982..768bac56 100644 --- a/demo/facematch.js +++ b/demo/facematch/facematch.js @@ -6,13 +6,15 @@ * Demo for face descriptor analysis and face simmilarity analysis */ -import Human from '../dist/human.esm.js'; +import Human from '../../dist/human.esm.js'; const userConfig = { backend: 'wasm', async: false, warmup: 'none', debug: true, + modelBasePath: '../../models/', + wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.7.0/dist/', face: { enabled: true, detector: { rotation: true, return: true }, @@ -49,8 +51,8 @@ function log(...msg) { async function getFaceDB() { // download db with known faces try { - let res = await fetch('/demo/facematch-faces.json'); - if (!res || !res.ok) res = await fetch('/human/demo/facematch-faces.json'); + let res = await fetch('/demo/facematch/faces.json'); + if (!res || !res.ok) res = await fetch('/human/demo/facematch/faces.json'); db = (res && res.ok) ? await res.json() : []; for (const rec of db) { rec.embedding = rec.embedding.map((a) => parseFloat(a.toFixed(4))); @@ -147,7 +149,7 @@ async function process(index, image) { return new Promise((resolve) => { const img = new Image(128, 128); img.onload = () => { // must wait until image is loaded - human.detect(img).then(async (res) => { + human.detect(img, userConfig).then(async (res) => { await faces(index, res, image); // then wait until image is analyzed log('Add image:', index + 1, image, 'faces:', res.face.length); document.getElementById('images').appendChild(img); // and finally we can add it diff --git a/demo/facematch-faces.json b/demo/facematch/faces.json similarity index 100% rename from demo/facematch-faces.json rename to demo/facematch/faces.json diff --git a/demo/facematch.html b/demo/facematch/index.html similarity index 84% rename from demo/facematch.html rename to demo/facematch/index.html index e5eff3c1..38d33a27 100644 --- a/demo/facematch.html +++ b/demo/facematch/index.html @@ -9,12 +9,12 @@ - - - - + + + +