BasePredictor

Trait BasePredictor 

Source
pub trait BasePredictor {
    type Result;
    type Error;

    // Required methods
    fn process(
        &self,
        batch_data: BatchData,
    ) -> Result<Self::Result, Self::Error>;
    fn convert_to_prediction_result(
        &self,
        result: Self::Result,
    ) -> PredictionResult<'static>;
    fn batch_sampler(&self) -> &BatchSampler;
    fn model_name(&self) -> &str;
    fn predictor_type_name(&self) -> &str;
}
Expand description

Trait for base predictors in the OCR pipeline.

This trait defines the interface for base predictors that process batch data.

Required Associated Types§

Source

type Result

The result type of this predictor.

Source

type Error

The error type of this predictor.

Required Methods§

Source

fn process(&self, batch_data: BatchData) -> Result<Self::Result, Self::Error>

Processes the given batch data.

§Arguments
  • batch_data - The batch data to process.
§Returns

A Result containing the processing result or an error.

Source

fn convert_to_prediction_result( &self, result: Self::Result, ) -> PredictionResult<'static>

Converts the processing result to a prediction result.

§Arguments
  • result - The processing result to convert.
§Returns

The converted prediction result.

Source

fn batch_sampler(&self) -> &BatchSampler

Gets the batch sampler used by this predictor.

§Returns

A reference to the batch sampler.

Source

fn model_name(&self) -> &str

Gets the name of the model used by this predictor.

§Returns

The name of the model.

Source

fn predictor_type_name(&self) -> &str

Gets the type name of this predictor.

§Returns

The type name of the predictor.

Implementors§