diff --git a/predictor-ml/ml.js b/predictor-ml/ml.js index 349b6b2..386859d 100644 --- a/predictor-ml/ml.js +++ b/predictor-ml/ml.js @@ -196,7 +196,6 @@ class MlPredictor extends Writable { predict(callback) { const self = this; - if (this.JSPredictorMl && this.child && this.ready) { this.child.send(JSON.stringify({ type: 'predict', diff --git a/predictor-ml/mlpredict.py b/predictor-ml/mlpredict.py index 1bd7993..fe9ffce 100644 --- a/predictor-ml/mlpredict.py +++ b/predictor-ml/mlpredict.py @@ -177,9 +177,9 @@ class MlPredictor(object): logger.debug("ceps.shape " + str(ceps.shape) + " nnXLen " + str(nnXLen) + " nnXStep " + str(nnXStep) + " nwin " + str(nwin)) X = np.empty([nwin, nnXLen, mfccNceps]) - #t3 = timer() for i in range(nwin): X[i,:,:] = ceps[i*nnXStep:(i*nnXStep+nnXLen),:] + #t3 = timer() predictions = self.model.predict(X, verbose=debug) @@ -195,6 +195,7 @@ class MlPredictor(object): logger.debug("confidence " + str(confidence)) logger.debug("rms " + str(rms)) + #t5 = timer() result = json.dumps({ 'type': predclass, 'data': predictions.tolist(), @@ -203,11 +204,12 @@ class MlPredictor(object): 'rms': rms, 'mem': process.memory_info().rss, 'lenpcm': len(self.pcm), - #'timings': {'mfcc': str(t2-t1), 'inference': str(t4-t3)} + #'timings': {'pre': str(t3-t0), 'tf': str(t4-t3), 'post': str(t5-t4), 'total': str(t5-t0)}, + 'nwin': nwin }) logger.info("audio predicted probs=" + result) - + #logger.info("pre=%s ms tf=%s ms post=%s ms total=%s ms" % (t3-t0, t4-t3, t5-t4, t5-t0)) return result def exit(self):