MoCo<T>
Models & Types · AiDotNet.SelfSupervisedLearning
MoCo: Momentum Contrast for Unsupervised Visual Representation Learning.
Inheritance: ModelBase<T, Tensor<T>, Tensor<T>> → SelfSupervisedLearningMethodBase<T> → MoCo<T>
Known derived types: MoCoV2<T>
For Beginners
MoCo is a contrastive learning method that uses a momentum encoder and a memory queue to provide a large pool of consistent negative samples without requiring huge batch sizes.
How It Works
Key innovations:
How MoCo works:
Reference: He et al., “Momentum Contrast for Unsupervised Visual Representation Learning” (CVPR 2020)
Best for: Limited GPU memory, consistent negative samples.
Pros: Memory efficient, consistent negative samples, good performance.
Cons: More complex than SimCLR, requires a momentum encoder.
Constructors
| Constructor | Summary |
|---|---|
MoCo(INeuralNetwork<T> encoder, IMomentumEncoder<T> momentumEncoder, IProjectorHead<T> projector, IProjectorHead<T> momentumProjector, int embeddingDim, SelfSupervisedLearningConfig<T> config) |
Initializes a new instance of the MoCo class. |
Properties
| Property | Summary |
|---|---|
IMemoryBank<T> MemoryBank { get; } |
Gets the memory bank used for negative samples. |
SelfSupervisedLearningMethodCategory Category { get; } |
|
bool RequiresMemoryBank { get; } |
|
bool UsesMomentumEncoder { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
MoCo<T> Create(INeuralNetwork<T> encoder, Func<INeuralNetwork<T>, INeuralNetwork<T>> createEncoderCopy, int encoderOutputDim, int projectionDim, int queueSize) |
Creates a MoCo instance with default configuration. |
void Reset() |