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§
Sourcetype InferenceOutput: Send + Sync + Debug
type InferenceOutput: Send + Sync + Debug
Input type from inference engine
Sourcetype PreprocessOutput: Send + Sync + Debug
type PreprocessOutput: Send + Sync + Debug
Preprocessed data type for context
Required Methods§
Sourcefn 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 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 enginepreprocess_output- Optional preprocessed data for contextbatch_data- Batch metadataraw_images- Original input imagesconfig- Optional configuration for postprocessing
§Returns
Final processed result or an error
Provided Methods§
Sourcefn postprocessing_info(&self) -> String
fn postprocessing_info(&self) -> String
Get information about the postprocessing operations.
§Returns
String describing postprocessing operations