VideoChat2<T>
Models & Types · AiDotNet.VisionLanguage.VideoLanguage
VideoChat2: progressive video training with diverse data.
Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → VideoChat2<T>
Implements: IVideoLanguageModel<T>
For Beginners
VideoChat2 is a video-language model trained progressively on diverse video-text data for video conversation. Default values follow the original paper settings.
How It Works
VideoChat2 (Shanghai AI Lab, 2023) uses progressive video training with diverse multi-modal data. It trains through multiple stages starting from image-text alignment, then image instruction tuning, and finally video instruction tuning on diverse video datasets, building strong video conversation capabilities incrementally.
References:
- Paper: “MVBench: A Comprehensive Multi-modal Video Understanding Benchmark” (Shanghai AI Lab, 2023)
Example
// Create a VideoChat2 model for video conversation
// with progressive training on diverse video-text data
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 VideoChat2<double>(architecture, "videochat2.onnx");
// Training mode with native layers
var trainModel = new VideoChat2<double>(architecture, new VideoChat2Options());
Constructors
| Constructor | Summary |
|---|---|
VideoChat2(NeuralNetworkArchitecture<T> architecture, VideoChat2Options options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
VideoChat2(NeuralNetworkArchitecture<T> architecture, string modelPath, VideoChat2Options 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 VideoChat2’s Q-Former visual-text cross-attention. |
Tensor<T> GenerateFromVideo(IReadOnlyList<Tensor<T>> frames, string prompt) |
Generates output from video frames using VideoChat2’s Q-Former temporal aggregation. |