From 86ec06afa7e020ac38dc700b53a00226c58406d2 Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Mon, 2 Jun 2014 12:00:14 +0200 Subject: [PATCH] Merge Irit Speech Entropy from Dev into diadems --- timeside/analyzer/irit_speech_entropy.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/timeside/analyzer/irit_speech_entropy.py b/timeside/analyzer/irit_speech_entropy.py index e583fd0..febf1a4 100644 --- a/timeside/analyzer/irit_speech_entropy.py +++ b/timeside/analyzer/irit_speech_entropy.py @@ -26,7 +26,6 @@ from timeside.analyzer.utils import segmentFromValues from timeside.api import IAnalyzer from numpy import array from scipy.ndimage.morphology import binary_opening -from timeside.analyzer.preprocessors import frames_adapter class IRITSpeechEntropy(Analyzer): @@ -44,11 +43,6 @@ class IRITSpeechEntropy(Analyzer): self.threshold = 0.4 self.smoothLen = 5 self.modulLen = 2 - self.wLen = 0.016 - self.wStep = 0.008 - - self.input_blocksize = int(self.wLen * samplerate) - self.input_stepsize = int(self.wStep * samplerate) @staticmethod @interfacedoc @@ -68,20 +62,15 @@ class IRITSpeechEntropy(Analyzer): def __str__(self): return "Speech confidences indexes" - @frames_adapter def process(self, frames, eod=False): self.entropyValue.append(entropy(frames)) return frames, eod def post_process(self): - entropyValue = array(self.entropyValue) - import pylab - pylab.plot(entropyValue) - pylab.show() - w = self.modulLen / self.wStep + entropyValue = array(self.entropyValue) + w = self.modulLen * self.samplerate() / self.blocksize() modulentropy = computeModulation(entropyValue, w, False) - confEntropy = array(modulentropy - self.threshold) / self.threshold confEntropy[confEntropy > 1] = 1 @@ -109,10 +98,9 @@ class IRITSpeechEntropy(Analyzer): segs.label_metadata.label = label segs.data_object.label = [convert[s[2]] for s in segList] - segs.data_object.time = [(float(s[0]) * self.input_blocksize / + segs.data_object.time = [(float(s[0]) * self.blocksize() / self.samplerate()) for s in segList] - segs.data_object.duration = [(float(s[1] - s[0] + 1) * self.blocksize() / self.samplerate()) for s in segList] -- 2.39.5