SpeakerVerifier<T>
Models & Types · AiDotNet.Audio.Speaker
Verifies speaker identity by comparing embeddings against enrolled speakers.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → SpeakerRecognitionBase<T> → SpeakerVerifier<T>
Implements: ISpeakerVerifier<T>
For Beginners
Speaker verification is like voice-based password checking:
- First, you “enroll” a speaker by recording their voice samples
- Later, when someone claims to be that person, you record them and compare
- If the voices match closely enough, the identity is verified
Usage (ONNX Mode):
Usage (Native Training Mode):
How It Works
Speaker verification answers the question “Is this the person they claim to be?” by comparing a test utterance against enrolled speaker embeddings.
Constructors
| Constructor | Summary |
|---|---|
SpeakerVerifier() |
Creates a SpeakerVerifier with default settings for native training mode. |
SpeakerVerifier(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, SpeakerVerifierOptions options) |
Creates a SpeakerVerifier for native training mode. |
SpeakerVerifier(NeuralNetworkArchitecture<T> architecture, string embeddingModelPath, SpeakerVerifierOptions options) |
Creates a SpeakerVerifier for ONNX inference with a pretrained model. |
Properties
| Property | Summary |
|---|---|
ISpeakerEmbeddingExtractor<T> EmbeddingExtractor { get; } |
Gets the underlying speaker embedding extractor. |
T DefaultThreshold { get; } |
Gets the default verification threshold. |
bool IsOnnxMode { get; } |
Gets whether the model is in ONNX inference mode. |
double VerificationThreshold { get; } |
Gets the verification threshold. |
int EnrolledCount { get; } |
Gets the number of enrolled speakers. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<string> GetEnrolledSpeakers() |
Gets all enrolled speaker IDs. |
IdentificationResult Identify(SpeakerEmbedding<T> testEmbedding) |
Identifies the most likely speaker from enrolled set (legacy API). |
ModelMetadata<T> GetModelMetadata() |
Gets metadata about the model. |
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 a test embedding matches an enrolled speaker (legacy API). |
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. |
Tensor<T> ForwardForTraining(Tensor<T> input) |
|
VerificationResult Verify(string speakerId, SpeakerEmbedding<T> testEmbedding) |
Verifies if a test embedding matches an enrolled speaker (legacy API). |
bool IsEnrolled(string speakerId) |
Checks if a speaker is enrolled. |
bool Unenroll(string speakerId) |
Removes a speaker’s enrollment. |
void Enroll(string speakerId, SpeakerEmbedding<T>[] embeddings) |
Enrolls a speaker with one or more embeddings (legacy API). |