tools/utilities/pythonlibs/audio/classifier.py
def _smooth(self, predictions):
        """ smooth the predictions over a time delay window """
        now = time.time()
        # if we get more than 1 second delay then reset our state
        if self.start_time is None or now > self.start_time + 1:
            self.start_time = now
            self.items = []
                
        # trim to our delay window
        new_items = [x for x in self.items if x[0] + self.smoothing_delay >= now ]
        new_items += [ (now, predictions) ] # add our new item
        self.items = new_items

        # compute summed probabilities over this new sliding window
        sum = np.sum([p[1] for p in new_items], axis=0)
        return sum / len(new_items)
 smooth the predictions over a time delay window 
smooth the predictions over a time delay window
smooth the predictions over a time delay window
def _smooth(self, predictions):
        now = time.time()
        if self.start_time is None or now > self.start_time + 1:
            self.start_time = now
            self.items = []
        new_items = [x for x in self.items if x[0] + self.smoothing_delay >= now ]
        new_items += [ (now, predictions) ] 
        self.items = new_items
        sum = np.sum([p[1] for p in new_items], axis=0)
        return sum / len(new_items)
def _smooth ( self , predictions ) : now = time . time ( ) if self . start_time is None or now > self . start_time + 1 : self . start_time = now self . items = [ ] new_items = [ x for x in self . items if x [ 0 ] + self . smoothing_delay >= now ] new_items += [ ( now , predictions ) ] self . items = new_items sum = np . sum ( [ p [ 1 ] for p in new_items ] , axis = 0 ) return sum / len ( new_items )
smooth the predictions over a time delay window
smooth the predictions over a time delay window
""" smooth the predictions over a time delay window """ # if we get more than 1 second delay then reset our state # trim to our delay window # add our new item # compute summed probabilities over this new sliding window
self
predictions