Postprocessor

Trait Postprocessor 

Source
pub trait Postprocessor:
    Send
    + Sync
    + Debug {
    type Config: Send + Sync + Debug;
    type InferenceOutput: Send + Sync + Debug;
    type PreprocessOutput: Send + Sync + Debug;
    type Result: Send + Sync + Debug;

    // Required methods
    fn postprocess(
        &self,
        inference_output: Self::InferenceOutput,
        preprocess_output: Option<&Self::PreprocessOutput>,
        batch_data: &BatchData,
        raw_images: Vec<RgbImage>,
        config: Option<&Self::Config>,
    ) -> OcrResult<Self::Result>;
    fn empty_result(&self) -> Result<Self::Result, OCRError>;

    // Provided method
    fn postprocessing_info(&self) -> String { ... }
}
Expand description

Trait for postprocessing operations.

This trait handles converting raw inference outputs into meaningful results (decoding, filtering, formatting, etc.).

Required Associated Types§

Source

type Config: Send + Sync + Debug

Configuration type for postprocessing

Source

type InferenceOutput: Send + Sync + Debug

Input type from inference engine

Source

type PreprocessOutput: Send + Sync + Debug

Preprocessed data type for context

Source

type Result: Send + Sync + Debug

Final result type after postprocessing

Required Methods§

Source

fn postprocess( &self, inference_output: Self::InferenceOutput, preprocess_output: Option<&Self::PreprocessOutput>, batch_data: &BatchData, raw_images: Vec<RgbImage>, config: Option<&Self::Config>, ) -> OcrResult<Self::Result>

Postprocess inference output into final results.

§Arguments
  • inference_output - Raw output from inference engine
  • preprocess_output - Optional preprocessed data for context
  • batch_data - Batch metadata
  • raw_images - Original input images
  • config - Optional configuration for postprocessing
§Returns

Final processed result or an error

Source

fn empty_result(&self) -> Result<Self::Result, OCRError>

Create an empty result for when no input is provided.

§Returns

Empty result instance

Provided Methods§

Source

fn postprocessing_info(&self) -> String

Get information about the postprocessing operations.

§Returns

String describing postprocessing operations

Implementors§