Skip to content

--merge_consecutive x now merges UP TO x segments#945

Merged
Josef-Haupt merged 2 commits into
mainfrom
fix-merge-consecutive
Jul 6, 2026
Merged

--merge_consecutive x now merges UP TO x segments#945
Josef-Haupt merged 2 commits into
mainfrom
fix-merge-consecutive

Conversation

@Josef-Haupt

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 6, 2026 14:26
@Josef-Haupt Josef-Haupt linked an issue Jul 6, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_segments docstring 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 thread birdnet_analyzer/cli.py
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.",
)
@Josef-Haupt Josef-Haupt merged commit c29eeaf into main Jul 6, 2026
6 of 8 checks passed
@Josef-Haupt Josef-Haupt deleted the fix-merge-consecutive branch July 6, 2026 14:49
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

Successfully merging this pull request may close these issues.

Not able to merge all consecutive detections in CLI

2 participants