Skip to content

Filter out too short segments from diarization in the separation pipeline#1816

Draft
clement-pages wants to merge 3 commits into
pyannote:developfrom
clement-pages:filter-out-too-short-segment-in-separation-pipeline
Draft

Filter out too short segments from diarization in the separation pipeline#1816
clement-pages wants to merge 3 commits into
pyannote:developfrom
clement-pages:filter-out-too-short-segment-in-separation-pipeline

Conversation

@clement-pages

Copy link
Copy Markdown
Collaborator

No description provided.

@stale

stale Bot commented Aug 3, 2025

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the wontfix label Aug 3, 2025
@hbredin hbredin requested a review from Copilot August 25, 2025 07:25
@stale stale Bot removed the wontfix label Aug 25, 2025

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

This PR adds filtering functionality to remove speech segments that are too short in the speaker diarization component of the speech separation pipeline.

  • Adds a min_duration_on parameter to control the minimum duration of speech segments
  • Implements morphological closing operation to filter out segments shorter than the threshold
  • Updates import statements to include the necessary scipy.ndimage functions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +34 to 35
from scipy.ndimage import binary_dilation, binary_closing
import torch

Copilot AI Aug 25, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The import reorganization places scipy.ndimage import before torch import, breaking alphabetical ordering. Consider maintaining consistent import ordering for better code organization.

Suggested change
from scipy.ndimage import binary_dilation, binary_closing
import torch
import torch
from scipy.ndimage import binary_dilation, binary_closing

Copilot uses AI. Check for mistakes.
Comment on lines +616 to +619
discrete_diarization.data = binary_closing(
discrete_diarization.data, structure=np.array([[True] * min_frames_on]).T
)

Copilot AI Aug 25, 2025

Copy link

Choose a reason for hiding this comment

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

Creating a new numpy array with np.array([[True] * min_frames_on]).T for each call is inefficient. Consider creating the structure array once outside the conditional or reusing it across calls.

Suggested change
discrete_diarization.data = binary_closing(
discrete_diarization.data, structure=np.array([[True] * min_frames_on]).T
)
structure = np.array([[True] * min_frames_on]).T
discrete_diarization.data = binary_closing(
discrete_diarization.data, structure=structure
)

Copilot uses AI. Check for mistakes.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@stale

stale Bot commented Feb 21, 2026

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the wontfix label Feb 21, 2026
@stale stale Bot closed this Mar 26, 2026
@hbredin hbredin reopened this Mar 26, 2026
@stale stale Bot removed the wontfix label Mar 26, 2026
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.

3 participants