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();