LLaVANeXTVideo<T>

Models & Types · AiDotNet.VisionLanguage.VideoLanguage

LLaVA-NeXT-Video: average pooling for frame token reduction.

Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → LLaVANeXTVideo<T>

Implements: IVideoLanguageModel<T>

For Beginners

LLaVA-NeXT-Video is a video understanding model that extends image LLMs to video through efficient frame token pooling. Default values follow the original paper settings.

How It Works

LLaVA-NeXT-Video (ByteDance, 2024) extends LLaVA-NeXT to video understanding using average pooling for efficient frame token reduction. It processes video frames through a shared image encoder and pools temporal tokens to reduce sequence length, enabling zero-shot video question answering and temporal reasoning without video-specific training.

References:

  • Paper: “LLaVA-NeXT: A Strong Zero-shot Video Understanding Model” (ByteDance, 2024)

Example

// Create a LLaVA-NeXT-Video model for zero-shot video understanding
// with average pooling for efficient frame token reduction
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 LLaVANeXTVideo<double>(architecture, "llavanextvideo.onnx");
            
// Training mode with native layers
var trainModel = new LLaVANeXTVideo<double>(architecture, new LLaVANeXTVideoOptions());

Constructors

Constructor Summary
LLaVANeXTVideo(NeuralNetworkArchitecture<T> architecture, LLaVANeXTVideoOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
LLaVANeXTVideo(NeuralNetworkArchitecture<T> architecture, string modelPath, LLaVANeXTVideoOptions options)

Properties

Property Summary
int DecoderEmbeddingDim { get; }
int EmbeddingDimension { get; }
int MaxFrames { get; }
int MaxGenerationLength { get; }
string LanguageModelName { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()
Tensor<T> EncodeImage(Tensor<T> image)
Tensor<T> GenerateFromImage(Tensor<T> image, string prompt) Generates from a single image using LLaVA-NeXT-Video’s AnyRes dynamic resolution processing.
Tensor<T> GenerateFromVideo(IReadOnlyList<Tensor<T>> frames, string prompt) Generates output from video frames using LLaVA-NeXT-Video’s AnyRes + temporal pooling.