diff --git a/.build.json b/.build.json index 459b55ab..e5c619de 100644 --- a/.build.json +++ b/.build.json @@ -112,13 +112,13 @@ "external": ["@tensorflow", "fs", "os", "buffer", "util"] }, { - "name": "tfjs/browser/esm/bundle", + "name": "tfjs/browser/esm/custom", "platform": "browser", + "target": "esnext", "format": "esm", - "input": "tfjs/tf-browser.ts", + "input": "tfjs/tf-custom.ts", "output": "dist/tfjs.esm.js", - "minify": false, - "sourcemap": true, + "sourcemap": false, "external": ["fs", "os", "buffer", "util"] }, { @@ -134,31 +134,10 @@ { "name": "human/browser/esm/bundle", "platform": "browser", + "target": "esnext", "format": "esm", "input": "src/human.ts", "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, "minify": false, "external": ["fs", "os", "buffer", "util"], @@ -174,7 +153,7 @@ "output": "demo/typescript/index.js", "sourcemap": true, "minify": false, - "external": ["*/human.custom.esm.js"] + "external": ["*/human.esm.js"] } ] }, diff --git a/.npmignore b/.npmignore index 64c274ec..e0b54f43 100644 --- a/.npmignore +++ b/.npmignore @@ -4,5 +4,3 @@ samples typedoc test wiki -dist/tfjs.esm.js -dist/tfjs.esm.js.map diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d5039af..58872da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,9 @@ ## 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 diff --git a/demo/facematch/facematch.js b/demo/facematch/facematch.js index a308c4fd..3620297d 100644 --- a/demo/facematch/facematch.js +++ b/demo/facematch/facematch.js @@ -6,7 +6,7 @@ */ /** @type {Human} */ -import Human from '../../dist/human.custom.esm.js'; +import Human from '../../dist/human.esm.js'; const userConfig = { backend: 'wasm', diff --git a/demo/facematch/node-match-worker.js b/demo/facematch/node-match-worker.js index 37837ef0..35cdbc7d 100644 --- a/demo/facematch/node-match-worker.js +++ b/demo/facematch/node-match-worker.js @@ -11,21 +11,21 @@ let records = 0; 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); let sum = 0; 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])); 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 index = -1; 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) { best = res; index = i; diff --git a/demo/facematch/node-match.js b/demo/facematch/node-match.js index 67ec685e..5562542b 100644 --- a/demo/facematch/node-match.js +++ b/demo/facematch/node-match.js @@ -5,19 +5,19 @@ const threads = require('worker_threads'); // global optinos 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 - 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 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 }; // test options const testOptions = { - dbFact: 100, // load db n times to fake huge size - maxJobs: 100, // exit after processing this many jobs + dbFact: 175, // load db n times to fake huge size + maxJobs: 200, // exit after processing this many jobs fuzDescriptors: true, // randomize descriptor content before match for harder jobs }; diff --git a/demo/multithread/index.js b/demo/multithread/index.js index e26acd2d..cb282622 100644 --- a/demo/multithread/index.js +++ b/demo/multithread/index.js @@ -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'; const workerJS = './worker.js'; diff --git a/demo/typescript/index.js b/demo/typescript/index.js index 977a4321..6a3b657a 100644 --- a/demo/typescript/index.js +++ b/demo/typescript/index.js @@ -5,7 +5,7 @@ */ // demo/typescript/index.ts -import Human from "../../dist/human.custom.esm.js"; +import Human from "../../dist/human.esm.js"; var config = { modelBasePath: "../../models", backend: "humangl", diff --git a/demo/typescript/index.ts b/demo/typescript/index.ts index 59672f7e..75e4e902 100644 --- a/demo/typescript/index.ts +++ b/demo/typescript/index.ts @@ -7,7 +7,7 @@ * @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 = { modelBasePath: '../../models', diff --git a/package.json b/package.json index 5c6e1681..7d5b172e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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", "sideEffects": false, "main": "dist/human.node.js", @@ -73,7 +73,7 @@ "@vladmandic/pilogger": "^0.3.3", "canvas": "^2.8.0", "dayjs": "^1.10.7", - "esbuild": "^0.13.10", + "esbuild": "^0.13.11", "eslint": "8.1.0", "eslint-config-airbnb-base": "^14.2.1", "eslint-plugin-html": "^6.2.0", @@ -81,7 +81,6 @@ "eslint-plugin-json": "^3.1.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.1", - "long": "4.0.0", "node-fetch": "^3.0.0", "rimraf": "^3.0.2", "seedrandom": "^3.0.5", diff --git a/src/tfjs/types.ts b/src/tfjs/types.ts index 85a227e6..3e5f19b8 100644 --- a/src/tfjs/types.ts +++ b/src/tfjs/types.ts @@ -13,8 +13,7 @@ export { Tensor } from '@tensorflow/tfjs-core/dist/index'; export { GraphModel } from '@tensorflow/tfjs-converter/dist/index'; /** Tensorflow Long type - * @external + * @external long */ +// eslint-disable-next-line node/no-missing-import export { Long } from 'long'; -// import Long from 'long'; -// export { Long }; diff --git a/test/browser.html b/test/browser.html index 94457126..8c93066b 100644 --- a/test/browser.html +++ b/test/browser.html @@ -26,7 +26,7 @@