diff --git a/README.md b/README.md index 419a498e..37615531 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,9 @@ If your application resides in a different folder, modify `modelPath` property i Demos are included in `/demo`: **Browser**: -- `index.html`, `browser.js`, `worker.js`: Full demo using Browser with ESM module, includes selectable backends and webworkers +- `index.html`: Full demo using Browser with ESM module, includes selectable backends and webworkers + it loads `dist/demo-browser-index.js` which is built from sources in `demo`, starting with `demo/browser` + alternatively you can load `demo/browser.js` directly *If you want to test `wasm` or `webgpu` backends, enable loading in `index.html`* diff --git a/config.js b/config.js index 0f181fc0..9ac1d3b9 100644 --- a/config.js +++ b/config.js @@ -58,7 +58,7 @@ export default { // as face probably hasn't moved much in short time (10 * 1/25 = 0.25 sec) minConfidence: 0.5, // threshold for discarding a prediction iouThreshold: 0.3, // threshold for deciding whether boxes overlap too much in non-maximum suppression - scoreThreshold: 0.7, // threshold for deciding when to remove boxes based on score in non-maximum suppression + scoreThreshold: 0.5, // threshold for deciding when to remove boxes based on score in non-maximum suppression }, mesh: { enabled: true, @@ -97,7 +97,7 @@ export default { inputResolution: 257, // fixed value outputStride: 16, // fixed value maxDetections: 10, // maximum number of people detected in the input, should be set to the minimum number for performance - scoreThreshold: 0.7, // threshold for deciding when to remove boxes based on score in non-maximum suppression + scoreThreshold: 0.5, // threshold for deciding when to remove boxes based on score in non-maximum suppression nmsRadius: 20, // radius for deciding points are too close in non-maximum suppression }, hand: { @@ -108,7 +108,7 @@ export default { // as the hand probably hasn't moved much in short time (10 * 1/25 = 0.25 sec) minConfidence: 0.5, // threshold for discarding a prediction iouThreshold: 0.3, // threshold for deciding whether boxes overlap too much in non-maximum suppression - scoreThreshold: 0.7, // threshold for deciding when to remove boxes based on score in non-maximum suppression + scoreThreshold: 0.5, // threshold for deciding when to remove boxes based on score in non-maximum suppression enlargeFactor: 1.65, // empiric tuning as skeleton prediction prefers hand box with some whitespace maxHands: 10, // maximum number of hands detected in the input, should be set to the minimum number for performance detector: { diff --git a/demo/browser.js b/demo/browser.js index 10a51731..a9122958 100644 --- a/demo/browser.js +++ b/demo/browser.js @@ -55,15 +55,15 @@ const config = { videoOptimized: true, face: { enabled: true, - detector: { maxFaces: 10, skipFrames: 10, minConfidence: 0.5, iouThreshold: 0.3, scoreThreshold: 0.7 }, + detector: { maxFaces: 10, skipFrames: 10, minConfidence: 0.5, iouThreshold: 0.3, scoreThreshold: 0.5 }, mesh: { enabled: true }, iris: { enabled: true }, age: { enabled: true, skipFrames: 10 }, gender: { enabled: true }, emotion: { enabled: true, minConfidence: 0.5, useGrayscale: true }, }, - body: { enabled: true, maxDetections: 10, scoreThreshold: 0.7, nmsRadius: 20 }, - hand: { enabled: true, skipFrames: 10, minConfidence: 0.5, iouThreshold: 0.3, scoreThreshold: 0.7 }, + body: { enabled: true, maxDetections: 10, scoreThreshold: 0.5, nmsRadius: 20 }, + hand: { enabled: true, skipFrames: 10, minConfidence: 0.5, iouThreshold: 0.3, scoreThreshold: 0.5 }, gesture: { enabled: true }, }; @@ -148,10 +148,8 @@ async function setupCamera() { const canvas = document.getElementById('canvas'); const output = document.getElementById('log'); const live = video.srcObject ? ((video.srcObject.getVideoTracks()[0].readyState === 'live') && (video.readyState > 2) && (!video.paused)) : false; - let msg = `Setting up camera: live: ${live} facing: ${ui.facing ? 'front' : 'back'}`; + let msg = ''; status('starting camera'); - output.innerText += `\n${msg}`; - log(msg); // setup webcam. note that navigator.mediaDevices requires that page is accessed via https if (!navigator.mediaDevices) { msg = 'camera access not supported'; @@ -182,6 +180,7 @@ async function setupCamera() { const track = stream.getVideoTracks()[0]; const settings = track.getSettings(); log('camera settings:', settings); + log('camera track:', track); camera = { name: track.label, width: settings.width, height: settings.height, facing: settings.facingMode === 'user' ? 'front' : 'back' }; return new Promise((resolve) => { video.onloadeddata = async () => { diff --git a/demo/index.html b/demo/index.html index 0315a2ec..35f2e42e 100644 --- a/demo/index.html +++ b/demo/index.html @@ -13,10 +13,14 @@ - - - - + + + + + + + +
@@ -48,10 +60,17 @@