MPLUGDocOwl2<T>
Models & Types · AiDotNet.VisionLanguage.Document
mPLUG-DocOwl 2: high-res compressing for multi-page document understanding.
Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → MPLUGDocOwl2<T>
Implements: IDocumentUnderstandingModel<T>
For Beginners
mPLUG-DocOwl 2 is a document understanding model for multi-page documents with high-resolution visual compression. Default values follow the original paper settings.
How It Works
mPLUG-DocOwl 2 (Alibaba, 2024) handles multi-page document understanding with high-resolution visual token compression. It processes each page at high resolution and compresses the visual tokens to manageable lengths, enabling the model to handle multi-page PDFs and long documents while preserving fine text details and layout structure.
References:
- Paper: “mPLUG-DocOwl 2: High-resolution Compressing for OCR-free Multi-page Document Understanding” (Alibaba, 2024)
Example
// Create an mPLUG-DocOwl 2 model for multi-page document understanding
// with high-resolution visual token compression for long documents
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.TwoDimensional,
taskType: NeuralNetworkTaskType.ImageClassification,
inputHeight: 224, inputWidth: 224, inputDepth: 3, outputSize: 512);
// ONNX inference mode with pre-trained model
var model = new MPLUGDocOwl2<double>(architecture, "mplugdocowl2.onnx");
// Training mode with native layers
var trainModel = new MPLUGDocOwl2<double>(architecture, new MPLUGDocOwl2Options());
Constructors
| Constructor | Summary |
|---|---|
MPLUGDocOwl2(NeuralNetworkArchitecture<T> architecture, MPLUGDocOwl2Options options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
MPLUGDocOwl2(NeuralNetworkArchitecture<T> architecture, string modelPath, MPLUGDocOwl2Options options) |
Properties
| Property | Summary |
|---|---|
bool IsOcrFree { get; } |
|
int DecoderEmbeddingDim { get; } |
|
int EmbeddingDimension { get; } |
|
int MaxGenerationLength { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> AnswerDocumentQuestion(Tensor<T> documentImage, string question) |
|
Tensor<T> EncodeImage(Tensor<T> image) |
|
Tensor<T> ExtractText(Tensor<T> documentImage) |
|
Tensor<T> GenerateFromImage(Tensor<T> image, string prompt) |
Generates text from a document image using mPLUG-DocOwl 2’s high-resolution compression. |