MoCoV2<T>

Models & Types · AiDotNet.SelfSupervisedLearning

MoCo v2: Improved Baselines with Momentum Contrastive Learning.

Inheritance: ModelBase<T, Tensor<T>, Tensor<T>> → SelfSupervisedLearningMethodBase<T> → MoCo<T> → MoCoV2<T>

For Beginners

MoCo v2 improves on MoCo v1 by incorporating ideas from SimCLR: an MLP projection head and stronger augmentations. This combines MoCo’s memory efficiency with SimCLR’s representation quality improvements.

How It Works

Key improvements over MoCo v1:

Result: MoCo v2 matches SimCLR performance with much smaller batch sizes (256 vs 4096-8192).

Reference: Chen et al., “Improved Baselines with Momentum Contrastive Learning” (arXiv 2020)

Best for: Better performance than MoCo v1 with similar efficiency.

Pros: Combines MoCo efficiency with SimCLR improvements.

Cons: Slightly more complex than MoCo v1.

Constructors

Constructor Summary
MoCoV2(INeuralNetwork<T> encoder, IMomentumEncoder<T> momentumEncoder, IProjectorHead<T> projector, IProjectorHead<T> momentumProjector, int embeddingDim, SelfSupervisedLearningConfig<T> config) Initializes a new instance of the MoCoV2 class.

Properties

Property Summary
string Name { get; }

Methods

Method Summary
MoCoV2<T> Create(INeuralNetwork<T> encoder, Func<INeuralNetwork<T>, INeuralNetwork<T>> createEncoderCopy, int encoderOutputDim, int projectionDim, int hiddenDim, int queueSize) Creates a MoCo v2 instance with default configuration.