TableTransformer<T>
Models & Types · AiDotNet.Document.Analysis.TableDetection
TableTransformer for table detection and structure recognition using DETR-style architecture.
Inheritance: NeuralNetworkBase<T> → DocumentNeuralNetworkBase<T> → TableTransformer<T>
Implements: ITableExtractor<T>
For Beginners
TableTransformer helps computers understand tables in documents. It can:
- Find where tables are located in a page (table detection)
- Identify the structure within tables - rows, columns, and cells (structure recognition)
- Handle both bordered and borderless tables
Example usage:
How It Works
TableTransformer is based on the DETR (DEtection TRansformer) architecture, adapted for table detection and table structure recognition. It can detect tables in documents and identify their internal structure (rows, columns, cells, headers).
Reference: “PubTables-1M: Towards Comprehensive Table Extraction from Unstructured Documents” (CVPR 2022)
https://arxiv.org/abs/2110.00061
Constructors
| Constructor | Summary |
|---|---|
TableTransformer(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, TableTransformerOptions options) |
Creates a TableTransformer model using native layers for training and inference. |
TableTransformer(NeuralNetworkArchitecture<T> architecture, string detectionModelPath, string structureModelPath, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, TableTransformerOptions options) |
Creates a TableTransformer model using pre-trained ONNX models for inference. |
Properties
| Property | Summary |
|---|---|
DocumentType SupportedDocumentTypes { get; } |
|
bool RequiresOCR { get; } |
|
bool SupportsBorderedTables { get; } |
|
bool SupportsBorderlessTables { get; } |
|
bool SupportsMergedCells { get; } |
|
int ExpectedImageSize { get; } |
|
int NumQueries { get; } |
Gets the number of object queries used in DETR decoder. |
Methods
| Method | Summary |
|---|---|
IEnumerable<List<List<string>>> ExtractTableContent(Tensor<T> documentImage) |
|
IEnumerable<TableRegion<T>> DetectTables(Tensor<T> documentImage) |
|
IEnumerable<TableRegion<T>> DetectTables(Tensor<T> documentImage, double confidenceThreshold) |
Detects tables with a custom confidence threshold. |
ModelMetadata<T> GetModelMetadata() |
|
TableStructureResult<T> RecognizeStructure(Tensor<T> tableImage) |
|
TableStructureResult<T> RecognizeStructure(Tensor<T> tableImage, double confidenceThreshold) |
Recognizes table structure with a custom confidence threshold. |
Tensor<T> EncodeDocument(Tensor<T> documentImage) |
|
string ExportTables(Tensor<T> documentImage, TableExportFormat format) |
|
string GetModelSummary() |
|
void ValidateInputShape(Tensor<T> documentImage) |