ABINet<T>

Models & Types · AiDotNet.Document.OCR.TextRecognition

ABINet (Autonomous, Bidirectional, Iterative Network) for text recognition.

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

Implements: ITextRecognizer<T>

For Beginners

ABINet has three key innovations:

  1. Autonomous vision model (works without external language model)
  2. Bidirectional language model (looks at context from both directions)
  3. Iterative correction (refines predictions multiple times)

Key features:

  • Self-contained (no external LM needed)
  • Built-in spell correction via language model
  • Iterative refinement for accuracy
  • Strong on noisy/occluded text

Example usage:

How It Works

ABINet uses a novel architecture with autonomous vision, bidirectional language modeling, and iterative correction to achieve robust text recognition.

Reference: “Read Like Humans: Autonomous, Bidirectional and Iterative Language Modeling” (CVPR 2021) https://arxiv.org/abs/2103.06495

Constructors

Constructor Summary
ABINet(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, ABINetOptions options) Initializes the model from an already-resolved options instance.
ABINet(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, ABINetOptions options) Creates an ABINet model using a pre-trained ONNX model for inference.

Properties

Property Summary
DocumentType SupportedDocumentTypes { get; }
TrainingObjectiveKind TrainingObjectiveKind { get; }
bool RequiresOCR { get; }
bool SupportsAttentionVisualization { get; }
int ExpectedImageSize { get; }
int ImageHeight { get; } Gets the input image height.
int MaxSequenceLength { get; }
int NumIterations { get; } Gets the number of iterative refinement steps.
string SupportedCharacters { get; }

Methods

Method Summary
Dictionary<string, Tensor<T>> GetNamedLayerActivations(Tensor<T> input)
IEnumerable<TextRecognitionResult<T>> RecognizeTextBatch(IEnumerable<Tensor<T>> croppedImages)
ModelMetadata<T> GetModelMetadata()
T EvaluateTrainingObjective(Tensor<T> input, Tensor<T> target)
Tensor<T> EncodeDocument(Tensor<T> documentImage)
Tensor<T> ForwardForTraining(Tensor<T> input) Emits all three branch predictions stacked along axis 0 so the multi-task objective can grade each of them.
Tensor<T> GetAttentionWeights()
Tensor<T> GetCharacterProbabilities()
Tensor<T> ResolveTrainingTarget(Tensor<T> input, Tensor<T> proposedTarget)
TextRecognitionResult<T> RecognizeText(Tensor<T> croppedImage)
string GetModelSummary()
void ValidateInputShape(Tensor<T> documentImage)