def extract(self): Features.extract(self) self._hop = 1 if self._hop is None else self._hop window, hop = self._window, self._hop if window and hop is not None: fp = self.feature_params num_frames = int( (window * fp['sample_rate']) / (1000.0 * fp['nhop'])) num_hop = int((hop * fp['sample_rate']) / (1000.0 * fp['nhop'])) print(num_frames, num_hop) if not num_frames and num_hop: raise ValueError( "num_frames and num_hop too small for FFT window / hop") else: Y = [] for k in range(0, self.X.shape[1] - window + 1, num_hop): X = log( self.X[:, np.arange(k, k + num_frames)] + np.finfo(np.float32).eps ) if self._log else self.X[:, np.arange(k, k + num_frames)] Y.append( np.fft.fftshift(np.absolute(np.fft.fft2(X))).flatten()) self.X = np.array(Y) else: self.X = log(self.X + np.finfo(np.float32).eps) if self._log else self.X self.X = np.fft.fftshift(np.absolute(np.fft.fft2(self.X)))
def extract(self): Features.extract(self) self._hop = 1 if self._hop is None else self._hop window, hop = self._window, self._hop if window and hop is not None: fp = self.feature_params num_frames = int((window*fp['sample_rate'])/(1000.0*fp['nhop'])) num_hop = int((hop*fp['sample_rate'])/(1000.0*fp['nhop'])) print num_frames, num_hop if not num_frames and num_hop : raise ValueError("num_frames and num_hop too small for FFT window / hop") else : Y = [] for k in range(0,self.X.shape[1]-window+1,num_hop): X = log(self.X[:,np.arange(k,k+num_frames)]+np.finfo(np.float32).eps) if self._log else self.X[:,np.arange(k,k+num_frames)] Y.append(np.fft.fftshift(np.absolute(np.fft.fft2(X))).flatten()) self.X = np.array(Y) else: self.X = log(self.X+np.finfo(np.float32).eps) if self._log else self.X self.X = np.fft.fftshift(np.absolute(np.fft.fft2(self.X)))
def extract(self): Features.extract(self) self.X = P.sqrt((P.diff(self.X)**2).sum(0)) / self.X.shape[0]
def extract(self): Features.extract(self) mf = (self.X.T * self._logfrqs).sum(1) / self.X.T.sum(1) self.X = (((self.X / self.X.T.sum(1)).T * ((P.atleast_2d(self._logfrqs).T - mf)).T)**2).sum(1)
def extract(self): Features.extract(self) self.X = (self.X.T * self._logfrqs).sum(1) / self.X.T.sum(1)
def extract(self): Features.extract(self) self.X = P.sqrt((P.diff(self.X)**2).sum(0))/self.X.shape[0]