Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supervision frame mask not handling negative end time #1203

Open
ArthLeu opened this issue Nov 4, 2023 · 5 comments
Open

Supervision frame mask not handling negative end time #1203

ArthLeu opened this issue Nov 4, 2023 · 5 comments

Comments

@ArthLeu
Copy link

ArthLeu commented Nov 4, 2023

lhotse/lhotse/cut/set.py

Lines 2908 to 2922 in c5f26af

for ali in supervision.alignment[use_alignment_if_exists]:
st = round(ali.start / frame_shift) if ali.start > 0 else 0
et = (
round(ali.end / frame_shift)
if ali.end < cut.duration
else num_frames
)
mask[st:et] = 1.0
else:
st = round(supervision.start / frame_shift) if supervision.start > 0 else 0
et = (
round(supervision.end / frame_shift)
if supervision.end < cut.duration
else num_frames
)

CutSet.cut_into_windows() produces negative start times in returned Supervision and Alignment items. But when computing the mask using supervision_frame_masks(), the end time et (assumed obtained from start + duration) does not handle this case where alignment ends before cut start, e.g. et <= 0.

Please verify if this is the case and resolve if needed.

ArthLeu added a commit to ArthLeu/lhotse that referenced this issue Nov 4, 2023
…end indices

When flipping mask digits to 1.0, negative indices should never be used.
@pzelasko
Copy link
Collaborator

pzelasko commented Nov 5, 2023

I see. I think your PR makes sense to help resolve this. You may also want to use keep_excessive_supervisions=False for such cases.

@ArthLeu
Copy link
Author

ArthLeu commented Nov 5, 2023

I tried it. But it would remove an entire Supervision altogether, regardless of whether a portion of its Alignment items are within the Cut time range.

@desh2608
Copy link
Collaborator

desh2608 commented Nov 6, 2023

I made some changes in alignment start times recently (#1193). Not sure if it is related, but may be worth checking if it resolved your issue?

@ArthLeu
Copy link
Author

ArthLeu commented Nov 6, 2023

Want to understand this. With #1193, the expectation is to unify all the Supervision and Alignment timestamps to absolutes (w.r.t. Recording start), and no more relatives (w.r.t. Cut start)?

@desh2608
Copy link
Collaborator

desh2608 commented Nov 6, 2023

@ArthLeu Alignments were always supposed to have absolute start times (w.r.t. the recording), but there was a bug in the implementation of some functions where they were being modified.

ArthLeu added a commit to ArthLeu/lhotse that referenced this issue Jan 17, 2024
ArthLeu added a commit to ArthLeu/lhotse that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants