mlsanityData to 7 Oct 2026

Rethinking Nearest Neighbors for Visual Classification

arXiv 2112.08459 ↗First posted 15 Dec 2021cs.CVcited by 6

Not on the map. Why?

Abstract (arXiv)

Neural network classifiers have become the de-facto choice for current "pre-train then fine-tune" paradigms of visual classification. In this paper, we investigate k-Nearest-Neighbor (k-NN) classifiers, a classical model-free learning method from the pre-deep learning era, as an augmentation to modern neural network based approaches. As a lazy learning method, k-NN simply aggregates the distance between the test image and top-k neighbors in a training set. We adopt k-NN with pre-trained visual representations produced by either supervised or self-supervised methods in two steps: (1) Leverage k-NN predicted probabilities as indications for easy vs. hard examples during training. (2) Linearly interpolate the k-NN predicted distribution with that of the augmented classifier. Via extensive experiments on a wide range of classification tasks, our study reveals the generality and flexibility of k-NN integration with additional insights: (1) k-NN achieves competitive results, sometimes even outperforming a standard linear classifier. (2) Incorporating k-NN is especially beneficial for tasks where parametric classifiers perform poorly and / or in low-data regimes. We hope these discoveries will encourage people to rethink the role of pre-deep learning, classical methods in computer vision. Our code is available at: https://github.com/KMnP/nn-revisit.

Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 61 of its 82 references that are in the map. First posted on arXiv 15 Dec 2021.

Builds on

61 of 82 references.

References · 61

  1. 2015Deep Residual Learning for Image Recognitioncited by 51,809
  2. 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
  3. 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,082
  4. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 11,979
  5. 2015Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networkscited by 9,617
  6. 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,482
  7. 2021Masked Autoencoders Are Scalable Vision Learnerscited by 7,339
  8. 2017Mask R-CNNcited by 7,259
  9. 2021Emerging Properties in Self-Supervised Vision Transformerscited by 6,893
  10. 2020Bootstrap your own latent: A new approach to self-supervised Learningcited by 4,712
  11. 2017Quo Vadis, Action Recognition? A New Model and the Kinetics Datasetcited by 3,259
  12. 2015Fast R-CNNcited by 2,930
38 more
  1. 2020Unsupervised Learning of Visual Features by Contrasting Cluster Assignmentscited by 2,845
  2. 2017Billion-scale similarity search with GPUscited by 2,477
  3. 2020Improved Baselines with Momentum Contrastive Learningcited by 2,282
  4. 2013Rich feature hierarchies for accurate object detection and semantic segmentationcited by 2,160
  5. 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,838
  6. 2021Barlow Twins: Self-Supervised Learning via Redundancy Reductioncited by 1,818
  7. 2021An Empirical Study of Training Self-Supervised Vision Transformerscited by 1,610
  8. 2018Unsupervised Representation Learning by Predicting Image Rotationscited by 1,586
  9. 2019Self-training with Noisy Student improves ImageNet classificationcited by 1,304
  10. 2016Colorful Image Colorizationcited by 1,113
  11. 2014Two-Stream Convolutional Networks for Action Recognition in Videoscited by 1,067
  12. 2017Revisiting Unreasonable Effectiveness of Data in Deep Learning Eracited by 916
  13. 2019Self-Supervised Learning of Pretext-Invariant Representationscited by 806
  14. 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 788
  15. 2019Big Transfer (BiT): General Visual Representation Learningcited by 766
  16. 2020Prototypical Contrastive Learning of Unsupervised Representationscited by 636
  17. 2018Exploring the Limits of Weakly Supervised Pretrainingcited by 604
  18. 2020Understanding the Behaviour of Contrastive Losscited by 397
  19. 2019Large Scale Adversarial Representation Learningcited by 238
  20. 2015YFCC100M: The New Data in Multimedia Researchcited by 234
  21. 2019Billion-scale semi-supervised learning for image classificationcited by 232
  22. 2019Unsupervised Embedding Learning via Invariant and Spreading Instance Featurecited by 231
  23. 2016Split-Brain Autoencoders: Unsupervised Learning by Cross-Channel Predictioncited by 217
  24. 2020How Well Do Self-Supervised Models Transfer?cited by 213
  25. 2020Nearest Neighbor Machine Translationcited by 209
  26. 2019Local Aggregation for Unsupervised Learning of Visual Embeddingscited by 204
  27. 2018Deep k-Nearest Neighbors: Towards Confident, Interpretable and Robust Deep Learningcited by 203
  28. 2019Scaling and Benchmarking Self-Supervised Visual Representation Learningcited by 201
  29. 2019SimpleShot: Revisiting Nearest-Neighbor Classification for Few-Shot Learningcited by 194
  30. 2018Large Scale Fine-Grained Categorization and Domain-Specific Transfer Learningcited by 174
  31. 2021Benchmarking Representation Learning for Natural World Image Collectionscited by 167
  32. 2016End-to-end Learning of Deep Visual Representations for Image Retrievalcited by 122
  33. 2021Self-Supervised Learning with Swin Transformerscited by 121
  34. 2018Neural Nearest Neighbors Networkscited by 98
  35. 2019ClusterFit: Improving Generalization of Visual Representationscited by 82
  36. 2019When Does Self-supervision Improve Few-shot Learning?cited by 78
  37. 2017Fine-Grained Car Detection for Visual Census Estimationcited by 76
  38. 2020MoPro: Webly Supervised Learning with Momentum Prototypescited by 66

50 most cited of 61 All 61 (JSON)

Built on by

Cited by year

Citing papers per year: 2022: 1; 2023: 3; 2024: 1; 2025: 1.

6 papers.