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).
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<Vec<Vec<String>>>
pub fn predict_table_rows( &mut self, page_image: &RgbImage, region: [f32; 4], words: &[TextCell], ) -> Option<Vec<Vec<String>>>
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.
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