CAMPlusPlus<T>

Models & Types · AiDotNet.Audio.Speaker

CAM++ (Context-Aware Masking Plus Plus) speaker verification model (Wang et al., 2023).

Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → SpeakerRecognitionBase<T> → CAMPlusPlus<T>

Implements: ISpeakerEmbeddingExtractor<T>, ISpeakerVerifier<T>

For Beginners

CAM++ is like a smart listener who can automatically tune out background noise and silence, focusing only on the parts of audio where someone is actually speaking. It creates a unique “voiceprint” from just the speech portions, making it both fast and accurate for identifying people by their voice.

Usage:

How It Works

CAM++ is a fast speaker verification model using context-aware masking with a densely connected TDNN (D-TDNN). It learns to mask uninformative frames (silence, noise) and focus on speech-rich segments. Achieves competitive EER while being significantly faster than Transformer-based approaches.

Constructors

Constructor Summary
CAMPlusPlus(NeuralNetworkArchitecture<T> architecture, CAMPlusPlusOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
CAMPlusPlus(NeuralNetworkArchitecture<T> architecture, string modelPath, CAMPlusPlusOptions options)

Properties

Property Summary
ISpeakerEmbeddingExtractor<T> EmbeddingExtractor { get; }
T DefaultThreshold { get; }
bool IsOnnxMode { get; }
double MinimumDurationSeconds { get; }
double VerificationThreshold { get; }

Methods

Method Summary
IReadOnlyList<Tensor<T>> ExtractEmbeddings(IReadOnlyList<Tensor<T>> audioSegments)
ModelMetadata<T> GetModelMetadata()
SpeakerProfile<T> Enroll(IReadOnlyList<Tensor<T>> enrollmentAudio)
SpeakerProfile<T> Enroll(Tensor<T> enrollmentAudio)
SpeakerProfile<T> UpdateProfile(SpeakerProfile<T> existingProfile, Tensor<T> newAudio)
SpeakerVerificationResult<T> Verify(Tensor<T> audio, Tensor<T> referenceEmbedding)
SpeakerVerificationResult<T> Verify(Tensor<T> audio, Tensor<T> referenceEmbedding, T threshold)
SpeakerVerificationResult<T> VerifyWithReferenceAudio(Tensor<T> audio, Tensor<T> referenceAudio)
T ComputeScore(Tensor<T> audio, Tensor<T> referenceEmbedding)
T ComputeSimilarity(Tensor<T> embedding1, Tensor<T> embedding2)
T GetThresholdForFAR(double targetFAR)
Task<SpeakerVerificationResult<T>> VerifyAsync(Tensor<T> audio, Tensor<T> referenceEmbedding, CancellationToken cancellationToken)
Task<Tensor<T>> ExtractEmbeddingAsync(Tensor<T> audio, CancellationToken cancellationToken)
Tensor<T> ExtractEmbedding(Tensor<T> audio)
Tensor<T> ForwardForTraining(Tensor<T> input)
void SetTrainingMode(bool isTraining)