added diagnostics output

pull/280/head
Vladimir Mandic 2020-10-17 11:43:04 -04:00
parent 0411ed1371
commit 08101e4c45
2 changed files with 10 additions and 5 deletions

View File

@ -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

View File

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