Momentum Contrast for Unsupervised Visual Representation Learning

Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, Ross Girshick

2020 · CVPR

Momentum Contrast for Unsupervised Visual Representation Learning

Problem

Framing

Contrastive visual pretraining faced a trade-off: end-to-end dictionaries were small, while memory banks were stale. MoCo closes it with a queue-based dictionary and a momentum key encoder that keeps many negatives usable without exploding batch size. On ImageNet linear evaluation, ResNet-50 reaches 60.6% top-1.

Currently Used Methods

Foundational

Proposed Method

Architecture

MoCo uses two encoders with identical architecture: a query encoder fqf_q and a key encoder fkf_k. The current mini-batch produces queries and positive keys, while older keys remain in a FIFO queue, so dictionary size KK is decoupled from batch size.

Conceptual comparison of contrastive mechanisms: end-to-end, memory bank, and MoCo with a momentum encoder for keys.

Loss / Objective

The objective is InfoNCE over one positive key and KK dictionary negatives.

Lq=logexp(qk+/T)i=0Kexp(qki/T)\mathcal{L}_q = - \log \frac{\exp(q \cdot k_+ / T)}{\sum_{i=0}^{K} \exp(q \cdot k_i / T)}

Sampling Rule / Algorithm

The key encoder evolves by exponential moving average of the query encoder.

θkmθk+(1m)θq\theta_k \leftarrow m\,\theta_k + (1-m)\,\theta_q

Training Procedure

Evaluation

Datasets

Metrics

Headline results

Results plot: ImageNet linear accuracy versus dictionary size K for end-to-end, memory bank, and MoCo.

Table 3: Scaling ImageNet linear accuracy against model size, compared with prior unsupervised methods.

Method#parameters (M)accuracy (%)
Colorization2439.7
Jigsaw2845.7
DeepCluster2648.3
CPCv12848.7
InstDisc2851.5
RelativePosition2851.8
LocalAgg2852.6
Rotation2855.4
BigBiGAN-R502856.6
Exemplar2857.0
AMDIM-small2861.7
CMC-R504656.0
CPCv26163.8
BigBiGAN-Rv50x48661.3
CMC-R50w2x18868.4
AMDIM-large62668.1
MoCo-R502860.6
MoCo-R50w2x8665.4
MoCo-R50w4x37568.6

Ablations

Method Strengths and Weaknesses

Strengths

Weaknesses

Suggestions from the authors

Links

Prior Papers

Further Papers