From a0248a9f7c19d5c0be1d886640fed727b64f526b Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 29 Jul 2021 16:35:16 -0400 Subject: [PATCH] enable webgl uniform support for faster warmup --- CHANGELOG.md | 8 ++++++-- src/human.ts | 3 ++- tfjs/tf-browser.ts | 34 ++++++++++------------------------ 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f604f5..c05947ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # @vladmandic/human -Version: **2.1.1** +Version: **2.1.2** Description: **Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition** Author: **Vladimir Mandic ** @@ -9,8 +9,12 @@ Repository: **** ## Changelog -### **HEAD -> main** 2021/07/29 mandic00@live.com +### **2.1.2** 2021/07/29 mandic00@live.com + +### **origin/main** 2021/07/29 mandic00@live.com + +- fix typo - rebuild new release ### **2.1.1** 2021/07/29 mandic00@live.com diff --git a/src/human.ts b/src/human.ts index 8d7e87fe..09e4aaf4 100644 --- a/src/human.ts +++ b/src/human.ts @@ -329,7 +329,8 @@ export class Human { if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') { this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false); this.tf.ENV.set('WEBGL_CPU_FORWARD', true); - this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true); + this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', false); + this.tf.ENV.set('WEBGL_USE_SHAPES_UNIFORMS', true); // if (!this.config.object.enabled) this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision if (typeof this.config['deallocate'] !== 'undefined' && this.config['deallocate']) { // hidden param log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true); diff --git a/tfjs/tf-browser.ts b/tfjs/tf-browser.ts index 48517418..6db3d96e 100644 --- a/tfjs/tf-browser.ts +++ b/tfjs/tf-browser.ts @@ -3,29 +3,6 @@ * @external */ -// import from dist -// 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'; -// for backends, get version from source to avoid incorrect tree shaking -import { version_cpu } from '@tensorflow/tfjs-backend-cpu/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'; - -// export all -export * from '@tensorflow/tfjs-core/dist/index.js'; -export * from '@tensorflow/tfjs-layers/dist/index.js'; -export * from '@tensorflow/tfjs-converter/dist/index.js'; -export * as data from '@tensorflow/tfjs-data/dist/index.js'; -export * from '@tensorflow/tfjs-backend-cpu/dist/index.js'; -export * from '@tensorflow/tfjs-backend-webgl/dist/index.js'; -export * from '@tensorflow/tfjs-backend-wasm/dist/index.js'; -*/ - // import from src // get versions of all packages import { version as tfjsVersion } from '@tensorflow/tfjs/package.json'; @@ -39,6 +16,7 @@ import { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm // export all // requires treeShaking:ignore-annotations due to tfjs misconfiguration +/* export * from '@tensorflow/tfjs-core/src/index'; export * from '@tensorflow/tfjs-layers/src/index'; export * from '@tensorflow/tfjs-converter/src/index'; @@ -46,9 +24,17 @@ 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 all +export * from '@tensorflow/tfjs-core/dist/index.js'; +export * from '@tensorflow/tfjs-layers/dist/index.js'; +export * from '@tensorflow/tfjs-converter/dist/index.js'; +export * as data from '@tensorflow/tfjs-data/dist/index.js'; +export * from '@tensorflow/tfjs-backend-cpu/dist/index.js'; +export * from '@tensorflow/tfjs-backend-webgl/dist/index.js'; +export * from '@tensorflow/tfjs-backend-wasm/dist/index.js'; + // export versions export const version = { tfjs: tfjsVersion,