--merge_consecutive x now merges UP TO x segments#945
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates _merge_consecutive_segments so merge_consecutive=N merges up to N contiguous detections (merging shorter runs too) and splits longer runs into chunks of size at most N, aligning behavior with the --merge_consecutive intent.
Changes:
- Change merge behavior to merge any run of consecutive segments up to
merge_consecutive, chunking longer runs. - Update
_merge_consecutive_segmentsdocstring to describe the new “up to N” semantics. - Expand test coverage to validate chunking and merging of short runs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
birdnet_analyzer/analyze/core.py |
Adjusts merge logic to collapse 2..N consecutive segments (and chunk longer runs), plus updates parameter docs. |
tests/analyze/test_core_merge.py |
Renames an existing test and adds new tests covering “up to window size” chunking and short-run merging. |
birdnet_analyzer/cli.py |
Updates --merge_consecutive CLI help text to reflect the changed semantics (but still contains inaccuracies/typos per review comment). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
500
to
504
| "--merge_consecutive", | ||
| type=int, | ||
| default=1, | ||
| help="Maximum number of consecutive detections above MIN_CONF to merge for each detected species. This will result in fewer entires in the result file with segments longer than 3 seconds. Set to 0 or 1 to disable merging. Set to None to include all consecutive detections. We use the mean of the top 3 scores from all consecutive detections for merging.", | ||
| help="Maximum number of consecutive detections above the threshold to merge for each detected species. This will result in fewer entires in the result file with segments longer than 3 seconds. Set to 0 or 1 to disable merging. We use the mean of the top 3 scores from all consecutive detections for merging.", | ||
| ) |
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.
No description provided.