mirror of https://github.com/vladmandic/human
update build process to remove warnings
parent
39172c3740
commit
b70775caa9
|
@ -9,8 +9,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
## 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
|
||||
|
|
|
@ -34,10 +34,6 @@ Check out [**Live Demo**](https://vladmandic.github.io/human/demo/index.html) ap
|
|||
|
||||
<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
|
||||
|
||||
- [**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
|
||||
|
|
|
@ -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();
|
||||
|
|
10
package.json
10
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"
|
||||
}
|
||||
}
|
||||
|
|
17
src/face.ts
17
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:');
|
||||
|
|
|
@ -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)}`);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
"outDir": "types",
|
||||
"declaration": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit de0142bceebb460363d28274e1f91d16c0cfbdd0
|
||||
Subproject commit 0c5c707400b5ebe4780b27e9d6060bc44f6415b8
|
Loading…
Reference in New Issue