Table of Contents

Interface ILayoutDetector<T>

Namespace
AiDotNet.Document.Interfaces
Assembly
AiDotNet.dll

Interface for document layout detection models.

public interface ILayoutDetector<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

Layout detection identifies and localizes different structural elements in a document, such as text blocks, tables, figures, headers, and footers.

For Beginners: Think of layout detection as drawing boxes around different parts of a document and labeling what each part is (title, paragraph, table, etc.). This helps computers understand the structure of a document just like humans do.

Example usage:

var result = layoutDetector.DetectLayout(documentImage);
foreach (var region in result.Regions)
{
    Console.WriteLine($"Found {region.ElementType} at ({region.BoundingBox})");
}

Properties

SupportedElementTypes

Gets the layout element types this detector can identify.

IReadOnlyList<LayoutElementType> SupportedElementTypes { get; }

Property Value

IReadOnlyList<LayoutElementType>

Methods

DetectLayout(Tensor<T>)

Detects layout regions in a document image.

DocumentLayoutResult<T> DetectLayout(Tensor<T> documentImage)

Parameters

documentImage Tensor<T>

The document image tensor [batch, channels, height, width].

Returns

DocumentLayoutResult<T>

Layout detection result with regions and their types.

DetectLayout(Tensor<T>, double)

Detects layout regions with a specified confidence threshold.

DocumentLayoutResult<T> DetectLayout(Tensor<T> documentImage, double confidenceThreshold)

Parameters

documentImage Tensor<T>

The document image tensor.

confidenceThreshold double

Minimum confidence for detected regions (0.0 to 1.0).

Returns

DocumentLayoutResult<T>

Filtered layout detection result.

Remarks

Higher thresholds return fewer but more confident detections. Lower thresholds return more detections but may include false positives.