Skip to content

Commit 151df64

Browse files
committed
full rebuild
Signed-off-by: Vladimir Mandic <[email protected]>
1 parent 6cc00a1 commit 151df64

File tree

134 files changed

+2401
-2948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+2401
-2948
lines changed

.eslintrc.json

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,28 @@
1919
"extends": [
2020
"airbnb-base",
2121
"eslint:recommended",
22-
"plugin:@typescript-eslint/eslint-recommended",
22+
"plugin:@typescript-eslint/strict",
2323
"plugin:@typescript-eslint/recommended",
2424
"plugin:@typescript-eslint/recommended-requiring-type-checking",
25-
"plugin:@typescript-eslint/strict",
25+
"plugin:@typescript-eslint/eslint-recommended",
2626
"plugin:import/recommended",
2727
"plugin:promise/recommended"
2828
],
2929
"rules": {
3030
"@typescript-eslint/ban-ts-comment":"off",
3131
"@typescript-eslint/dot-notation":"off",
3232
"@typescript-eslint/no-empty-interface":"off",
33+
"@typescript-eslint/no-empty-object-type":"off",
3334
"@typescript-eslint/no-inferrable-types":"off",
3435
"@typescript-eslint/no-misused-promises":"off",
36+
"@typescript-eslint/no-require-imports":"off",
3537
"@typescript-eslint/no-unnecessary-condition":"off",
38+
"@typescript-eslint/no-unnecessary-type-assertion":"off",
3639
"@typescript-eslint/no-unsafe-argument":"off",
3740
"@typescript-eslint/no-unsafe-assignment":"off",
3841
"@typescript-eslint/no-unsafe-call":"off",
3942
"@typescript-eslint/no-unsafe-member-access":"off",
4043
"@typescript-eslint/no-unsafe-return":"off",
41-
"@typescript-eslint/no-require-imports":"off",
42-
"@typescript-eslint/no-empty-object-type":"off",
4344
"@typescript-eslint/non-nullable-type-assertion-style":"off",
4445
"@typescript-eslint/prefer-for-of":"off",
4546
"@typescript-eslint/prefer-nullish-coalescing":"off",
@@ -163,24 +164,6 @@
163164
},
164165
"extends": []
165166
},
166-
{
167-
"files": ["**/*.html"],
168-
"parserOptions": { "sourceType": "module", "ecmaVersion": "latest" },
169-
"parser": "@html-eslint/parser",
170-
"plugins": ["html", "@html-eslint"],
171-
"env": {
172-
"browser": true,
173-
"commonjs": false,
174-
"node": false,
175-
"es2021": false
176-
},
177-
"extends": ["plugin:@html-eslint/recommended"],
178-
"rules": {
179-
"@html-eslint/element-newline":"off",
180-
"@html-eslint/attrs-newline":"off",
181-
"@html-eslint/indent": ["error", 2]
182-
}
183-
},
184167
{
185168
"files": ["**/*.md"],
186169
"plugins": ["markdown"],

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @vladmandic/human
22

3-
Version: **3.3.5**
3+
Version: **3.3.6**
44
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**
55

66
Author: **Vladimir Mandic <[email protected]>**
@@ -9,11 +9,16 @@
99

1010
## Changelog
1111

12-
### **3.3.5** 2025/02/05 [email protected]
12+
### **3.3.6** 2025/08/26 [email protected]
13+
14+
15+
### **origin/main** 2025/02/05 [email protected]
1316

17+
- full rebuild
1418

15-
### **origin/main** 2024/10/24 [email protected]
19+
### **3.3.5** 2025/02/05 [email protected]
1620

21+
- rebuild
1722
- add human.draw.tensor method
1823

1924
### **3.3.4** 2024/10/24 [email protected]

demo/nodejs/node-age-gender.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const fs = require('fs');
2+
const process = require('process');
3+
const log = require('@vladmandic/pilogger'); // eslint-disable-line node/no-unpublished-require
4+
const tf = require('@tensorflow/tfjs-node'); // eslint-disable-line node/no-unpublished-require
5+
const Human = require('../../dist/human.node.js');
6+
7+
const humanConfig = {
8+
debug: false,
9+
face: {
10+
enabled: true,
11+
detector: { enabled: true, modelPath: 'blazeface.json' },
12+
description: { enabled: true, modelPath: 'faceres.json' },
13+
// gear: { enabled: true, modelPath: '/home/vlado/dev/human-models/models/gear.json' },
14+
// ssrnet: { enabled: true, modelPathAge: '/home/vlado/dev/human-models/models/age.json', modelPathGender: '/home/vlado/dev/human-models/models/gender.json' },
15+
emotion: { enabled: false },
16+
mesh: { enabled: false },
17+
iris: { enabled: false },
18+
antispoof: { enabled: false },
19+
liveness: { enabled: false },
20+
},
21+
body: { enabled: false },
22+
hand: { enabled: false },
23+
gesture: { enabled: false },
24+
};
25+
const human = new Human.Human(humanConfig);
26+
const ageThreshold = 18;
27+
28+
async function detect(inputFile) {
29+
try {
30+
const buffer = fs.readFileSync(inputFile);
31+
const tensor = human.tf.node.decodeImage(buffer);
32+
const result = await human.detect(tensor);
33+
human.tf.dispose(tensor);
34+
if (!result || !result.face || result.face.length === 0) return false;
35+
let msg = ` file=${inputFile} resolution=${tensor.shape}`;
36+
for (const face of result.face) {
37+
msg = ` file=${inputFile} resolution=${tensor.shape} age=${face.age} gender=${face.gender} confidence=${face.genderScore}`;
38+
if (face.age < ageThreshold) {
39+
log.warn('fail:' + msg);
40+
return true;
41+
}
42+
}
43+
log.info('pass: ' + msg);
44+
return false;
45+
} catch (err) {
46+
log.error(`error: file=${inputFile}: ${err}`);
47+
}
48+
return false;
49+
}
50+
51+
async function main() {
52+
log.info(`Human: version=${human.version} tf=${tf.version_core}`);
53+
process.noDeprecation = true;
54+
if (process.argv.length < 3) return;
55+
await human.load();
56+
await human.warmup();
57+
const t0 = performance.now();
58+
const args = process.argv.slice(2);
59+
let pass = 0;
60+
let fail = 0;
61+
for (const arg of args) {
62+
const ok = await detect(arg);
63+
if (ok) pass++;
64+
else fail++;
65+
}
66+
const t1 = performance.now();
67+
log.info(`Human: files=${args.length} pass=${pass} fail=${fail} time=${Math.round(t1 - t0)} fps=${Math.round(10000 * args.length / (t1 - t0)) / 10}`);
68+
}
69+
70+
main();

demo/nodejs/node-canvas.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const config = { // just enable all and leave default settings
2424

2525
async function main() {
2626
log.header();
27+
process.noDeprecation = true;
2728

2829
globalThis.Canvas = canvas.Canvas; // patch global namespace with canvas library
2930
globalThis.ImageData = canvas.ImageData; // patch global namespace with canvas library

demo/nodejs/node-similarity.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ async function detect(input) {
4545
}
4646

4747
async function main() {
48+
process.noDeprecation = true;
4849
log.configure({ inspect: { breakLength: 265 } });
4950
log.header();
5051
if (process.argv.length !== 4) {

demo/nodejs/node-simple.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const humanConfig = {
1717
};
1818

1919
async function detect(inputFile) {
20+
process.noDeprecation = true;
2021
const human = new Human.Human(humanConfig); // create instance of human using default configuration
2122
console.log('Human:', human.version, 'TF:', tf.version_core); // eslint-disable-line no-console
2223
await human.load(); // optional as models would be loaded on-demand first time they are required

demo/nodejs/node-video.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async function detect(jpegBuffer) {
7676

7777
async function main() {
7878
log.header();
79+
process.noDeprecation = true;
7980
await human.tf.ready();
8081
// pre-load models
8182
log.info({ human: human.version, tf: human.tf.version_core });

demo/nodejs/node.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ async function test() {
187187
async function main() {
188188
log.configure({ inspect: { breakLength: 265 } });
189189
log.header();
190+
process.noDeprecation = true;
190191
log.info('Current folder:', process.env.PWD);
191192
await init();
192193
const f = process.argv[2];

demo/nodejs/process-folder.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ async function main() {
7777
globalThis.ImageData = canvas.ImageData; // patch global namespace with canvas library
7878

7979
log.info('Human:', human.version, 'TF:', tf.version_core);
80+
process.noDeprecation = true;
8081
const configErrors = await human.validate();
8182
if (configErrors.length > 0) log.error('Configuration errors:', configErrors);
8283
await human.load(); // pre-load models

0 commit comments

Comments
 (0)