pub struct TableFormer { /* private fields */ }Implementations§
Source§impl TableFormer
impl TableFormer
Sourcepub fn load() -> Option<Self>
pub fn load() -> Option<Self>
Load the exported encoder/decoder/bbox ONNX graphs (env overrides, else
.models/tableformer/{encoder,decoder,bbox}.onnx). Returns None if any is
absent, so the pipeline falls back to geometric reconstruction.
Sourcepub fn load_with(intra: usize) -> Option<Self>
pub fn load_with(intra: usize) -> Option<Self>
Like load but with an explicit intra-op thread count, so a
parallel page-worker pool can run each table model on fewer threads (the
throughput comes from running pages concurrently, not from one fat model).
See resolved_paths for the encoder/decoder/bbox file selection.
Sourcepub fn predict_otsl(&mut self, img: &RgbImage) -> Result<Vec<i64>, String>
pub fn predict_otsl(&mut self, img: &RgbImage) -> Result<Vec<i64>, String>
Predict the OTSL structure-token sequence for a table-region image.
Sourcepub fn predict_table_structure(
&mut self,
img: &RgbImage,
) -> Result<Vec<TableCell>, String>
pub fn predict_table_structure( &mut self, img: &RgbImage, ) -> Result<Vec<TableCell>, String>
Full structure prediction: OTSL grid cells with per-cell boxes (in the 448 image, normalized cxcywh). Collects per-cell decoder hidden states using docling’s exact bbox bookkeeping (skip-after-row-break, first-lcel of a horizontal span), runs the bbox decoder, merges span boxes, then lays the cells onto the OTSL grid with row/col spans.
Sourcepub fn predict_table_rows(
&mut self,
page_image: &RgbImage,
region: [f32; 4],
words: &[TextCell],
) -> Option<TableGrid>
pub fn predict_table_rows( &mut self, page_image: &RgbImage, region: [f32; 4], words: &[TextCell], ) -> Option<TableGrid>
Predict a table region’s Markdown grid: crop the region (docling’s
page→1024px box-average then bbox crop), run the structure model, then
match the page’s word cells into the predicted cells with docling’s
matching post-processor (crate::tf_match) and expand spans into a
dense rows × cols grid. region is (l, t, r, b) in page points
(top-left). Returns None if no structure is predicted.
Sourcepub fn page_1024(page_image: &RgbImage) -> RgbImage
pub fn page_1024(page_image: &RgbImage) -> RgbImage
The page rendered at 1024 px height (cv2.INTER_AREA), the frame every table crop of that page is cut from. Computed once per page by the pipeline and shared across its tables — the resample is a full-page f64 box filter, 110–170 ms on the corpus pages, and it used to run again for every table on the page.
Sourcepub fn predict_table_rows_on(
&mut self,
page_h: u32,
page1024: &RgbImage,
region: [f32; 4],
words: &[TextCell],
) -> Option<TableGrid>
pub fn predict_table_rows_on( &mut self, page_h: u32, page1024: &RgbImage, region: [f32; 4], words: &[TextCell], ) -> Option<TableGrid>
predict_table_rows with the page’s
1024-px frame already built (page_1024);
page_h is the source page image’s pixel height.
Sourcepub fn predict_tables_on(
&mut self,
page_h: u32,
page1024: &RgbImage,
regions: &[[f32; 4]],
words: &[TextCell],
) -> Vec<Option<TableGrid>>
pub fn predict_tables_on( &mut self, page_h: u32, page1024: &RgbImage, regions: &[[f32; 4]], words: &[TextCell], ) -> Vec<Option<TableGrid>>
Every table of a page at once: predict_table_rows_on
per region, except that with the dynamic-batch decoder the tables’
decode steps are shared — each table is encoded on its own, then one
decode loop steps all of them together (Self::decode_batch), then
each runs its own bbox head. Per table the result is bit-identical to
the one-at-a-time path; a page with a single table takes exactly that
path. Should the batched run fail (an ort error), the tables are
retried one by one so a page never loses all of its tables to one
shared step.
Auto Trait Implementations§
impl !RefUnwindSafe for TableFormer
impl !UnwindSafe for TableFormer
impl Freeze for TableFormer
impl Send for TableFormer
impl Sync for TableFormer
impl Unpin for TableFormer
impl UnsafeUnpin for TableFormer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more