Skip to main content

Module processors

Module processors 

Source

Modules§

db_postprocess
Post-processing for DB (Differentiable Binarization) text detection models.
formula_preprocess
Formula preprocessing utilities for formula recognition models.
layout_postprocess
Layout Detection Post-processing
layout_sorting
Enhanced layout sorting logic — xycut_enhanced algorithm.
layout_utils
Layout parsing utilities.
resize_detection
Image resizing utilities for OCR preprocessing
resize_recognition
OCR-specific image resizing functionality.
simd
SIMD-accelerated kernels for the pipeline’s two hot CPU loops: per-pixel image normalization and per-timestep CTC argmax decode. (Conv/matmul work lives in ONNX Runtime.)
table_ocr_split
Table OCR box splitting utilities.
table_structure_decode
Table Structure Decoding Processor
types
Types used in image processing operations
unimernet_preprocess
UniMERNet-specific preprocessing functions
uvdoc_postprocess
Document transformation post-processing functionality.

Structs§

AspectRatioBucket
Aspect ratio bucket definition
AspectRatioBucketing
Aspect ratio bucketing processor
AspectRatioBucketingConfig
Configuration for aspect ratio bucketing
BaseRecLabelDecode
A base decoder for text recognition that handles character mapping and basic decoding operations.
BoundingBox
A bounding box represented by a collection of points.
CTCLabelDecode
A decoder for CTC (Connectionist Temporal Classification) based text recognition models.
CellGridInfo
Grid position and span information for a table cell.
Crop
A processor for cropping images with different positioning modes.
CrossCellDetection
Detection result for a cross-cell OCR box.
DBPostProcess
Post-processor for DB (Differentiable Binarization) text detection models.
DBPostProcessConfig
Runtime configuration for DB post-processing.
DetResizeForTest
A struct for resizing images for OCR testing
FormulaPreprocessParams
Configuration parameters for formula preprocessing pipeline.
FormulaPreprocessor
Formula recognition preprocessor: margin crop → resize-and-pad → normalize-and-grayscale → 4D tensor formatting.
ImageScaleInfo
Information about image scaling during preprocessing
LayoutBox
Layout box with bounding box and label for sorting/processing purposes.
LayoutOCRAssociation
Result of associating OCR boxes with layout regions.
LayoutPostProcess
Layout detection post-processor for models like PicoDet and RT-DETR.
MinAreaRect
A rectangle with minimum area that encloses a shape.
NormalizeImage
Normalizes images for OCR processing.
OCRResize
OCR-specific image resizer.
OverlapRemovalResult
Result of overlap removal.
Point
A 2D point with floating-point coordinates.
SortableRegion
Represents a sortable region for hierarchical sorting.
SplitConfig
Configuration for OCR box splitting.
SplitOcrResult
Result of splitting a single OCR box.
SplitSegment
A segment resulting from splitting an OCR box.
TableStructureDecode
Table structure decoder that converts model outputs to HTML tokens and bboxes.
TableStructureDecodeOutput
Output from table structure decoding.
Topk
A processor for extracting top-k results from classification outputs.
TopkResult
Result structure for top-k classification processing.
UVDocPostProcess
Post-processor for document transformation results.
UniMERNetPreprocessParams
Parameters for UniMERNet preprocessing
UniMERNetPreprocessor
UniMERNet preprocessor that matches Python’s UniMERNetImgDecode logic

Enums§

BoxType
Specifies the type of bounding box used for text detection
ColorOrder
Specifies whether the model expects RGB or BGR channel ordering.
CropMode
Specifies how to crop an image when the aspect ratios don’t match
LimitType
Specifies how to limit the size of an image during resizing operations
ResizeType
Specifies different strategies for resizing images
ScoreMode
Specifies the mode for calculating scores in text detection/recognition
SortDirection
Direction for XY-cut sorting.
TensorLayout
Specifies the data layout of an image tensor

Functions§

apply_nms_with_merge
Apply Non-Maximum Suppression with per-class merge modes.
assign_elements_to_regions
Assigns elements to regions based on overlap threshold.
associate_ocr_with_layout
Associate OCR results with layout regions.
calculate_iou
Calculates the IoU (Intersection over Union) between two bounding boxes.
calculate_overlap_ratio
Calculates the overlap ratio of box a covered by box b. Returns intersection_area / area_a
create_expanded_ocr_for_table
Creates expanded OCR results after splitting cross-cell boxes.
detect_cross_cell_ocr_boxes
Detects OCR boxes that span multiple table cells.
get_overlap_boxes_idx
Get indices of OCR boxes that overlap with layout regions.
get_overlap_removal_indices
Removes overlapping layout blocks, returning only indices to remove.
merge_boxes
Merge two bounding boxes according to the specified mode.
normalize_latex
Normalizes decoded LaTeX text to match standard output format.
parse_cell_grid_info
Parses structure tokens to extract grid position and span info for each cell.
reconcile_table_cells
Reconciles structure recognition cells with detected cells.
remove_overlap_blocks
Removes overlapping layout blocks based on overlap ratio threshold.
reprocess_table_cells_with_ocr
Reprocesses detected table cell boxes using OCR boxes to better match the structure model’s expected cell count.
sort_boxes_xycut
Sort bounding boxes using XY-cut and return sorted boxes (convenience wrapper).
sort_by_xycut
Sort bounding boxes using the XY-cut algorithm.
sort_elements_with_regions
Sorts elements within each region using XY-cut, then orders regions.
sort_layout_boxes
Sort layout boxes in reading order with column detection.
sort_poly_boxes
Sort polygon boxes (N-point bounding boxes) in reading order.
sort_quad_boxes
Sort quad boxes (4-point bounding boxes) in reading order.
sort_regions
Sorts regions in reading order (top-to-bottom, left-to-right).
sort_with_region_hierarchy
Convenience function that combines region detection output with layout elements to produce a hierarchically sorted reading order.
split_ocr_box_at_cell_boundaries
Splits an OCR box at cell boundaries and distributes text proportionally.
split_text_by_ratio
Splits text into parts based on given ratios.
unclip_boxes
Apply unclip ratio to expand/shrink bounding boxes while keeping center fixed.
wrap_table_html
Wraps table structure tokens with HTML document tags.
wrap_table_html_with_content
Wraps table structure tokens into an HTML string with cell content filled in.

Type Aliases§

PositionedDecodeResult
Decoded batch outputs along with positional metadata.