Skip to main content

ModelDetector

Trait ModelDetector 

Source
pub trait ModelDetector {
    // Required methods
    fn detect_tensor(
        &self,
        input: &Tensor,
    ) -> Result<Vec<Detection>, DetectError>;
    fn class_labels(&self) -> &[&str];
    fn input_shape(&self) -> [usize; 3];
}
Expand description

Abstract interface for model-backed object detectors.

Implementors provide detect_tensor which takes a preprocessed input tensor and returns detections. The framework handles NMS and thresholding via the config.

Required Methods§

Source

fn detect_tensor(&self, input: &Tensor) -> Result<Vec<Detection>, DetectError>

Run detection on a preprocessed input tensor.

The tensor format depends on the model. Typical NHWC shape: [1, H, W, C] where H and W match the config dimensions.

Returns raw detections (before NMS). The caller may apply non_max_suppression from this crate.

Source

fn class_labels(&self) -> &[&str]

Returns the class labels this detector can produce.

Source

fn input_shape(&self) -> [usize; 3]

Returns the expected input shape [H, W, C].

Implementors§