pull/280/head
Vladimir Mandic 2022-04-10 10:13:13 -04:00
parent 08c0d7af85
commit d9d6cbaf8f
15 changed files with 731 additions and 728 deletions

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
.vscode
node_modules
pnpm-lock.yaml
assets/tf*
*.swp
node_modules/
types/lib

View File

@ -9,7 +9,7 @@
## Changelog
### **HEAD -> main** 2022/04/01 mandic00@live.com
### **HEAD -> main** 2022/04/05 mandic00@live.com
### **2.6.5** 2022/04/01 mandic00@live.com

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/human.esm.js vendored
View File

@ -38889,6 +38889,7 @@ async function loadModel(modelPath) {
const modelCached = options.cacheModels && Object.keys(cachedModels).includes(cachedModelName);
const tfLoadOptions = typeof fetch === "undefined" ? {} : { fetchFunc: (url, init2) => httpHandler(url, init2) };
const model18 = new E4(modelCached ? cachedModelName : modelUrl, tfLoadOptions);
let loaded = false;
try {
model18.findIOHandler();
if (options.debug)
@ -38897,10 +38898,11 @@ async function loadModel(modelPath) {
model18.loadSync(artifacts);
if (options.verbose)
log("load model:", model18["modelUrl"]);
loaded = true;
} catch (err) {
log("error loading model:", modelUrl, err);
}
if (options.cacheModels && !modelCached) {
if (loaded && options.cacheModels && !modelCached) {
try {
const saveResult = await model18.save(cachedModelName);
log("model saved:", cachedModelName, saveResult);

File diff suppressed because one or more lines are too long

2
dist/human.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/human.node.js vendored

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@
"tensorflow"
],
"devDependencies": {
"@microsoft/api-extractor": "^7.20.0",
"@microsoft/api-extractor": "^7.21.2",
"@tensorflow/tfjs": "^3.15.0",
"@tensorflow/tfjs-backend-cpu": "^3.15.0",
"@tensorflow/tfjs-backend-wasm": "^3.15.0",
@ -74,11 +74,11 @@
"@vladmandic/tfjs": "github:vladmandic/tfjs",
"canvas": "^2.9.1",
"dayjs": "^1.11.0",
"esbuild": "^0.14.31",
"eslint": "8.12.0",
"esbuild": "^0.14.34",
"eslint": "8.13.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
@ -86,7 +86,7 @@
"rimraf": "^3.0.2",
"seedrandom": "^3.0.5",
"tslib": "^2.3.1",
"typedoc": "0.22.13",
"typedoc": "0.22.14",
"typescript": "4.6.3"
}
}

View File

@ -29,6 +29,7 @@ export async function loadModel(modelPath: string | undefined): Promise<GraphMod
const modelCached = options.cacheModels && Object.keys(cachedModels).includes(cachedModelName); // is model found in cache
const tfLoadOptions = typeof fetch === 'undefined' ? {} : { fetchFunc: (url, init?) => httpHandler(url, init) };
const model: GraphModel = new tf.GraphModel(modelCached ? cachedModelName : modelUrl, tfLoadOptions) as unknown as GraphModel; // create model prototype and decide if load from cache or from original modelurl
let loaded = false;
try {
// @ts-ignore private function
model.findIOHandler(); // decide how to actually load a model
@ -38,10 +39,11 @@ export async function loadModel(modelPath: string | undefined): Promise<GraphMod
const artifacts = await model.handler.load(); // load manifest
model.loadSync(artifacts); // load weights
if (options.verbose) log('load model:', model['modelUrl']);
loaded = true;
} catch (err) {
log('error loading model:', modelUrl, err);
}
if (options.cacheModels && !modelCached) { // save model to cache
if (loaded && options.cacheModels && !modelCached) { // save model to cache
try {
const saveResult = await model.save(cachedModelName);
log('model saved:', cachedModelName, saveResult);

View File

@ -1,24 +1,24 @@
2022-04-05 07:49:00 INFO:  Application: {"name":"@vladmandic/human","version":"2.6.5"}
2022-04-05 07:49:00 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-04-05 07:49:00 INFO:  Toolchain: {"build":"0.7.2","esbuild":"0.14.31","typescript":"4.6.3","typedoc":"0.22.13","eslint":"8.12.0"}
2022-04-05 07:49:00 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-04-05 07:49:00 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-04-05 07:49:00 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":595}
2022-04-05 07:49:00 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":64,"inputBytes":564501,"outputBytes":293301}
2022-04-05 07:49:00 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":599}
2022-04-05 07:49:00 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":64,"inputBytes":564505,"outputBytes":293305}
2022-04-05 07:49:00 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":651}
2022-04-05 07:49:00 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":64,"inputBytes":564557,"outputBytes":293355}
2022-04-05 07:49:00 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":394}
2022-04-05 07:49:00 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1068,"outputBytes":615}
2022-04-05 07:49:00 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":64,"inputBytes":564521,"outputBytes":292260}
2022-04-05 07:49:00 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1344714}
2022-04-05 07:49:00 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":64,"inputBytes":1908620,"outputBytes":1635990}
2022-04-05 07:49:00 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":64,"inputBytes":1908620,"outputBytes":2113774}
2022-04-05 07:49:06 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":112}
2022-04-05 07:49:07 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":72,"generated":true}
2022-04-05 07:49:07 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5862,"outputBytes":2915}
2022-04-05 07:49:07 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15174,"outputBytes":7820}
2022-04-05 07:49:15 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":96,"errors":0,"warnings":0}
2022-04-05 07:49:15 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-04-05 07:49:15 INFO:  Done...
2022-04-10 10:11:37 INFO:  Application: {"name":"@vladmandic/human","version":"2.6.5"}
2022-04-10 10:11:37 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true}
2022-04-10 10:11:37 INFO:  Toolchain: {"build":"0.7.2","esbuild":"0.14.34","typescript":"4.6.3","typedoc":"0.22.14","eslint":"8.13.0"}
2022-04-10 10:11:37 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2022-04-10 10:11:37 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]}
2022-04-10 10:11:37 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":595}
2022-04-10 10:11:37 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":64,"inputBytes":564552,"outputBytes":293314}
2022-04-10 10:11:37 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":599}
2022-04-10 10:11:37 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":64,"inputBytes":564556,"outputBytes":293318}
2022-04-10 10:11:37 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":651}
2022-04-10 10:11:37 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":64,"inputBytes":564608,"outputBytes":293368}
2022-04-10 10:11:37 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":394}
2022-04-10 10:11:37 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":1068,"outputBytes":615}
2022-04-10 10:11:37 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":64,"inputBytes":564572,"outputBytes":292273}
2022-04-10 10:11:37 STATE: Compile: {"name":"tfjs/browser/esm/custom","format":"esm","platform":"browser","input":"tfjs/tf-custom.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1344714}
2022-04-10 10:11:37 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":64,"inputBytes":1908671,"outputBytes":1636003}
2022-04-10 10:11:37 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":64,"inputBytes":1908671,"outputBytes":2113825}
2022-04-10 10:11:43 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":112}
2022-04-10 10:11:45 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":72,"generated":true}
2022-04-10 10:11:45 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":5862,"outputBytes":2915}
2022-04-10 10:11:45 STATE: Compile: {"name":"demo/faceid","format":"esm","platform":"browser","input":"demo/faceid/index.ts","output":"demo/faceid/index.js","files":2,"inputBytes":15174,"outputBytes":7820}
2022-04-10 10:11:54 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":96,"errors":0,"warnings":0}
2022-04-10 10:11:54 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2022-04-10 10:11:54 INFO:  Done...

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long