Mercurial > hg > plosone_underreview
diff scripts/load_features.py @ 34:115774aff442 branch-tests
music bounds not centered but aligned with start of segment to match the way features are computed
author | Maria Panteli |
---|---|
date | Thu, 14 Sep 2017 10:16:59 +0100 |
parents | e4736064d282 |
children | c4428589b82b |
line wrap: on
line diff
--- a/scripts/load_features.py Wed Sep 13 20:04:09 2017 +0100 +++ b/scripts/load_features.py Thu Sep 14 10:16:59 2017 +0100 @@ -76,13 +76,16 @@ # all segments are speech return music_idx else: - half_win_hop = int(round(0.5 * self.win2 / float(self.hop2))) + win2_frames = np.int(np.round(self.win2sec * self.framessr2)) + #half_win_hop = int(round(0.5 * self.win2 / float(self.hop2))) music_bounds = np.where(bounds[:, 2] == 'm')[0] bounds_in_frames = np.round(np.array(bounds[:, 0], dtype=float) * sr) - duration_in_frames = np.round(np.array(bounds[:, 1], dtype=float) * sr) + duration_in_frames = np.ceil(np.array(bounds[:, 1], dtype=float) * sr) for music_bound in music_bounds: - lower_bound = np.max([0, bounds_in_frames[music_bound] - half_win_hop]) - upper_bound = bounds_in_frames[music_bound] + duration_in_frames[music_bound] - half_win_hop + #lower_bound = np.max([0, bounds_in_frames[music_bound] - half_win_hop]) + #upper_bound = bounds_in_frames[music_bound] + duration_in_frames[music_bound] - half_win_hop + lower_bound = bounds_in_frames[music_bound] + upper_bound = bounds_in_frames[music_bound] + duration_in_frames[music_bound] - win2_frames music_idx.append(np.arange(lower_bound, upper_bound, dtype=int)) if len(music_idx)>0: music_idx = np.sort(np.concatenate(music_idx)) # it should be sorted, but just in case segments overlap -- remove duplicates if segments overlap