ALIGN<T>
Models & Types · AiDotNet.VisionLanguage.Encoders
ALIGN (A Large-scale ImaGe and Noisy-text embedding) model for zero-shot classification and cross-modal retrieval using EfficientNet as the vision encoder.
Inheritance: NeuralNetworkBase<T> → VisionLanguageModelBase<T> → ALIGN<T>
Implements: IContrastiveVisionLanguageModel<T>
For Beginners
ALIGN is similar to CLIP but uses a different type of image model (EfficientNet, which is a convolutional neural network) instead of a Vision Transformer. It was trained on a very large but noisy dataset, proving that more data beats cleaner data.
How It Works
ALIGN (Jia et al., ICML 2021) demonstrates that simple dual-encoder contrastive learning achieves strong image-text alignment when trained at massive scale. Unlike CLIP which uses a Vision Transformer, ALIGN uses an EfficientNet-B7 as its vision encoder, showing that the contrastive learning recipe is architecture-agnostic.
Key Innovation: ALIGN trains on 1.8 billion noisy alt-text image-text pairs without expensive filtering, showing that scale compensates for data noise. The EfficientNet backbone provides a CNN-based alternative to ViT for vision encoding.
References:
- Paper: “Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision” (Jia et al., ICML 2021)
Example
// Create an ALIGN model for contrastive image-text alignment
// using EfficientNet vision encoder trained on 1.8B noisy pairs
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 ALIGN<double>(architecture, "align.onnx");
// Training mode with native layers
var trainModel = new ALIGN<double>(architecture, new ALIGNOptions());
Constructors
| Constructor | Summary |
|---|---|
ALIGN(NeuralNetworkArchitecture<T> architecture, ALIGNOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
Creates an ALIGN model in native training mode. |
ALIGN(NeuralNetworkArchitecture<T> architecture, string imageEncoderModelPath, ALIGNOptions options) |
Creates an ALIGN model in native training mode. |
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) |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
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) |