Classifier

Struct Classifier 

Source
pub struct Classifier { /* private fields */ }
Expand description

Thread-safe classifier for bird species detection

Use Classifier::builder() to construct.

Implementations§

Source§

impl Classifier

Source

pub const fn builder() -> ClassifierBuilder

Create a new classifier builder

Source

pub fn config(&self) -> &ModelConfig

Get the model configuration

Source

pub fn labels(&self) -> &[String]

Get the species labels

Source

pub fn requested_provider(&self) -> ExecutionProviderInfo

Returns the execution provider that was requested for this classifier.

Note: This returns the provider that was requested during build, not necessarily the provider that is actually active. If the requested provider is unavailable, ONNX Runtime will silently fall back to CPU.

This value is only set by the typed with_<provider>() builder methods (e.g., with_cuda(), with_tensorrt()). The generic execution_provider() method does not affect the value returned here.

To verify the actual provider being used, enable ONNX Runtime verbose logging via environment variable: ORT_LOG_LEVEL=Verbose

Source

pub fn predict(&self, segment: &[f32]) -> Result<PredictionResult>

Run inference on a single audio segment

§Arguments
  • segment - Audio samples (must match config().sample_count)
§Returns
  • PredictionResult with top predictions, embeddings (if available), and raw scores
§Errors

Returns an error if:

  • Input segment size doesn’t match expected sample count
  • Session lock is poisoned
  • ONNX inference fails
Source

pub fn predict_batch( &self, segments: &[&[f32]], ) -> Result<Vec<PredictionResult>>

Run inference on multiple audio segments (more efficient for GPU)

§Arguments
  • segments - Slice of audio segments (all must match config().sample_count)
§Returns
  • Vector of PredictionResult, one per input segment
§Errors

Returns an error if:

  • Any segment size doesn’t match expected sample count
  • Session lock is poisoned
  • ONNX inference fails

Trait Implementations§

Source§

impl Clone for Classifier

Source§

fn clone(&self) -> Classifier

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Classifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more