Interface IFormUnderstanding<T>
- Namespace
- AiDotNet.Document.Interfaces
- Assembly
- AiDotNet.dll
Interface for form understanding models that extract structured fields from documents.
public interface IFormUnderstanding<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
TThe numeric type used for calculations.
- Inherited Members
- Extension Methods
Remarks
Form understanding models extract key-value pairs, checkboxes, signatures, and other structured information from forms, invoices, receipts, and similar documents.
For Beginners: Form understanding is like having someone read a form and fill out a digital version. The model finds: - Field labels and their values (e.g., "Name: John Smith") - Checkboxes and whether they're checked - Signatures and their locations
Example usage:
var model = new PICK<float>(architecture);
var result = model.ExtractFormFields(formImage);
foreach (var field in result.Fields)
Console.WriteLine($"{field.FieldName}: {field.FieldValue}");
Methods
DetectCheckboxes(Tensor<T>)
Detects checkboxes and their states in a document.
IEnumerable<CheckboxResult<T>> DetectCheckboxes(Tensor<T> documentImage)
Parameters
documentImageTensor<T>The document image tensor.
Returns
- IEnumerable<CheckboxResult<T>>
Collection of detected checkboxes.
DetectSignatures(Tensor<T>)
Detects signatures in a document.
IEnumerable<SignatureResult<T>> DetectSignatures(Tensor<T> documentImage)
Parameters
documentImageTensor<T>The document image tensor.
Returns
- IEnumerable<SignatureResult<T>>
Collection of detected signatures.
ExtractFormFields(Tensor<T>)
Extracts form fields from a document image.
FormFieldResult<T> ExtractFormFields(Tensor<T> documentImage)
Parameters
documentImageTensor<T>The document image tensor.
Returns
- FormFieldResult<T>
Form field extraction result.
ExtractFormFields(Tensor<T>, double)
Extracts form fields with a custom confidence threshold.
FormFieldResult<T> ExtractFormFields(Tensor<T> documentImage, double confidenceThreshold)
Parameters
documentImageTensor<T>The document image tensor.
confidenceThresholddoubleMinimum confidence for field extraction (0-1).
Returns
- FormFieldResult<T>
Form field extraction result.
ExtractKeyValuePairs(Tensor<T>)
Extracts key-value pairs from a document.
Dictionary<string, string> ExtractKeyValuePairs(Tensor<T> documentImage)
Parameters
documentImageTensor<T>The document image tensor.
Returns
- Dictionary<string, string>
Dictionary of field names to values.