pub struct CamPlusPlusExtractor { /* private fields */ }Expand description
CAM++ embedder (Channel-Attentive Multi-scale Pooling). Dim is supplied
explicitly because WeSpeaker ships several CAM++ variants:
voxceleb_CAM++.onnx is 512-d; smaller variants exist at 192-d.
Targets the Mobile profile of v1.0; M5 may swap to INT8 + smaller dim.
Uses the same 80-bin log-mel fbank pipeline as ResNet34.
Implementations§
Source§impl CamPlusPlusExtractor
impl CamPlusPlusExtractor
Sourcepub fn new(
path: impl AsRef<Path>,
dim: usize,
pool_size: usize,
) -> Result<Self, EmbedderError>
pub fn new( path: impl AsRef<Path>, dim: usize, pool_size: usize, ) -> Result<Self, EmbedderError>
{ true }
pub fn new( path: impl AsRef<Path>, dim: usize, pool_size: usize, ) -> Result<Self, EmbedderError>
{ ret.as_ref().map_or(true, |e| e.dim() == dim) }
Load a CAM++ ONNX model. dim must match the model’s output
dimension (e.g. 192 or 512 depending on the variant). Pool size
controls the number of concurrent ONNX sessions held internally
(canonical: num_cpus().min(4)).
Trait Implementations§
Source§impl Embedder for CamPlusPlusExtractor
impl Embedder for CamPlusPlusExtractor
Source§fn embed(&self, audio: &[f32]) -> Result<Vec<f32>, EmbedderError>
fn embed(&self, audio: &[f32]) -> Result<Vec<f32>, EmbedderError>
Compute an embedding for one audio segment. Read more
Source§fn embed_batch(&self, audios: &[&[f32]]) -> Result<Vec<Vec<f32>>, EmbedderError>
fn embed_batch(&self, audios: &[&[f32]]) -> Result<Vec<Vec<f32>>, EmbedderError>
Compute embeddings for a batch of audio segments. Default implementation
is sequential; impls may override with a true batched ONNX call.
Auto Trait Implementations§
impl !Freeze for CamPlusPlusExtractor
impl !RefUnwindSafe for CamPlusPlusExtractor
impl !UnwindSafe for CamPlusPlusExtractor
impl Send for CamPlusPlusExtractor
impl Sync for CamPlusPlusExtractor
impl Unpin for CamPlusPlusExtractor
impl UnsafeUnpin for CamPlusPlusExtractor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more