ISpeakerVerifier<T>

Interfaces · AiDotNet.Interfaces

Interface for speaker verification models that determine if audio matches a claimed identity.

Implements: IFeatureAware, IFullModel<T, Tensor<T>, Tensor<T>>, IGradientComputable<T, Tensor<T>, Tensor<T>>

Known implementations: CAMPlusPlus<T>, ECAPATDNNSpeaker<T>, SpeakerLM<T>, SpeakerVerifier<T>, TitaNet<T>, WavLMSpeaker<T>

For Beginners

Speaker verification is like a voice-based password check.

How it works:

  1. User enrolls by providing voice samples
  2. System creates a voiceprint (speaker embedding) for that user
  3. Later, user provides a new voice sample
  4. System compares new sample to stored voiceprint
  5. Decision: Accept (same person) or Reject (different person)

Common use cases:

  • Voice banking authentication
  • Phone-based customer verification
  • Smart speaker personalization
  • Access control systems

Key metrics:

  • False Accept Rate (FAR): How often imposters are wrongly accepted
  • False Reject Rate (FRR): How often legitimate users are wrongly rejected
  • Equal Error Rate (EER): When FAR = FRR (lower is better)

How It Works

Speaker verification (also called speaker authentication) determines whether a speech sample matches a claimed identity. It answers the question “Is this person who they claim to be?” This is a 1-to-1 comparison task.

This interface extends IFullModel for Tensor-based audio processing.

Properties

Property Summary
ISpeakerEmbeddingExtractor<T> EmbeddingExtractor { get; } Gets the underlying speaker embedding extractor.
T DefaultThreshold { get; } Gets the default decision threshold for verification.
bool IsOnnxMode { get; } Gets whether this model is running in ONNX inference mode.
int SampleRate { get; } Gets the expected sample rate for input audio.

Methods

Method Summary
SpeakerProfile<T> Enroll(IReadOnlyList<Tensor<T>> enrollmentAudio) Enrolls a speaker by creating a reference embedding from a single audio sample.
SpeakerProfile<T> Enroll(Tensor<T> enrollmentAudio) Enrolls a speaker by creating a reference embedding from a single audio sample.
SpeakerProfile<T> UpdateProfile(SpeakerProfile<T> existingProfile, Tensor<T> newAudio) Updates an existing speaker profile with additional audio.
SpeakerVerificationResult<T> Verify(Tensor<T> audio, Tensor<T> referenceEmbedding) Verifies if audio matches a reference speaker embedding.
SpeakerVerificationResult<T> Verify(Tensor<T> audio, Tensor<T> referenceEmbedding, T threshold) Verifies if audio matches a reference speaker embedding with custom threshold.
SpeakerVerificationResult<T> VerifyWithReferenceAudio(Tensor<T> audio, Tensor<T> referenceAudio) Verifies if audio matches reference audio of a claimed speaker.
T ComputeScore(Tensor<T> audio, Tensor<T> referenceEmbedding) Computes the verification score between audio and a reference.
T GetThresholdForFAR(double targetFAR) Gets the recommended threshold for a target false accept rate.
Task<SpeakerVerificationResult<T>> VerifyAsync(Tensor<T> audio, Tensor<T> referenceEmbedding, CancellationToken cancellationToken) Verifies if audio matches a reference speaker embedding asynchronously.