fix(asr): end the final VAD speech segment at the last frame's end - #16200
Open
Kayvan-Zahiri wants to merge 2 commits into
Open
fix(asr): end the final VAD speech segment at the last frame's end#16200Kayvan-Zahiri wants to merge 2 commits into
Kayvan-Zahiri wants to merge 2 commits into
Conversation
binarization() closed a trailing speech segment at the start time of the last active frame instead of its end, so any segment still active at the end of the sequence came out one frame short, and a lone active final frame produced a zero-duration segment. Signed-off-by: Kayvan Zahiri <123409429+Kayvan-Zahiri@users.noreply.github.com>
nithinraok
approved these changes
Sep 2, 2026
nithinraok
left a comment
Member
There was a problem hiding this comment.
Thanks LGTM. Verified locally.
Member
|
/ok to test 6cab274 |
nithinraok
enabled auto-merge (squash)
September 2, 2026 15:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
binarization()closes a trailing speech segment ati * frame_length_in_sec, whereiis the index of the last active frame, so the segment ends where that frame starts. Interior segments close at the index of the first inactive frame, i.e. at the end of the last active frame. A segment still active at the end of the sequence therefore comes out one full frame short, and a lone active final frame yields a zero-duration segment[t, t].binarization_vectorizedin the same module does not have this. Its testfinal-active-frame-uses-full-durationexpects[[0.0, 0.16]]for[0.6, 0.6]at 0.08 s frames;binarizationreturns[[0.0, 0.08]]. The affected callers aregenerate_vad_segment_table_per_tensor(frame-VAD speech segments and RTTM) andts_vad_post_processing.Collection: ASR
Changelog
binarization()now ends the trailing segment atlen(sequence) * frame_length_in_sec + pad_offset.i = 0, which only existed to feed that expression.test_binarization_final_active_frame_uses_full_duration, which also asserts agreement withbinarization_vectorized.Usage
Checks run
pytest tests/collections/speaker_tasks/utils/ tests/collections/asr/utils/ -m "not pleasefixme" --cpu-> 834 passed, 40 skipped. The three new cases fail before the fix and pass after.binarization_vectorized(onset >= offset, frame lengths 0.01/0.02/0.08 s) goes from 3268 mismatches and 851 zero-duration segments to 0 and 0. Empty results are skipped there becausebinarizationreturns shape[0]whilebinarization_vectorizedreturns(0, 2); that shape difference is left alone.black --check,isort --check-only,flake8 --config=.flake8.speech,pylint --rcfile=.pylintrc.speech-> clean, pylint 10.00/10.binarizationis@torch.jit.scriptand still compiles.Before your PR is "Ready for review"
Pre checks:
PR Type:
Who can review?
@nithinraok per CONTRIBUTING.md for ASR.