enumerate additional models

pull/356/head
Vladimir Mandic 2022-08-12 09:13:48 -04:00
parent a10b37d13a
commit 37cf9e37d1
5 changed files with 98 additions and 61 deletions

View File

@ -9,12 +9,13 @@
## Changelog
### **HEAD -> main** 2022/08/10 mandic00@live.com
### **2.9.3** 2022/08/10 mandic00@live.com
- rehault testing framework
### **origin/main** 2022/08/08 mandic00@live.com
- release refresh
- add insightface
### **2.9.2** 2022/08/08 mandic00@live.com

View File

@ -1,12 +1,22 @@
const fs = require('fs');
const path = require('path');
const log = require('@vladmandic/pilogger');
const Build = require('@vladmandic/build').Build;
const APIExtractor = require('@microsoft/api-extractor');
const tf = require('@tensorflow/tfjs-node');
const package = require('./package.json');
const modelsDir = '../human-models/models';
const modelsOut = 'models/models.json';
const modelsFolders = [
'./models',
'../human-models/models',
'../blazepose/model/',
'../anti-spoofing/model',
'../efficientpose/models',
'../insightface/models',
'../movenet/models',
'../nanodet/models',
];
const apiExtractorIgnoreList = [ // eslint-disable-line @typescript-eslint/no-unused-vars
'ae-missing-release-tag',
@ -27,29 +37,33 @@ function copy(src, dst) {
}
async function analyzeModels() {
log.info('Analyze:', { modelsDir, modelsOut });
log.info('Analyze models:', { folders: modelsFolders.length, result: modelsOut });
let totalSize = 0;
const models = {};
let dir;
try {
dir = fs.readdirSync(modelsDir);
} catch {
log.warn('Cannot enumerate:', modelsDir);
const allModels = [];
for (const folder of modelsFolders) {
try {
if (!fs.existsSync(folder)) continue;
const stat = fs.statSync(folder);
if (!stat.isDirectory) continue;
const dir = fs.readdirSync(folder);
const found = dir.map((f) => `file://${folder}/${f}`).filter((f) => f.endsWith('json'));
log.state('Models', { folder, models: found.length });
allModels.push(...found);
} catch {
// log.warn('Cannot enumerate:', modelFolder);
}
}
if (!dir || dir.length === 0) {
log.warn('No models found:', modelsDir);
return;
}
for (const f of dir) {
if (!f.endsWith('.json')) continue;
const url = `file://${modelsDir}/${f}`;
for (const url of allModels) {
// if (!f.endsWith('.json')) continue;
// const url = `file://${modelsDir}/${f}`;
const model = new tf.GraphModel(url); // create model prototype and decide if load from cache or from original modelurl
model.findIOHandler();
const artifacts = await model.handler.load();
const size = artifacts?.weightData?.byteLength || 0;
totalSize += size;
const name = f.replace('.json', '');
models[name] = size;
const name = path.basename(url).replace('.json', '');
if (!models[name]) models[name] = size;
}
const json = JSON.stringify(models, null, 2);
fs.writeFileSync(modelsOut, json);

View File

@ -1,44 +1,59 @@
{
"age": 161240,
"antispoof": 853098,
"blazeface": 538928,
"emotion": 820516,
"facemesh": 1477958,
"faceres": 6978814,
"handlandmark-full": 5431368,
"handtrack": 2964837,
"iris": 2599092,
"liveness": 592976,
"mb3-centernet": 4030290,
"models": 0,
"movenet-lightning": 4650216,
"selfie": 212886,
"age": 161240,
"blazeface-back": 538928,
"blazeface-front": 402048,
"blazeface": 538928,
"blazepose-detector2d": 7499400,
"blazepose-detector3d": 5928856,
"blazepose-full": 6338290,
"blazepose-heavy": 27501554,
"blazepose-lite": 2725490,
"efficientpose": 5651240,
"emotion": 820516,
"faceboxes": 2013002,
"facemesh-attention-alt": 2387598,
"facemesh-attention": 2382414,
"facemesh-detection-full": 1026192,
"facemesh-detection-short": 201268,
"facemesh-orig": 2955780,
"facemesh": 1477958,
"faceres-deep": 13957620,
"faceres": 6978814,
"gear": 1498916,
"gender-ssrnet-imdb": 161236,
"gender": 201808,
"handdetect": 3515612,
"handlandmark-full": 5431368,
"handlandmark-lite": 2023432,
"handlandmark-sparse": 5286322,
"handskeleton": 5502280,
"handtrack": 2964837,
"iris": 2599092,
"liveness": 592976,
"mb3-centernet": 4030290,
"meet": 372228,
"mobileface": 2183192,
"mobilefacenet": 5171976,
"movenet-lightning": 4650216,
"movenet-multipose": 9448838,
"movenet-thunder": 12477112,
"nanodet": 7574558,
"posenet": 5032780,
"selfie": 212886
"blazepose-detect": 5928804,
"anti-spoofing": 853098,
"efficientpose-i-lite": 2269064,
"efficientpose-ii-lite": 5651240,
"efficientpose-iv": 25643252,
"insightface-efficientnet-b0": 13013224,
"insightface-ghostnet-strides1": 8093408,
"insightface-ghostnet-strides2": 8049584,
"insightface-mobilenet-emore": 6938536,
"insightface-mobilenet-swish": 12168584,
"nanodet-e": 12319156,
"nanodet-g": 7574558,
"nanodet-m": 1887474,
"nanodet-t": 5294216
}

View File

@ -7,6 +7,13 @@
"module": "dist/human.esm.js",
"browser": "dist/human.esm.js",
"types": "types/human.d.ts",
"exports": {
"require": "./dist/human.node.js",
"import": "./dist/human.esm.js",
"script": "./dist/human.js",
"module": "./dist/human.esm.js",
"types": "./types/human.d.ts"
},
"author": "Vladimir Mandic <mandic00@live.com>",
"bugs": {
"url": "https://github.com/vladmandic/human/issues"
@ -59,7 +66,7 @@
"node-webcam": "^0.8.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.29.0",
"@microsoft/api-extractor": "^7.29.2",
"@tensorflow/tfjs": "^3.19.0",
"@tensorflow/tfjs-backend-cpu": "^3.19.0",
"@tensorflow/tfjs-backend-wasm": "^3.19.0",
@ -72,15 +79,15 @@
"@tensorflow/tfjs-node": "^3.19.0",
"@tensorflow/tfjs-node-gpu": "^3.19.0",
"@tensorflow/tfjs-tflite": "0.0.1-alpha.8",
"@types/node": "^18.6.4",
"@types/node": "^18.7.2",
"@types/offscreencanvas": "^2019.7.0",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"@vladmandic/build": "^0.7.8",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"@vladmandic/build": "^0.7.9",
"@vladmandic/pilogger": "^0.4.6",
"@vladmandic/tfjs": "github:vladmandic/tfjs",
"@webgpu/types": "^0.1.21",
"esbuild": "^0.14.54",
"esbuild": "^0.15.1",
"eslint": "8.21.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^7.1.0",

View File

@ -1,24 +1,24 @@
2022-08-10 13:47:25 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-10 13:47:25 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-08-10 13:47:25 INFO:  Toolchain: {"build":"0.7.8","esbuild":"0.14.54","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.21.0"}
2022-08-10 13:47:25 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-08-10 13:47:25 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":654091,"outputBytes":306229}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":654095,"outputBytes":306233}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":654147,"outputBytes":306283}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":654066,"outputBytes":305082}
2022-08-10 13:47:25 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3441052,"outputBytes":1667923}
2022-08-10 13:47:25 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3441052,"outputBytes":3070725}
2022-08-10 13:47:31 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30}
2022-08-10 13:47:34 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
2022-08-10 13:47:34 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141}
2022-08-10 13:47:34 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798}
2022-08-10 13:47:43 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0}
2022-08-10 13:47:43 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-08-10 13:47:43 INFO:  Done...
2022-08-12 09:12:16 INFO:  Application: {"name":"@vladmandic/human","version":"2.9.3"}
2022-08-12 09:12:16 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-08-12 09:12:16 INFO:  Toolchain: {"build":"0.7.9","esbuild":"0.15.1","typescript":"4.7.4","typedoc":"0.23.10","eslint":"8.21.0"}
2022-08-12 09:12:16 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-08-12 09:12:16 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":608}
2022-08-12 09:12:16 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":75,"inputBytes":654779,"outputBytes":307161}
2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":612}
2022-08-12 09:12:16 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":75,"inputBytes":654783,"outputBytes":307165}
2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":664}
2022-08-12 09:12:16 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":75,"inputBytes":654835,"outputBytes":307215}
2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1069,"outputBytes":358}
2022-08-12 09:12:16 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1032,"outputBytes":583}
2022-08-12 09:12:16 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":75,"inputBytes":654754,"outputBytes":306014}
2022-08-12 09:12:17 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":11,"inputBytes":1271,"outputBytes":2787569}
2022-08-12 09:12:17 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":75,"inputBytes":3441740,"outputBytes":1668900}
2022-08-12 09:12:17 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":75,"inputBytes":3441740,"outputBytes":3072630}
2022-08-12 09:12:23 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":30}
2022-08-12 09:12:25 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":77,"generated":true}
2022-08-12 09:12:25 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6716,"outputBytes":3141}
2022-08-12 09:12:25 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15629,"outputBytes":7798}
2022-08-12 09:12:35 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":109,"errors":0,"warnings":0}
2022-08-12 09:12:35 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-08-12 09:12:35 INFO:  Done...