Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Momentum Contrast for Unsupervised Visual Representation Learning

  • Problem Contrastive learning for vision needs a dictionary of keys that is both large and consistent over training, and existing mechanisms give up one of the two.
  • Method MoCo keeps encoded keys in a queue and encodes them with a key encoder that is a momentum-weighted average of the query encoder, trained with an InfoNCE loss.
  • Results Reached 60.6% top-1 under linear classification with ResNet-50 pre-trained on IN-1M at K=65536, against 58.0% for the memory bank mechanism at the same K.

Why dictionaries limit unsupervised vision

Unsupervised pre-training works well for language, but in computer vision supervised ImageNet pre-training is still the default. The authors trace part of the gap to the input: pixels form a continuous, high-dimensional signal with no natural discrete vocabulary, so building a set of candidate targets is harder than for words. A group of recent methods avoids labels by matching an encoded query to a set of keys, and these methods can be read as building dynamic dictionaries whose keys come from data and are produced by an encoder.

The authors argue that a useful dictionary has to be large, so that it covers many negative samples, and consistent, so that keys encoded at different training steps remain comparable.

Existing mechanisms each sacrifice one of these two properties. End-to-end training uses the current mini-batch as the dictionary, so its keys are consistent, but the dictionary size is capped by the mini-batch size and by GPU memory. A memory bank can hold far more keys, but each stored representation was computed when its sample was last visited, so the sampled keys come from encoders at many different steps.

Contrastive loss as dictionary look-up

Training is framed as a dictionary look-up: a query q should retrieve its single positive key k+ from a set of keys k0 to kK, and every other key acts as a negative. The loss is InfoNCE, with dot-product similarity and a temperature τ, written for each query as: \[ L_q = -\log \frac{\exp(q\cdot k_+/\tau)}{\sum_{i=0}^{K}\exp(q\cdot k_i/\tau)} \] The denominator sums over the positive key and the K negatives, so the softmax is taken over K+1 candidates.

The query is produced by an encoder f_q applied to a query input x_q, and the key is produced by an encoder f_k applied to a key input x_k. The two encoders can be identical, partially shared or different, depending on the pretext task used. Figure 2 places three ways of setting up this loss side by side: end-to-end updates, a memory bank and MoCo.

Queue and momentum key encoder

MoCo keeps its dictionary as a queue of encoded keys. Each step enqueues the keys of the current mini-batch and dequeues the oldest mini-batch. Because the queue is separate from the mini-batch, the dictionary size can be set as an independent hyperparameter. Removing the oldest keys is useful because they were encoded most long ago and are the least consistent with the newest keys.

Figure 1 summarizes the loop: a query encoder and a momentum-updated key encoder feed a contrastive loss, and the keys are kept in the queue.

Back-propagating through every key in the queue is impractical, so the key encoder cannot be trained by gradients in the usual way. Its parameters θk follow the update below, with momentum m in [0, 1), while only the query encoder parameters θq receive back-propagation: \[ \theta_k \leftarrow m\theta_k + (1-m)\theta_q \] Because θk changes slowly, keys in the queue that were encoded in different mini-batches still come from encoders that are close to each other.

Copying the query encoder into the key encoder without the momentum term gives poor results, which the authors attribute to a rapidly changing encoder that makes the stored keys inconsistent. The default momentum is m=0.999, and a smaller value of m=0.9 works much worse, which the authors read as evidence that a slowly evolving key encoder is needed to use a queue.

Pretext task, encoders and shuffling BN

The pretext task follows instance discrimination: two random views of the same image form a positive pair, and views of other images are negatives. The encoder is a ResNet whose final fully-connected output is 128-D and is L2-normalized, with the temperature τ set to 0.07. Input crops are 224 × 224 pixels taken from randomly resized images, with random color jittering, horizontal flip and grayscale conversion.

The encoders contain Batch Normalization, and the authors found that BN let the model find a low-loss shortcut on the pretext task, possibly because samples in a batch share information through BN. Shuffling BN fixes this: the key encoder's sample order is shuffled before distribution across GPUs and shuffled back after encoding, while the query order is left unchanged.

Without shuffling BN, the pretext training accuracy rapidly passes 99.9% while the kNN-based validation accuracy drops, which the authors read as overfitting to the pretext task.

On IG-1B the batch is 1024 across 64 GPUs with an initial learning rate of 0.12. Algorithm 1 in the paper gives the pseudocode: keys are detached, positive logits come from a batched dot product, negatives come from the queue, and after the loss the key encoder is momentum-updated and the queue is updated.

ImageNet linear classification results

The linear protocol freezes the ResNet features and trains a supervised linear classifier, reporting 1-crop top-1 accuracy on the ImageNet validation set. Figure 3 varies K from 256 to 65536 for the three mechanisms, keeping the pretext task fixed. All three mechanisms gain from larger K. The end-to-end mechanism performs similarly to MoCo at small K, but its batch is capped at 1024 on the available hardware.

The memory bank mechanism can support a larger dictionary, but it is 2.6% worse than MoCo, reaching 58.0% at K=65536 against MoCo's 60.6%. The authors attribute the gap to the memory bank keys coming from very different encoders across the past epoch, which makes them inconsistent.

With m=0 the training loss oscillates and does not converge, so that setting fails.

The comparison counts parameters of the feature extractor and uses the ImageNet-1M training set for unsupervised pre-training.

MoCo v2, an extension of this preliminary version that changes data augmentation and the output projection head, reaches 71.1% accuracy with R50 under the linear protocol. That number belongs to the extension and is not part of the configuration reported for MoCo in the main comparison.

PASCAL VOC detection transfer

Detection uses Faster R-CNN with an R50-dilated-C5 or R50-C4 backbone, with BN trained rather than frozen, and all layers are fine-tuned end-to-end. Models are fine-tuned on trainval07+12 and evaluated on test2007, with results averaged over 5 trials and the same setup used for every entry, including the supervised baseline.

With R50-dilated-C5, MoCo on IN-1M reaches 81.1 AP50 against 81.4 for the supervised baseline, while MoCo on IG-1B reaches 81.6. With R50-C4, MoCo on IN-1M reaches 55.9 AP and 62.6 AP75, and MoCo on IG-1B reaches 57.2 AP and 63.7 AP75, against 53.5 AP and 58.8 AP75 for supervised pre-training. Across these settings MoCo gains up to +0.9 AP50, +3.7 AP and +4.9 AP75 over the supervised counterpart on the C4 backbone.

Figure 2 and Table 2 show the backbone dependence, with the C4 backbone giving the larger advantage for unsupervised pre-training.

The authors note that the transfer gain depends on the detector structure, and that the C4 backbone is the default in several existing ResNet-based results. They suggest the relation between pre-training and detector design should be considered in future work.

To isolate the contribution of MoCo's mechanism, the end-to-end and memory bank models were also fine-tuned with the same setting. On R50-dilated-C5, MoCo reaches 79.2 AP50 for end-to-end, 79.8 for the memory bank and 81.1 for MoCo, with AP 52.0, 52.9 and 54.6. On R50-C4, the same three models reach 80.4, 80.6 and 81.5 AP50, with AP 54.6, 54.9 and 55.9.

Both competitors are worse than MoCo in all metrics, and the authors note that how to train them on larger data is an open question.

On trainval2007 with the C4 backbone, the comparison with other methods uses a 9k-iteration fine-tuning averaged over 5 trials. For AP50, MoCo pre-trained on IN-1M reaches 74.9 (+0.5), on IN-14M 75.2 (+0.8), on YFCC-100M 74.7 (+0.3) and on IG-1B 75.6 (+1.2), each relative to its supervised counterpart. Its AP gain on IG-1B is 47.6 (+5.2) and its AP75 gain is 51.7 (+9.0), and the authors state these gains are larger than those seen on trainval07+12.

Figure 4 places the compared methods and their supervised counterparts in one table.

COCO and further downstream tasks

COCO experiments use Mask R-CNN with an FPN or C4 backbone, fine-tuned on train2017 (about 118k images) and evaluated on val2017, with a 1x or 2x schedule. With the 1x schedule, all models including the supervised counterparts are heavily under-trained, as the about 2-point gap to the 2x results indicates.

On FPN with the 1x schedule, MoCo on IN-1M reaches 38.5 AP_bb against 38.9 for supervised pre-training, and MoCo on IG-1B matches it at 38.9. On FPN with the 2x schedule, MoCo on IG-1B reaches 41.1 AP_bb against 40.6 for supervised pre-training, a gain of +0.5. On C4 with the 1x schedule, MoCo on IN-1M reaches 38.5 AP_bb (+0.3) and MoCo on IG-1B 39.1 AP_bb (+0.9), against 38.2 for supervised pre-training.

With the 2x schedule, the authors report MoCo is better than its supervised counterpart in all metrics on both backbones.

With a 6x schedule, supervised pre-training reaches 41.9 AP_bb and training from scratch reaches 41.4 AP_bb. MoCo improves further, reaching 42.8 AP_bb with a gap of +0.9 AP_bb over supervised, compared with +0.5 AP_bb at the 2x schedule.

Table 6 reports keypoint detection, dense pose, LVIS, Cityscapes and VOC semantic segmentation with the same architecture and schedule for each task. On COCO keypoint detection, MoCo on IG-1B reaches 66.9 APkp against 65.8 for supervised pre-training, while supervised pre-training shows no clear advantage over random initialization. On COCO dense pose, MoCo on IG-1B reaches 50.6 APdp against 48.3, with APdp75 gaining +3.7.

On LVIS, MoCo on IG-1B reaches 24.9 APmk against 24.4 for supervised pre-training with frozen BN, which the authors use as the stronger supervised variant. On Cityscapes semantic segmentation MoCo on IG-1B reaches 75.5 mIoU against 74.6 for the supervised counterpart, while on VOC semantic segmentation it reaches 73.6 against 74.4.

The authors state that MoCo can outperform its ImageNet supervised counterpart in 7 detection or segmentation tasks.

Fine-tuning on ImageNet itself

End-to-end fine-tuning on the 1000-class ImageNet classification task starts from a learning rate of 0.03, compared with 0.1 when training from scratch. The authors note that IN-1M pre-training gives 77.0% here, but since ImageNet is then the downstream task too, this case does not represent a real scenario.

Limits of the evidence

The gain from IN-1M to IG-1B is consistently visible but relatively small, and the authors suggest the larger dataset may not be fully exploited. They expect a more advanced pretext task to help, and they mention masked auto-encoding as one option they did not test.

On VOC semantic segmentation MoCo is worse than supervised pre-training by at least 0.8 points, with 72.5 against 74.4 on IN-1M and 73.6 on IG-1B. The authors report this as a negative case they observed.

The experiments all use one pretext task, instance discrimination, and the paper does not explore orthogonal factors such as the pretext task choice. Transfer uses the supervised counterpart's fine-tuning schedule and hyperparameters, which the authors say may place MoCo at a disadvantage.

The end-to-end comparison is limited to batches of 1024, and the authors note that large-batch training is an open problem. They also question whether the trend with K can be extrapolated to larger K even when memory is sufficient. COCO results with the 1x and 2x schedules are short fine-tuning runs, and the 6x schedule changes the size of the gaps.

Paper info

Authors
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, Ross Girshick
Venue
arXiv · Preprint
First published
2019-11-13
Added
2026-10-20
Updated
2020-3-23
Version
v3
arXiv
1911.05722
Category
cs.CV
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, Ross Girshick (2019). Momentum Contrast for Unsupervised Visual Representation Learning. arXiv:1911.05722v3. https://arxiv.org/abs/1911.05722v3

BibTeX
@misc{he2019momentum,
  title = {{Momentum Contrast for Unsupervised Visual Representation Learning}},
  author = {Kaiming He and Haoqi Fan and Yuxin Wu and Saining Xie and Ross Girshick},
  year = {2019},
  eprint = {1911.05722},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.05722v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up