diff --git a/CHANGELOG.md b/CHANGELOG.md index bd5aad81..3b719db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,9 @@ Repository: **** ## 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 ### **2.1.2** 2021/07/29 mandic00@live.com diff --git a/README.md b/README.md index 9c2739f3..bb9958b1 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,6 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) ap
-*Note: `Human` Release 2.0 contains large list of changes, see [Change log](https://github.com/vladmandic/human/blob/main/CHANGELOG.md) for details* - -
- ## Demos - [**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) - [**Development Server**](https://github.com/vladmandic/human/wiki/Development-Server) - [**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 Profiling**](https://github.com/vladmandic/human/wiki/Profiling) - [**Platform Support**](https://github.com/vladmandic/human/wiki/Platforms) @@ -279,6 +276,7 @@ Default models in Human library are: - **Face Description**: HSE FaceRes - **Emotion Detection**: Oarriaga Emotion - **Body Analysis**: MoveNet - Lightning variation +- **Object Detection**: CenterNet 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 diff --git a/demo/facematch/facematch.js b/demo/facematch/facematch.js index 8645f854..4345a809 100644 --- a/demo/facematch/facematch.js +++ b/demo/facematch/facematch.js @@ -21,8 +21,6 @@ const userConfig = { mesh: { enabled: true }, embedding: { enabled: false }, iris: { enabled: false }, - age: { enabled: false }, - gender: { enabled: false }, emotion: { enabled: true }, description: { enabled: true }, }, @@ -174,12 +172,14 @@ async function createDB() { } async function main() { + /* window.addEventListener('unhandledrejection', (evt) => { // eslint-disable-next-line no-console console.error(evt.reason || evt); document.getElementById('list').innerHTML = evt?.reason?.message || evt?.reason || evt; evt.preventDefault(); }); + */ // pre-load human models await human.load(); diff --git a/package.json b/package.json index fcdb4ff1..3d4ae451 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "scripts": { "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", - "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", "test": "node --trace-warnings --unhandled-rejections=strict --trace-uncaught test/test.js", "scan": "npx auditjs@latest ossi --dev --quiet" @@ -65,7 +65,7 @@ "@tensorflow/tfjs-layers": "^3.8.0", "@tensorflow/tfjs-node": "^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/parser": "^4.28.5", "@vladmandic/pilogger": "^0.2.18", @@ -73,7 +73,7 @@ "chokidar": "^3.5.2", "dayjs": "^1.10.6", "esbuild": "^0.12.17", - "eslint": "^7.31.0", + "eslint": "^7.32.0", "eslint-config-airbnb-base": "^14.2.1", "eslint-plugin-import": "^2.23.4", "eslint-plugin-json": "^3.0.0", @@ -82,9 +82,9 @@ "node-fetch": "^2.6.1", "rimraf": "^3.0.2", "seedrandom": "^3.0.5", - "simple-git": "^2.41.2", + "simple-git": "^2.42.0", "tslib": "^2.3.0", - "typedoc": "0.21.4", + "typedoc": "0.21.5", "typescript": "4.3.5" } } diff --git a/src/face.ts b/src/face.ts index aa421173..6473fa4f 100644 --- a/src/face.ts +++ b/src/face.ts @@ -145,6 +145,7 @@ export const detectFace = async (parent /* instance of human */, input: Tensor): // eslint-disable-next-line no-async-promise-executor let timeStamp; let ageRes; + let gearRes; let genderRes; let emotionRes; let embeddingRes; @@ -181,6 +182,20 @@ export const detectFace = async (parent /* instance of human */, input: Tensor): } 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 parent.analyze('Start Description:'); if (parent.config.async) { @@ -195,7 +210,7 @@ export const detectFace = async (parent /* instance of human */, input: Tensor): // if async wait for results 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:'); diff --git a/src/human.ts b/src/human.ts index 09e4aaf4..73ee4976 100644 --- a/src/human.ts +++ b/src/human.ts @@ -336,6 +336,7 @@ export class Human { log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true); 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; if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`); } diff --git a/src/models.ts b/src/models.ts index c56a4afe..c52ffd9d 100644 --- a/src/models.ts +++ b/src/models.ts @@ -9,6 +9,7 @@ import * as movenet from './movenet/movenet'; import * as nanodet from './object/nanodet'; import * as centernet from './object/centernet'; import * as segmentation from './segmentation/segmentation'; +// import * as agegenderrace from './gear/agegenderrace'; /** Load method preloads all instance.configured models on-demand * - 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, // @ts-ignore models loaded via promise array cannot be correctly inferred instance.models.segmentation, + // @ts-ignore models loaded via promise array cannot be correctly inferred + // instance.models.agegenderrace, ] = await Promise.all([ 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), @@ -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.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.agegenderrace || ((instance.config.face.enabled && instance.config.face.agegenderrace.enabled) ? agegenderrace.load(instance.config) : null), ]); } else { // load models sequentially 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.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.face.enabled && instance.config.face.agegenderrace.enabled && !instance.models.agegenderrace) instance.models.agegenderrace = await agegenderrace.load(instance.config); } } diff --git a/tsconfig.json b/tsconfig.json index 7de74d7d..64f1ec30 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,6 @@ "outDir": "types", "declaration": true, "allowSyntheticDefaultImports": true, - "emitDeclarationOnly": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, diff --git a/wiki b/wiki index de0142bc..0c5c7074 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit de0142bceebb460363d28274e1f91d16c0cfbdd0 +Subproject commit 0c5c707400b5ebe4780b27e9d6060bc44f6415b8