Skip to content

Commit

Permalink
bug fix: audio feature extract and index mistake when register new sp…
Browse files Browse the repository at this point in the history
…eaker
  • Loading branch information
lovemefan committed Dec 16, 2023
1 parent b9202eb commit 11738c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion paraformer/runtime/python/model/sv/campplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def extract_feature(self, audio: Union[str, Path, bytes], sample_rate=16000):
mat[i, :] = fbank_fn.get_frame(i)
feature = mat.astype(np.float32)

feature = feature - feature.mean()
feature = feature - feature.mean(0, keepdims=True)
feature = feature[None, ...]
return feature

Expand All @@ -109,5 +109,6 @@ def recognize(self, waveform: Union[str, Path, bytes], threshold=0.65):

if sim[max_sim_index] <= threshold:
self.register_speaker(emb)
max_sim_index = len(self.memory) - 1

return max_sim_index

0 comments on commit 11738c0

Please sign in to comment.