From 18e00241843f1e2f2ebcf74c7f287247d2a8e386 Mon Sep 17 00:00:00 2001 From: Anthony Liu Date: Sat, 4 Nov 2023 16:11:08 -0700 Subject: [PATCH 1/2] #1203 Update supervision_frame_masks() to skip negative end indices When flipping mask digits to 1.0, negative indices should never be used. --- lhotse/cut/set.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lhotse/cut/set.py b/lhotse/cut/set.py index 8f724f3c9..1eb0d8a16 100644 --- a/lhotse/cut/set.py +++ b/lhotse/cut/set.py @@ -2912,6 +2912,7 @@ def compute_supervisions_frame_mask( if ali.end < cut.duration else num_frames ) + if et <= 0: continue mask[st:et] = 1.0 else: st = round(supervision.start / frame_shift) if supervision.start > 0 else 0 @@ -2920,6 +2921,7 @@ def compute_supervisions_frame_mask( if supervision.end < cut.duration else num_frames ) + if et <= 0: continue mask[st:et] = 1.0 return mask From 193fc857f8206d14b22b8f80d25e2217da3ac567 Mon Sep 17 00:00:00 2001 From: Anthony Liu Date: Thu, 9 Nov 2023 23:34:57 -0800 Subject: [PATCH 2/2] Update set.py to pass Black test --- lhotse/cut/set.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lhotse/cut/set.py b/lhotse/cut/set.py index 1eb0d8a16..82a9dc24b 100644 --- a/lhotse/cut/set.py +++ b/lhotse/cut/set.py @@ -2912,7 +2912,8 @@ def compute_supervisions_frame_mask( if ali.end < cut.duration else num_frames ) - if et <= 0: continue + if et <= 0: + continue mask[st:et] = 1.0 else: st = round(supervision.start / frame_shift) if supervision.start > 0 else 0 @@ -2921,7 +2922,8 @@ def compute_supervisions_frame_mask( if supervision.end < cut.duration else num_frames ) - if et <= 0: continue + if et <= 0: + continue mask[st:et] = 1.0 return mask