From 08101e4c45fc9d782cc524bf0cf3bb2bd97d8f2e Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 17 Oct 2020 11:43:04 -0400 Subject: [PATCH] added diagnostics output --- README.md | 1 + src/index.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bb1a62db..4055c666 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,7 @@ result = { ], performance = { // performance data of last execution for each module measuredin miliseconds config, // time to parse configuration + backend, // time to initialize tf backend load, // time to load models sanity, // time for input verification body, // model time diff --git a/src/index.js b/src/index.js index 12e81434..2755074c 100644 --- a/src/index.js +++ b/src/index.js @@ -110,10 +110,6 @@ async function detect(input, userConfig = {}) { return new Promise(async (resolve) => { const timeStart = now(); - // check number of loaded models - const loadedModels = Object.values(models).filter((a) => a).length; - if (loadedModels === 0) log('Human library starting'); - // configure backend timeStamp = now(); if (tf.getBackend() !== config.backend) { @@ -122,7 +118,15 @@ async function detect(input, userConfig = {}) { await tf.setBackend(config.backend); await tf.ready(); } - perf.body = Math.trunc(now() - timeStamp); + perf.backend = Math.trunc(now() - timeStamp); + + // check number of loaded models + const loadedModels = Object.values(models).filter((a) => a).length; + if (loadedModels === 0) { + log('Human library starting'); + log('Configuration:', config); + log('Flags:', tf.ENV.flags); + } // load models if enabled timeStamp = now();