pull/134/head
Vladimir Mandic 2021-04-08 12:10:15 -04:00
parent 36ab82b7db
commit d75608c895
17 changed files with 885 additions and 868 deletions

View File

@ -1,6 +1,6 @@
# @vladmandic/human # @vladmandic/human
Version: **1.3.4** Version: **1.3.5**
Description: **Human: AI-powered 3D Face Detection, Face Description & Recognition, Body Pose Tracking, Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction & Gesture Recognition** Description: **Human: AI-powered 3D Face Detection, Face Description & Recognition, Body Pose Tracking, Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction & Gesture Recognition**
Author: **Vladimir Mandic <mandic00@live.com>** Author: **Vladimir Mandic <mandic00@live.com>**
@ -9,7 +9,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
## Changelog ## Changelog
### **HEAD -> main** 2021/04/06 mandic00@live.com ### **1.3.5** 2021/04/06 mandic00@live.com
- add dynamic viewport and fix web worker - add dynamic viewport and fix web worker
- add cdn links - add cdn links

View File

@ -11,6 +11,7 @@
<link rel="manifest" href="./manifest.webmanifest"> <link rel="manifest" href="./manifest.webmanifest">
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="../assets/icon.png"> <link rel="apple-touch-icon" href="../assets/icon.png">
<!-- <script src="../node_modules/@tensorflow/tfjs/dist/tf.es2017.js"></script> -->
<script src="./index.js" type="module"></script> <script src="./index.js" type="module"></script>
<style> <style>
@font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../assets/lato-light.woff2') } @font-face { font-family: 'Lato'; font-display: swap; font-style: normal; font-weight: 100; src: local('Lato'), url('../assets/lato-light.woff2') }

View File

@ -1,5 +1,6 @@
/* global tf */
import Human from '../dist/human.esm.js'; // equivalent of @vladmandic/human import Human from '../dist/human.esm.js'; // equivalent of @vladmandic/human
// import Human from '../src/human'; // import sources directly // import Human from '../dist/human.esm-nobundle.js'; // this requires that tf is loaded manually and bundled before human can be used
import Menu from './helpers/menu.js'; import Menu from './helpers/menu.js';
import GLBench from './helpers/gl-bench.js'; import GLBench from './helpers/gl-bench.js';
@ -28,8 +29,6 @@ const userConfig = {
}; };
*/ */
const human = new Human(userConfig);
// ui options // ui options
const ui = { const ui = {
baseBackground: 'rgba(50, 50, 50, 1)', // 'grey' baseBackground: 'rgba(50, 50, 50, 1)', // 'grey'
@ -90,6 +89,12 @@ function status(msg) {
if (div) div.innerText = msg; if (div) div.innerText = msg;
} }
const human = new Human(userConfig);
if (typeof tf !== 'undefined') {
log('TensorFlow external version:', tf.version);
human.tf = tf; // use externally loaded version of tfjs
}
const compare = { enabled: false, original: null }; const compare = { enabled: false, original: null };
async function calcSimmilariry(result) { async function calcSimmilariry(result) {
document.getElementById('compare-container').style.display = compare.enabled ? 'block' : 'none'; document.getElementById('compare-container').style.display = compare.enabled ? 'block' : 'none';
@ -190,7 +195,7 @@ async function setupCamera() {
if (ui.busy) return null; if (ui.busy) return null;
ui.busy = true; ui.busy = true;
const viewportScale = Math.min(1, Math.round(100 * window.outerWidth / 700) / 100); const viewportScale = Math.min(1, Math.round(100 * window.outerWidth / 700) / 100);
log('demo viewport scale:', viewportScale); // log('demo viewport scale:', viewportScale);
document.querySelector('meta[name=viewport]').setAttribute('content', `width=device-width, shrink-to-fit=no; initial-scale=${viewportScale}`); document.querySelector('meta[name=viewport]').setAttribute('content', `width=device-width, shrink-to-fit=no; initial-scale=${viewportScale}`);
const video = document.getElementById('video'); const video = document.getElementById('video');
const canvas = document.getElementById('canvas'); const canvas = document.getElementById('canvas');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

574
dist/human.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

574
dist/human.js vendored

File diff suppressed because one or more lines are too long

6
dist/human.js.map vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

510
dist/tfjs.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -64,10 +64,10 @@
"@types/node": "^14.14.37", "@types/node": "^14.14.37",
"@typescript-eslint/eslint-plugin": "^4.21.0", "@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0", "@typescript-eslint/parser": "^4.21.0",
"@vladmandic/pilogger": "^0.2.15", "@vladmandic/pilogger": "^0.2.16",
"chokidar": "^3.5.1", "chokidar": "^3.5.1",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"esbuild": "^0.11.5", "esbuild": "^0.11.6",
"eslint": "^7.23.0", "eslint": "^7.23.0",
"eslint-config-airbnb-base": "^14.2.1", "eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
@ -79,6 +79,6 @@
"simple-git": "^2.37.0", "simple-git": "^2.37.0",
"tslib": "^2.2.0", "tslib": "^2.2.0",
"typedoc": "^0.20.35", "typedoc": "^0.20.35",
"typescript": "^4.2.3" "typescript": "^4.2.4"
} }
} }

View File

@ -223,7 +223,7 @@ async function build(f, msg, dev = false) {
for (const [targetGroupName, targetGroup] of Object.entries(targets)) { for (const [targetGroupName, targetGroup] of Object.entries(targets)) {
for (const [targetName, targetOptions] of Object.entries(targetGroup)) { for (const [targetName, targetOptions] of Object.entries(targetGroup)) {
// if triggered from watch mode, rebuild only browser bundle // if triggered from watch mode, rebuild only browser bundle
if ((require.main !== module) && ((targetGroupName === 'browserNoBundle') || (targetGroupName === 'nodeGPU'))) continue; // if ((require.main !== module) && ((targetGroupName === 'browserNoBundle') || (targetGroupName === 'nodeGPU'))) continue;
const meta = dev const meta = dev
// @ts-ignore // @ts-ignore
? await esbuild.build({ ...config.common, ...config.debug, ...targetOptions }) ? await esbuild.build({ ...config.common, ...config.debug, ...targetOptions })

View File

@ -1,13 +1,12 @@
// wrapper to load tfjs in a single place so version can be changed quickly // wrapper to load tfjs in a single place so version can be changed quickly
// simplified // simplified
// { modules: 1061, moduleBytes: 3772720, outputBytes: 1531035 } // { modules: 1250, moduleBytes: 4013323, imports: 7, importBytes: 2255, outputBytes: 2991826, outputFiles: 'dist/tfjs.esm.js' }
// export * from '@tensorflow/tfjs/dist/index.js'; // export * from '@tensorflow/tfjs/dist/index.js';
// export * from '@tensorflow/tfjs-backend-wasm'; // export * from '@tensorflow/tfjs-backend-wasm';
// modular // modular
// { modules: 1064, moduleBytes: 3793219, outputBytes: 1535600 } // { modules: 1253, moduleBytes: 4029357, imports: 7, importBytes: 2285, outputBytes: 2998298, outputFiles: 'dist/tfjs.esm.js' }
// get versions of all packages. // get versions of all packages.
import * as packageBundle from '@tensorflow/tfjs/package.json'; import * as packageBundle from '@tensorflow/tfjs/package.json';
@ -20,7 +19,7 @@ import { version_cpu } from '@tensorflow/tfjs-backend-cpu/dist/index.js';
import { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js'; import { version_webgl } from '@tensorflow/tfjs-backend-webgl/dist/index.js';
import { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js'; import { version_wasm } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
// export all // export all - compiled
export * from '@tensorflow/tfjs-core/dist/index.js'; export * from '@tensorflow/tfjs-core/dist/index.js';
export * from '@tensorflow/tfjs-layers/dist/index.js'; export * from '@tensorflow/tfjs-layers/dist/index.js';
export * from '@tensorflow/tfjs-converter/dist/index.js'; export * from '@tensorflow/tfjs-converter/dist/index.js';
@ -29,14 +28,26 @@ export * from '@tensorflow/tfjs-backend-cpu/dist/index.js';
export * from '@tensorflow/tfjs-backend-webgl/dist/index.js'; export * from '@tensorflow/tfjs-backend-webgl/dist/index.js';
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js'; export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
// export all - sources
/*
export * from '@tensorflow/tfjs-core/src/index';
export * from '@tensorflow/tfjs-layers/src/index';
export * from '@tensorflow/tfjs-converter/src/index';
export * as data from '@tensorflow/tfjs-data/src/index';
export * from '@tensorflow/tfjs-backend-cpu/src/index';
export * from '@tensorflow/tfjs-backend-webgl/src/index';
export * from '@tensorflow/tfjs-backend-wasm/src/index';
*/
// export versions // export versions
export const version = { export const version = {
tfjs: packageBundle.version, tfjs: packageBundle?.version || undefined,
'tfjs-core': packageCore.version, 'tfjs-core': packageCore?.version || undefined,
'tfjs-data': packageData.version, 'tfjs-data': packageData?.version || undefined,
'tfjs-layers': packageLayers.version, 'tfjs-layers': packageLayers?.version || undefined,
'tfjs-converter': packageConverter.version, 'tfjs-converter': packageConverter?.version || undefined,
'tfjs-backend-cpu': version_cpu, 'tfjs-backend-cpu': version_cpu || undefined,
'tfjs-backend-webgl': version_webgl, 'tfjs-backend-webgl': version_webgl || undefined,
'tfjs-backend-wasm': version_wasm, 'tfjs-backend-wasm': version_wasm || undefined,
}; };
// export const version = {};

2
wiki

@ -1 +1 @@
Subproject commit 2e665d7f322cfc79bae842c648feaffa668d883d Subproject commit eaf77ad8c8a91df6e63bee662062ff59a0ce987a