LXMERT<T>

Models & Types · AiDotNet.VisionLanguage.Foundational

LXMERT (Learning Cross-Modality Encoder Representations from Transformers) with three-encoder architecture.

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

Implements: IVisionLanguageFusionModel<T>

For Beginners

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

How It Works

LXMERT (Tan and Bansal, EMNLP 2019) uses three transformer encoders: an object relationship encoder for visual features, a language encoder for text, and a cross-modality encoder that performs cross-attention between the two modalities.

References:

  • Paper: “LXMERT: Learning Cross-Modality Encoder Representations from Transformers” (Tan and Bansal, EMNLP 2019)

Example

var architecture = new NeuralNetworkArchitecture<double>(
    inputType: InputType.TwoDimensional,
    taskType: NeuralNetworkTaskType.ImageClassification,
    inputHeight: 224, inputWidth: 224, inputDepth: 3, outputSize: 512);
var trainModel = new LXMERT<double>(architecture, new LXMERTOptions());

Constructors

Constructor Summary
LXMERT(NeuralNetworkArchitecture<T> architecture, LXMERTOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
LXMERT(NeuralNetworkArchitecture<T> architecture, string modelPath, LXMERTOptions 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> FuseImageText(Tensor<T> image, string text)