VinVL<T>

Models & Types · AiDotNet.VisionLanguage.Foundational

VinVL (Visual Features in Vision-Language) with enhanced object detection features.

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

Implements: IVisionLanguageFusionModel<T>

For Beginners

VinVL is a vision-language model. Default values follow the original paper settings.

How It Works

VinVL (Zhang et al., CVPR 2021) improves on Oscar by providing better visual features through a stronger object detection backbone (ResNeXt-152 C4), enriching object tags with attributes and achieving state-of-the-art on VQA, captioning, and retrieval benchmarks.

References:

  • Paper: “VinVL: Revisiting Visual Representations in Vision-Language Models” (Zhang et al., CVPR 2021)

Example

// Create a VinVL model for enhanced vision-language representation
// with stronger object detection features via ResNeXt-152 backbone
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 VinVL<double>(architecture, "vinvl.onnx");
            
// Training mode with native layers
var trainModel = new VinVL<double>(architecture, new VinVLOptions());

Constructors

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

Properties

Property Summary
int EmbeddingDimension { get; }
int FusionEmbeddingDim { get; }
int MaxSequenceLength { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()
T ComputeMatchingScore(Tensor<T> image, string text)
Tensor<T> EncodeImage(Tensor<T> image)
Tensor<T> ForwardForTraining(Tensor<T> input)
Tensor<T> FuseImageText(Tensor<T> image, string text)