DocGCN<T>

Models & Types · AiDotNet.Document.GraphBased

DocGCN (Document Graph Convolutional Network) for document understanding using graph neural networks.

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

Implements: ILayoutDetector<T>

For Beginners

DocGCN views documents as networks:

  1. Each text block becomes a node in a graph
  2. Nearby blocks are connected by edges
  3. Graph convolutions learn relationships
  4. Can classify, extract, or understand document structure

Key features:

  • Graph-based document representation
  • Spatial relationship modeling
  • Multi-hop reasoning through graph layers
  • Entity and relation extraction

Example usage:

How It Works

DocGCN represents documents as graphs where nodes are text blocks and edges represent spatial and semantic relationships. Graph convolutional layers propagate information to understand document structure.

Reference: Based on graph neural network approaches for document understanding.

Constructors

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

Properties

Property Summary
DocumentType SupportedDocumentTypes { get; }
IReadOnlyList<LayoutElementType> SupportedElementTypes { get; }
bool RequiresOCR { get; }
int ExpectedImageSize { get; }
int MaxNodes { get; } Gets the maximum number of nodes.
int NodeDim { get; } Gets the node feature dimension.
int NumGCNLayers { get; } Gets the number of GCN layers.

Methods

Method Summary
DocumentLayoutResult<T> DetectLayout(Tensor<T> documentImage)
DocumentLayoutResult<T> DetectLayout(Tensor<T> documentImage, double confidenceThreshold)
ModelMetadata<T> GetModelMetadata()
Tensor<T> EncodeDocument(Tensor<T> documentImage)
Tensor<T> ForwardForTraining(Tensor<T> input)
Tensor<T> PredictMultimodal(Tensor<T>[] modalityNodeFeatures) Modality-robust HETEROGENEOUS-graph inference (Luo et al.
string GetModelSummary()
void ValidateInputShape(Tensor<T> documentImage)