LISA<T>

Models & Types · AiDotNet.ComputerVision.Segmentation.Referring

LISA: Reasoning Segmentation via Large Language Model.

Inheritance: NeuralNetworkBase<T> → SegmentationModelBase<T> → ReferringSegmentationBase<T> → LISA<T>

For Beginners

Reasoning-based segmentation from complex text queries. Implicit referring segmentation.

Common use cases:

  • Reasoning-based segmentation from complex text queries
  • Implicit referring segmentation
  • Conversational image segmentation
  • World-knowledge-powered segmentation

How It Works

Technical Details:

  • Large Language Model (LLaVA) + SAM mask decoder
  • Embedding-as-mask paradigm: LLM output tokens control SAM
  • Handles complex reasoning queries (not just simple references)
  • End-to-end trainable with LoRA fine-tuning

Reference: Lai et al., “LISA: Reasoning Segmentation via Large Language Model”, CVPR 2024.

Example

// Create a LISA model for reasoning-based segmentation from text queries
// 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 LISA<double>(architecture, textEncoder);
// Every tunable is now set through the options object; these are the defaults:
var custom = new LISA<double>(architecture, textEncoder,
    options: new LISAOptions { NumClasses = 1, DropRate = 0 });
            
// Or load a pre-trained ONNX model for conversational segmentation
var onnxModel = new LISA<double>(architecture, "lisa.onnx", textEncoder, options: null);

Constructors

Constructor Summary
LISA(NeuralNetworkArchitecture<T> architecture, ITextEncoder<T> textEncoder, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, LISAOptions options) Initializes LISA in native (trainable) mode.
LISA(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, ITextEncoder<T> textEncoder, LISAOptions options) Initializes LISA 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)