ContrastiveEncoderOptions
Options & Configuration · AiDotNet.VisionLanguage.Encoders
Base configuration options for contrastive vision-language encoders (CLIP-family models).
Inheritance: ModelOptions → ContrastiveEncoderOptions
Known derived types: ALIGNOptions, BASICOptions, BiomedCLIPOptions, CLIPAOptions, DFNCLIPOptions, DeCLIPOptions, EVACLIPOptions, FLIPOptions, LLM2CLIPOptions, LiTOptions, MedCLIPOptions, MetaCLIPOptions, OpenCLIPOptions, RegionCLIPOptions, RemoteCLIPOptions, SigLIP2Options, SigLIPOptions
For Beginners
These settings control how the model processes images and text. The most important ones are:
- ImageSize: The size images are resized to before processing (e.g., 224x224 pixels)
- EmbeddingDim: How many numbers represent each image or text (bigger = more detail)
- Temperature: How “sharp” the similarity comparisons are (lower = more decisive)
How It Works
Contrastive encoders learn a shared embedding space for images and text via contrastive learning. They share common hyperparameters: image/text embedding dimensions, projection dimension, temperature, and image preprocessing settings.
Constructors
| Constructor | Summary |
|---|---|
ContrastiveEncoderOptions() |
Initializes a new instance with default values. |
ContrastiveEncoderOptions(ContrastiveEncoderOptions other) |
Initializes a new instance by copying from another instance. |
Properties
| Property | Summary |
|---|---|
OnnxModelOptions OnnxOptions { get; set; } |
Gets or sets ONNX runtime options. |
TextEncoderVariant TextEncoderVariant { get; set; } |
Gets or sets the text encoder variant. |
ViTVariant VisionEncoderVariant { get; set; } |
Gets or sets the vision encoder variant. |
double DropoutRate { get; set; } |
Gets or sets the dropout rate for regularization. |
double LabelSmoothing { get; set; } |
Gets or sets the label smoothing factor. |
double LearningRate { get; set; } |
Gets or sets the initial learning rate. |
double Temperature { get; set; } |
Gets or sets the temperature parameter for contrastive loss. |
double WeightDecay { get; set; } |
Gets or sets the weight decay for regularization. |
double[] ImageMean { get; set; } |
Gets or sets the per-channel mean for image normalization. |
double[] ImageStd { get; set; } |
Gets or sets the per-channel standard deviation for image normalization. |
int ImageSize { get; set; } |
Gets or sets the input image size (height = width). |
int MaxSequenceLength { get; set; } |
Gets or sets the maximum text token sequence length. |
int NumTextHeads { get; set; } |
Gets or sets the number of text attention heads. |
int NumTextLayers { get; set; } |
Gets or sets the number of text transformer layers. |
int NumVisionHeads { get; set; } |
Gets or sets the number of vision attention heads. |
int NumVisionLayers { get; set; } |
Gets or sets the number of vision transformer layers. |
int PatchSize { get; set; } |
Gets or sets the ViT patch size in pixels. |
int ProjectionDim { get; set; } |
Gets or sets the shared projection dimension for the joint embedding space. |
int TextEmbeddingDim { get; set; } |
Gets or sets the text encoder embedding dimension. |
int VisionEmbeddingDim { get; set; } |
Gets or sets the vision encoder embedding dimension. |
int VisionFfnMultiplier { get; set; } |
Gets or sets the feed-forward hidden dimension multiplier for vision encoder. |
int VocabSize { get; set; } |
Gets or sets the vocabulary size. |
int WarmUpSteps { get; set; } |
Gets or sets the warm-up steps for the learning rate scheduler. |
string ImageEncoderModelPath { get; set; } |
Gets or sets the path to the image encoder ONNX model. |
string TextEncoderModelPath { get; set; } |
Gets or sets the path to the text encoder ONNX model. |