feat: add CAM++ speaker diarization with sentence-level speaker labels#26
Open
yanhuicsdn wants to merge 2 commits into
Open
feat: add CAM++ speaker diarization with sentence-level speaker labels#26yanhuicsdn wants to merge 2 commits into
yanhuicsdn wants to merge 2 commits into
Conversation
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.
Summary
Adds a speaker diarization module that uses FunASR CAM++ (
iic/speech_campplus_sv_zh-cn_16k-common) to assign speaker labels to transcribed segments. Works at the sentence level by splitting VAD segments into small sliding windows (3s / 1.5s shift) before clustering.Changes
New:
core/diarization.pySpeakerDiarizerclass with two-phase embedding extraction:ClusterBackendmerge_thr,window_s,shift_sModified:
core/auto_model.pyAutoModel.transcribe_with_diarization()method that returns:"text": full concatenated transcript with[讲话人N]markers"segments": list of per-segment dicts withstart_s,end_s,text,speaker"num_speakers": number of distinct speakers foundSpeakerDiarizerinstance; failures caught gracefullyUsage
Dependencies (optional)
funasr(for CAM++ model)soundfile(for audio I/O)Performance
On a 7-minute podcast (8 VAD segments → 108 sub-windows):
The overhead is proportional to the number of sub-windows, not audio duration.