[ASR] Add unit tests for VAD thresholding and post-processing logic#15704
Open
shivansh023023 wants to merge 1 commit into
Open
[ASR] Add unit tests for VAD thresholding and post-processing logic#15704shivansh023023 wants to merge 1 commit into
shivansh023023 wants to merge 1 commit into
Conversation
Adds 26 CPU-only unit tests for nemo/collections/asr/parts/utils/vad_utils.py covering the core VAD pipeline functions. Tests cover: - Binarization: symmetric threshold, hysteresis, empty/all-zeros/all-ones/single-frame - Parametrized threshold sweep: onset in [0.3, 0.5, 0.7, 0.9] - Filtering: short segment removal, gap merging, empty input - Segment helpers: filter_short_segments, get_gap_segments, remove_segments - Threshold scale conversion: absolute and relative modes - Percentile utility: basic and boundary values - Full pipeline integration: correctness, determinism, non-overlapping output All tests are CPU-only and deterministic (torch.manual_seed(42)). Signed-off-by: Hackathon User <hackathon@example.com>
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?
Adds 26 CPU-only unit tests for the VAD (Voice Activity Detection) thresholding
and post-processing pipeline in
nemo/collections/asr/parts/utils/vad_utils.py.These functions had zero test coverage prior to this PR.
Collection: ASR
Changelog
tests/collections/asr/test_vad_utils.py(new file, 221 lines, 26 tests):TestBinarization: symmetric threshold, hysteresis, empty input, all-zeros, all-ones, single-frame edge casesTestBinarizationParametrized: threshold sweep over onset in [0.3, 0.5, 0.7, 0.9]TestFiltering: short segment removal, no-op filtering, empty inputTestMergeOverlapSegment: overlapping merge, non-overlapping, empty inputTestSegmentHelpers: filter_short_segments, get_gap_segments, remove_segmentsTestCalVadOnsetOffset: absolute and relative scale conversionTestPercentile: basic and boundary percentile valuesTestGenerateVadSegmentTablePerTensor: full pipeline correctness, determinism, non-overlapping outputUsage
Before your PR is "Ready for review"
Pre checks:
PR Type:
Additional Information
torch.manual_seed(42)