UNPKG

@jaehyun-ko/speaker-verification

Version:

Real-time speaker verification in the browser using NeXt-TDNN models

51 lines 1.4 kB
/** * Score Normalization (S-norm) implementation * Based on the paper: adaptive s-norm with cohort selection */ export interface SNormConfig { cohortSize: number; topK: number; } export declare class ScoreNormalizer { private cohortEmbeddings; private config; constructor(config?: Partial<SNormConfig>); /** * Add cohort embeddings for score normalization */ addCohortEmbeddings(embeddings: Float32Array[]): void; /** * Load cohort embeddings from a file */ loadCohortEmbeddings(url: string): Promise<void>; /** * Compute cosine similarity between two embeddings */ private computeSimilarity; /** * Apply S-normalization to a raw score * * @param enrollEmbedding - Enrollment speaker embedding * @param testEmbedding - Test speaker embedding * @param rawScore - Raw cosine similarity score * @returns Normalized score */ normalize(enrollEmbedding: Float32Array, testEmbedding: Float32Array, rawScore: number): number; /** * Compute mean of an array */ private computeMean; /** * Compute standard deviation of an array */ private computeStd; /** * Get statistics about the cohort */ getCohortStats(): { size: number; topK: number; loaded: boolean; }; } //# sourceMappingURL=score-normalization.d.ts.map