From 9d403a3a9455769af340af4f4877bd5ba5ce6ad6 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 12 May 2022 16:47:21 -0400 Subject: [PATCH] fix demo when used with video files --- CHANGELOG.md | 7 ++++--- demo/index.js | 17 ++++++++++------- package.json | 10 +++++----- test/build.log | 48 ++++++++++++++++++++++++------------------------ 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e72068a..5a84c2a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,13 @@ ## Changelog +### **HEAD -> main** 2022/05/09 mandic00@live.com + + ### **2.7.1** 2022/05/09 mandic00@live.com - support 4k input - -### **origin/main** 2022/04/18 mandic00@live.com - +- add attention draw methods - fix coloring function - enable precompile as part of warmup - prepare release beta diff --git a/demo/index.js b/demo/index.js index 7e424418..7587076a 100644 --- a/demo/index.js +++ b/demo/index.js @@ -187,9 +187,9 @@ function status(msg) { } } -async function videoPlay() { +async function videoPlay(videoElement = document.getElementById('video')) { document.getElementById('btnStartText').innerHTML = 'pause video'; - await document.getElementById('video').play(); + await videoElement.play(); // status(); } @@ -630,12 +630,14 @@ async function processImage(input, title) { async function processVideo(input, title) { status(`processing video: ${title}`); - const video = document.createElement('video'); + // const video = document.getElementById('video-file') || document.createElement('video'); + const video = document.getElementById('video'); const canvas = document.getElementById('canvas'); - video.id = 'video-file'; - video.controls = true; - video.loop = true; - // video.onerror = async () => status(`video loading error: ${video.error.message}`); + // video.id = 'video-file'; + // video.controls = true; + // video.loop = true; + // video.style.display = 'none'; + // document.body.appendChild(video); video.addEventListener('error', () => status(`video loading error: ${video.error.message}`)); video.addEventListener('canplay', async () => { for (const m of Object.values(menu)) m.hide(); @@ -644,6 +646,7 @@ async function processVideo(input, title) { await videoPlay(); if (!ui.detectThread) runHumanDetect(video, canvas); }); + video.srcObject = null; video.src = input; } diff --git a/package.json b/package.json index bbbcfb31..18b3bcfd 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "tensorflow" ], "devDependencies": { - "@microsoft/api-extractor": "^7.23.1", + "@microsoft/api-extractor": "^7.23.2", "@tensorflow/tfjs": "^3.16.0", "@tensorflow/tfjs-backend-cpu": "^3.16.0", "@tensorflow/tfjs-backend-wasm": "^3.16.0", @@ -65,16 +65,16 @@ "@tensorflow/tfjs-layers": "^3.16.0", "@tensorflow/tfjs-node": "^3.16.0", "@tensorflow/tfjs-node-gpu": "^3.16.0", - "@types/node": "^17.0.31", + "@types/node": "^17.0.32", "@types/offscreencanvas": "^2019.6.4", - "@typescript-eslint/eslint-plugin": "^5.22.0", - "@typescript-eslint/parser": "^5.22.0", + "@typescript-eslint/eslint-plugin": "^5.23.0", + "@typescript-eslint/parser": "^5.23.0", "@vladmandic/build": "^0.7.3", "@vladmandic/pilogger": "^0.4.4", "@vladmandic/tfjs": "github:vladmandic/tfjs", "canvas": "^2.9.1", "dayjs": "^1.11.2", - "esbuild": "^0.14.38", + "esbuild": "^0.14.39", "eslint": "8.15.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-html": "^6.2.0", diff --git a/test/build.log b/test/build.log index 7e8a7b22..c0ddd680 100644 --- a/test/build.log +++ b/test/build.log @@ -1,24 +1,24 @@ -2022-05-09 08:14:02 INFO:  Application: {"name":"@vladmandic/human","version":"2.7.1"} -2022-05-09 08:14:02 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true} -2022-05-09 08:14:02 INFO:  Toolchain: {"build":"0.7.3","esbuild":"0.14.38","typescript":"4.6.4","typedoc":"0.22.15","eslint":"8.15.0"} -2022-05-09 08:14:02 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} -2022-05-09 08:14:02 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]} -2022-05-09 08:14:02 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-05-09 08:14:02 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":72,"inputBytes":606670,"outputBytes":297893} -2022-05-09 08:14:02 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-05-09 08:14:02 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":72,"inputBytes":606674,"outputBytes":297897} -2022-05-09 08:14:02 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-05-09 08:14:02 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":72,"inputBytes":606726,"outputBytes":297947} -2022-05-09 08:14:02 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-05-09 08:14:02 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-05-09 08:14:02 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":72,"inputBytes":606658,"outputBytes":296806} -2022-05-09 08:14:03 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":1351141} -2022-05-09 08:14:03 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":72,"inputBytes":1957216,"outputBytes":1646998} -2022-05-09 08:14:03 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":72,"inputBytes":1957216,"outputBytes":2129196} -2022-05-09 08:14:08 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":114} -2022-05-09 08:14:10 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":73,"generated":true} -2022-05-09 08:14:10 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6021,"outputBytes":3024} -2022-05-09 08:14:10 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-05-09 08:14:18 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":104,"errors":0,"warnings":0} -2022-05-09 08:14:18 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} -2022-05-09 08:14:18 INFO:  Done... +2022-05-12 16:46:38 INFO:  Application: {"name":"@vladmandic/human","version":"2.7.1"} +2022-05-12 16:46:38 INFO:  Environment: {"profile":"production","config":".build.json","package":"package.json","tsconfig":true,"eslintrc":true,"git":true} +2022-05-12 16:46:38 INFO:  Toolchain: {"build":"0.7.3","esbuild":"0.14.39","typescript":"4.6.4","typedoc":"0.22.15","eslint":"8.15.0"} +2022-05-12 16:46:38 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]} +2022-05-12 16:46:38 STATE: Clean: {"locations":["dist/*","types/lib/*","typedoc/*"]} +2022-05-12 16:46:38 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-05-12 16:46:38 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":72,"inputBytes":606670,"outputBytes":297893} +2022-05-12 16:46:38 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-05-12 16:46:38 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":72,"inputBytes":606674,"outputBytes":297897} +2022-05-12 16:46:38 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-05-12 16:46:38 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":72,"inputBytes":606726,"outputBytes":297947} +2022-05-12 16:46:38 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-05-12 16:46:38 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-05-12 16:46:38 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":72,"inputBytes":606658,"outputBytes":296806} +2022-05-12 16:46:38 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":1351141} +2022-05-12 16:46:38 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":72,"inputBytes":1957216,"outputBytes":1646998} +2022-05-12 16:46:38 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":72,"inputBytes":1957216,"outputBytes":2129196} +2022-05-12 16:46:43 STATE: Typings: {"input":"src/human.ts","output":"types/lib","files":114} +2022-05-12 16:46:45 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":73,"generated":true} +2022-05-12 16:46:45 STATE: Compile: {"name":"demo/typescript","format":"esm","platform":"browser","input":"demo/typescript/index.ts","output":"demo/typescript/index.js","files":1,"inputBytes":6021,"outputBytes":3024} +2022-05-12 16:46: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-05-12 16:46:52 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":104,"errors":0,"warnings":0} +2022-05-12 16:46:52 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"} +2022-05-12 16:46:52 INFO:  Done...