From 0dc4b7afd20f353d73ef8569f1f112b945e23a97 Mon Sep 17 00:00:00 2001 From: Moe Date: Sun, 5 Apr 2020 16:13:52 -0700 Subject: [PATCH] add inference time to yolo plugin --- plugins/yolo/shinobi-yolo.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/yolo/shinobi-yolo.js b/plugins/yolo/shinobi-yolo.js index e04f67d9..fb50798b 100644 --- a/plugins/yolo/shinobi-yolo.js +++ b/plugins/yolo/shinobi-yolo.js @@ -27,6 +27,7 @@ var yolo = require('node-yolo-shinobi');//this is @vapi/node-yolo@1.2.4 without // var yolo = require('@vapi/node-yolo'); var detector = new yolo(__dirname + "/models", "cfg/coco.data", "cfg/yolov3.cfg", "yolov3.weights"); s.detectObject=function(buffer,d,tx,frameLocation){ + var timeStart = new Date() var detectStuff = function(frame,callback){ detector.detect(frame) .then(detections => { @@ -52,7 +53,8 @@ s.detectObject=function(buffer,d,tx,frameLocation){ reason:'object', matrices:matrices, imgHeight:parseFloat(d.mon.detector_scale_y), - imgWidth:parseFloat(d.mon.detector_scale_x) + imgWidth:parseFloat(d.mon.detector_scale_x), + time: (new Date()) - timeStart } }) }