pub struct TableStructureDecode { /* private fields */ }Expand description
Table structure decoder that converts model outputs to HTML tokens and bboxes.
Implementations§
Source§impl TableStructureDecode
impl TableStructureDecode
Sourcepub fn from_dict_path(
dict_path: &Path,
) -> Result<TableStructureDecode, OCRError>
pub fn from_dict_path( dict_path: &Path, ) -> Result<TableStructureDecode, OCRError>
Creates a new table structure decoder from a dictionary file.
§Alignment
This follows TableLabelDecode.add_special_char() logic exactly:
- “sos” token is prepended at index 0
- “eos” token is appended at the end
- The dict order is: [“sos”, <original_dict…>, “eos”]
Sourcepub fn decode(
&self,
structure_logits: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 3]>>,
bbox_preds: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 3]>>,
shape_info: &[[f32; 6]],
) -> Result<TableStructureDecodeOutput, OCRError>
pub fn decode( &self, structure_logits: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 3]>>, bbox_preds: &ArrayBase<OwnedRepr<f32>, Dim<[usize; 3]>>, shape_info: &[[f32; 6]], ) -> Result<TableStructureDecodeOutput, OCRError>
Decodes structure logits and bbox predictions.
§Arguments
structure_logits- [batch, seq_len, vocab_size] structure predictionsbbox_preds- [batch, seq_len, 8] bbox predictions (normalized coordinates)shape_info- [(orig_h, orig_w, scale, pad_h, pad_w, target_size), …] for each image.scaleis the ResizeByLong factor used during preprocessing:target_size / max(orig_h, orig_w).
§Returns
Decoded structure tokens, bounding boxes, and confidence scores
Trait Implementations§
Source§impl Clone for TableStructureDecode
impl Clone for TableStructureDecode
Source§fn clone(&self) -> TableStructureDecode
fn clone(&self) -> TableStructureDecode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TableStructureDecode
impl RefUnwindSafe for TableStructureDecode
impl Send for TableStructureDecode
impl Sync for TableStructureDecode
impl Unpin for TableStructureDecode
impl UnwindSafe for TableStructureDecode
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.