EVACLIP<T>
Models & Types · AiDotNet.VisionLanguage.Encoders
EVA-CLIP model combining EVA-02 masked image modeling backbone with CLIP contrastive training.
Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → EVACLIP<T>
Implements: IContrastiveVisionLanguageModel<T>
For Beginners
EVA-CLIP improves CLIP by first pre-training the vision encoder with masked image modeling (learning to reconstruct hidden image patches), then applying contrastive image-text training. The largest variant has 4.4 billion parameters and achieves 82.0% zero-shot ImageNet accuracy. It also adds rotary position embeddings (RoPE) and SwiGLU activations for stronger feature learning. Default values follow the original paper settings.
How It Works
EVA-CLIP (Sun et al., 2023) uses the EVA-02 ViT backbone pre-trained with masked image modeling (MIM) for stronger visual representations. The largest variant (ViT-E/14, 4.4B params) achieves 82.0% zero-shot on ImageNet. EVA-02 adds RoPE positional embeddings and SwiGLU FFN activations.
References:
- Paper: “EVA-CLIP: Improved Training Techniques for CLIP at Scale” (Sun et al., 2023)
Example
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.TwoDimensional,
taskType: NeuralNetworkTaskType.ImageClassification,
inputHeight: 224, inputWidth: 224, inputDepth: 3, outputSize: 512);
var trainModel = new EVACLIP<double>(architecture, new EVACLIPOptions());
Constructors
| Constructor | Summary |
|---|---|
EVACLIP(NeuralNetworkArchitecture<T> architecture, EVACLIPOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
|
EVACLIP(NeuralNetworkArchitecture<T> architecture, string imageEncoderModelPath, EVACLIPOptions options) |
Properties
| Property | Summary |
|---|---|
T Temperature { get; } |
|
int EmbeddingDimension { get; } |
|
int MaxSequenceLength { get; } |
|
int ProjectionDimension { get; } |
|
int TextEmbeddingDimension { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> ZeroShotClassify(Tensor<T> image, string[] labels) |
|
ModelMetadata<T> GetModelMetadata() |
|
T ComputeSimilarity(Tensor<T> image, string text) |
|
Tensor<T> EncodeImage(Tensor<T> image) |
|
Tensor<T> EncodeText(string text) |
|
Tensor<T>[] EncodeTexts(string[] texts) |