mirror of https://github.com/vladmandic/human
reduce dev dependencies
parent
7a82a73273
commit
510e89d9f2
21
.build.json
21
.build.json
|
@ -39,6 +39,13 @@
|
|||
"banner": { "js": "/*\n Human\n homepage: <https://github.com/vladmandic/human>\n author: <https://github.com/vladmandic>'\n*/\n" }
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "tfjs/browser/version",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-version.ts",
|
||||
"output": "dist/tfjs.version.js"
|
||||
},
|
||||
{
|
||||
"name": "tfjs/nodejs/cpu",
|
||||
"platform": "node",
|
||||
|
@ -77,6 +84,7 @@
|
|||
"format": "cjs",
|
||||
"input": "tfjs/tf-node-wasm.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"minify": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
|
@ -87,13 +95,6 @@
|
|||
"output": "dist/human.node-wasm.js",
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "tfjs/browser/version",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-version.ts",
|
||||
"output": "dist/tfjs.version.js"
|
||||
},
|
||||
{
|
||||
"name": "tfjs/browser/esm/nobundle",
|
||||
"platform": "browser",
|
||||
|
@ -112,13 +113,13 @@
|
|||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "tfjs/browser/esm/custom",
|
||||
"name": "tfjs/browser/esm/bundle",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-custom.ts",
|
||||
"input": "tfjs/tf-browser.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"minify": false
|
||||
"minify": true
|
||||
},
|
||||
{
|
||||
"name": "human/browser/iife/bundle",
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2022/10/13 mandic00@live.com
|
||||
### **HEAD -> main** 2022/10/16 mandic00@live.com
|
||||
|
||||
|
||||
### **origin/main** 2022/10/13 mandic00@live.com
|
||||
|
||||
|
||||
### **release: 2.11.1** 2022/10/09 mandic00@live.com
|
||||
|
|
6
build.js
6
build.js
|
@ -93,8 +93,12 @@ async function main() {
|
|||
const build = new Build();
|
||||
await build.run('production');
|
||||
// patch tfjs typedefs
|
||||
log.state('Copy:', { input: 'src/tfjs/tfjs.esm.d.ts', output: 'dist/tfjs.esm.d.ts' });
|
||||
log.state('Copy:', { input: 'src/tfjs', output: 'dist/tfjs.esm.d.ts' });
|
||||
copy('src/tfjs/tfjs.esm.d.ts', 'dist/tfjs.esm.d.ts');
|
||||
// log.state('Copy:', { input: '@vladmandic/tfjs/types', output: 'types/tfjs-core.esm.d.ts' });
|
||||
// copy('node_modules/@vladmandic/tfjs/types/tfjs-core.d.ts', 'types/tfjs-core.esm.d.ts');
|
||||
// log.state('Copy:', { input: '@vladmandic/tfjs/types', output: 'types/tfjs.esm.d.ts' });
|
||||
// copy('node_modules/@vladmandic/tfjs/types/tfjs.d.ts', 'types/tfjs.esm.d.ts');
|
||||
// run api-extractor to create typedef rollup
|
||||
const extractorConfig = APIExtractor.ExtractorConfig.loadFileAndPrepare('.api-extractor.json');
|
||||
const extractorResult = APIExtractor.Extractor.invoke(extractorConfig, {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
const fs = require('fs');
|
||||
const process = require('process');
|
||||
|
||||
let fetch; // fetch is dynamically imported later
|
||||
|
||||
const log = require('@vladmandic/pilogger'); // eslint-disable-line node/no-unpublished-require
|
||||
// in nodejs environments tfjs-node is required to be loaded before human
|
||||
const tf = require('@tensorflow/tfjs-node'); // eslint-disable-line node/no-unpublished-require
|
||||
|
@ -38,13 +36,13 @@ async function detect(input) {
|
|||
let buffer;
|
||||
log.info('Loading image:', input);
|
||||
if (input.startsWith('http:') || input.startsWith('https:')) {
|
||||
fetch = (await import('node-fetch')).default; // eslint-disable-line node/no-unpublished-import
|
||||
const res = await fetch(input);
|
||||
if (res && res.ok) buffer = await res.buffer();
|
||||
if (res && res.ok) buffer = Buffer.from(await res.arrayBuffer());
|
||||
else log.error('Invalid image URL:', input, res.status, res.statusText, res.headers.get('content-type'));
|
||||
} else {
|
||||
buffer = fs.readFileSync(input);
|
||||
}
|
||||
log.data('Image bytes:', buffer?.length, 'buffer:', buffer?.slice(0, 32));
|
||||
|
||||
// decode image using tfjs-node so we don't need external depenencies
|
||||
if (!buffer) return;
|
||||
|
|
|
@ -16,8 +16,7 @@ const humanConfig = {
|
|||
};
|
||||
|
||||
async function main(inputFile) {
|
||||
// @ts-ignore
|
||||
global.fetch = (await import('node-fetch')).default; // eslint-disable-line node/no-unpublished-import
|
||||
global.fetch = (await import('node-fetch')).default; // eslint-disable-line node/no-unpublished-import, import/no-unresolved, node/no-missing-import
|
||||
const human = new Human.Human(humanConfig); // create instance of human using default configuration
|
||||
log.info('Human:', human.version, 'TF:', tf.version_core);
|
||||
await human.load(); // optional as models would be loaded on-demand first time they are required
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/**
|
||||
* Human demo for NodeJS
|
||||
*
|
||||
* Requires [node-fetch](https://www.npmjs.com/package/node-fetch) to provide `fetch` functionality in NodeJS environment
|
||||
*/
|
||||
|
||||
const log = require('@vladmandic/pilogger'); // eslint-disable-line node/no-unpublished-require
|
||||
|
@ -9,8 +7,6 @@ const fs = require('fs');
|
|||
const path = require('path');
|
||||
const process = require('process');
|
||||
|
||||
let fetch; // fetch is dynamically imported later
|
||||
|
||||
// in nodejs environments tfjs-node is required to be loaded before human
|
||||
const tf = require('@tensorflow/tfjs-node'); // eslint-disable-line node/no-unpublished-require
|
||||
// const human = require('@vladmandic/human'); // use this when human is installed as module (majority of use cases)
|
||||
|
@ -65,11 +61,12 @@ async function detect(input) {
|
|||
log.info('Loading image:', input);
|
||||
if (input.startsWith('http:') || input.startsWith('https:')) {
|
||||
const res = await fetch(input);
|
||||
if (res && res.ok) buffer = await res.buffer();
|
||||
if (res && res.ok) buffer = Buffer.from(await res.arrayBuffer());
|
||||
else log.error('Invalid image URL:', input, res.status, res.statusText, res.headers.get('content-type'));
|
||||
} else {
|
||||
buffer = fs.readFileSync(input);
|
||||
}
|
||||
log.data('Image bytes:', buffer?.length, 'buffer:', buffer?.slice(0, 32));
|
||||
|
||||
// decode image using tfjs-node so we don't need external depenencies
|
||||
// can also be done using canvas.js or some other 3rd party image library
|
||||
|
@ -192,7 +189,6 @@ async function main() {
|
|||
log.configure({ inspect: { breakLength: 265 } });
|
||||
log.header();
|
||||
log.info('Current folder:', process.env.PWD);
|
||||
fetch = (await import('node-fetch')).default; // eslint-disable-line node/no-unpublished-import
|
||||
await init();
|
||||
const f = process.argv[2];
|
||||
if (process.argv.length !== 3) {
|
||||
|
|
|
@ -69,19 +69,14 @@
|
|||
"@html-eslint/eslint-plugin": "^0.15.0",
|
||||
"@html-eslint/parser": "^0.15.0",
|
||||
"@microsoft/api-extractor": "^7.33.2",
|
||||
"@tensorflow/tfjs": "^4.0.0",
|
||||
"@tensorflow/tfjs-backend-cpu": "^4.0.0",
|
||||
"@tensorflow/tfjs-backend-wasm": "^4.0.0",
|
||||
"@tensorflow/tfjs-backend-webgl": "^4.0.0",
|
||||
"@tensorflow/tfjs-backend-webgpu": "0.0.1-alpha.14",
|
||||
"@tensorflow/tfjs-converter": "^4.0.0",
|
||||
"@tensorflow/tfjs-core": "^4.0.0",
|
||||
"@tensorflow/tfjs-data": "^4.0.0",
|
||||
"@tensorflow/tfjs-layers": "^4.0.0",
|
||||
"@tensorflow/tfjs-node": "^4.0.0",
|
||||
"@tensorflow/tfjs-node-gpu": "^4.0.0",
|
||||
"@tensorflow/tfjs-tflite": "0.0.1-alpha.9",
|
||||
"@types/emscripten": "^1.39.6",
|
||||
"@types/node": "^18.11.0",
|
||||
"@types/offscreencanvas": "^2019.7.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.40.0",
|
||||
|
@ -89,7 +84,6 @@
|
|||
"@vladmandic/build": "^0.7.14",
|
||||
"@vladmandic/pilogger": "^0.4.6",
|
||||
"@vladmandic/tfjs": "github:vladmandic/tfjs",
|
||||
"@webgpu/types": "^0.1.22",
|
||||
"canvas": "^2.10.1",
|
||||
"esbuild": "^0.15.11",
|
||||
"eslint": "8.25.0",
|
||||
|
@ -99,10 +93,7 @@
|
|||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^6.1.0",
|
||||
"long": "^5.2.0",
|
||||
"node-fetch": "^3.2.10",
|
||||
"rimraf": "^3.0.2",
|
||||
"seedrandom": "^3.0.5",
|
||||
"tslib": "^2.4.0",
|
||||
"typedoc": "0.23.16",
|
||||
"typescript": "4.8.4"
|
||||
|
|
|
@ -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 type { MathBackendWebGL } from './types';
|
||||
// import { env } from '../env';
|
||||
|
||||
export const config = {
|
||||
|
@ -105,6 +104,7 @@ export function register(instance: Human): void {
|
|||
}
|
||||
try {
|
||||
const ctx = new tf.GPGPUContext(config.gl);
|
||||
// @ts-ignore uncompatible kernelMs timing info
|
||||
tf.registerBackend(config.name, () => new tf.MathBackendWebGL(ctx), config.priority);
|
||||
} catch (err) {
|
||||
log('humangl error: cannot register webgl backend:', err);
|
||||
|
@ -128,8 +128,8 @@ export function register(instance: Human): void {
|
|||
return;
|
||||
}
|
||||
extensions();
|
||||
const backend = tf.backend() as MathBackendWebGL;
|
||||
const current = typeof backend['gpgpu'] !== 'undefined' ? backend.getGPGPUContext().gl : null;
|
||||
const backend = tf.backend();
|
||||
const current = typeof backend['gpgpu'] !== 'undefined' ? backend['getGPGPUContext']().gl : null;
|
||||
if (current) {
|
||||
if (instance.config.debug) log('humangl backend registered:', { webgl: current.getParameter(current.VERSION) as string, renderer: current.getParameter(current.RENDERER) as string });
|
||||
} else {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable import/no-unresolved */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
export declare const version: {
|
||||
|
@ -17,3 +18,7 @@ export * from '@tensorflow/tfjs-converter';
|
|||
// export * from '@tensorflow/tfjs-backend-cpu';
|
||||
export * from '@tensorflow/tfjs-backend-wasm';
|
||||
export * from '@tensorflow/tfjs-backend-webgl';
|
||||
// export * from '@tensorflow/tfjs-backend-webgpu';
|
||||
|
||||
// export * from 'types/tfjs-core.esm';
|
||||
// export * from 'types/tfjs.esm';
|
||||
|
|
|
@ -14,6 +14,18 @@ export type { loadGraphModel, GraphModel } from '@tensorflow/tfjs-converter';
|
|||
export type { setWasmPaths } from '@tensorflow/tfjs-backend-wasm';
|
||||
export type { setWebGLContext, GPGPUContext, MathBackendWebGL } from '@tensorflow/tfjs-backend-webgl';
|
||||
|
||||
/*
|
||||
export type { version_core } from '@vladmandic/tfjs/dist/tfjs-core.esm'; // eslint-disable-line camelcase
|
||||
export type { image, browser, io } from '@vladmandic/tfjs/dist/tfjs-core.esm';
|
||||
export type { clone, sum, transpose, addN, softmax, tile, cast, unstack, pad, div, split, squeeze, add, mul, sub, stack, sigmoid, argMax, reshape, max, mod, min, floorDiv } from '@vladmandic/tfjs/dist/tfjs-core.esm';
|
||||
export type { slice, slice3d, slice4d, concat, concat2d, expandDims } from '@tensorflow/tfjs-core';
|
||||
export type { fill, scalar, tensor2d, zeros, tensor, dispose, tensor1d, tidy, ready, getBackend, registerKernel, engine, env, setBackend, enableProdMode, getKernelsForBackend, findBackend, registerBackend, backend } from '@vladmandic/tfjs/dist/tfjs-core.esm';
|
||||
export type { Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D, TensorLike, TensorInfo, DataType, Rank, TensorContainer, TensorContainerObject } from '@vladmandic/tfjs/dist/tfjs-core.esm';
|
||||
export type { loadGraphModel, GraphModel } from '@vladmandic/tfjs/dist/tfjs.esm';
|
||||
export type { setWasmPaths } from '@vladmandic/tfjs/dist/tfjs.esm';
|
||||
export type { setWebGLContext, GPGPUContext, MathBackendWebGL } from '@vladmandic/tfjs/dist/tfjs.esm';
|
||||
*/
|
||||
|
||||
export declare const version: {
|
||||
'tfjs-core': string;
|
||||
'tfjs-backend-cpu': string;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import * as tf from 'dist/tfjs.esm.js';
|
||||
import * as image from '../image/image';
|
||||
import type { MathBackendWebGL } from '../tfjs/types';
|
||||
|
||||
/** Env class that holds detected capabilities */
|
||||
export class Env {
|
||||
|
@ -140,8 +139,8 @@ export class Env {
|
|||
this.webgl.supported = typeof ctx !== 'undefined';
|
||||
this.webgl.backend = this.backends.includes('webgl');
|
||||
if (this.webgl.supported && this.webgl.backend && (tf.getBackend() === 'webgl' || tf.getBackend() === 'humangl')) {
|
||||
const backend = tf.backend() as MathBackendWebGL;
|
||||
const gl = typeof backend['gpgpu'] !== 'undefined' ? backend.getGPGPUContext().gl : null;
|
||||
const backend = tf.backend();
|
||||
const gl = typeof backend['gpgpu'] !== 'undefined' ? backend['getGPGPUContext']().gl : null;
|
||||
if (gl) {
|
||||
this.webgl.version = gl.getParameter(gl.VERSION);
|
||||
this.webgl.renderer = gl.getParameter(gl.RENDERER);
|
||||
|
|
|
@ -11,7 +11,7 @@ import { env } from './util/env';
|
|||
import type { Config } from './config';
|
||||
import type { Result } from './result';
|
||||
import { Human, models } from './human';
|
||||
import type { Tensor, DataType, MathBackendWebGL } from './tfjs/types';
|
||||
import type { Tensor, DataType } from './tfjs/types';
|
||||
|
||||
async function warmupBitmap(instance: Human): Promise<Result | undefined> {
|
||||
const b64toBlob = (base64: string, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob());
|
||||
|
@ -113,7 +113,7 @@ export async function runCompile(instance: Human) {
|
|||
// @ts-ignore private property
|
||||
if (!tf.env().flagRegistry.ENGINE_COMPILE_ONLY) return; // tfjs does not support compile-only inference
|
||||
const backendType = tf.getBackend();
|
||||
const webGLBackend = tf.backend() as MathBackendWebGL;
|
||||
const webGLBackend = tf.backend();
|
||||
if ((backendType !== 'webgl' && backendType !== 'humangl') || !webGLBackend?.['checkCompileCompletion']) {
|
||||
// log('compile pass: skip');
|
||||
return;
|
||||
|
@ -138,8 +138,8 @@ export async function runCompile(instance: Human) {
|
|||
}
|
||||
tf.dispose(tensor);
|
||||
}
|
||||
const kernels = await webGLBackend.checkCompileCompletionAsync();
|
||||
webGLBackend.getUniformLocations();
|
||||
const kernels = await webGLBackend['checkCompileCompletionAsync']();
|
||||
webGLBackend['getUniformLocations']();
|
||||
if (instance.config.debug) log('compile pass:', { models: compiledModels, kernels: kernels.length });
|
||||
tf.env().set('ENGINE_COMPILE_ONLY', false);
|
||||
const numTensorsEnd = tf.engine().state.numTensors;
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
2022-10-16 20:28:16 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"3.0.0"}
|
||||
2022-10-16 20:28:16 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"3.0.0"}
|
||||
2022-10-16 20:28:16 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2022-10-16 20:28:16 [36mINFO: [39m Toolchain: {"build":"0.7.14","esbuild":"0.15.11","typescript":"4.8.4","typedoc":"0.23.16","eslint":"8.25.0"}
|
||||
2022-10-16 20:28:16 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":159,"outputBytes":608}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":78,"inputBytes":671035,"outputBytes":315423}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":167,"outputBytes":612}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":78,"inputBytes":671039,"outputBytes":315427}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":206,"outputBytes":664}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":78,"inputBytes":671091,"outputBytes":315477}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1125,"outputBytes":351}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1081,"outputBytes":576}
|
||||
2022-10-16 20:28:16 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":78,"inputBytes":671003,"outputBytes":314166}
|
||||
2022-10-16 20:28:17 [35mSTATE:[39m Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1354,"outputBytes":2868616}
|
||||
2022-10-16 20:28:17 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":78,"inputBytes":3539043,"outputBytes":1717157}
|
||||
2022-10-16 20:28:17 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":78,"inputBytes":3539043,"outputBytes":3175031}
|
||||
2022-10-16 20:28:27 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":15}
|
||||
2022-10-16 20:28:29 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":76,"generated":true}
|
||||
2022-10-16 20:28:29 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5672,"outputBytes":2632}
|
||||
2022-10-16 20:28:29 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":17134,"outputBytes":9181}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":115,"errors":0,"warnings":0}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Copy: {"input":"src/tfjs/tfjs.esm.d.ts","output":"dist/tfjs.esm.d.ts"}
|
||||
2022-10-16 20:28:39 [36mINFO: [39m Done...
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":195}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Filter: {"input":"types/human.d.ts"}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Link: {"input":"types/human.d.ts"}
|
||||
2022-10-16 20:28:39 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"./models","models":12}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../human-models/models","models":43}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2022-10-16 20:28:39 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2022-10-16 20:28:40 [35mSTATE:[39m Models: {"count":58,"totalSize":386543911}
|
||||
2022-10-16 20:28:40 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
2022-10-17 10:45:30 [32mDATA: [39m Build {"name":"@vladmandic/human","version":"3.0.0"}
|
||||
2022-10-17 10:45:30 [36mINFO: [39m Application: {"name":"@vladmandic/human","version":"3.0.0"}
|
||||
2022-10-17 10:45:30 [36mINFO: [39m Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
|
||||
2022-10-17 10:45:30 [36mINFO: [39m Toolchain: {"build":"0.7.14","esbuild":"0.15.11","typescript":"4.8.4","typedoc":"0.23.16","eslint":"8.25.0"}
|
||||
2022-10-17 10:45:30 [36mINFO: [39m Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m Clean: {"locations":["dist/*","types/*","typedoc/*"]}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m 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-10-17 10:45:30 [35mSTATE:[39m 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-10-17 10:45:30 [35mSTATE:[39m Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":78,"inputBytes":670926,"outputBytes":315728}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m 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-10-17 10:45:30 [35mSTATE:[39m Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":78,"inputBytes":670930,"outputBytes":315732}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m 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-10-17 10:45:30 [35mSTATE:[39m Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":78,"inputBytes":671878,"outputBytes":315843}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m 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-10-17 10:45:30 [35mSTATE:[39m Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":78,"inputBytes":670672,"outputBytes":314337}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m 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":1144854}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":78,"inputBytes":1814856,"outputBytes":1455805}
|
||||
2022-10-17 10:45:30 [35mSTATE:[39m Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":78,"inputBytes":1814856,"outputBytes":1912566}
|
||||
2022-10-17 10:45:34 [35mSTATE:[39m Typings: {"input":"src/human.ts","output":"types/lib","files":15}
|
||||
2022-10-17 10:45:36 [35mSTATE:[39m TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":76,"generated":true}
|
||||
2022-10-17 10:45:36 [35mSTATE:[39m Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5672,"outputBytes":2632}
|
||||
2022-10-17 10:45:36 [35mSTATE:[39m Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":17134,"outputBytes":9181}
|
||||
2022-10-17 10:45:44 [35mSTATE:[39m Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":115,"errors":0,"warnings":0}
|
||||
2022-10-17 10:45:44 [35mSTATE:[39m ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
|
||||
2022-10-17 10:45:44 [35mSTATE:[39m Copy: {"input":"src/tfjs","output":"dist/tfjs.esm.d.ts"}
|
||||
2022-10-17 10:45:44 [36mINFO: [39m Done...
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m API-Extractor: {"succeeeded":true,"errors":0,"warnings":195}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Filter: {"input":"types/human.d.ts"}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Link: {"input":"types/human.d.ts"}
|
||||
2022-10-17 10:45:45 [36mINFO: [39m Analyze models: {"folders":8,"result":"models/models.json"}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"./models","models":12}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../human-models/models","models":43}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../blazepose/model/","models":4}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../anti-spoofing/model","models":1}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../efficientpose/models","models":3}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../insightface/models","models":5}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../movenet/models","models":3}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models {"folder":"../nanodet/models","models":4}
|
||||
2022-10-17 10:45:45 [35mSTATE:[39m Models: {"count":58,"totalSize":386543911}
|
||||
2022-10-17 10:45:45 [36mINFO: [39m Human Build complete... {"logFile":"test/build.log"}
|
||||
|
|
|
@ -19,7 +19,6 @@ const tests = [
|
|||
const demos = [
|
||||
{ cmd: '../demo/nodejs/node.js', args: [] },
|
||||
{ cmd: '../demo/nodejs/node-simple.js', args: [] },
|
||||
{ cmd: '../demo/nodejs/node-fetch.js', args: [] },
|
||||
{ cmd: '../demo/nodejs/node-event.js', args: ['samples/in/ai-body.jpg'] },
|
||||
{ cmd: '../demo/nodejs/node-similarity.js', args: ['samples/in/ai-face.jpg', 'samples/in/ai-upper.jpg'] },
|
||||
{ cmd: '../demo/nodejs/node-canvas.js', args: ['samples/in/ai-body.jpg', 'samples/out/ai-body.jpg'] },
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const log = require('@vladmandic/pilogger');
|
||||
const tf = require('@tensorflow/tfjs'); // wasm backend requires tfjs to be loaded first
|
||||
const tf = require('@tensorflow/tfjs-core'); // wasm backend requires tfjs to be loaded first
|
||||
require('@tensorflow/tfjs-converter');
|
||||
const wasm = require('@tensorflow/tfjs-backend-wasm'); // wasm backend does not get auto-loaded in nodejs
|
||||
const { Canvas, Image } = require('canvas'); // eslint-disable-line node/no-extraneous-require, node/no-missing-require
|
||||
const H = require('../dist/human.node-wasm.js');
|
||||
|
|
|
@ -2,7 +2,6 @@ const fs = require('fs');
|
|||
const process = require('process');
|
||||
const canvasJS = require('canvas'); // eslint-disable-line node/no-extraneous-require, node/no-missing-require
|
||||
|
||||
let fetch; // fetch is dynamically imported later
|
||||
let config;
|
||||
let lastOp = 'unknown';
|
||||
|
||||
|
@ -12,8 +11,10 @@ const log = (status, ...data) => {
|
|||
};
|
||||
|
||||
process.on('uncaughtException', (err) => {
|
||||
log('error', 'uncaughtException', lastOp, err); // abort immediately
|
||||
throw new Error(err);
|
||||
log('error', 'failed:', lastOp);
|
||||
log('error', 'uncaughtException', { name: err.name, message: err.message, cause: err.cause, stack: err.stack?.split('\n') });
|
||||
process.exit(1); // eslint-disable-line no-process-exit
|
||||
// throw new Error(err);
|
||||
});
|
||||
|
||||
async function testHTTP() {
|
||||
|
@ -145,6 +146,7 @@ async function testDetect(human, input, title, checkLeak = true) {
|
|||
log('error', 'failed: detect: input is null', { input, title });
|
||||
return false;
|
||||
}
|
||||
lastOp = `testDetect ${title}`;
|
||||
let detect = {};
|
||||
try {
|
||||
detect = await human.detect(image, config);
|
||||
|
@ -262,7 +264,6 @@ async function verifyCompare(human) {
|
|||
async function test(Human, inputConfig) {
|
||||
lastOp = `test ${inputConfig}`;
|
||||
config = inputConfig;
|
||||
fetch = (await import('node-fetch')).default; // eslint-disable-line node/no-unsupported-features/es-syntax
|
||||
const ok = await testHTTP();
|
||||
if (!ok) {
|
||||
log('error', 'aborting test');
|
||||
|
|
1362
test/test.log
1362
test/test.log
File diff suppressed because it is too large
Load Diff
|
@ -1,21 +1,25 @@
|
|||
/**
|
||||
* Creates tfjs bundle used by Human browser build target
|
||||
/** Creates tfjs bundle used by Human browser build target
|
||||
* @external
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
// export all from build bundle
|
||||
export * from '@tensorflow/tfjs/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-webgl/dist/index.js';
|
||||
// export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
// export * from '@vladmandic/tfjs/dist/tfjs-core.esm.js';
|
||||
// export * from '@vladmandic/tfjs/dist/tfjs.esm.js';
|
||||
|
||||
// add webgpu to bundle, experimental
|
||||
// export * from '@tensorflow/tfjs-backend-webgpu/dist/index.js';
|
||||
// export all from build bundle
|
||||
export * from '@tensorflow/tfjs-core/dist/index.js';
|
||||
// export * from '@tensorflow/tfjs-data/dist/index.js';
|
||||
// export * from '@tensorflow/tfjs-layers/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-converter/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-cpu/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-webgl/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
export * from '@tensorflow/tfjs-backend-webgpu/dist/index.js';
|
||||
|
||||
// add tflite to bundle, experimental
|
||||
// @ts-ignore duplicate definition for setWasmPath
|
||||
// export * from '@tensorflow/tfjs-tflite/dist/index.js';
|
||||
|
||||
// export versions, overrides version object from @tensorflow/tfjs
|
||||
export { version } from '../dist/tfjs.version.js';
|
||||
|
||||
// export utility types used by Human
|
||||
export { Tensor } from '@tensorflow/tfjs/dist/index.js';
|
||||
export { GraphModel } from '@tensorflow/tfjs-converter/dist/index';
|
||||
export { version } from 'dist/tfjs.version.js';
|
||||
|
|
|
@ -5,3 +5,5 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
export * from '@tensorflow/tfjs-node-gpu';
|
||||
|
||||
export { version } from 'dist/tfjs.version.js';
|
||||
|
|
|
@ -4,5 +4,8 @@
|
|||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
export * from '@tensorflow/tfjs';
|
||||
export * from '@tensorflow/tfjs-core';
|
||||
export * from '@tensorflow/tfjs-converter';
|
||||
export * from '@tensorflow/tfjs-backend-wasm';
|
||||
|
||||
export { version } from 'dist/tfjs.version.js';
|
||||
|
|
|
@ -5,3 +5,5 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
export * from '@tensorflow/tfjs-node';
|
||||
|
||||
export { version } from 'dist/tfjs.version.js';
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
// get versions of all packages
|
||||
import { version as tfjsVersion } from '@tensorflow/tfjs/package.json';
|
||||
// import { version as tfjsVersion } from '@tensorflow/tfjs/package.json';
|
||||
import { version as tfjsCoreVersion } from '@tensorflow/tfjs-core/package.json';
|
||||
import { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';
|
||||
import { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';
|
||||
import { version as tfjsConverterVersion } from '@tensorflow/tfjs-converter/package.json';
|
||||
// import { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';
|
||||
// import { version as tfjsDataVersion } from '@tensorflow/tfjs-data/package.json';
|
||||
// import { version as tfjsLayersVersion } from '@tensorflow/tfjs-layers/package.json';
|
||||
import { version as tfjsBackendCPUVersion } from '@tensorflow/tfjs-backend-cpu/package.json';
|
||||
import { version as tfjsBackendWebGLVersion } from '@tensorflow/tfjs-backend-webgl/package.json';
|
||||
import { version as tfjsBackendWASMVersion } from '@tensorflow/tfjs-backend-wasm/package.json';
|
||||
import { version as tfjsBackendWebGPUVersion } from '@tensorflow/tfjs-backend-webgpu/package.json';
|
||||
|
||||
export const version = {
|
||||
tfjs: tfjsVersion,
|
||||
tfjs: tfjsCoreVersion,
|
||||
'tfjs-core': tfjsCoreVersion,
|
||||
'tfjs-data': tfjsDataVersion,
|
||||
'tfjs-layers': tfjsLayersVersion,
|
||||
// 'tfjs-data': tfjsDataVersion,
|
||||
// 'tfjs-layers': tfjsLayersVersion,
|
||||
'tfjs-converter': tfjsConverterVersion,
|
||||
// 'tfjs-backend-cpu': tfjsBackendCPUVersion,
|
||||
'tfjs-backend-cpu': tfjsBackendCPUVersion,
|
||||
'tfjs-backend-webgl': tfjsBackendWebGLVersion,
|
||||
'tfjs-backend-wasm': tfjsBackendWASMVersion,
|
||||
'tfjs-backend-webgpu': tfjsBackendWebGPUVersion,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue