Mercurial > hg > segmentation
comparison utils/SegUtil.py @ 12:c23658e8ae38
fp feature notebook
author | mitian |
---|---|
date | Mon, 25 May 2015 17:27:48 +0100 |
parents | 56a2ca9359d0 |
children | cc8ceb270e79 |
comparison
equal
deleted
inserted
replaced
11:915c849b17ea | 12:c23658e8ae38 |
---|---|
344 feature_array[np.isinf(feature_array)] = 0.0 | 344 feature_array[np.isinf(feature_array)] = 0.0 |
345 | 345 |
346 return feature_array | 346 return feature_array |
347 | 347 |
348 | 348 |
349 def getRolloff(data, tpower, filterbank, thresh=0.9): | |
350 nFrames = data.shape[0] | |
351 nFilters = len(filterbank) | |
352 rolloff = np.zeros(nFrames) | |
353 for i in xrange(nFrames): | |
354 rolloffE = thresh * tpower[i] | |
355 temp = 0.0 | |
356 tempE = 0.0 | |
357 for band in xrange(nFilters): | |
358 temp += data[i][band] | |
359 if temp > rolloffE: break | |
360 rolloff[i] = filterbank[nFilters-band-1] | |
361 | |
362 return rolloff | |
363 | |
364 | |
349 def verifyPeaks(peak_canditates, dev_list): | 365 def verifyPeaks(peak_canditates, dev_list): |
350 '''Verify peaks from the 1st round detection by applying adaptive thresholding to the deviation list.''' | 366 '''Verify peaks from the 1st round detection by applying adaptive thresholding to the deviation list.''' |
351 | 367 |
352 final_peaks = copy(peak_canditates) | 368 final_peaks = copy(peak_canditates) |
353 dev_list = np.array([np.mean(x) for x in dev_list]) # get average of devs of different features | 369 dev_list = np.array([np.mean(x) for x in dev_list]) # get average of devs of different features |