add inference time to yolo plugin

build-default-monitor-config-from-definitions
Moe 2020-04-05 16:13:52 -07:00
parent 9cd9446800
commit 0dc4b7afd2
1 changed files with 3 additions and 1 deletions

View File

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