start using partial definitions

pull/193/head
Vladimir Mandic 2021-09-11 16:11:00 -04:00
parent 9ae3f10ded
commit 1f0fe66fe0
12 changed files with 315 additions and 77 deletions

View File

@ -11,6 +11,9 @@
### **HEAD -> main** 2021/09/11 mandic00@live.com
### **origin/main** 2021/09/11 mandic00@live.com
- simplify dependencies
- fix file permissions
- remove old build server

View File

@ -6,7 +6,8 @@ WebGL shader optimizations for faster load and initial detection
- Implement WebGL uniforms for shaders: <https://github.com/tensorflow/tfjs/issues/5205>
- Fix shader packing: <https://github.com/tensorflow/tfjs/issues/5343>
- Event emitters
- Refactor Human as multiple partial class
- Refactor ImageFX as ESM
<br>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -160,7 +160,7 @@ export class Human {
* Creates instance of Human library that is futher used for all operations
* @param userConfig: {@link Config}
*/
constructor(userConfig?: Config | Record<string, unknown>) {
constructor(userConfig?: Partial<Config>) {
this.version = app.version; // expose version property on instance of class
Object.defineProperty(this, 'version', { value: app.version }); // expose version property directly on class itself
defaults.wasmPath = `https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@${tf.version_core}/dist/`;
@ -280,7 +280,7 @@ export class Human {
* - Not explicitly required as any required model is load implicitly on it's first run
* @param userConfig?: {@link Config}
*/
async load(userConfig?: Config | Record<string, unknown>) {
async load(userConfig?: Partial<Config>) {
this.state = 'load';
const timeStamp = now();
const count = Object.values(this.models).filter((model) => model).length;
@ -464,7 +464,7 @@ export class Human {
* @param userConfig?: {@link Config}
* @returns result: {@link Result}
*/
async detect(input: Input, userConfig?: Config | Record<string, unknown>): Promise<Result | Error> {
async detect(input: Input, userConfig?: Partial<Config>): Promise<Result | Error> {
// detection happens inside a promise
return new Promise(async (resolve) => {
this.state = 'config';
@ -716,7 +716,7 @@ export class Human {
* - only used for `webgl` and `humangl` backends
* @param userConfig?: Config
*/
async warmup(userConfig?: Config | Record<string, unknown>): Promise<Result | { error }> {
async warmup(userConfig?: Partial<Config>): Promise<Result | { error }> {
const t0 = now();
if (userConfig) this.config = mergeDeep(this.config, userConfig) as Config;
if (!this.config.warmup || this.config.warmup === 'none') return { error: 'null' };

View File

@ -923,3 +923,148 @@
2021-09-11 16:00:06 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":7,"inputBytes":2168,"outputBytes":2343983}
2021-09-11 16:00:06 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":47,"inputBytes":2800567,"outputBytes":1392342}
2021-09-11 16:00:06 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":47,"inputBytes":2800567,"outputBytes":2584375}
2021-09-11 16:02:09 INFO:  Watch: {"event":"modify","input":"src/human.ts"}
2021-09-11 16:02:09 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1416}
2021-09-11 16:02:09 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":47,"inputBytes":457983,"outputBytes":397457}
2021-09-11 16:02:10 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1424}
2021-09-11 16:02:10 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":47,"inputBytes":457991,"outputBytes":397461}
2021-09-11 16:02:10 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1491}
2021-09-11 16:02:10 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":47,"inputBytes":458058,"outputBytes":397533}
2021-09-11 16:02:10 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":2168,"outputBytes":1590}
2021-09-11 16:02:10 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":47,"inputBytes":458157,"outputBytes":399437}
2021-09-11 16:02:10 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":7,"inputBytes":2168,"outputBytes":2343983}
2021-09-11 16:02:10 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":47,"inputBytes":2800550,"outputBytes":1392342}
2021-09-11 16:02:11 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":47,"inputBytes":2800550,"outputBytes":2584375}
2021-09-11 16:02:19 INFO:  Build exiting...
2021-09-11 16:02:22 INFO:  @vladmandic/human version 2.1.5
2021-09-11 16:02:22 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0
2021-09-11 16:02:22 INFO:  Application: {"name":"@vladmandic/human","version":"2.1.5"}
2021-09-11 16:02:22 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-09-11 16:02:22 INFO:  Toolchain: {"build":"0.4.1","esbuild":"0.12.26","typescript":"4.4.3","typedoc":"0.21.9","eslint":"7.32.0"}
2021-09-11 16:02:22 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-09-11 16:02:22 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-09-11 16:02:22 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1416}
2021-09-11 16:02:22 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":47,"inputBytes":457983,"outputBytes":397457}
2021-09-11 16:02:22 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1424}
2021-09-11 16:02:22 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":47,"inputBytes":457991,"outputBytes":397461}
2021-09-11 16:02:22 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1491}
2021-09-11 16:02:22 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":47,"inputBytes":458058,"outputBytes":397533}
2021-09-11 16:02:22 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":2168,"outputBytes":1590}
2021-09-11 16:02:22 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":47,"inputBytes":458157,"outputBytes":399437}
2021-09-11 16:02:22 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":7,"inputBytes":2168,"outputBytes":2343983}
2021-09-11 16:02:23 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":47,"inputBytes":2800550,"outputBytes":1392342}
2021-09-11 16:02:23 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":47,"inputBytes":2800550,"outputBytes":2584375}
2021-09-11 16:02:39 STATE: Typings: {"input":"src/human.ts","output":"types","files":47}
2021-09-11 16:02:45 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":14,"index":true}
2021-09-11 16:03:12 STATE: Lint: {"locations":["src/**/*.ts","test/*.js","demo/**/*.js"],"files":75,"errors":0,"warnings":0}
2021-09-11 16:03:12 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-09-11 16:03:12 INFO:  Done...
2021-09-11 16:05:15 INFO:  @vladmandic/human version 2.1.5
2021-09-11 16:05:15 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0
2021-09-11 16:05:15 INFO:  Application: {"name":"@vladmandic/human","version":"2.1.5"}
2021-09-11 16:05:15 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-09-11 16:05:15 INFO:  Toolchain: {"build":"0.4.1","esbuild":"0.12.26","typescript":"4.4.3","typedoc":"0.21.9","eslint":"7.32.0"}
2021-09-11 16:05:15 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-09-11 16:05:15 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-09-11 16:05:15 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1416}
2021-09-11 16:05:15 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":47,"inputBytes":457932,"outputBytes":397457}
2021-09-11 16:05:15 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1424}
2021-09-11 16:05:15 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":47,"inputBytes":457940,"outputBytes":397461}
2021-09-11 16:05:15 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1491}
2021-09-11 16:05:15 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":47,"inputBytes":458007,"outputBytes":397533}
2021-09-11 16:05:15 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":2168,"outputBytes":1590}
2021-09-11 16:05:15 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":47,"inputBytes":458106,"outputBytes":399437}
2021-09-11 16:05:16 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":7,"inputBytes":2168,"outputBytes":2343983}
2021-09-11 16:05:16 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":47,"inputBytes":2800499,"outputBytes":1392342}
2021-09-11 16:05:16 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":47,"inputBytes":2800499,"outputBytes":2584375}
2021-09-11 16:05:32 STATE: Typings: {"input":"src/human.ts","output":"types","files":47}
2021-09-11 16:05:39 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":14,"index":true}
2021-09-11 16:06:04 STATE: Lint: {"locations":["src/**/*.ts","test/*.js","demo/**/*.js"],"files":75,"errors":0,"warnings":0}
2021-09-11 16:06:04 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-09-11 16:06:04 INFO:  Done...
2021-09-11 16:06:55 INFO:  @vladmandic/human version 2.1.5
2021-09-11 16:06:55 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0
2021-09-11 16:06:55 INFO:  Application: {"name":"@vladmandic/human","version":"2.1.5"}
2021-09-11 16:06:55 INFO:  Environment: {"profile":"development","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-09-11 16:06:55 INFO:  Toolchain: {"build":"0.4.1","esbuild":"0.12.26","typescript":"4.4.3","typedoc":"0.21.9","eslint":"7.32.0"}
2021-09-11 16:06:55 INFO:  Build: {"profile":"development","steps":["serve","watch","compile"]}
2021-09-11 16:06:55 STATE: WebServer: {"ssl":false,"port":10030,"root":"."}
2021-09-11 16:06:55 STATE: WebServer: {"ssl":true,"port":10031,"root":".","sslKey":"node_modules/@vladmandic/build/cert/https.key","sslCrt":"node_modules/@vladmandic/build/cert/https.crt"}
2021-09-11 16:06:55 STATE: Watch: {"locations":["src/**","src/**","tfjs/*"]}
2021-09-11 16:06:55 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1416}
2021-09-11 16:06:55 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":47,"inputBytes":457932,"outputBytes":397457}
2021-09-11 16:06:55 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1424}
2021-09-11 16:06:55 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":47,"inputBytes":457940,"outputBytes":397461}
2021-09-11 16:06:55 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1491}
2021-09-11 16:06:55 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":47,"inputBytes":458007,"outputBytes":397533}
2021-09-11 16:06:55 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":2168,"outputBytes":1590}
2021-09-11 16:06:55 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":47,"inputBytes":458106,"outputBytes":399437}
2021-09-11 16:06:55 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":7,"inputBytes":2168,"outputBytes":2343983}
2021-09-11 16:06:56 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":47,"inputBytes":2800499,"outputBytes":1392342}
2021-09-11 16:06:56 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":47,"inputBytes":2800499,"outputBytes":2584375}
2021-09-11 16:06:56 INFO:  Listening...
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/html","size":6435,"url":"/","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/css","size":107884,"url":"/icons.css","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":44675,"url":"/index.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"font/woff2","size":181500,"url":"/assets/lato-light.woff2","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":2584375,"url":"/dist/human.esm.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":14222,"url":"/helpers/menu.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":10894,"url":"/helpers/gl-bench.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":2976,"url":"/helpers/webrtc.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":6543388,"url":"/dist/human.esm.js.map","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"image/x-icon","size":261950,"url":"/favicon.ico","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:09 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":4115,"url":"/index-pwa.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":1938,"url":"/index-worker.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":1392342,"url":"/dist/human.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":79038,"url":"/models/blazeface.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":89289,"url":"/models/facemesh.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":122025,"url":"/models/iris.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":17980,"url":"/models/emotion.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":113998,"url":"/models/handdetect.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":129116,"url":"/models/handskeleton.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":161813,"url":"/models/movenet-lightning.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/json","size":71432,"url":"/models/faceres.json","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":2955780,"url":"/models/facemesh.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":2599092,"url":"/models/iris.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":3515612,"url":"/models/handdetect.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":4650216,"url":"/models/movenet-lightning.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":5502280,"url":"/models/handskeleton.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":820516,"url":"/models/emotion.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":538928,"url":"/models/blazeface.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:14 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"application/octet-stream","size":6978814,"url":"/models/faceres.bin","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:48 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/html","size":12963,"url":"/typedoc/index.html","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:48 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/css","size":72023,"url":"/typedoc/assets/css/main.css","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:48 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":66486,"url":"/typedoc/assets/js/search.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:48 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":155546,"url":"/typedoc/assets/js/main.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:48 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"image/png","size":855,"url":"/typedoc/assets/images/widgets@2x.png","remote":"::ffff:192.168.0.200"}
2021-09-11 16:07:48 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"image/png","size":28144,"url":"/typedoc/assets/images/icons@2x.png","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:03 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/html","size":96001,"url":"/typedoc/classes/Human.html","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:03 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/css","size":72023,"url":"/typedoc/assets/css/main.css","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:03 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":66486,"url":"/typedoc/assets/js/search.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:03 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"text/javascript","size":155546,"url":"/typedoc/assets/js/main.js","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:03 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"image/png","size":855,"url":"/typedoc/assets/images/widgets@2x.png","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:03 DATA:  HTTP: {"method":"GET","ver":"1.1","status":200,"mime":"image/png","size":28144,"url":"/typedoc/assets/images/icons@2x.png","remote":"::ffff:192.168.0.200"}
2021-09-11 16:08:58 INFO:  Build exiting...
2021-09-11 16:09:01 INFO:  @vladmandic/human version 2.1.5
2021-09-11 16:09:01 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0
2021-09-11 16:09:01 INFO:  Application: {"name":"@vladmandic/human","version":"2.1.5"}
2021-09-11 16:09:01 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-09-11 16:09:01 INFO:  Toolchain: {"build":"0.4.1","esbuild":"0.12.26","typescript":"4.4.3","typedoc":"0.21.9","eslint":"7.32.0"}
2021-09-11 16:09:01 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-09-11 16:09:01 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-09-11 16:09:01 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1416}
2021-09-11 16:09:01 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":47,"inputBytes":457932,"outputBytes":397457}
2021-09-11 16:09:01 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1424}
2021-09-11 16:09:01 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":47,"inputBytes":457940,"outputBytes":397461}
2021-09-11 16:09:01 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1491}
2021-09-11 16:09:01 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":47,"inputBytes":458007,"outputBytes":397533}
2021-09-11 16:09:01 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":2168,"outputBytes":1590}
2021-09-11 16:09:01 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":47,"inputBytes":458106,"outputBytes":399437}
2021-09-11 16:09:02 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":7,"inputBytes":2168,"outputBytes":2343983}
2021-09-11 16:09:02 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":47,"inputBytes":2800499,"outputBytes":1392342}
2021-09-11 16:09:02 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":47,"inputBytes":2800499,"outputBytes":2584375}
2021-09-11 16:09:18 STATE: Typings: {"input":"src/human.ts","output":"types","files":47}
2021-09-11 16:09:25 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":14,"index":true}
2021-09-11 16:09:50 STATE: Lint: {"locations":["src/**/*.ts","test/*.js","demo/**/*.js"],"files":75,"errors":0,"warnings":0}
2021-09-11 16:09:50 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-09-11 16:09:50 INFO:  Done...

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -120,7 +120,7 @@
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="canvas" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> canvas</h3>
<div class="tsd-signature tsd-kind-icon">canvas<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></div>
<div class="tsd-signature tsd-kind-icon">canvas<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLCanvasElement</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">OffscreenCanvas</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/vladmandic/human/blob/main/src/result.ts#L189">result.ts:189</a></li>

37
types/src/human.d.ts vendored
View File

@ -5,6 +5,7 @@ import { Config } from './config';
import { Result, Face, Hand, Body, Item, Gesture } from './result';
import * as tf from '../dist/tfjs.esm.js';
import * as facemesh from './blazeface/facemesh';
import * as image from './image/image';
import * as draw from './draw/draw';
import { Tensor, GraphModel } from './tfjs/types';
export { Config } from './config';
@ -52,8 +53,10 @@ export declare class Human {
* - Progresses through: 'config', 'check', 'backend', 'load', 'run:<model>', 'idle'
*/
state: string;
/** @internal: Instance of current image being processed */
image: {
/** process input and return tensor and canvas */
image: typeof image.process;
/** currenty processed image tensor and canvas */
process: {
tensor: Tensor | null;
canvas: OffscreenCanvas | HTMLCanvasElement | null;
};
@ -66,7 +69,7 @@ export declare class Human {
* - face: draw detected faces
* - body: draw detected people and body parts
* - hand: draw detected hands and hand parts
* - canvas: draw processed canvas which is a processed copy of the input
* - canvas: draw this.processed canvas which is a this.processed copy of the input
* - all: meta-function that performs: canvas, face, body, hand
*/
draw: {
@ -105,6 +108,16 @@ export declare class Human {
faceres: GraphModel | null;
segmentation: GraphModel | null;
};
/** Container for events dispatched by Human
*
* Possible events:
* - `create`: triggered when Human object is instantiated
* - `load`: triggered when models are loaded (explicitly or on-demand)
* - `image`: triggered when input image is this.processed
* - `result`: triggered when detection is complete
* - `warmup`: triggered when warmup is complete
*/
events: EventTarget;
/** Reference face triangualtion array of 468 points, used for triangle references between points */
faceTriangulation: typeof facemesh.triangulation;
/** Refernce UV map of 468 values, used for 3D mapping of the face mesh */
@ -120,7 +133,7 @@ export declare class Human {
* Creates instance of Human library that is futher used for all operations
* @param userConfig: {@link Config}
*/
constructor(userConfig?: Config | Record<string, unknown>);
constructor(userConfig?: Partial<Config>);
/** @hidden */
analyze: (...msg: string[]) => void;
/** Simmilarity method calculates simmilarity between two provided face descriptors (face embeddings)
@ -132,16 +145,16 @@ export declare class Human {
*/
similarity(embedding1: Array<number>, embedding2: Array<number>): number;
/**
* Segmentation method takes any input and returns processed canvas with body segmentation
* Segmentation method takes any input and returns this.processed canvas with body segmentation
* Optional parameter background is used to fill the background with specific input
* Segmentation is not triggered as part of detect process
* Segmentation is not triggered as part of detect this.process
*
* @param input: {@link Input}
* @param background?: {@link Input}
* @returns Canvas
*/
segmentation(input: Input, background?: Input): Promise<OffscreenCanvas | HTMLCanvasElement | null>;
/** Enhance method performs additional enhacements to face image previously detected for futher processing
/** Enhance method performs additional enhacements to face image previously detected for futher this.processing
* @param input: Tensor as provided in human.result.face[n].tensor
* @returns Tensor
*/
@ -166,7 +179,7 @@ export declare class Human {
* - Not explicitly required as any required model is load implicitly on it's first run
* @param userConfig?: {@link Config}
*/
load(userConfig?: Config | Record<string, unknown>): Promise<void>;
load(userConfig?: Partial<Config>): Promise<void>;
/**
* Runs interpolation using last known result and returns smoothened result
* Interpolation is based on time since last known result so can be called independently
@ -177,21 +190,21 @@ export declare class Human {
next: (result?: Result | undefined) => Result;
/** Main detection method
* - Analyze configuration: {@link Config}
* - Pre-process input: {@link Input}
* - Pre-this.process input: {@link Input}
* - Run inference for all configured models
* - Process and return result: {@link Result}
* - this.process and return result: {@link Result}
*
* @param input: Input
* @param userConfig?: {@link Config}
* @returns result: {@link Result}
*/
detect(input: Input, userConfig?: Config | Record<string, unknown>): Promise<Result | Error>;
detect(input: Input, userConfig?: Partial<Config>): Promise<Result | Error>;
/** Warmup method pre-initializes all configured models for faster inference
* - can take significant time on startup
* - only used for `webgl` and `humangl` backends
* @param userConfig?: Config
*/
warmup(userConfig?: Config | Record<string, unknown>): Promise<Result | {
warmup(userConfig?: Partial<Config>): Promise<Result | {
error: any;
}>;
}

View File

@ -196,7 +196,7 @@ export interface Result {
/** global performance object with timing values for each operation */
performance: Record<string, unknown>;
/** optional processed canvas that can be used to draw input on screen */
canvas?: OffscreenCanvas | HTMLCanvasElement;
canvas?: OffscreenCanvas | HTMLCanvasElement | null;
/** timestamp of detection representing the milliseconds elapsed since the UNIX epoch */
readonly timestamp: number;
/** getter property that returns unified persons object */

View File

@ -7,7 +7,7 @@ declare type Input = Tensor | typeof Image | ImageData | ImageBitmap | HTMLImage
export declare function load(config: Config): Promise<GraphModel>;
export declare function predict(input: {
tensor: Tensor | null;
canvas: OffscreenCanvas | HTMLCanvasElement;
canvas: OffscreenCanvas | HTMLCanvasElement | null;
}): Promise<Uint8ClampedArray | null>;
export declare function process(input: Input, background: Input | undefined, config: Config): Promise<HTMLCanvasElement | OffscreenCanvas | null>;
export {};