start 2.5 major version

pull/356/head
Vladimir Mandic 2021-10-30 12:21:54 -04:00
parent f3411437a0
commit da7f4300b2
13 changed files with 27 additions and 51 deletions

View File

@ -112,13 +112,13 @@
"external": ["@tensorflow", "fs", "os", "buffer", "util"] "external": ["@tensorflow", "fs", "os", "buffer", "util"]
}, },
{ {
"name": "tfjs/browser/esm/bundle", "name": "tfjs/browser/esm/custom",
"platform": "browser", "platform": "browser",
"target": "esnext",
"format": "esm", "format": "esm",
"input": "tfjs/tf-browser.ts", "input": "tfjs/tf-custom.ts",
"output": "dist/tfjs.esm.js", "output": "dist/tfjs.esm.js",
"minify": false, "sourcemap": false,
"sourcemap": true,
"external": ["fs", "os", "buffer", "util"] "external": ["fs", "os", "buffer", "util"]
}, },
{ {
@ -134,31 +134,10 @@
{ {
"name": "human/browser/esm/bundle", "name": "human/browser/esm/bundle",
"platform": "browser", "platform": "browser",
"target": "esnext",
"format": "esm", "format": "esm",
"input": "src/human.ts", "input": "src/human.ts",
"output": "dist/human.esm.js", "output": "dist/human.esm.js",
"minify": true,
"sourcemap": true,
"external": ["fs", "os", "buffer", "util"]
},
{
"name": "tfjs/browser/esm/custom",
"platform": "browser",
"target": "esnext",
"format": "esm",
"input": "tfjs/tf-custom.ts",
"output": "dist/tfjs.esm.js",
"sourcemap": false,
"external": ["fs", "os", "buffer", "util"]
},
{
"name": "human/browser/esm/custom",
"platform": "browser",
"target": "esnext",
"format": "esm",
"input": "src/human.ts",
"output": "dist/human.custom.esm.js",
"sourcemap": true, "sourcemap": true,
"minify": false, "minify": false,
"external": ["fs", "os", "buffer", "util"], "external": ["fs", "os", "buffer", "util"],
@ -174,7 +153,7 @@
"output": "demo/typescript/index.js", "output": "demo/typescript/index.js",
"sourcemap": true, "sourcemap": true,
"minify": false, "minify": false,
"external": ["*/human.custom.esm.js"] "external": ["*/human.esm.js"]
} }
] ]
}, },

View File

@ -4,5 +4,3 @@ samples
typedoc typedoc
test test
wiki wiki
dist/tfjs.esm.js
dist/tfjs.esm.js.map

View File

@ -9,8 +9,9 @@
## Changelog ## Changelog
### **HEAD -> main** 2021/10/28 mandic00@live.com ### **HEAD -> main** 2021/10/29 mandic00@live.com
- fix firefox bug
### **2.4.3** 2021/10/28 mandic00@live.com ### **2.4.3** 2021/10/28 mandic00@live.com

View File

@ -6,7 +6,7 @@
*/ */
/** @type {Human} */ /** @type {Human} */
import Human from '../../dist/human.custom.esm.js'; import Human from '../../dist/human.esm.js';
const userConfig = { const userConfig = {
backend: 'wasm', backend: 'wasm',

View File

@ -11,21 +11,21 @@ let records = 0;
const descLength = 1024; // descriptor length in bytes const descLength = 1024; // descriptor length in bytes
function distance(descBuffer, index, options = { order: 2 }) { function distance(descBuffer, index, options = { order: 2, multiplier: 20 }) {
const descriptor = new Float32Array(descBuffer); const descriptor = new Float32Array(descBuffer);
let sum = 0; let sum = 0;
for (let i = 0; i < descriptor.length; i++) { for (let i = 0; i < descriptor.length; i++) {
const diff = (options.order === 2) ? (descriptor[i] - view[index * descLength + i]) : (Math.abs(descriptor[i] - view[index * descLength + i])); const diff = (options.order === 2) ? (descriptor[i] - view[index * descLength + i]) : (Math.abs(descriptor[i] - view[index * descLength + i]));
sum += (options.order === 2) ? (diff * diff) : (diff ** options.order); sum += (options.order === 2) ? (diff * diff) : (diff ** options.order);
} }
return sum; return (options.multiplier || 20) * sum;
} }
function match(descBuffer, options = { order: 2 }) { function match(descBuffer, options = { order: 2, multiplier: 20 }) {
let best = Number.MAX_SAFE_INTEGER; let best = Number.MAX_SAFE_INTEGER;
let index = -1; let index = -1;
for (let i = 0; i < records; i++) { for (let i = 0; i < records; i++) {
const res = distance(descBuffer, i, { order: options.order }); const res = distance(descBuffer, i, { order: options.order, multiplier: options.multiplier });
if (res < best) { if (res < best) {
best = res; best = res;
index = i; index = i;

View File

@ -5,19 +5,19 @@ const threads = require('worker_threads');
// global optinos // global optinos
const options = { const options = {
dbFile: './faces.json', // sample face db dbFile: 'demo/facematch/faces.json', // sample face db
dbMax: 10000, // maximum number of records to hold in memory dbMax: 10000, // maximum number of records to hold in memory
threadPoolSize: 6, // number of worker threads to create in thread pool threadPoolSize: 12, // number of worker threads to create in thread pool
workerSrc: './node-match-worker.js', // code that executes in the worker thread workerSrc: './node-match-worker.js', // code that executes in the worker thread
debug: false, // verbose messages debug: false, // verbose messages
minThreshold: 0.9, // match returns first record that meets the similarity threshold, set to 0 to always scan all records minThreshold: 0.5, // match returns first record that meets the similarity threshold, set to 0 to always scan all records
descLength: 1024, // descriptor length descLength: 1024, // descriptor length
}; };
// test options // test options
const testOptions = { const testOptions = {
dbFact: 100, // load db n times to fake huge size dbFact: 175, // load db n times to fake huge size
maxJobs: 100, // exit after processing this many jobs maxJobs: 200, // exit after processing this many jobs
fuzDescriptors: true, // randomize descriptor content before match for harder jobs fuzDescriptors: true, // randomize descriptor content before match for harder jobs
}; };

View File

@ -5,7 +5,7 @@
* *
*/ */
import Human from '../../dist/human.custom.esm.js'; // equivalent of @vladmandic/human import Human from '../../dist/human.esm.js'; // equivalent of @vladmandic/human
import GLBench from '../helpers/gl-bench.js'; import GLBench from '../helpers/gl-bench.js';
const workerJS = './worker.js'; const workerJS = './worker.js';

View File

@ -5,7 +5,7 @@
*/ */
// demo/typescript/index.ts // demo/typescript/index.ts
import Human from "../../dist/human.custom.esm.js"; import Human from "../../dist/human.esm.js";
var config = { var config = {
modelBasePath: "../../models", modelBasePath: "../../models",
backend: "humangl", backend: "humangl",

View File

@ -7,7 +7,7 @@
* @license MIT * @license MIT
*/ */
import Human from '../../dist/human.custom.esm.js'; // equivalent of @vladmandic/human import Human from '../../dist/human.esm.js'; // equivalent of @vladmandic/human
const config = { const config = {
modelBasePath: '../../models', modelBasePath: '../../models',

View File

@ -1,6 +1,6 @@
{ {
"name": "@vladmandic/human", "name": "@vladmandic/human",
"version": "2.4.3", "version": "2.5.0",
"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", "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",
"sideEffects": false, "sideEffects": false,
"main": "dist/human.node.js", "main": "dist/human.node.js",
@ -73,7 +73,7 @@
"@vladmandic/pilogger": "^0.3.3", "@vladmandic/pilogger": "^0.3.3",
"canvas": "^2.8.0", "canvas": "^2.8.0",
"dayjs": "^1.10.7", "dayjs": "^1.10.7",
"esbuild": "^0.13.10", "esbuild": "^0.13.11",
"eslint": "8.1.0", "eslint": "8.1.0",
"eslint-config-airbnb-base": "^14.2.1", "eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-html": "^6.2.0", "eslint-plugin-html": "^6.2.0",
@ -81,7 +81,6 @@
"eslint-plugin-json": "^3.1.0", "eslint-plugin-json": "^3.1.0",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.1", "eslint-plugin-promise": "^5.1.1",
"long": "4.0.0",
"node-fetch": "^3.0.0", "node-fetch": "^3.0.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"seedrandom": "^3.0.5", "seedrandom": "^3.0.5",

View File

@ -13,8 +13,7 @@ export { Tensor } from '@tensorflow/tfjs-core/dist/index';
export { GraphModel } from '@tensorflow/tfjs-converter/dist/index'; export { GraphModel } from '@tensorflow/tfjs-converter/dist/index';
/** Tensorflow Long type /** Tensorflow Long type
* @external * @external long
*/ */
// eslint-disable-next-line node/no-missing-import
export { Long } from 'long'; export { Long } from 'long';
// import Long from 'long';
// export { Long };

View File

@ -26,7 +26,7 @@
<div id="state" class="state"></div> <div id="state" class="state"></div>
<canvas id="canvas" class="canvas" width=256 height=256></canvas> <canvas id="canvas" class="canvas" width=256 height=256></canvas>
<script type="module"> <script type="module">
import Human from '../dist/human.custom.esm.js'; import Human from '../dist/human.esm.js';
const config = { const config = {
async: true, async: true,

View File

@ -13,7 +13,7 @@
"allowUnusedLabels": false, "allowUnusedLabels": false,
"alwaysStrict": true, "alwaysStrict": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": false,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"esModuleInterop": false, "esModuleInterop": false,
"exactOptionalPropertyTypes": true, "exactOptionalPropertyTypes": true,