update wasm to tfjs 3.7.0

pull/356/head
Vladimir Mandic 2021-06-06 12:58:06 -04:00
parent e65ea98bc3
commit ccad4a8c20
4 changed files with 23 additions and 13 deletions

View File

@ -11,6 +11,8 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
### **HEAD -> main** 2021/06/05 mandic00@live.com ### **HEAD -> main** 2021/06/05 mandic00@live.com
- modularize build platform
- enable body segmentation and background replacement in demo
- minor git corruption - minor git corruption
- unified build - unified build
- enable body segmentation and background replacement - enable body segmentation and background replacement

View File

@ -30,7 +30,7 @@ let human;
let userConfig = { let userConfig = {
warmup: 'none', warmup: 'none',
backend: 'humangl', backend: 'humangl',
wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.6.0/dist/', wasmPath: 'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.7.0/dist/',
/* /*
async: false, async: false,
cacheSensitivity: 0, cacheSensitivity: 0,
@ -255,7 +255,7 @@ async function drawResults(input) {
const processing = result.canvas ? `processing: ${result.canvas.width} x ${result.canvas.height}` : ''; const processing = result.canvas ? `processing: ${result.canvas.width} x ${result.canvas.height}` : '';
const avgDetect = ui.detectFPS.length > 0 ? Math.trunc(10 * ui.detectFPS.reduce((a, b) => a + b, 0) / ui.detectFPS.length) / 10 : 0; const avgDetect = ui.detectFPS.length > 0 ? Math.trunc(10 * ui.detectFPS.reduce((a, b) => a + b, 0) / ui.detectFPS.length) / 10 : 0;
const avgDraw = ui.drawFPS.length > 0 ? Math.trunc(10 * ui.drawFPS.reduce((a, b) => a + b, 0) / ui.drawFPS.length) / 10 : 0; const avgDraw = ui.drawFPS.length > 0 ? Math.trunc(10 * ui.drawFPS.reduce((a, b) => a + b, 0) / ui.drawFPS.length) / 10 : 0;
const warning = (ui.detectFPS.length > 5) && (avgDetect < 5) ? '<font color="lightcoral">warning: your performance is low: try switching to higher performance backend, lowering resolution or disabling some models</font>' : ''; const warning = (ui.detectFPS.length > 5) && (avgDetect < 2) ? '<font color="lightcoral">warning: your performance is low: try switching to higher performance backend, lowering resolution or disabling some models</font>' : '';
const fps = avgDetect > 0 ? `FPS process:${avgDetect} refresh:${avgDraw}` : ''; const fps = avgDetect > 0 ? `FPS process:${avgDetect} refresh:${avgDraw}` : '';
document.getElementById('log').innerHTML = ` document.getElementById('log').innerHTML = `
video: ${ui.camera.name} | facing: ${ui.camera.facing} | screen: ${window.innerWidth} x ${window.innerHeight} camera: ${ui.camera.width} x ${ui.camera.height} ${processing}<br> video: ${ui.camera.name} | facing: ${ui.camera.facing} | screen: ${window.innerWidth} x ${window.innerHeight} camera: ${ui.camera.width} x ${ui.camera.height} ${processing}<br>

View File

@ -2,15 +2,9 @@
* Creates tfjs bundle used by Human browser build target * Creates tfjs bundle used by Human browser build target
*/ */
// simplified // import from dist
// { modules: 1250, moduleBytes: 4013323, imports: 7, importBytes: 2255, outputBytes: 2991826, outputFiles: 'dist/tfjs.esm.js' } // modules: 1299, moduleBytes: 4230827, imports: 7, importBytes: 2478, outputBytes: 2357435
// export * from '@tensorflow/tfjs/dist/index.js'; // get versions of all packages
// export * from '@tensorflow/tfjs-backend-wasm';
// modular
// { modules: 1253, moduleBytes: 4029357, imports: 7, importBytes: 2285, outputBytes: 2998298, outputFiles: 'dist/tfjs.esm.js' }
// get versions of all packages.
import * as packageBundle from '@tensorflow/tfjs/package.json'; import * as packageBundle from '@tensorflow/tfjs/package.json';
import * as packageCore from '@tensorflow/tfjs-core/package.json'; import * as packageCore from '@tensorflow/tfjs-core/package.json';
import * as packageData from '@tensorflow/tfjs-data/package.json'; import * as packageData from '@tensorflow/tfjs-data/package.json';
@ -21,7 +15,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 - compiled // export all
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';
@ -30,8 +24,20 @@ 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 // import from src
// modules: 1681, moduleBytes: 5711239, imports: 7, importBytes: 2701, outputBytes: 2107830
// get versions of all packages
/* /*
import * as packageBundle from '@tensorflow/tfjs/package.json';
import * as packageCore from '@tensorflow/tfjs-core/package.json';
import * as packageData from '@tensorflow/tfjs-data/package.json';
import * as packageLayers from '@tensorflow/tfjs-layers/package.json';
import * as packageConverter from '@tensorflow/tfjs-converter/package.json';
import { version_cpu } from '@tensorflow/tfjs-backend-cpu/src/index';
import { version_webgl } from '@tensorflow/tfjs-backend-webgl/src/index';
import { version_wasm } from '@tensorflow/tfjs-backend-wasm/src/index';
// export all
export * from '@tensorflow/tfjs-core/src/index'; export * from '@tensorflow/tfjs-core/src/index';
export * from '@tensorflow/tfjs-layers/src/index'; export * from '@tensorflow/tfjs-layers/src/index';
export * from '@tensorflow/tfjs-converter/src/index'; export * from '@tensorflow/tfjs-converter/src/index';

View File

@ -50,6 +50,8 @@
"readme": "none", "readme": "none",
"out": "typedoc", "out": "typedoc",
"entryPoints": "src/human.ts", "entryPoints": "src/human.ts",
"exclude": ["**/node_modules/**"],
"externalPattern": ["**/node_modules/**"],
"logLevel": "Info", "logLevel": "Info",
"logger": "none", "logger": "none",
"theme": "wiki/theme/" "theme": "wiki/theme/"