diff --git a/config.js b/config.js index fba6f6a6..7541b96d 100644 --- a/config.js +++ b/config.js @@ -71,7 +71,7 @@ export default { // 'blazeface-back' is blazeface model optimized for smaller and/or distanct faces // 'faceboxes' is alternative model to 'blazeface' inputSize: 256, // fixed value: 128 for front and 256 for 'back' - rotation: false, // use best-guess rotated face image or just box with rotation as-is + rotation: true, // use best-guess rotated face image or just box with rotation as-is // false means higher performance, but incorrect mesh mapping if face angle is above 20 degrees maxFaces: 10, // maximum number of faces detected in the input // should be set to the minimum number for performance diff --git a/demo/browser.js b/demo/browser.js index f4b6793e..e717960b 100644 --- a/demo/browser.js +++ b/demo/browser.js @@ -2,7 +2,7 @@ import Human from '../dist/human.esm.js'; // equivalent of @vladmandic/human import Menu from './menu.js'; import GLBench from './gl-bench.js'; -const userConfig = { }; // add any user configuration overrides +const userConfig = { backend: 'wasm' }; // add any user configuration overrides /* const userConfig = { @@ -40,11 +40,11 @@ const ui = { drawFPS: [], // internal, holds fps values for draw performance buffered: false, // experimental, should output be buffered between frames drawWarmup: false, // debug only, should warmup image processing be displayed on startup - drawThread: null, // perform draw operations in a separate thread - detectThread: null, // perform detect operations in a separate thread + drawThread: null, // internl, perform draw operations in a separate thread + detectThread: null, // internl, perform detect operations in a separate thread framesDraw: 0, // internal, statistics on frames drawn framesDetect: 0, // internal, statistics on frames detected - bench: false, // show gl fps benchmark window + bench: true, // show gl fps benchmark window lastFrame: 0, // time of last frame processing }; @@ -110,7 +110,11 @@ async function drawResults(input) { await menu.process.updateChart('FPS', ui.detectFPS); // get updated canvas - if (ui.buffered || !result.canvas) result.canvas = await human.image(input).canvas; + if (ui.buffered || !result.canvas) { + const image = await human.image(input); + result.canvas = image.canvas; + human.tf.dispose(image.tensor); + } // draw image from video const ctx = canvas.getContext('2d'); @@ -421,10 +425,10 @@ function setupMenu() { menu.display.addHTML('