mirror of https://github.com/vladmandic/human
change build process
parent
26570042cd
commit
52b4310992
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -1,16 +1,17 @@
|
|||
# @vladmandic/human
|
||||
|
||||
Version: **2.1.5**
|
||||
Description: **Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition**
|
||||
|
||||
Author: **Vladimir Mandic <mandic00@live.com>**
|
||||
License: **MIT** </LICENSE>
|
||||
Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||
|
||||
Version: **2.1.5**
|
||||
Description: **Human: AI-powered 3D Face Detection & Rotation Tracking, Face Description & Recognition, Body Pose Tracking, 3D Hand & Finger Tracking, Iris Analysis, Age & Gender & Emotion Prediction, Gesture Recognition**
|
||||
|
||||
Author: **Vladimir Mandic <mandic00@live.com>**
|
||||
License: **MIT**
|
||||
Repository: **<https://github.com/vladmandic/human>**
|
||||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/09/06 mandic00@live.com
|
||||
|
||||
### **HEAD -> main** 2021/08/31 mandic00@live.com
|
||||
|
||||
- add benchmark info
|
||||
- simplify canvas handling in nodejs
|
||||
- full rebuild
|
||||
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
"log": {
|
||||
"enabled": true,
|
||||
"debug": false,
|
||||
"console": true,
|
||||
"output": "test/build.log"
|
||||
},
|
||||
"clean": {
|
||||
"enabled": true,
|
||||
"locations": ["dist/*", "types/*", "typedoc/*"]
|
||||
},
|
||||
"lint": {
|
||||
"enabled": true,
|
||||
"locations": [ "src/**/*.ts", "test/*.js", "demo/**/*.js" ],
|
||||
"rules": { }
|
||||
},
|
||||
"changelog": {
|
||||
"enabled": true,
|
||||
"log": "CHANGELOG.md"
|
||||
},
|
||||
"serve": {
|
||||
"enabled": true,
|
||||
"sslKey": "node_modules/@vladmandic/build/cert/https.key",
|
||||
"sslCrt": "node_modules/@vladmandic/build/cert/https.crt",
|
||||
"httpPort": 10030,
|
||||
"httpsPort": 10031,
|
||||
"documentRoot": ".",
|
||||
"defaultFolder": "demo",
|
||||
"defaultFile": "index.html"
|
||||
},
|
||||
"build": {
|
||||
"enabled": true,
|
||||
"global": {
|
||||
"target": "es2018",
|
||||
"sourcemap": true,
|
||||
"banner": { "js": "/*\n Human\n homepage: <https://github.com/vladmandic/human>\n author: <https://github.com/vladmandic>'\n*/\n" }
|
||||
},
|
||||
"production": {
|
||||
"minify": false
|
||||
},
|
||||
"development": {
|
||||
"minify": false
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"name": "tfjs for nodejs with cpu",
|
||||
"platform": "node",
|
||||
"format": "cjs",
|
||||
"input": "tfjs/tf-node.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "human for nodejs with cpu",
|
||||
"platform": "node",
|
||||
"format": "cjs",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.node.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "tfjs for nodejs with gpu",
|
||||
"platform": "node",
|
||||
"format": "cjs",
|
||||
"input": "tfjs/tf-node-gpu.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "human for nodejs with gpu",
|
||||
"platform": "node",
|
||||
"format": "cjs",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.node-gpu.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "tfjs for nodejs with wasm",
|
||||
"platform": "node",
|
||||
"format": "cjs",
|
||||
"input": "tfjs/tf-node-wasm.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "human for nodejs with wasm",
|
||||
"platform": "node",
|
||||
"format": "cjs",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.node-wasm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow"]
|
||||
},
|
||||
{
|
||||
"name": "tfjs for browser esm nobundle",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-browser.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["@tensorflow", "fs", "os", "buffer", "util"]
|
||||
},
|
||||
{
|
||||
"name": "human for browser esm nobundle",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.esm-nobundle.js",
|
||||
"sourcemap": true,
|
||||
"external": ["@tensorflow", "fs", "os", "buffer", "util"]
|
||||
},
|
||||
{
|
||||
"name": "tfjs for browser esm bundle",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "tfjs/tf-browser.ts",
|
||||
"output": "dist/tfjs.esm.js",
|
||||
"sourcemap": false,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
{
|
||||
"name": "human for browser iife bundle",
|
||||
"platform": "browser",
|
||||
"format": "iife",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.js",
|
||||
"sourcemap": false,
|
||||
"external": ["fs", "os", "buffer", "util"]
|
||||
},
|
||||
{
|
||||
"name": "human for browser esm bundle",
|
||||
"platform": "browser",
|
||||
"format": "esm",
|
||||
"input": "src/human.ts",
|
||||
"output": "dist/human.esm.js",
|
||||
"sourcemap": true,
|
||||
"external": ["fs", "os", "buffer", "util"],
|
||||
"typings": "types",
|
||||
"typedoc": "typedoc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"watch": {
|
||||
"enabled": true,
|
||||
"locations": [ "src/**", "tfjs/*" ]
|
||||
},
|
||||
"typescript": {
|
||||
"allowJs": false
|
||||
}
|
||||
}
|
|
@ -50,7 +50,7 @@ async function init() {
|
|||
await human.tf.ready();
|
||||
// pre-load models
|
||||
log.info('Human:', human.version);
|
||||
log.info('Active Configuration', human.config);
|
||||
// log.info('Active Configuration', human.config);
|
||||
await human.load();
|
||||
const loaded = Object.keys(human.models).filter((a) => human.models[a]);
|
||||
log.info('Loaded:', loaded);
|
||||
|
@ -186,6 +186,7 @@ async function test() {
|
|||
}
|
||||
|
||||
async function main() {
|
||||
log.configure({ inspect: { breakLength: 265 } });
|
||||
log.header();
|
||||
log.info('Current folder:', process.env.PWD);
|
||||
fetch = (await import('node-fetch')).default;
|
||||
|
|
42
package.json
42
package.json
|
@ -8,24 +8,17 @@
|
|||
"browser": "dist/human.esm.js",
|
||||
"types": "types/src/human.d.ts",
|
||||
"author": "Vladimir Mandic <mandic00@live.com>",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vladmandic/human/issues"
|
||||
},
|
||||
"bugs": { "url": "https://github.com/vladmandic/human/issues" },
|
||||
"homepage": "https://vladmandic.github.io/human/demo/index.html",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vladmandic/human.git"
|
||||
},
|
||||
"engines": { "node": ">=14.0.0" },
|
||||
"repository": { "type": "git", "url": "git+https://github.com/vladmandic/human.git" },
|
||||
"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 --no-deprecation server/build.js",
|
||||
"lint": "eslint src server demo test",
|
||||
"start": "node --no-warnings demo/nodejs/node.js",
|
||||
"dev": "build development",
|
||||
"build": "build production",
|
||||
"test": "node --no-warnings --unhandled-rejections=strict --trace-uncaught test/test.js",
|
||||
"lint": "eslint src demo test",
|
||||
"scan": "npx auditjs@latest ossi --dev --quiet"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -66,14 +59,15 @@
|
|||
"@tensorflow/tfjs-layers": "^3.9.0",
|
||||
"@tensorflow/tfjs-node": "^3.9.0",
|
||||
"@tensorflow/tfjs-node-gpu": "^3.9.0",
|
||||
"@types/node": "^16.7.10",
|
||||
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
||||
"@typescript-eslint/parser": "^4.30.0",
|
||||
"@vladmandic/pilogger": "^0.2.18",
|
||||
"@types/node": "^16.9.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.0",
|
||||
"@typescript-eslint/parser": "^4.31.0",
|
||||
"@vladmandic/pilogger": "^0.3.1",
|
||||
"@vladmandic/build": "^0.3.4",
|
||||
"canvas": "^2.8.0",
|
||||
"chokidar": "^3.5.2",
|
||||
"dayjs": "^1.10.6",
|
||||
"esbuild": "^0.12.25",
|
||||
"dayjs": "^1.10.7",
|
||||
"esbuild": "^0.12.26",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
|
@ -85,7 +79,9 @@
|
|||
"seedrandom": "^3.0.5",
|
||||
"simple-git": "^2.45.1",
|
||||
"tslib": "^2.3.1",
|
||||
"typedoc": "0.21.9",
|
||||
"typescript": "4.4.2"
|
||||
}
|
||||
"typedoc": "0.22.1",
|
||||
"typescript": "4.4.3"
|
||||
},
|
||||
"peerDependencies": { },
|
||||
"dependencies": { }
|
||||
}
|
||||
|
|
|
@ -370,10 +370,10 @@ export class Human {
|
|||
}
|
||||
|
||||
// handle webgl & humangl
|
||||
if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') {
|
||||
if (this.tf.getBackend() === 'humangl') {
|
||||
this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);
|
||||
this.tf.ENV.set('WEBGL_CPU_FORWARD', true);
|
||||
this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||
this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', false);
|
||||
this.tf.ENV.set('WEBGL_USE_SHAPES_UNIFORMS', true);
|
||||
// if (!this.config.object.enabled) this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision
|
||||
if (typeof this.config['deallocate'] !== 'undefined' && this.config['deallocate']) { // hidden param
|
||||
|
|
|
@ -13,8 +13,8 @@ const maxSize = 2048;
|
|||
// internal temp canvases
|
||||
let inCanvas;
|
||||
let outCanvas;
|
||||
// instance of fximage
|
||||
let fx: fxImage.GLImageFilter | null;
|
||||
// @ts-ignore // imagefx is js module that should be converted to a class
|
||||
let fx: fxImage.GLImageFilter | null; // instance of imagefx
|
||||
|
||||
// process input image and return tensor
|
||||
// input can be tensor, imagedata, htmlimageelement, htmlvideoelement
|
||||
|
@ -38,8 +38,8 @@ export function process(input: Input, config: Config): { tensor: Tensor | null,
|
|||
}
|
||||
if (input instanceof tf.Tensor) {
|
||||
// if input is tensor, use as-is
|
||||
if (input.shape && input.shape.length === 4 && input.shape[0] === 1 && input.shape[3] === 3) tensor = tf.clone(input);
|
||||
else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${input.shape}`);
|
||||
if ((input as Tensor).shape && (input as Tensor).shape.length === 4 && (input as Tensor).shape[0] === 1 && (input as Tensor).shape[3] === 3) tensor = tf.clone(input);
|
||||
else throw new Error(`Human: Input tensor shape must be [1, height, width, 3] and instead was ${(input as Tensor).shape}`);
|
||||
} else {
|
||||
// check if resizing will be needed
|
||||
const originalWidth = input['naturalWidth'] || input['videoWidth'] || input['width'] || (input['shape'] && (input['shape'][1] > 0));
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
WebGLImageFilter by Dominic Szablewski: <https://github.com/phoboslab/WebGLImageFilter>
|
||||
*/
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
function GLProgram(gl, vertexSource, fragmentSource) {
|
||||
const _collect = function (source, prefix, collection) {
|
||||
const r = new RegExp('\\b' + prefix + ' \\w+ (\\w+)', 'ig');
|
|
@ -44,20 +44,6 @@
|
|||
"exclude": ["node_modules/", "types/", "tfjs/", "dist/"],
|
||||
"include": ["src"],
|
||||
"typedocOptions": {
|
||||
"excludePrivate": true,
|
||||
"excludeExternals": true,
|
||||
"excludeProtected": true,
|
||||
"excludeInternal": true,
|
||||
"disableSources": true,
|
||||
"gitRevision": "main",
|
||||
"hideGenerator": "true",
|
||||
"readme": "none",
|
||||
"out": "typedoc",
|
||||
"entryPoints": ["src/human.ts"],
|
||||
"exclude": [],
|
||||
"externalPattern": ["node_modules/", "tfjs/"],
|
||||
"logLevel": "Verbose",
|
||||
"logger": "none",
|
||||
"theme": "wiki/theme/"
|
||||
}
|
||||
}
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit 1e67b7ca730fb4b50b5a609bdd6724bda3407d73
|
||||
Subproject commit 3bf213c17d3f25368dc161ad33df8195b60dacb2
|
Loading…
Reference in New Issue