UNITER<T>

Models & Types · AiDotNet.VisionLanguage.Foundational

UNITER (Universal Image-TExt Representation) with conditional masking pre-training.

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

Implements: IVisionLanguageFusionModel<T>

For Beginners

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

How It Works

UNITER (Chen et al., ECCV 2020) uses a single-stream transformer with conditional masking where either image regions or text tokens are masked during pre-training, forcing the model to learn cross-modal alignment. Four pre-training tasks: MLM, MRM (with KL divergence), ITM, and WRA.

References:

  • Paper: “UNITER: UNiversal Image-TExt Representation Learning” (Chen et al., ECCV 2020)

Example

// Create a UNITER model for universal image-text representation
// with conditional masking pre-training for cross-modal alignment
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 UNITER<double>(architecture, "uniter.onnx");
            
// Training mode with native layers
var trainModel = new UNITER<double>(architecture, new UNITEROptions());

Constructors

Constructor Summary
UNITER(NeuralNetworkArchitecture<T> architecture, UNITEROptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
UNITER(NeuralNetworkArchitecture<T> architecture, string modelPath, UNITEROptions 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)