diff --git a/demo/node-multiprocess-worker.js b/demo/node-multiprocess-worker.js index 79078bf..324724d 100644 --- a/demo/node-multiprocess-worker.js +++ b/demo/node-multiprocess-worker.js @@ -30,10 +30,10 @@ async function detect(img) { const tensor = await image(img); const result = await faceapi .detectAllFaces(tensor, optionsSSDMobileNet) - .withFaceLandmarks() - .withFaceExpressions() - .withFaceDescriptors() - .withAgeAndGender(); + .withFaceLandmarks(); + // .withFaceExpressions() + // .withFaceDescriptors() + // .withAgeAndGender(); process.send({ image: img, detected: result }); // send results back to main process.send({ ready: true }); // send signal back to main that this worker is now idle and ready for next image tensor.dispose(); diff --git a/demo/node-multiprocess.js b/demo/node-multiprocess.js index 556ad10..f2a7419 100644 --- a/demo/node-multiprocess.js +++ b/demo/node-multiprocess.js @@ -8,7 +8,7 @@ const child_process = require('child_process'); // note that main process import faceapi or tfjs at all const imgPathRoot = './demo'; // modify to include your sample images -const numWorkers = 2; // how many workers will be started +const numWorkers = 4; // how many workers will be started const workers = []; // this holds worker processes const images = []; // this holds queue of enumerated images const t = []; // timers @@ -33,7 +33,7 @@ function waitCompletion() { if (activeWorkers > 0) setImmediate(() => waitCompletion()); else { t[1] = process.hrtime.bigint(); - log.info('Processed', numImages, 'images in', Math.trunc(parseInt(t[1] - t[0]) / 1000 / 1000), 'ms'); + log.info('Processed:', numImages, 'images in', 'total:', Math.trunc(parseInt(t[1] - t[0]) / 1000000), 'ms', 'working:', Math.trunc(parseInt(t[1] - t[2]) / 1000000), 'ms', 'average:', Math.trunc(parseInt(t[1] - t[2]) / numImages / 1000000), 'ms'); } }