Table of Contents

Interface IPageSegmenter<T>

Namespace
AiDotNet.Document.Interfaces
Assembly
AiDotNet.dll

Interface for page segmentation models that identify different regions in document pages.

public interface IPageSegmenter<T> : IDocumentModel<T>, IFullModel<T, Tensor<T>, Tensor<T>>, IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>, IModelSerializer, ICheckpointableModel, IParameterizable<T, Tensor<T>, Tensor<T>>, IFeatureAware, IFeatureImportance<T>, ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>, IGradientComputable<T, Tensor<T>, Tensor<T>>, IJitCompilable<T>

Type Parameters

T

The numeric type used for calculations.

Inherited Members
Extension Methods

Remarks

Page segmentation models divide a document page into semantic regions like text blocks, figures, tables, headers, footers, and captions.

For Beginners: When you look at a document page, you can easily identify different sections - titles, paragraphs, images, tables. Page segmentation teaches computers to do the same thing, labeling each region with its type.

Example usage:

var segmenter = new DocBank<float>(architecture);
var result = segmenter.SegmentPage(documentImage);
foreach (var region in result.Regions)
{
    Console.WriteLine($"Found {region.RegionType} at {region.BoundingBox}");
}

Properties

SupportedRegionTypes

Gets the region types this segmenter can detect.

IReadOnlyList<DocumentRegionType> SupportedRegionTypes { get; }

Property Value

IReadOnlyList<DocumentRegionType>

SupportsInstanceSegmentation

Gets whether this segmenter performs instance segmentation (separate instances of same type).

bool SupportsInstanceSegmentation { get; }

Property Value

bool

Methods

GetSegmentationMask(Tensor<T>)

Gets the pixel-level segmentation mask.

Tensor<T> GetSegmentationMask(Tensor<T> documentImage)

Parameters

documentImage Tensor<T>

The document page image tensor.

Returns

Tensor<T>

Segmentation mask with class indices for each pixel.

SegmentPage(Tensor<T>)

Segments a document page into semantic regions.

PageSegmentationResult<T> SegmentPage(Tensor<T> documentImage)

Parameters

documentImage Tensor<T>

The document page image tensor.

Returns

PageSegmentationResult<T>

Segmentation result with labeled regions.

SegmentPage(Tensor<T>, double)

Segments a document page with a custom confidence threshold.

PageSegmentationResult<T> SegmentPage(Tensor<T> documentImage, double confidenceThreshold)

Parameters

documentImage Tensor<T>

The document page image tensor.

confidenceThreshold double

Minimum confidence for region detection (0-1).

Returns

PageSegmentationResult<T>

Segmentation result with labeled regions.