karlhajal commited on
Commit
1fe441b
·
verified ·
1 Parent(s): 2325843

Add fix for second-to-last frame

Browse files
Files changed (1) hide show
  1. src/audio_preprocessing.py +2 -0
src/audio_preprocessing.py CHANGED
@@ -266,6 +266,8 @@ def get_red_green_segments(dist_matrix, path, wav_type='ref', threshold=0.4):
266
  num_wav_frames = len(dist_matrix[0])
267
  wav_distances = [0] * num_wav_frames
268
  for (i, j) in zip(*path):
 
 
269
  wav_distances[i] = dist_matrix[i, j]
270
 
271
  red_segments = [i for i, d in enumerate(wav_distances) if d >= threshold]
 
266
  num_wav_frames = len(dist_matrix[0])
267
  wav_distances = [0] * num_wav_frames
268
  for (i, j) in zip(*path):
269
+ if i == num_wav_frames - 2 and wav_distances[i] > 0: # Special case for second to last frame
270
+ continue
271
  wav_distances[i] = dist_matrix[i, j]
272
 
273
  red_segments = [i for i, d in enumerate(wav_distances) if d >= threshold]