PixelLM<T>
Models & Types · AiDotNet.ComputerVision.Segmentation.Referring
PixelLM: Pixel Reasoning with Large Multimodal Model.
Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → ReferringSegmentationBase<T> → PixelLM<T>
For Beginners
Multi-target reasoning segmentation. Complex text-to-mask segmentation.
Common use cases:
- Multi-target reasoning segmentation
- Complex text-to-mask segmentation
- Pixel-level reasoning from language
- Detailed visual grounding
How It Works
Technical Details:
- Lightweight pixel decoder with codebook tokens
- Multi-scale feature integration for segmentation
- Handles multiple target masks from a single query
- End-to-end LLM + pixel decoder training
Reference: Ren et al., “PixelLM: Pixel Reasoning with Large Multimodal Model”, CVPR 2024.
Example
// Create a PixelLM model for multi-target reasoning segmentation
// 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 PixelLM<double>(architecture, textEncoder);
// Every tunable is now set through the options object; these are the defaults:
var custom = new PixelLM<double>(architecture, textEncoder,
options: new PixelLMOptions { NumClasses = 1, DropRate = 0 });
// Or load a pre-trained ONNX model for pixel-level reasoning
var onnxModel = new PixelLM<double>(architecture, "pixellm.onnx", textEncoder, options: null);
Constructors
| Constructor | Summary |
|---|---|
PixelLM(NeuralNetworkArchitecture<T> architecture, ITextEncoder<T> textEncoder, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, PixelLMOptions options) |
Initializes PixelLM in native (trainable) mode. |
PixelLM(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, ITextEncoder<T> textEncoder, PixelLMOptions options) |
Initializes PixelLM in ONNX (inference-only) mode. |
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) |