OMGLLaVA<T>
Models & Types · AiDotNet.ComputerVision.Segmentation.Referring
OMG-LLaVA: Bridging Image-Level, Object-Level, and Pixel-Level understanding.
Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → ReferringSegmentationBase<T> → OMGLLaVA<T>
For Beginners
Unified visual perception and understanding. Object-level and pixel-level reasoning.
Common use cases:
- Unified visual perception and understanding
- Object-level and pixel-level reasoning
- Visual question answering with segmentation
- Multi-granularity visual understanding
How It Works
Technical Details:
- Universal segmentation model (Mask2Former) + LLM (LLaVA)
- Bridges perception (segmentation) and understanding (reasoning)
- Object-level queries from segmentation feed into LLM
- Pixel-level grounding from LLM responses
Reference: Zhang et al., “OMG-LLaVA: Bridging Image-Level, Object-Level, Pixel-Level Reasoning and Understanding”, arXiv 2024.
Example
// Create an OMG-LLaVA model for multi-granularity visual understanding
// Any CLIP-style ITextEncoder supplies the text embeddings, e.g. a CLIP model from VisionLanguage.Encoders.
ITextEncoder<double> textEncoder = clipModel;
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.ThreeDimensional,
taskType: NeuralNetworkTaskType.BinaryClassification,
inputHeight: 1024, inputWidth: 1024, inputDepth: 3, outputSize: 1);
var model = new OMGLLaVA<double>(architecture, textEncoder);
// Every tunable is now set through the options object; these are the defaults:
var custom = new OMGLLaVA<double>(architecture, textEncoder,
options: new OMGLLaVAOptions { NumClasses = 1, DropRate = 0 });
// Or load a pre-trained ONNX model for visual question answering with segmentation
var onnxModel = new OMGLLaVA<double>(architecture, "omgllava.onnx", textEncoder, options: null);
Constructors
| Constructor | Summary |
|---|---|
OMGLLaVA(NeuralNetworkArchitecture<T> architecture, ITextEncoder<T> textEncoder, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, OMGLLaVAOptions options) |
Initializes OMGLLaVA in native (trainable) mode. |
OMGLLaVA(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, ITextEncoder<T> textEncoder, OMGLLaVAOptions options) |
Initializes OMGLLaVA in ONNX (inference-only) mode. |
Properties
| Property | Summary |
|---|---|
bool SupportsConversation { get; } |
Methods
| Method | Summary |
|---|---|
List<ReferringSegmentationResult<T>> SegmentVideoFromExpression(Tensor<T> frames, string expression) |
|
ModelMetadata<T> GetModelMetadata() |
Collects metadata describing this model’s configuration. |
ReferringSegmentationResult<T> SegmentFromConversation(Tensor<T> image, IReadOnlyList<ValueTuple<string, string>> conversationHistory, string currentQuery) |