From db40c5b727ee93a391468154cd4074d8050f3c57 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 19 Apr 2021 11:17:55 -0400 Subject: [PATCH] update node demo --- demo/node.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/demo/node.js b/demo/node.js index dca66720..0c9f8639 100644 --- a/demo/node.js +++ b/demo/node.js @@ -60,18 +60,24 @@ async function detect(input) { } else { buffer = fs.readFileSync(input); } + + // decode image using tfjs-node so we don't need external depenencies const decoded = human.tf.node.decodeImage(buffer); const casted = decoded.toFloat(); const image = casted.expandDims(0); decoded.dispose(); casted.dispose(); + // image shape contains image dimensions and depth log.state('Processing:', image.shape); + // run actual detection const result = await human.detect(image, myConfig); + // no need to print results as they are printed to console during detection from within the library due to human.config.debug set // dispose image tensor as we no longer need it image.dispose(); + // print data to console log.data('Results:'); for (let i = 0; i < result.face.length; i++) {