prepare external typedefs

pull/356/head
Vladimir Mandic 2022-11-11 16:19:27 -05:00
parent 4c26e6cbbb
commit 39735b03f6
9 changed files with 3038 additions and 72 deletions

View File

@ -21,8 +21,6 @@ export type { WebCam, WebCamConfig } from './util/webcam';
// export type { Models, ModelStats, KernelOps } from './models';
export type { ModelInfo } from './tfjs/load';
// define enum types
/** Events dispatched by `human.events`
* - `create`: triggered when Human object is instantiated
* - `load`: triggered when models are loaded (explicitly or on-demand)

View File

@ -1,4 +1,5 @@
/* eslint-disable no-use-before-define */
/* eslint-disable */
// Type definitions for long.js 4.0.0
// Project: https://github.com/dcodeIO/long.js
// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans>

2984
src/external/webgpu.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,7 @@ export function GLImageFilter() {
let filterChain: Record<string, unknown>[] = [];
let vertexBuffer: WebGLBuffer | null = null;
let currentProgram: GLProgram | null = null;
const fxcanvas = canvas(100, 100);
const fxcanvas = canvas(100, 100) as HTMLCanvasElement;
const shaderProgramCache = { }; // key is the shader program source, value is the compiled program
const DRAW = { INTERMEDIATE: 1 };
const gl = fxcanvas.getContext('webgl') as WebGLRenderingContext;

View File

@ -6,7 +6,6 @@ import { log } from '../util/util';
import * as image from '../image/image';
import * as models from '../models';
import type { AnyCanvas } from '../exports';
// import { env } from '../env';
export const config = {
name: 'humangl',
@ -79,11 +78,6 @@ export function register(instance: Human): void {
log('possible browser memory leak using webgl or conflict with multiple backend registrations');
instance.emit('error');
throw new Error('backend error: webgl context lost');
// log('resetting humangl backend');
// env.initial = true;
// models.reset(instance);
// await tf.removeBackend(config.name);
// await register(instance); // re-register
});
config.canvas.addEventListener('webglcontextrestored', (e) => {
log('humangl error: context restored:', e);

View File

@ -3,7 +3,6 @@ import { log, join } from '../util/util';
import type { GraphModel } from './types';
import type { Config } from '../config';
import * as modelsDefs from '../../models/models.json';
// import { validateModel } from '../models';
const options = {
cacheModels: true,
@ -86,6 +85,5 @@ export async function loadModel(modelPath: string | undefined): Promise<GraphMod
log('error saving model:', modelUrl, err);
}
}
// validateModel(null, model, `${modelPath || ''}`);
return model;
}

View File

@ -99,7 +99,7 @@ export class Env {
// @ts-ignore WorkerGlobalScope evaluated in browser only
this.worker = this.browser && this.offscreen ? (typeof WorkerGlobalScope !== 'undefined') : undefined;
if (typeof navigator !== 'undefined') {
if (typeof navigator !== 'undefined') { // TBD replace with navigator.userAgentData once in mainline
const raw = navigator.userAgent.match(/\(([^()]+)\)/g);
if (raw?.[0]) {
const platformMatch = raw[0].match(/\(([^()]+)\)/g);
@ -107,15 +107,6 @@ export class Env {
this.agent = navigator.userAgent.replace(raw[0], '');
if (this.platform[1]) this.agent = this.agent.replace(raw[1], '');
this.agent = this.agent.replace(/ /g, ' ');
// chrome offscreencanvas gpu memory leak
/*
const isChrome = env.agent.match(/Chrome\/.[0-9]/g);
const verChrome = isChrome && isChrome[0] ? isChrome[0].split('/')[1] : 0;
if (verChrome > 92 && verChrome < 96) {
log('disabling offscreenCanvas due to browser error:', isChrome ? isChrome[0] : 'unknown');
this.offscreen = false;
}
*/
}
} else if (typeof process !== 'undefined') {
this.platform = `${process.platform} ${process.arch}`;

View File

@ -1,50 +1,50 @@
2022-11-11 12:33:55 DATA:  Build {"name":"@vladmandic/human","version":"3.0.0"}
2022-11-11 12:33:55 INFO:  Application: {"name":"@vladmandic/human","version":"3.0.0"}
2022-11-11 12:33:55 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-11-11 12:33:55 INFO:  Toolchain: {"build":"0.7.14","esbuild":"0.15.13","typescript":"4.8.4","typedoc":"0.23.20","eslint":"8.27.0"}
2022-11-11 12:33:55 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-11-11 12:33:55 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2022-11-11 12:33:55 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1289,"outputBytes":361}
2022-11-11 12:33:55 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":569,"outputBytes":924}
2022-11-11 12:33:55 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":79,"inputBytes":674035,"outputBytes":316862}
2022-11-11 12:33:55 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":577,"outputBytes":928}
2022-11-11 12:33:55 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":79,"inputBytes":674039,"outputBytes":316866}
2022-11-11 12:33:55 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":665,"outputBytes":1876}
2022-11-11 12:33:55 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":79,"inputBytes":674987,"outputBytes":316977}
2022-11-11 12:33:55 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1375,"outputBytes":670}
2022-11-11 12:33:55 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":79,"inputBytes":673781,"outputBytes":315471}
2022-11-11 12:33:55 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":10,"inputBytes":1375,"outputBytes":1144900}
2022-11-11 12:33:55 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":79,"inputBytes":1818011,"outputBytes":1457057}
2022-11-11 12:33:55 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":79,"inputBytes":1818011,"outputBytes":1914726}
2022-11-11 12:34:00 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":15}
2022-11-11 12:34:02 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":76,"generated":true}
2022-11-11 12:34:02 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5981,"outputBytes":2862}
2022-11-11 12:34:02 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":17166,"outputBytes":9243}
2022-11-11 12:34:11 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":116,"errors":0,"warnings":0}
2022-11-11 12:34:11 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-11-11 12:34:11 STATE: Copy: {"input":"src/tfjs/tfjs.esm.d.ts","output":"dist/tfjs.esm.d.ts"}
2022-11-11 12:34:11 INFO:  Done...
2022-11-11 12:34:11 STATE: Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs-core.d.ts","output":"types/tfjs-core.d.ts"}
2022-11-11 12:34:11 STATE: Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs.d.ts","output":"types/tfjs.esm.d.ts"}
2022-11-11 12:34:11 STATE: Copy: {"input":"tfjs/types-tsconfig.json","output":"types/tsconfig.json"}
2022-11-11 12:34:11 STATE: Copy: {"input":"tfjs/types-eslint.json","output":"types/.eslintrc.json"}
2022-11-11 12:34:11 STATE: Filter: {"input":"types/tfjs-core.d.ts"}
2022-11-11 12:34:12 STATE: API-Extractor: {"succeeeded":true,"errors":0,"warnings":195}
2022-11-11 12:34:12 STATE: Filter: {"input":"types/human.d.ts"}
2022-11-11 12:34:12 STATE: Write: {"output":"dist/human.esm-nobundle.d.ts"}
2022-11-11 12:34:12 STATE: Write: {"output":"dist/human.esm.d.ts"}
2022-11-11 12:34:12 STATE: Write: {"output":"dist/human.d.ts"}
2022-11-11 12:34:12 STATE: Write: {"output":"dist/human.node-gpu.d.ts"}
2022-11-11 12:34:12 STATE: Write: {"output":"dist/human.node.d.ts"}
2022-11-11 12:34:12 STATE: Write: {"output":"dist/human.node-wasm.d.ts"}
2022-11-11 12:34:12 INFO:  Analyze models: {"folders":8,"result":"models/models.json"}
2022-11-11 12:34:12 STATE: Models {"folder":"./models","models":12}
2022-11-11 12:34:12 STATE: Models {"folder":"../human-models/models","models":43}
2022-11-11 12:34:12 STATE: Models {"folder":"../blazepose/model/","models":4}
2022-11-11 12:34:12 STATE: Models {"folder":"../anti-spoofing/model","models":1}
2022-11-11 12:34:12 STATE: Models {"folder":"../efficientpose/models","models":3}
2022-11-11 12:34:12 STATE: Models {"folder":"../insightface/models","models":5}
2022-11-11 12:34:12 STATE: Models {"folder":"../movenet/models","models":3}
2022-11-11 12:34:12 STATE: Models {"folder":"../nanodet/models","models":4}
2022-11-11 12:34:13 STATE: Models: {"count":58,"totalSize":386543911}
2022-11-11 12:34:13 INFO:  Human Build complete... {"logFile":"test/build.log"}
2022-11-11 16:18:41 DATA:  Build {"name":"@vladmandic/human","version":"3.0.0"}
2022-11-11 16:18:41 INFO:  Application: {"name":"@vladmandic/human","version":"3.0.0"}
2022-11-11 16:18:41 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-11-11 16:18:41 INFO:  Toolchain: {"build":"0.7.14","esbuild":"0.15.13","typescript":"4.8.4","typedoc":"0.23.20","eslint":"8.27.0"}
2022-11-11 16:18:41 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-11-11 16:18:41 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2022-11-11 16:18:41 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1289,"outputBytes":361}
2022-11-11 16:18:41 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":569,"outputBytes":924}
2022-11-11 16:18:41 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":79,"inputBytes":673330,"outputBytes":316862}
2022-11-11 16:18:41 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":577,"outputBytes":928}
2022-11-11 16:18:41 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":79,"inputBytes":673334,"outputBytes":316866}
2022-11-11 16:18:41 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":665,"outputBytes":1876}
2022-11-11 16:18:41 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":79,"inputBytes":674282,"outputBytes":316977}
2022-11-11 16:18:41 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1375,"outputBytes":670}
2022-11-11 16:18:41 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":79,"inputBytes":673076,"outputBytes":315471}
2022-11-11 16:18:41 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":10,"inputBytes":1375,"outputBytes":1144900}
2022-11-11 16:18:41 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":79,"inputBytes":1817306,"outputBytes":1457057}
2022-11-11 16:18:41 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":79,"inputBytes":1817306,"outputBytes":1914726}
2022-11-11 16:18:45 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":15}
2022-11-11 16:18:47 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":76,"generated":true}
2022-11-11 16:18:47 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5981,"outputBytes":2862}
2022-11-11 16:18:47 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":17166,"outputBytes":9243}
2022-11-11 16:18:56 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":117,"errors":0,"warnings":0}
2022-11-11 16:18:56 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-11-11 16:18:56 STATE: Copy: {"input":"src/tfjs/tfjs.esm.d.ts","output":"dist/tfjs.esm.d.ts"}
2022-11-11 16:18:56 INFO:  Done...
2022-11-11 16:18:56 STATE: Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs-core.d.ts","output":"types/tfjs-core.d.ts"}
2022-11-11 16:18:56 STATE: Copy: {"input":"node_modules/@vladmandic/tfjs/types/tfjs.d.ts","output":"types/tfjs.esm.d.ts"}
2022-11-11 16:18:56 STATE: Copy: {"input":"tfjs/types-tsconfig.json","output":"types/tsconfig.json"}
2022-11-11 16:18:56 STATE: Copy: {"input":"tfjs/types-eslint.json","output":"types/.eslintrc.json"}
2022-11-11 16:18:56 STATE: Filter: {"input":"types/tfjs-core.d.ts"}
2022-11-11 16:18:56 STATE: API-Extractor: {"succeeeded":true,"errors":0,"warnings":195}
2022-11-11 16:18:56 STATE: Filter: {"input":"types/human.d.ts"}
2022-11-11 16:18:56 STATE: Write: {"output":"dist/human.esm-nobundle.d.ts"}
2022-11-11 16:18:56 STATE: Write: {"output":"dist/human.esm.d.ts"}
2022-11-11 16:18:56 STATE: Write: {"output":"dist/human.d.ts"}
2022-11-11 16:18:56 STATE: Write: {"output":"dist/human.node-gpu.d.ts"}
2022-11-11 16:18:56 STATE: Write: {"output":"dist/human.node.d.ts"}
2022-11-11 16:18:56 STATE: Write: {"output":"dist/human.node-wasm.d.ts"}
2022-11-11 16:18:56 INFO:  Analyze models: {"folders":8,"result":"models/models.json"}
2022-11-11 16:18:56 STATE: Models {"folder":"./models","models":12}
2022-11-11 16:18:56 STATE: Models {"folder":"../human-models/models","models":43}
2022-11-11 16:18:56 STATE: Models {"folder":"../blazepose/model/","models":4}
2022-11-11 16:18:56 STATE: Models {"folder":"../anti-spoofing/model","models":1}
2022-11-11 16:18:56 STATE: Models {"folder":"../efficientpose/models","models":3}
2022-11-11 16:18:56 STATE: Models {"folder":"../insightface/models","models":5}
2022-11-11 16:18:56 STATE: Models {"folder":"../movenet/models","models":3}
2022-11-11 16:18:56 STATE: Models {"folder":"../nanodet/models","models":4}
2022-11-11 16:18:57 STATE: Models: {"count":58,"totalSize":386543911}
2022-11-11 16:18:57 INFO:  Human Build complete... {"logFile":"test/build.log"}