DeCLIP<T>

Models & Types · AiDotNet.VisionLanguage.Encoders

DeCLIP (Data-efficient CLIP) model using self-supervised and nearest-neighbor supervision for data efficiency.

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

Implements: IContrastiveVisionLanguageModel<T>

For Beginners

DeCLIP achieves CLIP-level performance with much less training data by extracting extra supervision from the data itself. It combines contrastive image-text matching with image self-supervision (SimSiam), text masked language modeling, and nearest- neighbor supervision — squeezing more learning from each image-text pair. Default values follow the original paper settings.

How It Works

DeCLIP (Li et al., ICLR 2022) achieves CLIP-level performance with less data by combining contrastive learning with image self-supervision (SimSiam), text MLM, and nearest-neighbor supervision.

References:

  • Paper: “Supervision Exists Everywhere: A Data-Efficient Contrastive Language-Image Pre-training Paradigm” (Li et al., ICLR 2022)

Example

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

Constructors

Constructor Summary
DeCLIP(NeuralNetworkArchitecture<T> architecture, DeCLIPOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer)
DeCLIP(NeuralNetworkArchitecture<T> architecture, string imageEncoderModelPath, DeCLIPOptions 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)