Rethinking Nearest Neighbors for Visual Classification
- URL: http://arxiv.org/abs/2112.08459v1
- Date: Wed, 15 Dec 2021 20:15:01 GMT
- Title: Rethinking Nearest Neighbors for Visual Classification
- Authors: Menglin Jia, Bor-Chun Chen, Zuxuan Wu, Claire Cardie, Serge Belongie,
Ser-Nam Lim
- Abstract summary: k-NN is a lazy learning method that 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.
Via extensive experiments on a wide range of classification tasks, our study reveals the generality and flexibility of k-NN integration.
- Score: 56.00783095670361
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: 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.
Related papers
- On adversarial training and the 1 Nearest Neighbor classifier [8.248839892711478]
We compare the performance of adversarial training to that of the simple 1 Nearest Neighbor (1NN) classifier.
Experiments with 135 different binary image classification problems taken from CIFAR10, MNIST and Fashion-MNIST.
We find that 1NN outperforms almost all of them in terms of robustness to perturbations that are only slightly different from those used during training.
arXiv Detail & Related papers (2024-04-09T13:47:37Z) - Exploring Learned Representations of Neural Networks with Principal
Component Analysis [1.0923877073891446]
In certain layers, as little as 20% of the intermediate feature-space variance is necessary for high-accuracy classification.
We relate our findings to neural collapse and provide partial evidence for the related phenomenon of intermediate neural collapse.
arXiv Detail & Related papers (2023-09-27T00:18:25Z) - How neural networks learn to classify chaotic time series [77.34726150561087]
We study the inner workings of neural networks trained to classify regular-versus-chaotic time series.
We find that the relation between input periodicity and activation periodicity is key for the performance of LKCNN models.
arXiv Detail & Related papers (2023-06-04T08:53:27Z) - Revisiting k-NN for Fine-tuning Pre-trained Language Models [25.105882538429743]
We revisit k-Nearest-Neighbor (kNN) classifiers for augmenting the PLMs-based classifiers.
At the heart of our approach is the implementation of kNN-calibrated training, which treats predicted results as indicators for easy versus hard examples.
We conduct extensive experiments on fine-tuning, prompt-tuning paradigms and zero-shot, few-shot and fully-supervised settings.
arXiv Detail & Related papers (2023-04-18T15:28:47Z) - Do We Really Need a Learnable Classifier at the End of Deep Neural
Network? [118.18554882199676]
We study the potential of learning a neural network for classification with the classifier randomly as an ETF and fixed during training.
Our experimental results show that our method is able to achieve similar performances on image classification for balanced datasets.
arXiv Detail & Related papers (2022-03-17T04:34:28Z) - KNN-BERT: Fine-Tuning Pre-Trained Models with KNN Classifier [61.063988689601416]
Pre-trained models are widely used in fine-tuning downstream tasks with linear classifiers optimized by the cross-entropy loss.
These problems can be improved by learning representations that focus on similarities in the same class and contradictions when making predictions.
We introduce the KNearest Neighbors in pre-trained model fine-tuning tasks in this paper.
arXiv Detail & Related papers (2021-10-06T06:17:05Z) - S2-BNN: Bridging the Gap Between Self-Supervised Real and 1-bit Neural
Networks via Guided Distribution Calibration [74.5509794733707]
We present a novel guided learning paradigm from real-valued to distill binary networks on the final prediction distribution.
Our proposed method can boost the simple contrastive learning baseline by an absolute gain of 5.515% on BNNs.
Our method achieves substantial improvement over the simple contrastive learning baseline, and is even comparable to many mainstream supervised BNN methods.
arXiv Detail & Related papers (2021-02-17T18:59:28Z) - One Versus all for deep Neural Network Incertitude (OVNNI)
quantification [12.734278426543332]
We propose a new technique to quantify the epistemic uncertainty of data easily.
This method consists in mixing the predictions of an ensemble of DNNs trained to classify One class vs All the other classes (OVA) with predictions from a standard DNN trained to perform All vs All (AVA) classification.
arXiv Detail & Related papers (2020-06-01T14:06:12Z) - Approximation and Non-parametric Estimation of ResNet-type Convolutional
Neural Networks [52.972605601174955]
We show a ResNet-type CNN can attain the minimax optimal error rates in important function classes.
We derive approximation and estimation error rates of the aformentioned type of CNNs for the Barron and H"older classes.
arXiv Detail & Related papers (2019-03-24T19:42:39Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.