TRIE<T>

Models & Types · AiDotNet.Document.GraphBased

TRIE (Text Reading and Information Extraction) for end-to-end document understanding.

Inheritance: NeuralNetworkBase<T> → DocumentNeuralNetworkBase<T> → TRIE<T>

Implements: IFormUnderstanding<T>, ITextDetector<T>

For Beginners

TRIE does reading and extraction together:

  1. Reads text from document images
  2. Builds a graph of text entities
  3. Extracts key-value pairs and entities
  4. Outputs structured information

Key features:

  • End-to-end text reading + extraction
  • Graph-based entity relationship modeling
  • Joint optimization of OCR and IE
  • Strong performance on receipts and forms

Example usage:

How It Works

TRIE combines text reading (OCR) with information extraction in an end-to-end framework, using graph neural networks to model relationships between text entities and extract structured information.

Reference: “TRIE: End-to-End Text Reading and Information Extraction” (ACM MM 2020) https://arxiv.org/abs/2005.13118

Constructors

Constructor Summary
TRIE() Creates a TRIE model with default configuration for native training.
TRIE(NeuralNetworkArchitecture<T> architecture, TRIEOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) Creates a TRIE model using native layers for training and inference.
TRIE(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, TRIEOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) Creates a TRIE model using a pre-trained ONNX model for inference.

Properties

Property Summary
DocumentType SupportedDocumentTypes { get; }
bool RequiresOCR { get; }
bool SupportsPolygonOutput { get; }
bool SupportsRotatedText { get; }
int ExpectedImageSize { get; }
int MinTextHeight { get; }
int NumEntityTypes { get; } Gets the number of entity types.

Methods

Method Summary
Dictionary<string, Tensor<T>> GetNamedLayerActivations(Tensor<T> input)
Dictionary<string, string> ExtractKeyValuePairs(Tensor<T> documentImage)
FormFieldResult<T> ExtractFormFields(Tensor<T> documentImage)
FormFieldResult<T> ExtractFormFields(Tensor<T> documentImage, double confidenceThreshold)
IEnumerable<CheckboxResult<T>> DetectCheckboxes(Tensor<T> documentImage)
IEnumerable<SignatureResult<T>> DetectSignatures(Tensor<T> documentImage)
IEnumerable<TextDetectionResult<T>> DetectTextBatch(IEnumerable<Tensor<T>> documentImages)
ModelMetadata<T> GetModelMetadata()
Tensor<T> EncodeDocument(Tensor<T> documentImage)
Tensor<T> ForwardForTraining(Tensor<T> input)
Tensor<T> GetHeatmap()
Tensor<T> GetProbabilityMap(Tensor<T> image)
Tensor<T> PredictMultimodal(Tensor<T> textTokens, Tensor<T> documentImage) Modality-robust fused inference: reasons jointly over BOTH a document image and its text tokens by concatenating their encoded node sets and running the shared graph stack.
TextDetectionResult<T> DetectText(Tensor<T> documentImage)
TextDetectionResult<T> DetectText(Tensor<T> documentImage, double confidenceThreshold)
string GetModelSummary()
void ValidateInputShape(Tensor<T> documentImage)