mirror of https://github.com/vladmandic/human
reduced bundle size
parent
e78cbe7064
commit
544cac628f
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -23,7 +23,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"dist/human.esm.js": {
|
||||
"bytes": 3443493,
|
||||
"bytes": 2080824,
|
||||
"imports": []
|
||||
}
|
||||
},
|
||||
|
@ -31,25 +31,31 @@
|
|||
"dist/demo-browser-index.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 5414325
|
||||
"bytes": 2844399
|
||||
},
|
||||
"dist/demo-browser-index.js": {
|
||||
"imports": [],
|
||||
"inputs": {
|
||||
"dist/human.esm.js": {
|
||||
"bytesInOutput": 3432788
|
||||
"bytesInOutput": 1144406
|
||||
},
|
||||
"dist/human.esm.js": {
|
||||
"bytesInOutput": 319699
|
||||
},
|
||||
"dist/human.esm.js": {
|
||||
"bytesInOutput": 578472
|
||||
},
|
||||
"demo/draw.js": {
|
||||
"bytesInOutput": 9599
|
||||
},
|
||||
"demo/menu.js": {
|
||||
"bytesInOutput": 13813
|
||||
"bytesInOutput": 13821
|
||||
},
|
||||
"demo/browser.js": {
|
||||
"bytesInOutput": 17362
|
||||
"bytesInOutput": 17394
|
||||
}
|
||||
},
|
||||
"bytes": 3473684
|
||||
"bytes": 2083513
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1347,7 +1347,7 @@ var require_gender = __commonJS((exports) => {
|
|||
const confidence = Math.trunc(200 * Math.abs(data2[0] - 0.5)) / 100;
|
||||
if (confidence > config2.face.gender.minConfidence) {
|
||||
obj.gender = data2[0] <= 0.5 ? "female" : "male";
|
||||
obj.confidence = confidence;
|
||||
obj.confidence = Math.min(0.99, confidence);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20867,7 +20867,7 @@ var require_image = __commonJS((exports) => {
|
|||
});
|
||||
|
||||
// src/tf.js
|
||||
import * as tf from "@tensorflow/tfjs/dist/tf.es2017.js";
|
||||
import * as tf from "@tensorflow/tfjs/dist/index.js";
|
||||
import {setWasmPaths} from "@tensorflow/tfjs-backend-wasm/dist/index.js";
|
||||
const loadGraphModel = tf.loadGraphModel;
|
||||
|
||||
|
@ -23785,7 +23785,7 @@ var config_default = {
|
|||
};
|
||||
|
||||
// package.json
|
||||
var version = "0.8.6";
|
||||
var version = "0.8.7";
|
||||
|
||||
// src/human.js
|
||||
const disableSkipFrames = {
|
||||
|
@ -23890,33 +23890,33 @@ class Human {
|
|||
}
|
||||
if (this.config.async) {
|
||||
[
|
||||
this.models.facemesh,
|
||||
this.models.age,
|
||||
this.models.gender,
|
||||
this.models.emotion,
|
||||
this.models.facemesh,
|
||||
this.models.posenet,
|
||||
this.models.handpose
|
||||
] = await Promise.all([
|
||||
this.models.age || (this.config.face.age.enabled ? age.load(this.config) : null),
|
||||
this.models.gender || (this.config.face.gender.enabled ? gender.load(this.config) : null),
|
||||
this.models.emotion || (this.config.face.emotion.enabled ? emotion.load(this.config) : null),
|
||||
this.models.facemesh || (this.config.face.enabled ? facemesh.load(this.config.face) : null),
|
||||
this.models.age || (this.config.face.enabled && this.config.face.age.enabled ? age.load(this.config) : null),
|
||||
this.models.gender || (this.config.face.enabled && this.config.face.gender.enabled ? gender.load(this.config) : null),
|
||||
this.models.emotion || (this.config.face.enabled && this.config.face.emotion.enabled ? emotion.load(this.config) : null),
|
||||
this.models.posenet || (this.config.body.enabled ? posenet.load(this.config) : null),
|
||||
this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config.hand) : null)
|
||||
]);
|
||||
} else {
|
||||
if (this.config.face.enabled && !this.models.facemesh)
|
||||
this.models.facemesh = await facemesh.load(this.config.face);
|
||||
if (this.config.body.enabled && !this.models.posenet)
|
||||
this.models.posenet = await posenet.load(this.config);
|
||||
if (this.config.hand.enabled && !this.models.handpose)
|
||||
this.models.handpose = await handpose.load(this.config.hand);
|
||||
if (this.config.face.enabled && this.config.face.age.enabled && !this.models.age)
|
||||
this.models.age = await age.load(this.config);
|
||||
if (this.config.face.enabled && this.config.face.gender.enabled && !this.models.gender)
|
||||
this.models.gender = await gender.load(this.config);
|
||||
if (this.config.face.enabled && this.config.face.emotion.enabled && !this.models.emotion)
|
||||
this.models.emotion = await emotion.load(this.config);
|
||||
if (this.config.body.enabled && !this.models.posenet)
|
||||
this.models.posenet = await posenet.load(this.config);
|
||||
if (this.config.hand.enabled && !this.models.handpose)
|
||||
this.models.handpose = await handpose.load(this.config.hand);
|
||||
}
|
||||
const current = Math.trunc(now() - timeStamp);
|
||||
if (current > (this.perf.load || 0))
|
||||
|
@ -24025,6 +24025,13 @@ class Human {
|
|||
}
|
||||
return faceRes;
|
||||
}
|
||||
async image(input, userConfig = {}) {
|
||||
this.state = "image";
|
||||
this.config = mergeDeep(this.config, userConfig);
|
||||
const process3 = image.process(input, this.config);
|
||||
process3.tensor.dispose();
|
||||
return process3.canvas;
|
||||
}
|
||||
async detect(input, userConfig = {}) {
|
||||
this.state = "config";
|
||||
let timeStamp;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -216,7 +216,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytes": 3193,
|
||||
"bytes": 3209,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/tf.js"
|
||||
|
@ -289,7 +289,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 14460,
|
||||
"bytes": 14787,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/tf.js"
|
||||
|
@ -349,7 +349,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/tf.js": {
|
||||
"bytes": 1135,
|
||||
"bytes": 1401,
|
||||
"imports": []
|
||||
}
|
||||
},
|
||||
|
@ -357,7 +357,7 @@
|
|||
"dist/human.esm-nobundle.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 768064
|
||||
"bytes": 769567
|
||||
},
|
||||
"dist/human.esm-nobundle.js": {
|
||||
"imports": [],
|
||||
|
@ -390,7 +390,7 @@
|
|||
"bytesInOutput": 1826
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 2980
|
||||
"bytesInOutput": 2996
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 2697
|
||||
|
@ -450,7 +450,7 @@
|
|||
"bytesInOutput": 5382
|
||||
},
|
||||
"src/tf.js": {
|
||||
"bytesInOutput": 174
|
||||
"bytesInOutput": 170
|
||||
},
|
||||
"src/face/triangulation.js": {
|
||||
"bytesInOutput": 17898
|
||||
|
@ -477,13 +477,13 @@
|
|||
"bytesInOutput": 23
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 12010
|
||||
"bytesInOutput": 12333
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 0
|
||||
}
|
||||
},
|
||||
"bytes": 418822
|
||||
"bytes": 419157
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -1352,7 +1352,7 @@ var require_gender = __commonJS((exports2) => {
|
|||
const confidence = Math.trunc(200 * Math.abs(data2[0] - 0.5)) / 100;
|
||||
if (confidence > config2.face.gender.minConfidence) {
|
||||
obj.gender = data2[0] <= 0.5 ? "female" : "male";
|
||||
obj.confidence = confidence;
|
||||
obj.confidence = Math.min(0.99, confidence);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20877,7 +20877,7 @@ __export(exports, {
|
|||
});
|
||||
|
||||
// src/tf.js
|
||||
const tf = __toModule(require("@tensorflow/tfjs/dist/tf.es2017.js"));
|
||||
const tf = __toModule(require("@tensorflow/tfjs/dist/index.js"));
|
||||
const dist = __toModule(require("@tensorflow/tfjs-backend-wasm/dist/index.js"));
|
||||
const loadGraphModel = tf.loadGraphModel;
|
||||
|
||||
|
@ -23795,7 +23795,7 @@ var config_default = {
|
|||
};
|
||||
|
||||
// package.json
|
||||
var version = "0.8.6";
|
||||
var version = "0.8.7";
|
||||
|
||||
// src/human.js
|
||||
const disableSkipFrames = {
|
||||
|
@ -23900,33 +23900,33 @@ class Human {
|
|||
}
|
||||
if (this.config.async) {
|
||||
[
|
||||
this.models.facemesh,
|
||||
this.models.age,
|
||||
this.models.gender,
|
||||
this.models.emotion,
|
||||
this.models.facemesh,
|
||||
this.models.posenet,
|
||||
this.models.handpose
|
||||
] = await Promise.all([
|
||||
this.models.age || (this.config.face.age.enabled ? age.load(this.config) : null),
|
||||
this.models.gender || (this.config.face.gender.enabled ? gender.load(this.config) : null),
|
||||
this.models.emotion || (this.config.face.emotion.enabled ? emotion.load(this.config) : null),
|
||||
this.models.facemesh || (this.config.face.enabled ? facemesh.load(this.config.face) : null),
|
||||
this.models.age || (this.config.face.enabled && this.config.face.age.enabled ? age.load(this.config) : null),
|
||||
this.models.gender || (this.config.face.enabled && this.config.face.gender.enabled ? gender.load(this.config) : null),
|
||||
this.models.emotion || (this.config.face.enabled && this.config.face.emotion.enabled ? emotion.load(this.config) : null),
|
||||
this.models.posenet || (this.config.body.enabled ? posenet.load(this.config) : null),
|
||||
this.models.handpose || (this.config.hand.enabled ? handpose.load(this.config.hand) : null)
|
||||
]);
|
||||
} else {
|
||||
if (this.config.face.enabled && !this.models.facemesh)
|
||||
this.models.facemesh = await facemesh.load(this.config.face);
|
||||
if (this.config.body.enabled && !this.models.posenet)
|
||||
this.models.posenet = await posenet.load(this.config);
|
||||
if (this.config.hand.enabled && !this.models.handpose)
|
||||
this.models.handpose = await handpose.load(this.config.hand);
|
||||
if (this.config.face.enabled && this.config.face.age.enabled && !this.models.age)
|
||||
this.models.age = await age.load(this.config);
|
||||
if (this.config.face.enabled && this.config.face.gender.enabled && !this.models.gender)
|
||||
this.models.gender = await gender.load(this.config);
|
||||
if (this.config.face.enabled && this.config.face.emotion.enabled && !this.models.emotion)
|
||||
this.models.emotion = await emotion.load(this.config);
|
||||
if (this.config.body.enabled && !this.models.posenet)
|
||||
this.models.posenet = await posenet.load(this.config);
|
||||
if (this.config.hand.enabled && !this.models.handpose)
|
||||
this.models.handpose = await handpose.load(this.config.hand);
|
||||
}
|
||||
const current = Math.trunc(now() - timeStamp);
|
||||
if (current > (this.perf.load || 0))
|
||||
|
@ -24035,6 +24035,13 @@ class Human {
|
|||
}
|
||||
return faceRes;
|
||||
}
|
||||
async image(input, userConfig = {}) {
|
||||
this.state = "image";
|
||||
this.config = mergeDeep(this.config, userConfig);
|
||||
const process3 = image.process(input, this.config);
|
||||
process3.tensor.dispose();
|
||||
return process3.canvas;
|
||||
}
|
||||
async detect(input, userConfig = {}) {
|
||||
this.state = "config";
|
||||
let timeStamp;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -216,7 +216,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytes": 3193,
|
||||
"bytes": 3209,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/tf.js"
|
||||
|
@ -289,7 +289,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytes": 14460,
|
||||
"bytes": 14787,
|
||||
"imports": [
|
||||
{
|
||||
"path": "src/tf.js"
|
||||
|
@ -349,7 +349,7 @@
|
|||
"imports": []
|
||||
},
|
||||
"src/tf.js": {
|
||||
"bytes": 1135,
|
||||
"bytes": 1401,
|
||||
"imports": []
|
||||
}
|
||||
},
|
||||
|
@ -357,7 +357,7 @@
|
|||
"dist/human.node-nobundle.js.map": {
|
||||
"imports": [],
|
||||
"inputs": {},
|
||||
"bytes": 782976
|
||||
"bytes": 784814
|
||||
},
|
||||
"dist/human.node-nobundle.js": {
|
||||
"imports": [],
|
||||
|
@ -390,7 +390,7 @@
|
|||
"bytesInOutput": 1829
|
||||
},
|
||||
"src/gender/gender.js": {
|
||||
"bytesInOutput": 2983
|
||||
"bytesInOutput": 2999
|
||||
},
|
||||
"src/emotion/emotion.js": {
|
||||
"bytesInOutput": 2700
|
||||
|
@ -453,7 +453,7 @@
|
|||
"bytesInOutput": 47
|
||||
},
|
||||
"src/tf.js": {
|
||||
"bytesInOutput": 193
|
||||
"bytesInOutput": 189
|
||||
},
|
||||
"src/face/triangulation.js": {
|
||||
"bytesInOutput": 17898
|
||||
|
@ -480,10 +480,10 @@
|
|||
"bytesInOutput": 23
|
||||
},
|
||||
"src/human.js": {
|
||||
"bytesInOutput": 12015
|
||||
"bytesInOutput": 12338
|
||||
}
|
||||
},
|
||||
"bytes": 419169
|
||||
"bytes": 419504
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
19
src/tf.js
19
src/tf.js
|
@ -1,18 +1,18 @@
|
|||
// custom: bundle 3.4M
|
||||
/*
|
||||
import * as tf from '../../../dev-clone/tfjs/tfjs/dist/tf.esnext.js';
|
||||
// from compileld sources: bundle 2.0M
|
||||
import * as tf from '@tensorflow/tfjs/dist/index.js';
|
||||
import { setWasmPaths } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
|
||||
const loadGraphModel = tf.loadGraphModel;
|
||||
export { tf, setWasmPaths, loadGraphModel };
|
||||
*/
|
||||
|
||||
// monolithic: bundle 3.4M
|
||||
// from esm bundles: bundle 3.2M
|
||||
/*
|
||||
import * as tf from '@tensorflow/tfjs/dist/tf.es2017.js';
|
||||
import { setWasmPaths } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
|
||||
const loadGraphModel = tf.loadGraphModel;
|
||||
export { tf, setWasmPaths, loadGraphModel };
|
||||
*/
|
||||
|
||||
// modular: bundle 4.2M
|
||||
/*
|
||||
|
@ -26,3 +26,12 @@ const version = { core: tf.version, cpu: tfCPU.version_cpu, webgl: tfWebGL.versi
|
|||
|
||||
export { tf, setWasmPaths, loadGraphModel, version };
|
||||
*/
|
||||
|
||||
// custom: bundle 3.4M
|
||||
/*
|
||||
import * as tf from '../../../dev-clone/tfjs/tfjs/dist/index.js';
|
||||
import { setWasmPaths } from '@tensorflow/tfjs-backend-wasm/dist/index.js';
|
||||
|
||||
const loadGraphModel = tf.loadGraphModel;
|
||||
export { tf, setWasmPaths, loadGraphModel };
|
||||
*/
|
||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
|||
Subproject commit 5dcbe8ad56fc4dc21378046c225185e6203250eb
|
||||
Subproject commit 1cc1d9bf597c26a37f4e70c4895b1e956195c1b3
|
Loading…
Reference in New Issue