Skip to content

Commit

Permalink
fix: peak-normalize separated sources
Browse files Browse the repository at this point in the history
  • Loading branch information
joonaskalda committed Jun 21, 2024
1 parent 2e04ec7 commit a766f2a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyannote/audio/pipelines/speech_separation.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,12 @@ def apply(
sources.data * discrete_diarization.align(sources).data[:, :num_sources]
)

# separated sources might be scaled up/down due to SI-SDR loss used when training
# so we peak-normalize them
sources.data = sources.data / np.max(
np.abs(sources.data), axis=0, keepdims=True
)

# convert to continuous diarization
diarization = self.to_annotation(
discrete_diarization,
Expand Down

0 comments on commit a766f2a

Please sign in to comment.