update build process to remove warnings

pull/356/head
Vladimir Mandic 2021-07-31 20:42:28 -04:00
parent 39172c3740
commit b70775caa9
9 changed files with 34 additions and 15 deletions

View File

@ -9,8 +9,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
## Changelog ## Changelog
### **HEAD -> main** 2021/07/30 mandic00@live.com ### **HEAD -> main** 2021/07/31 mandic00@live.com
- replace movenet with lightning-v4
- enable webgl uniform support for faster warmup - enable webgl uniform support for faster warmup
### **2.1.2** 2021/07/29 mandic00@live.com ### **2.1.2** 2021/07/29 mandic00@live.com

View File

@ -34,10 +34,6 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) ap
<br> <br>
*Note: `Human` Release 2.0 contains large list of changes, see [Change log](https://github.com/vladmandic/human/blob/main/CHANGELOG.md) for details*
<br>
## Demos ## Demos
- [**Main Application**](https://vladmandic.github.io/human/demo/index.html) - [**Main Application**](https://vladmandic.github.io/human/demo/index.html)
@ -72,6 +68,7 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) ap
- [**Notes on Backends**](https://github.com/vladmandic/human/wiki/Backends) - [**Notes on Backends**](https://github.com/vladmandic/human/wiki/Backends)
- [**Development Server**](https://github.com/vladmandic/human/wiki/Development-Server) - [**Development Server**](https://github.com/vladmandic/human/wiki/Development-Server)
- [**Build Process**](https://github.com/vladmandic/human/wiki/Build-Process) - [**Build Process**](https://github.com/vladmandic/human/wiki/Build-Process)
- [**Adding Custom Modules**](https://github.com/vladmandic/human/wiki/Module)
- [**Performance Notes**](https://github.com/vladmandic/human/wiki/Performance) - [**Performance Notes**](https://github.com/vladmandic/human/wiki/Performance)
- [**Performance Profiling**](https://github.com/vladmandic/human/wiki/Profiling) - [**Performance Profiling**](https://github.com/vladmandic/human/wiki/Profiling)
- [**Platform Support**](https://github.com/vladmandic/human/wiki/Platforms) - [**Platform Support**](https://github.com/vladmandic/human/wiki/Platforms)
@ -279,6 +276,7 @@ Default models in Human library are:
- **Face Description**: HSE FaceRes - **Face Description**: HSE FaceRes
- **Emotion Detection**: Oarriaga Emotion - **Emotion Detection**: Oarriaga Emotion
- **Body Analysis**: MoveNet - Lightning variation - **Body Analysis**: MoveNet - Lightning variation
- **Object Detection**: CenterNet
Note that alternative models are provided and can be enabled via configuration Note that alternative models are provided and can be enabled via configuration
For example, `PoseNet` model can be switched for `BlazePose`, `EfficientPose` or `MoveNet` model depending on the use case For example, `PoseNet` model can be switched for `BlazePose`, `EfficientPose` or `MoveNet` model depending on the use case

View File

@ -21,8 +21,6 @@ const userConfig = {
mesh: { enabled: true }, mesh: { enabled: true },
embedding: { enabled: false }, embedding: { enabled: false },
iris: { enabled: false }, iris: { enabled: false },
age: { enabled: false },
gender: { enabled: false },
emotion: { enabled: true }, emotion: { enabled: true },
description: { enabled: true }, description: { enabled: true },
}, },
@ -174,12 +172,14 @@ async function createDB() {
} }
async function main() { async function main() {
/*
window.addEventListener('unhandledrejection', (evt) => { window.addEventListener('unhandledrejection', (evt) => {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(evt.reason || evt); console.error(evt.reason || evt);
document.getElementById('list').innerHTML = evt?.reason?.message || evt?.reason || evt; document.getElementById('list').innerHTML = evt?.reason?.message || evt?.reason || evt;
evt.preventDefault(); evt.preventDefault();
}); });
*/
// pre-load human models // pre-load human models
await human.load(); await human.load();

View File

@ -23,7 +23,7 @@
"scripts": { "scripts": {
"start": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught demo/nodejs/node.js", "start": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught demo/nodejs/node.js",
"dev": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught server/serve.js", "dev": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught server/serve.js",
"build": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught server/build.js", "build": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught --no-deprecation server/build.js",
"lint": "eslint src server demo test", "lint": "eslint src server demo test",
"test": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught test/test.js", "test": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught test/test.js",
"scan": "npx auditjs@latest ossi --dev --quiet" "scan": "npx auditjs@latest ossi --dev --quiet"
@ -65,7 +65,7 @@
"@tensorflow/tfjs-layers": "^3.8.0", "@tensorflow/tfjs-layers": "^3.8.0",
"@tensorflow/tfjs-node": "^3.8.0", "@tensorflow/tfjs-node": "^3.8.0",
"@tensorflow/tfjs-node-gpu": "^3.8.0", "@tensorflow/tfjs-node-gpu": "^3.8.0",
"@types/node": "^16.4.7", "@types/node": "^16.4.9",
"@typescript-eslint/eslint-plugin": "^4.28.5", "@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5", "@typescript-eslint/parser": "^4.28.5",
"@vladmandic/pilogger": "^0.2.18", "@vladmandic/pilogger": "^0.2.18",
@ -73,7 +73,7 @@
"chokidar": "^3.5.2", "chokidar": "^3.5.2",
"dayjs": "^1.10.6", "dayjs": "^1.10.6",
"esbuild": "^0.12.17", "esbuild": "^0.12.17",
"eslint": "^7.31.0", "eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1", "eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.4", "eslint-plugin-import": "^2.23.4",
"eslint-plugin-json": "^3.0.0", "eslint-plugin-json": "^3.0.0",
@ -82,9 +82,9 @@
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"seedrandom": "^3.0.5", "seedrandom": "^3.0.5",
"simple-git": "^2.41.2", "simple-git": "^2.42.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"typedoc": "0.21.4", "typedoc": "0.21.5",
"typescript": "4.3.5" "typescript": "4.3.5"
} }
} }

View File

@ -145,6 +145,7 @@ export const detectFace = async (parent /* instance of human */, input: Tensor):
// eslint-disable-next-line no-async-promise-executor // eslint-disable-next-line no-async-promise-executor
let timeStamp; let timeStamp;
let ageRes; let ageRes;
let gearRes;
let genderRes; let genderRes;
let emotionRes; let emotionRes;
let embeddingRes; let embeddingRes;
@ -181,6 +182,20 @@ export const detectFace = async (parent /* instance of human */, input: Tensor):
} }
parent.analyze('End Emotion:'); parent.analyze('End Emotion:');
// run gear, inherits face from blazeface
/*
parent.analyze('Start GEAR:');
if (parent.config.async) {
gearRes = parent.config.face.agegenderrace.enabled ? agegenderrace.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : {};
} else {
parent.state = 'run:gear';
timeStamp = now();
gearRes = parent.config.face.agegenderrace.enabled ? await agegenderrace.predict(faces[i].image || tf.tensor([]), parent.config, i, faces.length) : {};
parent.performance.emotion = Math.trunc(now() - timeStamp);
}
parent.analyze('End GEAR:');
*/
// run emotion, inherits face from blazeface // run emotion, inherits face from blazeface
parent.analyze('Start Description:'); parent.analyze('Start Description:');
if (parent.config.async) { if (parent.config.async) {
@ -195,7 +210,7 @@ export const detectFace = async (parent /* instance of human */, input: Tensor):
// if async wait for results // if async wait for results
if (parent.config.async) { if (parent.config.async) {
[ageRes, genderRes, emotionRes, embeddingRes, descRes] = await Promise.all([ageRes, genderRes, emotionRes, embeddingRes, descRes]); [ageRes, genderRes, emotionRes, embeddingRes, descRes, gearRes] = await Promise.all([ageRes, genderRes, emotionRes, embeddingRes, descRes, gearRes]);
} }
parent.analyze('Finish Face:'); parent.analyze('Finish Face:');

View File

@ -336,6 +336,7 @@ export class Human {
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true); log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);
this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0); this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', 0);
} }
// @ts-ignore getGPGPUContext only exists on WebGL backend
const gl = await this.tf.backend().getGPGPUContext().gl; const gl = await this.tf.backend().getGPGPUContext().gl;
if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`); if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
} }

View File

@ -9,6 +9,7 @@ import * as movenet from './movenet/movenet';
import * as nanodet from './object/nanodet'; import * as nanodet from './object/nanodet';
import * as centernet from './object/centernet'; import * as centernet from './object/centernet';
import * as segmentation from './segmentation/segmentation'; import * as segmentation from './segmentation/segmentation';
// import * as agegenderrace from './gear/agegenderrace';
/** Load method preloads all instance.configured models on-demand /** Load method preloads all instance.configured models on-demand
* - Not explicitly required as any required model is load implicitly on it's first run * - Not explicitly required as any required model is load implicitly on it's first run
@ -39,6 +40,8 @@ export async function load(instance) {
instance.models.faceres, instance.models.faceres,
// @ts-ignore models loaded via promise array cannot be correctly inferred // @ts-ignore models loaded via promise array cannot be correctly inferred
instance.models.segmentation, instance.models.segmentation,
// @ts-ignore models loaded via promise array cannot be correctly inferred
// instance.models.agegenderrace,
] = await Promise.all([ ] = await Promise.all([
instance.models.face || (instance.config.face.enabled ? facemesh.load(instance.config) : null), instance.models.face || (instance.config.face.enabled ? facemesh.load(instance.config) : null),
instance.models.emotion || ((instance.config.face.enabled && instance.config.face.emotion.enabled) ? emotion.load(instance.config) : null), instance.models.emotion || ((instance.config.face.enabled && instance.config.face.emotion.enabled) ? emotion.load(instance.config) : null),
@ -51,6 +54,7 @@ export async function load(instance) {
instance.models.centernet || (instance.config.object.enabled && instance.config.object.modelPath.includes('centernet') ? centernet.load(instance.config) : null), instance.models.centernet || (instance.config.object.enabled && instance.config.object.modelPath.includes('centernet') ? centernet.load(instance.config) : null),
instance.models.faceres || ((instance.config.face.enabled && instance.config.face.description.enabled) ? faceres.load(instance.config) : null), instance.models.faceres || ((instance.config.face.enabled && instance.config.face.description.enabled) ? faceres.load(instance.config) : null),
instance.models.segmentation || (instance.config.segmentation.enabled ? segmentation.load(instance.config) : null), instance.models.segmentation || (instance.config.segmentation.enabled ? segmentation.load(instance.config) : null),
// instance.models.agegenderrace || ((instance.config.face.enabled && instance.config.face.agegenderrace.enabled) ? agegenderrace.load(instance.config) : null),
]); ]);
} else { // load models sequentially } else { // load models sequentially
if (instance.config.face.enabled && !instance.models.face) instance.models.face = await facemesh.load(instance.config); if (instance.config.face.enabled && !instance.models.face) instance.models.face = await facemesh.load(instance.config);
@ -64,5 +68,6 @@ export async function load(instance) {
if (instance.config.object.enabled && !instance.models.centernet && instance.config.object.modelPath.includes('centernet')) instance.models.centernet = await centernet.load(instance.config); if (instance.config.object.enabled && !instance.models.centernet && instance.config.object.modelPath.includes('centernet')) instance.models.centernet = await centernet.load(instance.config);
if (instance.config.face.enabled && instance.config.face.description.enabled && !instance.models.faceres) instance.models.faceres = await faceres.load(instance.config); if (instance.config.face.enabled && instance.config.face.description.enabled && !instance.models.faceres) instance.models.faceres = await faceres.load(instance.config);
if (instance.config.segmentation.enabled && !instance.models.segmentation) instance.models.segmentation = await segmentation.load(instance.config); if (instance.config.segmentation.enabled && !instance.models.segmentation) instance.models.segmentation = await segmentation.load(instance.config);
// if (instance.config.face.enabled && instance.config.face.agegenderrace.enabled && !instance.models.agegenderrace) instance.models.agegenderrace = await agegenderrace.load(instance.config);
} }
} }

View File

@ -8,7 +8,6 @@
"outDir": "types", "outDir": "types",
"declaration": true, "declaration": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"emitDeclarationOnly": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,

2
wiki

@ -1 +1 @@
Subproject commit de0142bceebb460363d28274e1f91d16c0cfbdd0 Subproject commit 0c5c707400b5ebe4780b27e9d6060bc44f6415b8