diff --git a/README.md b/README.md index 4aa9ac5b..9ffc7563 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ *Suggestions are welcome!* +![Sample](demo/sample.jpg) +
## Credits diff --git a/demo/demo-esm.html b/demo/demo-esm.html index f215ede6..c8aa84a9 100644 --- a/demo/demo-esm.html +++ b/demo/demo-esm.html @@ -5,7 +5,8 @@
+ -
+
Starting Human library
diff --git a/demo/demo-esm.js b/demo/demo-esm.js index ab6f2ec5..ded8fcc2 100644 --- a/demo/demo-esm.js +++ b/demo/demo-esm.js @@ -5,15 +5,15 @@ import human from '../dist/human.esm.js'; const config = { face: { - enabled: false, + enabled: true, detector: { maxFaces: 10, skipFrames: 5, minConfidence: 0.8, iouThreshold: 0.3, scoreThreshold: 0.75 }, - mesh: { enabled: false }, - iris: { enabled: false }, - age: { enabled: false, skipFrames: 5 }, - gender: { enabled: false }, + mesh: { enabled: true }, + iris: { enabled: true }, + age: { enabled: true, skipFrames: 5 }, + gender: { enabled: true }, }, - body: { enabled: false, maxDetections: 5, scoreThreshold: 0.75, nmsRadius: 20 }, - hand: { enabled: false, skipFrames: 5, minConfidence: 0.8, iouThreshold: 0.3, scoreThreshold: 0.75 }, + body: { enabled: true, maxDetections: 5, scoreThreshold: 0.75, nmsRadius: 20 }, + hand: { enabled: true, skipFrames: 5, minConfidence: 0.8, iouThreshold: 0.3, scoreThreshold: 0.75 }, }; let settings; @@ -189,6 +189,7 @@ async function runHumanDetect() { } function setupGUI() { + settings = QuickSettings.create(10, 10, 'Settings', document.getElementById('main')); settings.addRange('FPS', 0, 100, 0, 1); settings.addBoolean('Pause', false, (val) => { if (val) document.getElementById('video').pause(); @@ -237,7 +238,6 @@ async function setupCanvas() { const canvas = document.getElementById('canvas'); canvas.width = video.width; canvas.height = video.height; - settings = QuickSettings.create(10, 10, 'Settings', document.getElementById('main')); } async function setupCamera() { @@ -257,6 +257,20 @@ async function setupCamera() { }); } +// eslint-disable-next-line no-unused-vars +async function runImageDemo() { + const image = document.getElementById('image'); + const canvas = document.getElementById('canvas'); + canvas.width = image.width; + canvas.height = image.height; + const result = await human.detect(image, config); + const ctx = canvas.getContext('2d'); + ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height); + drawFace(result.face); + drawBody(result.body); + drawHand(result.hand); +} + async function main() { await human.tf.setBackend('webgl'); await human.tf.ready(); @@ -264,6 +278,7 @@ async function main() { await setupCanvas(); await setupGUI(); runHumanDetect(); + // runImageDemo(); } window.onload = main; diff --git a/demo/demo-iife.html b/demo/demo-iife.html index dc78e8dc..1d1a8480 100644 --- a/demo/demo-iife.html +++ b/demo/demo-iife.html @@ -6,7 +6,8 @@
+ -
+
Starting Human library
diff --git a/demo/sample.jpg b/demo/sample.jpg new file mode 100644 index 00000000..83bc5532 Binary files /dev/null and b/demo/sample.jpg differ