PSENet<T>

Models & Types · AiDotNet.Document.OCR.TextDetection

PSENet (Progressive Scale Expansion Network) for text detection.

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

Implements: ITextDetector<T>

For Beginners

PSENet handles difficult text detection scenarios:

  1. Detects text at multiple scales (kernels)
  2. Progressively expands from smallest to largest
  3. Separates closely spaced text instances
  4. Handles arbitrary-shaped text

Key features:

  • Multi-scale kernel prediction
  • Progressive scale expansion algorithm
  • Handles closely adjacent text
  • Accurate boundary detection

Example usage:

How It Works

PSENet uses a novel progressive scale expansion algorithm to accurately detect text instances of various shapes and sizes, especially useful for closely spaced text.

Reference: “Shape Robust Text Detection with Progressive Scale Expansion Network” (CVPR 2019) https://arxiv.org/abs/1903.12473

Constructors

Constructor Summary
PSENet() Creates a PSENet model with default configuration for native training.
PSENet(NeuralNetworkArchitecture<T> architecture, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, PSENetOptions options) Creates a PSENet model using native layers for training and inference.
PSENet(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, PSENetOptions options) Creates a PSENet 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 NumKernels { get; } Gets the number of scale kernels.

Methods

Method Summary
IEnumerable<TextDetectionResult<T>> DetectTextBatch(IEnumerable<Tensor<T>> documentImages)
ModelMetadata<T> GetModelMetadata()
Tensor<T> EncodeDocument(Tensor<T> documentImage)
Tensor<T> ForwardForTraining(Tensor<T> input) Trains on the SAME preprocessed tensor PredictCore evaluates, rather than on the raw input.
Tensor<T> GetHeatmap()
Tensor<T> GetProbabilityMap(Tensor<T> image)
TextDetectionResult<T> DetectText(Tensor<T> documentImage)
TextDetectionResult<T> DetectText(Tensor<T> documentImage, double confidenceThreshold)
string GetModelSummary()
void ValidateInputShape(Tensor<T> documentImage)